From 69018eeff3528092ff19768cca20471ee7a6fca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Schreiner?= Date: Thu, 17 Feb 2011 20:50:09 +0100 Subject: [PATCH] Adds drop-down list for choosing a backend. --- .../qwebcontentedit/main_window.py | 23 ++++++++++++++----- .../qwebcontentedit/ui/main_window.ui | 7 ++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/weboob/applications/qwebcontentedit/main_window.py b/weboob/applications/qwebcontentedit/main_window.py index 3dbd35fa..158a8f5b 100644 --- a/weboob/applications/qwebcontentedit/main_window.py +++ b/weboob/applications/qwebcontentedit/main_window.py @@ -38,6 +38,9 @@ class MainWindow(QtMainWindow): self._currentTabChanged) self.connect(self.ui.saveButton, SIGNAL("clicked()"), self.savePage) + for backend in self.weboob.iter_backends(): + self.ui.backendBox.insertItem(0, backend.name) + def _currentTabChanged(self): if self.ui.tabWidget.currentIndex() == 1: if self.backend is not None: @@ -48,14 +51,22 @@ self._currentTabChanged) _id = unicode(self.ui.idEdit.text()) if not _id: return + 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,)) - for backend in self.weboob.iter_backends(): - self.content = backend.get_content(_id) - if self.content: - self.ui.contentEdit.setPlainText(self.content.content) - self.backend = backend - return + + def _loadPage_cb(self, backend, data): + if not backend or not data: + return + self.content = data + self.ui.contentEdit.setPlainText(self.content.content) + self.backend = backend + + def _loadPage_eb(self, backend, error, backtrace): + print error + print backtrace def savePage(self): if self.backend is None: diff --git a/weboob/applications/qwebcontentedit/ui/main_window.ui b/weboob/applications/qwebcontentedit/ui/main_window.ui index ca447542..d92e6edc 100644 --- a/weboob/applications/qwebcontentedit/ui/main_window.ui +++ b/weboob/applications/qwebcontentedit/ui/main_window.ui @@ -17,6 +17,13 @@ + + + + false + + +