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

Fix account deletion

parent e943f355
Branches
Tags
No related merge requests found
...@@ -157,6 +157,7 @@ class Application(QObject): ...@@ -157,6 +157,7 @@ class Application(QObject):
Delete an account. Delete an account.
Current account changes to None if it is deleted. Current account changes to None if it is deleted.
""" """
account.stop_coroutines()
self.accounts.pop(account.name) self.accounts.pop(account.name)
if self.current_account == account: if self.current_account == account:
self.current_account = None self.current_account = None
......
...@@ -24,9 +24,11 @@ from .process_cfg_community import ProcessConfigureCommunity ...@@ -24,9 +24,11 @@ from .process_cfg_community import ProcessConfigureCommunity
from .homescreen import HomeScreenWidget from .homescreen import HomeScreenWidget
from ..core import money from ..core import money
from ..core.community import Community from ..core.community import Community
from ..tools.decorators import asyncify
from ..__init__ import __version__ from ..__init__ import __version__
from . import toast from . import toast
import asyncio
import logging import logging
...@@ -93,11 +95,24 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -93,11 +95,24 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.community_view.change_account(self.app.current_account, self.password_asker) self.community_view.change_account(self.app.current_account, self.password_asker)
self.refresh() self.refresh()
def open_add_account_dialog(self): @asyncify
@asyncio.coroutine
def open_add_account_dialog(self, checked=False):
dialog = ProcessConfigureAccount(self.app, None) 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 result == QDialog.Accepted:
if self.app.current_account:
self.action_change_account(self.app.current_account.name) self.action_change_account(self.app.current_account.name)
else:
self.refresh()
@pyqtSlot(str) @pyqtSlot(str)
def display_error(self, error): def display_error(self, error):
...@@ -173,15 +188,6 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -173,15 +188,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if result == QDialog.Accepted: if result == QDialog.Accepted:
self.window().refresh_contacts() 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): def open_preferences_dialog(self):
dialog = PreferencesDialog(self.app) dialog = PreferencesDialog(self.app)
result = dialog.exec_() result = dialog.exec_()
......
...@@ -49,8 +49,6 @@ class StepPageInit(Step): ...@@ -49,8 +49,6 @@ class StepPageInit(Step):
self.config_dialog.edit_account_name.setText(self.config_dialog.account.name) self.config_dialog.edit_account_name.setText(self.config_dialog.account.name)
model = CommunitiesListModel(self.config_dialog.account) model = CommunitiesListModel(self.config_dialog.account)
self.config_dialog.list_communities.setModel(model) 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.password_asker = PasswordAskerDialog(self.config_dialog.account)
self.config_dialog.button_previous.setEnabled(False) 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