kivy: Move network dialog to settings. Add coin chooser to settings
This commit is contained in:
parent
cb8d504c42
commit
75db90ffa5
|
@ -378,19 +378,16 @@ BoxLayout:
|
||||||
ActionOvrButton:
|
ActionOvrButton:
|
||||||
name: 'about'
|
name: 'about'
|
||||||
text: _('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:
|
ActionOvrButton:
|
||||||
name: 'wallets'
|
name: 'wallets'
|
||||||
text: _('Wallets')
|
text: _('Wallets')
|
||||||
ActionOvrButton:
|
ActionOvrButton:
|
||||||
name: 'settings'
|
name: 'settings'
|
||||||
text: _('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:
|
ScreenManager:
|
||||||
id: manager
|
id: manager
|
||||||
ScreenTabs:
|
ScreenTabs:
|
||||||
|
|
|
@ -9,6 +9,8 @@ from electrum_gui.kivy.i18n import _
|
||||||
from electrum.plugins import run_hook
|
from electrum.plugins import run_hook
|
||||||
from electrum.bitcoin import RECOMMENDED_FEE
|
from electrum.bitcoin import RECOMMENDED_FEE
|
||||||
|
|
||||||
|
from choice_dialog import ChoiceDialog
|
||||||
|
|
||||||
Builder.load_string('''
|
Builder.load_string('''
|
||||||
#:import partial functools.partial
|
#:import partial functools.partial
|
||||||
#:import _ electrum_gui.kivy.i18n._
|
#:import _ electrum_gui.kivy.i18n._
|
||||||
|
@ -82,15 +84,21 @@ Builder.load_string('''
|
||||||
title: _('Fiat Currency') + ': ' + self.status
|
title: _('Fiat Currency') + ': ' + self.status
|
||||||
description: _("Display amounts in fiat currency.")
|
description: _("Display amounts in fiat currency.")
|
||||||
action: partial(root.fx_dialog, self)
|
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:
|
SettingsItem:
|
||||||
status: 'ON' if bool(app.plugins.get('labels')) else 'OFF'
|
status: 'ON' if bool(app.plugins.get('labels')) else 'OFF'
|
||||||
title: _('Labels Sync') + ': ' + self.status
|
title: _('Labels Sync') + ': ' + self.status
|
||||||
description: "Synchronize labels."
|
description: "Synchronize labels."
|
||||||
action: partial(root.plugin_dialog, 'labels', self)
|
action: partial(root.plugin_dialog, 'labels', self)
|
||||||
#SettingsItem:
|
SettingsItem:
|
||||||
# title: _('OpenAlias')
|
status: root.coinselect_status()
|
||||||
# description: "DNS record that stores one of your Bitcoin addresses."
|
title: _('Coin selection') + ': ' + self.status
|
||||||
# action: partial(root.openalias_dialog, self)
|
description: "Coin selection method"
|
||||||
|
action: partial(root.coinselect_dialog, self)
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
size_hint: 1, 0.1
|
size_hint: 1, 0.1
|
||||||
Widget:
|
Widget:
|
||||||
|
@ -120,7 +128,6 @@ class SettingsDialog(Factory.Popup):
|
||||||
self.app.change_password()
|
self.app.change_password()
|
||||||
|
|
||||||
def language_dialog(self, item, dt):
|
def language_dialog(self, item, dt):
|
||||||
from choice_dialog import ChoiceDialog
|
|
||||||
l = self.config.get('language', 'en_UK')
|
l = self.config.get('language', 'en_UK')
|
||||||
def cb(key):
|
def cb(key):
|
||||||
self.config.set_key("language", key, True)
|
self.config.set_key("language", key, True)
|
||||||
|
@ -130,13 +137,25 @@ class SettingsDialog(Factory.Popup):
|
||||||
d.open()
|
d.open()
|
||||||
|
|
||||||
def unit_dialog(self, item, dt):
|
def unit_dialog(self, item, dt):
|
||||||
from choice_dialog import ChoiceDialog
|
|
||||||
def cb(text):
|
def cb(text):
|
||||||
self.app._set_bu(text)
|
self.app._set_bu(text)
|
||||||
item.bu = self.app.base_unit
|
item.bu = self.app.base_unit
|
||||||
d = ChoiceDialog(_('Denomination'), base_units.keys(), self.app.base_unit, cb)
|
d = ChoiceDialog(_('Denomination'), base_units.keys(), self.app.base_unit, cb)
|
||||||
d.open()
|
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):
|
def openalias_dialog(self, label, dt):
|
||||||
from label_dialog import LabelDialog
|
from label_dialog import LabelDialog
|
||||||
def callback(text):
|
def callback(text):
|
||||||
|
@ -144,6 +163,14 @@ class SettingsDialog(Factory.Popup):
|
||||||
d = LabelDialog(_('OpenAlias'), '', callback)
|
d = LabelDialog(_('OpenAlias'), '', callback)
|
||||||
d.open()
|
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):
|
def plugin_dialog(self, name, label, dt):
|
||||||
from checkbox_dialog import CheckBoxDialog
|
from checkbox_dialog import CheckBoxDialog
|
||||||
def callback(status):
|
def callback(status):
|
||||||
|
|
|
@ -1,31 +1,37 @@
|
||||||
Popup:
|
Popup:
|
||||||
id: nd
|
id: nd
|
||||||
title: _('Network')
|
title: _('Network')
|
||||||
|
n_nodes: len(app.network.get_interfaces())
|
||||||
|
blockchain_height: app.network.get_local_height()
|
||||||
|
is_connected: app.network.is_connected()
|
||||||
on_open:
|
on_open:
|
||||||
host.text, nd.port, nd.protocol, nd.proxy, auto_connect.active = app.network.get_parameters()
|
host.text, nd.port, nd.protocol, nd.proxy, auto_connect.active = app.network.get_parameters()
|
||||||
|
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
|
|
||||||
orientation: 'vertical'
|
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:
|
GridLayout:
|
||||||
cols: 2
|
cols: 2
|
||||||
|
Label:
|
||||||
|
text: _('Address server')
|
||||||
|
Spinner:
|
||||||
|
id: host
|
||||||
|
height: '48dp'
|
||||||
|
text: ''
|
||||||
|
values: sorted(app.network.get_servers())
|
||||||
|
disabled: auto_connect.active
|
||||||
Label:
|
Label:
|
||||||
text: _('Auto-connect')
|
text: _('Auto-connect')
|
||||||
CheckBox:
|
CheckBox:
|
||||||
id: auto_connect
|
id: auto_connect
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
Label:
|
|
||||||
text: _('Server')
|
|
||||||
Spinner:
|
|
||||||
id: host
|
|
||||||
text: ''
|
|
||||||
values: sorted(app.network.get_servers())
|
|
||||||
disabled: auto_connect.active
|
|
||||||
Widget:
|
Widget:
|
||||||
size_hint: 1, 1
|
size_hint: 1, 0.1
|
||||||
|
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
Widget:
|
Widget:
|
||||||
size_hint: 0.5, None
|
size_hint: 0.5, None
|
||||||
|
@ -36,4 +42,3 @@ Popup:
|
||||||
on_release:
|
on_release:
|
||||||
app.network.set_parameters(host.text, nd.port, nd.protocol, nd.proxy, auto_connect.active)
|
app.network.set_parameters(host.text, nd.port, nd.protocol, nd.proxy, auto_connect.active)
|
||||||
nd.dismiss()
|
nd.dismiss()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue