diff --git a/src/cutecoin/core/account.py b/src/cutecoin/core/account.py index aad96327eab228fe8b031b498dc2358d810db7f7..14dd247b5e9986fd48b4a723ef32f8da599a63d5 100644 --- a/src/cutecoin/core/account.py +++ b/src/cutecoin/core/account.py @@ -130,6 +130,11 @@ class Account(object): self.communities.append(community) return community + def refresh_cache(self): + for w in self.wallets: + for c in self.communities: + w.refresh_cache(c) + def set_display_referential(self, index): self.referential = index diff --git a/src/cutecoin/core/app.py b/src/cutecoin/core/app.py index 1b6339baf63050e65014866f9c15af8e90104100..4c5cb0187af70fbf854d66699c1a63f57c01fea2 100644 --- a/src/cutecoin/core/app.py +++ b/src/cutecoin/core/app.py @@ -63,6 +63,8 @@ class Application(object): def change_current_account(self, account): if self.current_account is not None: self.save_cache(self.current_account) + + account.refresh_cache() self.current_account = account def load(self): diff --git a/src/cutecoin/gui/mainwindow.py b/src/cutecoin/gui/mainwindow.py index 392c12bc84cd7fc9f538d4799e6416f6f5cd9252..16826ad0abac05e04e75ca46e16cf32c0405e91e 100644 --- a/src/cutecoin/gui/mainwindow.py +++ b/src/cutecoin/gui/mainwindow.py @@ -96,8 +96,9 @@ class MainWindow(QMainWindow, Ui_MainWindow): def open_add_account_dialog(self): dialog = ProcessConfigureAccount(self.app, None) - dialog.accepted.connect(self.refresh) - dialog.exec_() + result = dialog.exec_() + if result == QDialog.Accepted: + self.action_change_account(self.app.current_account.name) @pyqtSlot() def loader_finished(self): diff --git a/src/cutecoin/gui/process_cfg_account.py b/src/cutecoin/gui/process_cfg_account.py index c8214b3c98b18d627d4ec94abe1b969080ffde1e..576147f7c97c6a730d87a2b12f7300b07ee3d072 100644 --- a/src/cutecoin/gui/process_cfg_account.py +++ b/src/cutecoin/gui/process_cfg_account.py @@ -246,7 +246,7 @@ class ProcessConfigureAccount(QDialog, Ui_AccountConfigurationDialog): nb_wallets = self.spinbox_wallets.value() self.account.set_walletpool_size(nb_wallets, password) - if len(self.app.accounts) == 0: + if len(self.app.accounts) == 1: self.app.default_account = self.account.name self.app.save(self.account) diff --git a/src/cutecoin/tools/exceptions.py b/src/cutecoin/tools/exceptions.py index 1cbc25c438d62715da6c8775aa0c94fb687c4047..a240dbe13bed84541591f15502e58d507e23caee 100644 --- a/src/cutecoin/tools/exceptions.py +++ b/src/cutecoin/tools/exceptions.py @@ -95,12 +95,11 @@ class KeyAlreadyUsed(Error): Constructor ''' super() .__init__( - "Cannot add account " + - new_account.name + - " : the key " + - keyid + - " is already used by " + - found_account.name) +"""Cannot add account {0} : +the key {1} is already used by {2}""".format(new_account, + keyid, + found_account) + ) class NameAlreadyExists(Error): @@ -110,13 +109,13 @@ class NameAlreadyExists(Error): a key already used for another account. ''' - def __init__(self, account): + def __init__(self, account_name): ''' Constructor ''' super() .__init__( "Cannot add account " + - account.name + + account_name + " the name already exists")