tquery_info: raise if user cancelled - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit f7efedf8a0f8ed82cc9a97418501dcec2e10f7bf DIR parent 4189d9343d990939399acac59a6fcb0e5c35da17 HTML Author: ThomasV <thomasv@electrum.org> Date: Fri, 26 Aug 2016 12:26:43 +0200 query_info: raise if user cancelled Diffstat: M gui/qt/main_window.py | 3 ++- M lib/plugins.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) --- DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py t@@ -1288,7 +1288,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): vbox = QVBoxLayout(dialog) vbox.addLayout(clayout.layout()) vbox.addLayout(Buttons(OkButton(dialog))) - dialog.exec_() + if not dialog.exec_(): + return None return clayout.selected_index() def lock_amount(self, b): DIR diff --git a/lib/plugins.py b/lib/plugins.py t@@ -472,7 +472,10 @@ class DeviceMgr(ThreadJob, PrintError): return info msg = _("Please select which %s device to use:") % plugin.device descriptions = [info.label + ' (%s)'%(_("initialized") if info.initialized else _("wiped")) for info in infos] - info = infos[handler.query_choice(msg, descriptions)] + c = handler.query_choice(msg, descriptions) + if c is None: + raise UserCancelled() + info = infos[c] # save new label keystore.set_label(info.label) keystore.handler.win.wallet.save_keystore()