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
This commit is contained in:
parent
ba5949cd22
commit
a1a68847bb
2 changed files with 14 additions and 6 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>469</width>
|
||||
<height>520</height>
|
||||
<width>498</width>
|
||||
<height>543</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
<string>No changes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -102,8 +102,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>469</width>
|
||||
<height>20</height>
|
||||
<width>498</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue