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
This commit is contained in:
parent
4534457b27
commit
5fe9273b2f
2 changed files with 15 additions and 7 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,11 @@
|
|||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="contentEdit"/>
|
||||
<widget class="QPlainTextEdit" name="contentEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
@ -106,7 +110,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>498</width>
|
||||
<height>22</height>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue