electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit a10455f6857bd7c8d57e160cecf72d60f99465a7
parent c5747484b2ca54a4360e7226b1174b9df7229010
Author: ecdsa <ecdsa@github>
Date:   Sun, 17 Mar 2013 11:52:58 +0100

settings dialog

Diffstat:
Mgui/gui_classic.py | 2+-
Mgui/plugins.py | 4+++-
Mplugins/labels.py | 24+++++++++++++-----------
3 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/gui/gui_classic.py b/gui/gui_classic.py @@ -2015,7 +2015,7 @@ class ElectrumWindow(QMainWindow): cb.setChecked(p.is_enabled()) cb.clicked.connect(mk_toggle(cb,p)) grid_plugins.addWidget(cb, i, 0) - if p.requires_settings: + if p.requires_settings(): grid_plugins.addWidget(EnterButton(_('Settings'), p.settings_dialog), i, 1) grid_plugins.addWidget(HelpButton(description), i, 2) except: diff --git a/gui/plugins.py b/gui/plugins.py @@ -11,7 +11,9 @@ class BasePlugin: self.description = description self.gui = gui self.config = gui.config - self.requires_settings = False + + def requires_settings(self): + return False def toggle(self): enabled = not self.is_enabled() diff --git a/plugins/labels.py b/plugins/labels.py @@ -65,15 +65,13 @@ To get started visit http://labelectrum.herokuapp.com/ to sign up for an account return response = json.loads(response.read()) - def close_settings_dialog(self): - # When you enable the plugin for the first time this won't exist. - if self.is_enabled(): - if hasattr(self, 'auth_token_edit'): - self.config.set_key("plugin_label_api_key", str(self.auth_token_edit.text())) - else: - QMessageBox.information(None, _("Label sync loaded"), _("Please open the settings again to configure the label sync plugin.")) - def create_settings_tab(self, tabs): + def requires_settings(self): + return True + + def settings_dialog(self): + dialog = QDialog(self.gui) + def check_for_api_key(api_key): if api_key and len(api_key) > 12: self.config.set_key("plugin_label_api_key", str(self.auth_token_edit.text())) @@ -83,8 +81,7 @@ To get started visit http://labelectrum.herokuapp.com/ to sign up for an account self.upload.setEnabled(False) self.download.setEnabled(False) - cloud_tab = QWidget() - layout = QGridLayout(cloud_tab) + layout = QGridLayout() layout.addWidget(QLabel("API Key: "),0,0) self.auth_token_edit = QLineEdit(self.auth_token()) @@ -103,7 +100,12 @@ To get started visit http://labelectrum.herokuapp.com/ to sign up for an account check_for_api_key(self.auth_token()) - tabs.addTab(cloud_tab, "Label sync") + dialog.setLayout(layout) + + dialog.exec_() + self.config.set_key("plugin_label_api_key", str(self.auth_token_edit.text())) + + def full_push(self): if self.do_full_push():