Mercurial > hg > Feedworm
diff MainWindow.py @ 50:4b0d686493fb
better error handling while adding feeds: data is only saved if a feed could be created and entries could be retrieved. MainWindow displays feedback in the status bar if an exception occurred while adding a feed.
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Mon, 17 May 2010 04:30:55 +0200 |
parents | 6eba4168fd54 |
children | 8cca4585eb33 |
line wrap: on
line diff
--- a/MainWindow.py Mon May 17 03:52:13 2010 +0200 +++ b/MainWindow.py Mon May 17 04:30:55 2010 +0200 @@ -11,6 +11,8 @@ from Ui_MainWindow import Ui_MainWindow import subprocess +STATUS_MESSAGE_DISPLAY_MILLIS = 20000 + class MainWindow(QtGui.QMainWindow): def __init__(self, session=None): QtGui.QWidget.__init__(self, None) @@ -66,7 +68,14 @@ def addFeed(self): addFeed = AddFeed(self.session) success = addFeed.exec_() - if success: + if not success: + return + + if addFeed.exception is not None: + message = "Error while adding feed: " + str(addFeed.exception) + self.ui.statusbar.showMessage(message, STATUS_MESSAGE_DISPLAY_MILLIS) + else: + self.session.commit() self.updateFeedList() def openSelectedEntryInBrowser(self):