Skip to content
Snippets Groups Projects
Commit aa9f1705 authored by inso's avatar inso
Browse files

Fix account deletion

parent e943f355
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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,11 +95,24 @@ 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):
......@@ -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_()
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment