1
0

add checkpoint dialog to the kivy gui

This commit is contained in:
ThomasV
2017-03-27 12:48:10 +02:00
parent e6560b8d7f
commit 2fcdd458b3
4 changed files with 124 additions and 6 deletions

View File

@@ -113,6 +113,12 @@ Builder.load_string('''
title: _('Coin selection') + ': ' + self.status
description: "Coin selection method"
action: partial(root.coinselect_dialog, self)
CardSeparator
SettingsItem:
status: root.checkpoint_status()
title: _('Checkpoint') + ': ' + self.status
description: _("Configure blockchain checkpoint")
action: partial(root.checkpoint_dialog, self)
''')
@@ -134,6 +140,7 @@ class SettingsDialog(Factory.Popup):
self._language_dialog = None
self._unit_dialog = None
self._coinselect_dialog = None
self._checkpoint_dialog = None
def update(self):
self.wallet = self.app.wallet
@@ -177,6 +184,21 @@ class SettingsDialog(Factory.Popup):
self._coinselect_dialog = ChoiceDialog(_('Coin selection'), choosers, chooser_name, cb)
self._coinselect_dialog.open()
def checkpoint_status(self):
height, value = self.app.network.blockchain.get_checkpoint()
return "Block %d"% height if height else _("Genesis block")
def checkpoint_dialog(self, item, dt):
from checkpoint_dialog import CheckpointDialog
if self._checkpoint_dialog is None:
def callback(height, value):
if value:
self.app.network.blockchain.set_checkpoint(height, value)
item.status = self.checkpoint_status()
self._checkpoint_dialog = CheckpointDialog(self.app.network, callback)
self._checkpoint_dialog.open()
def network_dialog(self, item, dt):
if self._network_dialog is None:
server, port, protocol, proxy, auto_connect = self.app.network.get_parameters()