Commit bf0f1d94 authored by Romain Bignon's avatar Romain Bignon

correctly handle reload after backends configuration

parent 7859aa0b
......@@ -237,13 +237,14 @@ class ContactsWidget(QWidget):
self.ui.groupBox.addItem('All', MetaGroup(self.weboob, 'all', self.tr('All')))
self.ui.groupBox.addItem('Onlines', MetaGroup(self.weboob, 'online', self.tr('Online')))
self.ui.groupBox.addItem('Offlines', MetaGroup(self.weboob, 'offline', self.tr('Offline')))
self.ui.groupBox.setCurrentIndex(1)
self.connect(self.ui.groupBox, SIGNAL('currentIndexChanged(int)'), self.groupChanged)
self.connect(self.ui.contactList, SIGNAL('currentItemChanged(QListWidgetItem*, QListWidgetItem*)'), self.contactChanged)
self.connect(self.ui.refreshButton, SIGNAL('clicked()'), self.refreshContactList)
def load(self):
self.ui.groupBox.setCurrentIndex(1)
self.refreshContactList()
def groupChanged(self, i):
self.refreshContactList()
......
......@@ -43,6 +43,9 @@ class MainWindow(QtMainWindow):
self.loaded_tabs = {}
self.connect(self.ui.actionBackends, SIGNAL("triggered()"), self.backendsConfig)
self.connect(self.ui.tabWidget, SIGNAL('currentChanged(int)'), self.tabChanged)
self.ui.tabWidget.addTab(AccountsStatus(self.weboob), self.tr('Status'))
if HAVE_BOOBMSG:
self.ui.tabWidget.addTab(MessagesManager(self.weboob), self.tr('Messages'))
......@@ -50,12 +53,12 @@ class MainWindow(QtMainWindow):
self.ui.tabWidget.addTab(QWidget(), self.tr('Calendar'))
self.ui.tabWidget.addTab(QWidget(), self.tr('Optimizations'))
self.connect(self.ui.actionBackends, SIGNAL("triggered()"), self.backendsConfig)
self.connect(self.ui.tabWidget, SIGNAL('currentChanged(int)'), self.tabChanged)
def backendsConfig(self):
bckndcfg = BackendCfg(self.weboob, (ICapDating,), self)
bckndcfg.show()
if bckndcfg.run():
self.loaded_tabs.clear()
widget = self.ui.tabWidget.widget(self.ui.tabWidget.currentIndex())
widget.load()
def tabChanged(self, i):
widget = self.ui.tabWidget.currentWidget()
......
......@@ -28,7 +28,8 @@ class QHaveSex(QtApplication):
STORAGE_FILENAME = 'dating.storage'
def main(self, argv):
self.load_configured_backends(ICapDating, storage=self.create_storage(self.STORAGE_FILENAME))
self.create_storage(self.STORAGE_FILENAME)
self.load_configured_backends(ICapDating)
self.main_window = MainWindow(self.config, self.weboob)
self.main_window.show()
......
......@@ -102,8 +102,15 @@ class AccountsStatus(QWidget):
self.setLayout(QVBoxLayout())
def load(self):
while self.layout().count() > 0:
item = self.layout().takeAt(0)
if item.widget():
item.widget().hide()
item.widget().deleteLater()
for backend in self.weboob.iter_backends():
account = Account(weboob, backend)
account = Account(self.weboob, backend)
self.layout().addWidget(account)
self.layout().addStretch()
......@@ -73,6 +73,7 @@ class MainWindow(QtMainWindow):
for minivideo in self.minivideos:
self.ui.scrollAreaContent.layout().removeWidget(minivideo)
minivideo.hide()
minivideo.deleteLater()
self.minivideos = []
self.ui.searchEdit.setEnabled(False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment