diff --git a/src/cutecoin/core/app.py b/src/cutecoin/core/app.py index 93e228e6837ef2a7fbdd1784ae2311767e223841..c35969481f8a9e53238c6148d7713fc25e4a74b2 100644 --- a/src/cutecoin/core/app.py +++ b/src/cutecoin/core/app.py @@ -336,7 +336,7 @@ class Application(QObject): def import_account(self, file, name): ''' - Import an account from a tar file + Import an account from a tar file and open it :param str file: The file path of the tar file :param str name: The account name @@ -359,6 +359,7 @@ class Application(QObject): account.name = name self.add_account(account) self.save(account) + self.change_current_account(account) def export_account(self, file, account): ''' diff --git a/src/cutecoin/gui/mainwindow.py b/src/cutecoin/gui/mainwindow.py index 0acfa4bad63e5af6711a40831723dca0cadaf536..9371811f85effcfd1d877a543d438a3b6dca2628 100644 --- a/src/cutecoin/gui/mainwindow.py +++ b/src/cutecoin/gui/mainwindow.py @@ -101,6 +101,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.open_ucoin_info = lambda: QDesktopServices.openUrl(QUrl("http://ucoin.io/theoretical/")) self.homescreen.button_info.clicked.connect(self.open_ucoin_info) + self.import_dialog = None self.export_dialog = None # TODO: There are too much refresh() calls on startup @@ -343,12 +344,16 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.refresh_contacts() def import_account(self): - dialog = ImportAccountDialog(self.app, self) - dialog.accepted.connect(self.refresh) - dialog.exec_() + self.import_dialog = ImportAccountDialog(self.app, self) + self.import_dialog.accepted.connect(self.import_account_accepted) + self.import_dialog.exec_() + + def import_account_accepted(self): + # open account after import + self.action_change_account(self.import_dialog.edit_name.text()) def export_account(self): - # Testable way off using a QFileDialog + # Testable way of using a QFileDialog self.export_dialog = QFileDialog(self) self.export_dialog.setObjectName('ExportFileDialog') self.export_dialog.setWindowTitle(self.tr("Export an account"))