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

Fixed some bugs in account creation

parent 3fbd5951
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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):
......
......@@ -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):
......
......@@ -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)
......
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment