ThomasV
8 years ago
10 changed files with 276 additions and 260 deletions
@ -1,63 +0,0 @@ |
|||||
from kivy.app import App |
|
||||
from kivy.factory import Factory |
|
||||
from kivy.properties import ObjectProperty |
|
||||
from kivy.lang import Builder |
|
||||
|
|
||||
from electrum.i18n import _ |
|
||||
|
|
||||
Builder.load_string(''' |
|
||||
#:import _ electrum_gui.kivy.i18n._ |
|
||||
|
|
||||
<BlockchainDialog@Popup> |
|
||||
id: popup |
|
||||
title: _('Blockchain') |
|
||||
size_hint: 1, 1 |
|
||||
cp_height: 0 |
|
||||
cp_value: '' |
|
||||
|
|
||||
BoxLayout: |
|
||||
orientation: 'vertical' |
|
||||
padding: '10dp' |
|
||||
spacing: '10dp' |
|
||||
TopLabel: |
|
||||
height: '48dp' |
|
||||
id: bc_height |
|
||||
text: _("Verified headers: %d blocks.")% app.num_blocks |
|
||||
TopLabel: |
|
||||
height: '48dp' |
|
||||
id: bc_status |
|
||||
text: _("Connected to %d nodes.")% app.num_nodes if app.num_nodes else _("Not connected?") |
|
||||
Widget: |
|
||||
size_hint: 1, 0.1 |
|
||||
TopLabel: |
|
||||
text: _("Electrum connects to several nodes in order to download block headers and find out the longest blockchain.") + _("This blockchain is used to verify the transactions sent by your transaction server.") |
|
||||
font_size: '6pt' |
|
||||
Widget: |
|
||||
size_hint: 1, 0.1 |
|
||||
Widget: |
|
||||
size_hint: 1, 0.1 |
|
||||
BoxLayout: |
|
||||
orientation: 'horizontal' |
|
||||
size_hint: 1, 0.2 |
|
||||
Button: |
|
||||
text: _('Cancel') |
|
||||
size_hint: 0.5, None |
|
||||
height: '48dp' |
|
||||
on_release: popup.dismiss() |
|
||||
Button: |
|
||||
text: _('OK') |
|
||||
size_hint: 0.5, None |
|
||||
height: '48dp' |
|
||||
on_release: |
|
||||
root.callback(root.cp_height, root.cp_value) |
|
||||
popup.dismiss() |
|
||||
''') |
|
||||
|
|
||||
class BlockchainDialog(Factory.Popup): |
|
||||
def __init__(self, network, callback): |
|
||||
Factory.Popup.__init__(self) |
|
||||
self.network = network |
|
||||
self.callback = callback |
|
||||
self.is_split = len(self.network.blockchains) > 1 |
|
||||
|
|
||||
self.checkpoint_height = network.get_checkpoint() |
|
@ -1,72 +1,53 @@ |
|||||
Popup: |
Popup: |
||||
id: nd |
id: nd |
||||
title: _('Server') |
title: _('Network') |
||||
is_connected: app.network.is_connected() |
|
||||
|
|
||||
BoxLayout: |
BoxLayout: |
||||
orientation: 'vertical' |
orientation: 'vertical' |
||||
padding: '10dp' |
ScrollView: |
||||
spacing: '10dp' |
|
||||
TopLabel: |
|
||||
text: _("Electrum requests your transaction history from a single server. The returned history is then checked against blockchain headers sent by other nodes, using Simple Payment Verification (SPV).") |
|
||||
font_size: '6pt' |
|
||||
Widget: |
|
||||
size_hint: 1, 0.8 |
|
||||
GridLayout: |
GridLayout: |
||||
cols: 3 |
id: scrollviewlayout |
||||
Label: |
cols:1 |
||||
height: '36dp' |
size_hint: 1, None |
||||
size_hint_x: 1 |
height: self.minimum_height |
||||
size_hint_y: None |
padding: '10dp' |
||||
text: _('Host') + ':' |
SettingsItem: |
||||
TextInput: |
value: _("%d connections.")% app.num_nodes if app.num_nodes else _("Not connected") |
||||
id: host |
title: _("Status") + ': ' + self.value |
||||
multiline: False |
description: _("Connections with Electrum servers") |
||||
height: '36dp' |
action: lambda x: x |
||||
size_hint_x: 3 |
|
||||
size_hint_y: None |
CardSeparator |
||||
text: '' |
SettingsItem: |
||||
disabled: auto_connect.active |
title: _("Server") + ': ' + app.server_host |
||||
Button: |
description: _("Server used to request your history.") |
||||
id: chooser |
action: lambda x: app.popup_dialog('server') |
||||
text:'v' |
|
||||
height: '36dp' |
CardSeparator |
||||
size_hint_x: 0.5 |
SettingsItem: |
||||
size_hint_y: None |
title: _("Auto-connect") + ': ' + ('ON' if app.auto_connect else 'OFF') |
||||
disabled: auto_connect.active |
description: _("Find a server automatically") |
||||
Label: |
action: app.toggle_auto_connect |
||||
height: '36dp' |
|
||||
size_hint_x: 1 |
CardSeparator |
||||
size_hint_y: None |
SettingsItem: |
||||
text: _('Port') + ':' |
value: "%d blocks" % app.num_blocks |
||||
TextInput: |
title: _("Blockchain") + ': ' + self.value |
||||
id: port |
description: _("Verified block headers.") |
||||
multiline: False |
action: lambda x: x |
||||
input_type: 'number' |
|
||||
height: '36dp' |
CardSeparator |
||||
size_hint_x: 3 |
SettingsItem: |
||||
size_hint_y: None |
title: _("Checkpoint") + ': ' + app.blockchain_status() |
||||
text: '' |
description: app.blockchain_info() |
||||
disabled: auto_connect.active |
action: app.choose_blockchain_dialog |
||||
Widget: |
|
||||
size_hint: 1, 0.1 |
CardSeparator |
||||
TopLabel: |
SettingsItem: |
||||
text: _("If auto-connect is checked, your history server will be selected automatically.") |
proxy: app.proxy_config.get('mode') |
||||
font_size: '6pt' |
host: app.proxy_config.get('host') |
||||
BoxLayout: |
port: app.proxy_config.get('port') |
||||
Label: |
title: _("Proxy") + ': ' + ((self.host +':' + self.port) if self.proxy else _('None')) |
||||
text: _('Auto-connect') |
description: _('Proxy configuration') |
||||
CheckBox: |
action: lambda x: app.popup_dialog('proxy') |
||||
id: auto_connect |
|
||||
size_hint_y: None |
|
||||
Widget: |
|
||||
size_hint: 1, 0.1 |
|
||||
BoxLayout: |
|
||||
Widget: |
|
||||
size_hint: 0.5, None |
|
||||
Button: |
|
||||
size_hint: 0.5, None |
|
||||
height: '48dp' |
|
||||
text: _('OK') |
|
||||
on_release: |
|
||||
nd.dismiss() |
|
||||
|
@ -0,0 +1,63 @@ |
|||||
|
Popup: |
||||
|
id: nd |
||||
|
title: _('Server') |
||||
|
BoxLayout: |
||||
|
orientation: 'vertical' |
||||
|
padding: '10dp' |
||||
|
spacing: '10dp' |
||||
|
TopLabel: |
||||
|
text: _("Electrum requests your transaction history from a single server. The returned history is checked against blockchain headers sent by other nodes, using Simple Payment Verification (SPV).") |
||||
|
font_size: '6pt' |
||||
|
Widget: |
||||
|
size_hint: 1, 0.8 |
||||
|
GridLayout: |
||||
|
cols: 2 |
||||
|
Label: |
||||
|
height: '36dp' |
||||
|
size_hint_x: 1 |
||||
|
size_hint_y: None |
||||
|
text: _('Host') + ':' |
||||
|
TextInput: |
||||
|
id: host |
||||
|
multiline: False |
||||
|
height: '36dp' |
||||
|
size_hint_x: 3 |
||||
|
size_hint_y: None |
||||
|
text: app.server_host |
||||
|
Label: |
||||
|
height: '36dp' |
||||
|
size_hint_x: 1 |
||||
|
size_hint_y: None |
||||
|
text: _('Port') + ':' |
||||
|
TextInput: |
||||
|
id: port |
||||
|
multiline: False |
||||
|
input_type: 'number' |
||||
|
height: '36dp' |
||||
|
size_hint_x: 3 |
||||
|
size_hint_y: None |
||||
|
text: app.server_port |
||||
|
Widget |
||||
|
Button: |
||||
|
id: chooser |
||||
|
text: _('Choose from peers') |
||||
|
height: '36dp' |
||||
|
size_hint_x: 0.5 |
||||
|
size_hint_y: None |
||||
|
on_release: |
||||
|
app.choose_server_dialog(root) |
||||
|
Widget: |
||||
|
size_hint: 1, 0.1 |
||||
|
BoxLayout: |
||||
|
Widget: |
||||
|
size_hint: 0.5, None |
||||
|
Button: |
||||
|
size_hint: 0.5, None |
||||
|
height: '48dp' |
||||
|
text: _('OK') |
||||
|
on_release: |
||||
|
host, port, protocol, proxy, auto_connect = app.network.get_parameters() |
||||
|
host = str(root.ids.host.text) |
||||
|
port = str(root.ids.port.text) |
||||
|
app.network.set_parameters(host, port, protocol, proxy, auto_connect) |
||||
|
nd.dismiss() |
Loading…
Reference in new issue