From a1a68847bbdfd00f1d32e89892655ca61e8ad731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Schreiner?= Date: Fri, 23 Mar 2012 09:53:57 +0100 Subject: [PATCH] Minor UI changes. - The 'save' button is disabled and shows 'No changes' at first. Editing contentEdit's text enables the button and makes it show 'Save'. - The 'save' button is disabled and shows 'Saving...' when the page is being saved, and stays disabled until contentEdit's text has been changed again. - The 'save' button shows 'Saved' once the page has been successfully saved. fixes #560 - contentEdit is readonly when the page is being saved --- weboob/applications/qwebcontentedit/main_window.py | 10 +++++++++- weboob/applications/qwebcontentedit/ui/main_window.ui | 10 +++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/weboob/applications/qwebcontentedit/main_window.py b/weboob/applications/qwebcontentedit/main_window.py index da02e0f3..0d6a9021 100644 --- a/weboob/applications/qwebcontentedit/main_window.py +++ b/weboob/applications/qwebcontentedit/main_window.py @@ -45,6 +45,7 @@ class MainWindow(QtMainWindow): self._currentTabChanged) self.connect(self.ui.saveButton, SIGNAL("clicked()"), self.savePage) self.connect(self.ui.actionBackends, SIGNAL("triggered()"), self.backendsConfig) + self.connect(self.ui.contentEdit, SIGNAL("textChanged()"), self._textChanged) if self.weboob.count_backends() == 0: self.backendsConfig() @@ -66,6 +67,10 @@ class MainWindow(QtMainWindow): if self.backend is not None: self.showPreview() + def _textChanged(self): + self.ui.saveButton.setEnabled(True) + self.ui.saveButton.setText('Save') + def loadPage(self): _id = unicode(self.ui.idEdit.text()) if not _id: @@ -109,6 +114,8 @@ class MainWindow(QtMainWindow): minor = self.ui.minorBox.isChecked() if new_content != self.content.content: self.ui.saveButton.setEnabled(False) + self.ui.saveButton.setText('Saving...') + self.ui.contentEdit.setReadOnly(True) self.content.content = new_content message = unicode(self.ui.descriptionEdit.text()) self.process = QtDo(self.weboob, self._savePage_cb, self._savePage_eb) @@ -117,7 +124,8 @@ class MainWindow(QtMainWindow): def _savePage_cb(self, backend, data): if not backend: self.process = None - self.ui.saveButton.setEnabled(True) + self.ui.saveButton.setText('Saved') + self.ui.contentEdit.setReadOnly(False) return self.ui.descriptionEdit.clear() diff --git a/weboob/applications/qwebcontentedit/ui/main_window.ui b/weboob/applications/qwebcontentedit/ui/main_window.ui index 2b9e0fd9..e481c773 100644 --- a/weboob/applications/qwebcontentedit/ui/main_window.ui +++ b/weboob/applications/qwebcontentedit/ui/main_window.ui @@ -6,8 +6,8 @@ 0 0 - 469 - 520 + 498 + 543 @@ -89,7 +89,7 @@ false - Save + No changes @@ -102,8 +102,8 @@ 0 0 - 469 - 20 + 498 + 22