From 5daf71effedc35476cd1ccd5be406656a9606e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Schreiner?= Date: Sun, 25 Mar 2012 10:22:27 +0200 Subject: [PATCH] Small UI fixes. Compatibility with Qt version < 4.7. - error callback for loadHistory, to make the reload button enabled again after an error - remove descriptionEdit's placeholder (for compatibilty with earlier versions of Qt) - add placeholder text to descriptionEdit if supported by the user's version of Qt - set contentEdit read-only while loading a new page - saveButton was still showing "Saving" after saving had failed --- .../qwebcontentedit/main_window.py | 20 ++++++++++++++++++- .../qwebcontentedit/ui/main_window.ui | 3 --- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/weboob/applications/qwebcontentedit/main_window.py b/weboob/applications/qwebcontentedit/main_window.py index b647e8f0..489631ac 100644 --- a/weboob/applications/qwebcontentedit/main_window.py +++ b/weboob/applications/qwebcontentedit/main_window.py @@ -62,6 +62,9 @@ class MainWindow(QtMainWindow): SIGNAL("clicked()"), self.loadHistory) + if hasattr(self.ui.descriptionEdit, "setPlaceholderText"): + self.ui.descriptionEdit.setPlaceholderText("Edit summary") + if self.weboob.count_backends() == 0: self.backendsConfig() else: @@ -102,6 +105,7 @@ class MainWindow(QtMainWindow): self.ui.loadButton.setEnabled(False) self.ui.loadButton.setText('Loading...') + self.ui.contentEdit.setReadOnly(True) backend = str(self.ui.backendBox.currentText()) self.process = QtDo(self.weboob, @@ -184,6 +188,7 @@ class MainWindow(QtMainWindow): QMessageBox.critical(self, self.tr('Error while saving page'), content, QMessageBox.Ok) self.ui.saveButton.setEnabled(True) + self.ui.saveButton.setText("Save") def loadPreview(self): """ Loads the current page's preview into the preview QTextEdit """ @@ -208,7 +213,9 @@ class MainWindow(QtMainWindow): "Summary"]) self.ui.historyTable.setColumnWidth(3, 1000) - self.process = QtDo(self.weboob, self._gotRevision) + self.process = QtDo(self.weboob, + self._gotRevision, + self._errorHistory) self.process.do('iter_revisions', self.content.id, max_results=self.ui.nbRevBox.value(), @@ -245,3 +252,14 @@ class MainWindow(QtMainWindow): self.ui.historyTable.setItem(row, 3, item_summary) self.ui.historyTable.setCurrentCell(row, 0) + + def _errorHistory(self, backend, error, backtrace): + """ Loading the history has failed """ + content = unicode(self.tr('Unable to load history:\n%s\n')) % to_unicode(error) + if logging.root.level == logging.DEBUG: + content += '\n%s\n' % to_unicode(backtrace) + QMessageBox.critical(self, self.tr('Error while loading history'), + content, QMessageBox.Ok) + + self.ui.loadHistoryButton.setEnabled(True) + self.ui.loadHistoryButton.setText("Reload") diff --git a/weboob/applications/qwebcontentedit/ui/main_window.ui b/weboob/applications/qwebcontentedit/ui/main_window.ui index 3126beca..053e821e 100644 --- a/weboob/applications/qwebcontentedit/ui/main_window.ui +++ b/weboob/applications/qwebcontentedit/ui/main_window.ui @@ -147,9 +147,6 @@ - - Edit summary -