From 5fe9273b2f62fa0984854bff27749a521522c0c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Schreiner?= Date: Fri, 23 Mar 2012 17:26:46 +0100 Subject: [PATCH] More minor changes to the UI. - the contentEdit widget is ReadOnly before a page has been loaded - the saveButton widget stays disabled after the page has been saved --- weboob/applications/qwebcontentedit/main_window.py | 14 +++++++++----- .../applications/qwebcontentedit/ui/main_window.ui | 8 ++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/weboob/applications/qwebcontentedit/main_window.py b/weboob/applications/qwebcontentedit/main_window.py index 0d6a9021..0e127ada 100644 --- a/weboob/applications/qwebcontentedit/main_window.py +++ b/weboob/applications/qwebcontentedit/main_window.py @@ -68,14 +68,16 @@ class MainWindow(QtMainWindow): self.showPreview() def _textChanged(self): - self.ui.saveButton.setEnabled(True) - self.ui.saveButton.setText('Save') + if self.backend: + self.ui.saveButton.setEnabled(True) + self.ui.saveButton.setText('Save') def loadPage(self): _id = unicode(self.ui.idEdit.text()) if not _id: return - self.ui.saveButton.setEnabled(False) + self.ui.loadButton.setEnabled(False) + self.ui.loadButton.setText('Loading...') backend = str(self.ui.backendBox.currentText()) self.process = QtDo(self.weboob, self._loadPage_cb, self._loadPage_eb) self.process.do('get_content', _id, backends=(backend,)) @@ -84,7 +86,9 @@ class MainWindow(QtMainWindow): if not backend: self.process = None if self.backend: - self.ui.saveButton.setEnabled(True) + self.ui.contentEdit.setReadOnly(False) + self.ui.loadButton.setEnabled(True) + self.ui.loadButton.setText('Load') return if not data: self.content = None @@ -98,7 +102,7 @@ class MainWindow(QtMainWindow): self.content = data self.ui.contentEdit.setPlainText(self.content.content) self.setWindowTitle("QWebcontentedit - %s@%s" %(self.content.id, backend.name)) - self.backend = backend + self.backend = backend def _loadPage_eb(self, backend, error, backtrace): content = unicode(self.tr('Unable to load page:\n%s\n')) % to_unicode(error) diff --git a/weboob/applications/qwebcontentedit/ui/main_window.ui b/weboob/applications/qwebcontentedit/ui/main_window.ui index fb5e9b42..15675510 100644 --- a/weboob/applications/qwebcontentedit/ui/main_window.ui +++ b/weboob/applications/qwebcontentedit/ui/main_window.ui @@ -47,7 +47,11 @@ - + + + true + + @@ -106,7 +110,7 @@ 0 0 498 - 22 + 23