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()
|
self.showPreview()
|
||||||
|
|
||||||
def _textChanged(self):
|
def _textChanged(self):
|
||||||
self.ui.saveButton.setEnabled(True)
|
if self.backend:
|
||||||
self.ui.saveButton.setText('Save')
|
self.ui.saveButton.setEnabled(True)
|
||||||
|
self.ui.saveButton.setText('Save')
|
||||||
|
|
||||||
def loadPage(self):
|
def loadPage(self):
|
||||||
_id = unicode(self.ui.idEdit.text())
|
_id = unicode(self.ui.idEdit.text())
|
||||||
if not _id:
|
if not _id:
|
||||||
return
|
return
|
||||||
self.ui.saveButton.setEnabled(False)
|
self.ui.loadButton.setEnabled(False)
|
||||||
|
self.ui.loadButton.setText('Loading...')
|
||||||
backend = str(self.ui.backendBox.currentText())
|
backend = str(self.ui.backendBox.currentText())
|
||||||
self.process = QtDo(self.weboob, self._loadPage_cb, self._loadPage_eb)
|
self.process = QtDo(self.weboob, self._loadPage_cb, self._loadPage_eb)
|
||||||
self.process.do('get_content', _id, backends=(backend,))
|
self.process.do('get_content', _id, backends=(backend,))
|
||||||
|
|
@ -84,7 +86,9 @@ class MainWindow(QtMainWindow):
|
||||||
if not backend:
|
if not backend:
|
||||||
self.process = None
|
self.process = None
|
||||||
if self.backend:
|
if self.backend:
|
||||||
self.ui.saveButton.setEnabled(True)
|
self.ui.contentEdit.setReadOnly(False)
|
||||||
|
self.ui.loadButton.setEnabled(True)
|
||||||
|
self.ui.loadButton.setText('Load')
|
||||||
return
|
return
|
||||||
if not data:
|
if not data:
|
||||||
self.content = None
|
self.content = None
|
||||||
|
|
@ -98,7 +102,7 @@ class MainWindow(QtMainWindow):
|
||||||
self.content = data
|
self.content = data
|
||||||
self.ui.contentEdit.setPlainText(self.content.content)
|
self.ui.contentEdit.setPlainText(self.content.content)
|
||||||
self.setWindowTitle("QWebcontentedit - %s@%s" %(self.content.id, backend.name))
|
self.setWindowTitle("QWebcontentedit - %s@%s" %(self.content.id, backend.name))
|
||||||
self.backend = backend
|
self.backend = backend
|
||||||
|
|
||||||
def _loadPage_eb(self, backend, error, backtrace):
|
def _loadPage_eb(self, backend, error, backtrace):
|
||||||
content = unicode(self.tr('Unable to load page:\n%s\n')) % to_unicode(error)
|
content = unicode(self.tr('Unable to load page:\n%s\n')) % to_unicode(error)
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,11 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPlainTextEdit" name="contentEdit"/>
|
<widget class="QPlainTextEdit" name="contentEdit">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
@ -106,7 +110,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>498</width>
|
<width>498</width>
|
||||||
<height>22</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue