electrum

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

commit 75db90ffa5db16cc737d74b14c56499fc92498eb
parent cb8d504c4238a8e6306c8bf200de29aa97a07681
Author: ThomasV <thomasv@electrum.org>
Date:   Mon, 22 Feb 2016 10:50:27 +0100

kivy: Move network dialog to settings. Add coin chooser to settings

Diffstat:
Mgui/kivy/main.kv | 11++++-------
Mgui/kivy/uix/dialogs/settings.py | 39+++++++++++++++++++++++++++++++++------
Mgui/kivy/uix/ui_screens/network.kv | 29+++++++++++++++++------------
3 files changed, 54 insertions(+), 25 deletions(-)

diff --git a/gui/kivy/main.kv b/gui/kivy/main.kv @@ -379,18 +379,15 @@ BoxLayout: name: 'about' text: _('About') ActionOvrButton: - name: 'network' - text: _('Network') - on_parent: - # when widget overflow drop down is shown, adjust the width - parent = args[1] - if parent: ao._dropdown.width = sp(200) - ActionOvrButton: name: 'wallets' text: _('Wallets') ActionOvrButton: name: 'settings' text: _('Settings') + on_parent: + # when widget overflow drop down is shown, adjust the width + parent = args[1] + if parent: ao._dropdown.width = sp(200) ScreenManager: id: manager ScreenTabs: diff --git a/gui/kivy/uix/dialogs/settings.py b/gui/kivy/uix/dialogs/settings.py @@ -9,6 +9,8 @@ from electrum_gui.kivy.i18n import _ from electrum.plugins import run_hook from electrum.bitcoin import RECOMMENDED_FEE +from choice_dialog import ChoiceDialog + Builder.load_string(''' #:import partial functools.partial #:import _ electrum_gui.kivy.i18n._ @@ -83,14 +85,20 @@ Builder.load_string(''' description: _("Display amounts in fiat currency.") action: partial(root.fx_dialog, self) SettingsItem: + status: root.network_status() + title: _('Network') + ': ' + self.status + description: _("Network status and server selection.") + action: partial(root.network_dialog, self) + SettingsItem: status: 'ON' if bool(app.plugins.get('labels')) else 'OFF' title: _('Labels Sync') + ': ' + self.status description: "Synchronize labels." action: partial(root.plugin_dialog, 'labels', self) - #SettingsItem: - # title: _('OpenAlias') - # description: "DNS record that stores one of your Bitcoin addresses." - # action: partial(root.openalias_dialog, self) + SettingsItem: + status: root.coinselect_status() + title: _('Coin selection') + ': ' + self.status + description: "Coin selection method" + action: partial(root.coinselect_dialog, self) BoxLayout: size_hint: 1, 0.1 Widget: @@ -120,7 +128,6 @@ class SettingsDialog(Factory.Popup): self.app.change_password() def language_dialog(self, item, dt): - from choice_dialog import ChoiceDialog l = self.config.get('language', 'en_UK') def cb(key): self.config.set_key("language", key, True) @@ -130,13 +137,25 @@ class SettingsDialog(Factory.Popup): d.open() def unit_dialog(self, item, dt): - from choice_dialog import ChoiceDialog def cb(text): self.app._set_bu(text) item.bu = self.app.base_unit d = ChoiceDialog(_('Denomination'), base_units.keys(), self.app.base_unit, cb) d.open() + def coinselect_status(self): + return self.app.wallet.coin_chooser_name(self.app.electrum_config) + + def coinselect_dialog(self, item, dt): + from electrum import COIN_CHOOSERS + choosers = sorted(COIN_CHOOSERS.keys()) + chooser_name = self.app.wallet.coin_chooser_name(self.config) + def cb(text): + self.config.set_key('coin_chooser', text) + item.status = text + d = ChoiceDialog(_('Coin selection'), choosers, chooser_name, cb) + d.open() + def openalias_dialog(self, label, dt): from label_dialog import LabelDialog def callback(text): @@ -144,6 +163,14 @@ class SettingsDialog(Factory.Popup): d = LabelDialog(_('OpenAlias'), '', callback) d.open() + def network_dialog(self, label, dt): + popup = Builder.load_file('gui/kivy/uix/ui_screens/network.kv') + popup.open() + + def network_status(self): + server, port, protocol, proxy, auto_connect = self.app.network.get_parameters() + return 'auto-connect' if auto_connect else server + def plugin_dialog(self, name, label, dt): from checkbox_dialog import CheckBoxDialog def callback(status): diff --git a/gui/kivy/uix/ui_screens/network.kv b/gui/kivy/uix/ui_screens/network.kv @@ -1,31 +1,37 @@ Popup: id: nd title: _('Network') - + n_nodes: len(app.network.get_interfaces()) + blockchain_height: app.network.get_local_height() + is_connected: app.network.is_connected() on_open: host.text, nd.port, nd.protocol, nd.proxy, auto_connect.active = app.network.get_parameters() BoxLayout: - orientation: 'vertical' - + TopLabel: + s1: _("Connected to %d nodes.")%root.n_nodes if root.n_nodes else _("Not connected?") + s2: _("Blockchain length") + ": %d "%root.blockchain_height + _("blocks") + text: self.s1 + '\n' + self.s2 + Widget: + size_hint: 1, 0.1 GridLayout: cols: 2 Label: - text: _('Auto-connect') - CheckBox: - id: auto_connect - size_hint_y: None - Label: - text: _('Server') + text: _('Address server') Spinner: id: host + height: '48dp' text: '' values: sorted(app.network.get_servers()) disabled: auto_connect.active + Label: + text: _('Auto-connect') + CheckBox: + id: auto_connect + size_hint_y: None Widget: - size_hint: 1, 1 - + size_hint: 1, 0.1 BoxLayout: Widget: size_hint: 0.5, None @@ -36,4 +42,3 @@ Popup: on_release: app.network.set_parameters(host.text, nd.port, nd.protocol, nd.proxy, auto_connect.active) nd.dismiss() -