diff --git a/src/cutecoin/core/app.py b/src/cutecoin/core/app.py index 5ad77ced20ad7475e7ae18c69d3bedb6b9bf794d..75721e8b5a4689da4fbb012f1ca1dcd618f5bec4 100644 --- a/src/cutecoin/core/app.py +++ b/src/cutecoin/core/app.py @@ -157,6 +157,7 @@ class Application(QObject): Delete an account. Current account changes to None if it is deleted. """ + account.stop_coroutines() self.accounts.pop(account.name) if self.current_account == account: self.current_account = None diff --git a/src/cutecoin/gui/mainwindow.py b/src/cutecoin/gui/mainwindow.py index a361f6bcb9012d546eceba45ef738d0c5f99dc66..f9f7c5c1501a1f0bdc95074706a6a87fd39bb7e1 100644 --- a/src/cutecoin/gui/mainwindow.py +++ b/src/cutecoin/gui/mainwindow.py @@ -24,9 +24,11 @@ from .process_cfg_community import ProcessConfigureCommunity from .homescreen import HomeScreenWidget from ..core import money from ..core.community import Community +from ..tools.decorators import asyncify from ..__init__ import __version__ from . import toast +import asyncio import logging @@ -93,12 +95,25 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.community_view.change_account(self.app.current_account, self.password_asker) self.refresh() - def open_add_account_dialog(self): + @asyncify + @asyncio.coroutine + def open_add_account_dialog(self, checked=False): dialog = ProcessConfigureAccount(self.app, None) - result = dialog.exec_() + result = yield from dialog.async_exec() if result == QDialog.Accepted: self.action_change_account(self.app.current_account.name) + @asyncify + @asyncio.coroutine + def open_configure_account_dialog(self, checked=False): + dialog = ProcessConfigureAccount(self.app, self.app.current_account) + result = yield from dialog.async_exec() + if result == QDialog.Accepted: + if self.app.current_account: + self.action_change_account(self.app.current_account.name) + else: + self.refresh() + @pyqtSlot(str) def display_error(self, error): QMessageBox.critical(self, ":(", @@ -173,15 +188,6 @@ class MainWindow(QMainWindow, Ui_MainWindow): if result == QDialog.Accepted: self.window().refresh_contacts() - def open_configure_account_dialog(self): - dialog = ProcessConfigureAccount(self.app, self.app.current_account) - result = dialog.exec_() - if result == QDialog.Accepted: - if self.app.current_account: - self.action_change_account(self.app.current_account.name) - else: - self.refresh() - def open_preferences_dialog(self): dialog = PreferencesDialog(self.app) result = dialog.exec_() diff --git a/src/cutecoin/gui/process_cfg_account.py b/src/cutecoin/gui/process_cfg_account.py index d9a63e4d12576d3b75047666d94285141ad47b2a..02e6ffcc9c7edf0daf460ff9c350d41158a05473 100644 --- a/src/cutecoin/gui/process_cfg_account.py +++ b/src/cutecoin/gui/process_cfg_account.py @@ -49,8 +49,6 @@ class StepPageInit(Step): self.config_dialog.edit_account_name.setText(self.config_dialog.account.name) model = CommunitiesListModel(self.config_dialog.account) self.config_dialog.list_communities.setModel(model) - nb_wallets = len(self.config_dialog.account.wallets) - self.config_dialog.spinbox_wallets.setValue(nb_wallets) self.config_dialog.password_asker = PasswordAskerDialog(self.config_dialog.account) self.config_dialog.button_previous.setEnabled(False)