comparison MainWindow.py @ 90:a1066e5a8f88

save pending changes when quitting the app
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 24 Dec 2010 05:06:21 +0100
parents 2eddb44920d1
children e5d5fc34ff2e
comparison
equal deleted inserted replaced
89:2eddb44920d1 90:a1066e5a8f88
5 from FeedEntry import FeedEntry 5 from FeedEntry import FeedEntry
6 from FeedEntryItemDelegate import FeedEntryItemDelegate 6 from FeedEntryItemDelegate import FeedEntryItemDelegate
7 from FeedSettings import FeedSettings 7 from FeedSettings import FeedSettings
8 from Preferences import Preferences 8 from Preferences import Preferences
9 from PreferencesDialog import PreferencesDialog 9 from PreferencesDialog import PreferencesDialog
10 from PyQt4 import QtGui
11 from PyQt4.QtCore import QUrl 10 from PyQt4.QtCore import QUrl
11 from PyQt4.QtGui import QMainWindow
12 from PyQt4.QtGui import QWidget
12 from Ui_MainWindow import Ui_MainWindow 13 from Ui_MainWindow import Ui_MainWindow
13 import FeedList 14 import FeedList
14 import subprocess 15 import subprocess
15 16
16 STATUS_MESSAGE_DISPLAY_MILLIS = 20000 17 STATUS_MESSAGE_DISPLAY_MILLIS = 20000
17 18
18 class MainWindow(QtGui.QMainWindow): 19 class MainWindow(QMainWindow):
19 def __init__(self, session=None): 20 def __init__(self, session=None):
20 QtGui.QWidget.__init__(self, None) 21 QWidget.__init__(self, None)
21 self.session = session 22 self.session = session
22 self.preferences = Preferences(session) 23 self.preferences = Preferences(session)
23 self.ui = Ui_MainWindow() 24 self.ui = Ui_MainWindow()
24 self.ui.setupUi(self) 25 self.ui.setupUi(self)
25 self.updateFeedList() 26 self.updateFeedList()
125 feedSettings.exec_() 126 feedSettings.exec_()
126 127
127 def _updateStatusBar(self, message): 128 def _updateStatusBar(self, message):
128 self.ui.statusbar.showMessage(message, STATUS_MESSAGE_DISPLAY_MILLIS) 129 self.ui.statusbar.showMessage(message, STATUS_MESSAGE_DISPLAY_MILLIS)
129 130
131 def close(self):
132 # save all uncommitted state, just in case
133 self.session.commit()
134 QMainWindow.close(self)