commit 56c94153ff60ddf917645ceaf7823c5994a2b630
parent 451ac0d2599e3192657fe36f5acfde35b8b66581
Author: ThomasV <thomasv@electrum.org>
Date: Sun, 4 Mar 2018 10:29:56 +0100
kivy: simplify fee dialog
Diffstat:
1 file changed, 29 insertions(+), 22 deletions(-)
diff --git a/gui/kivy/uix/dialogs/fee_dialog.py b/gui/kivy/uix/dialogs/fee_dialog.py
@@ -20,8 +20,9 @@ Builder.load_string('''
Label:
text: _('Method') + ':'
Button:
- text: _('Mempool based') if root.method == 2 else _('ETA based') if root.method == 1 else _('Static')
+ text: _('Mempool') if root.method == 2 else _('ETA') if root.method == 1 else _('Static')
background_color: (0,0,0,0)
+ bold: True
on_release:
root.method = (root.method + 1) % 3
root.update_slider()
@@ -30,25 +31,26 @@ Builder.load_string('''
orientation: 'horizontal'
size_hint: 1, 0.5
Label:
- text: _('Target') + ':'
+ text: (_('Target') if root.method > 0 else _('Fee')) + ':'
Label:
id: fee_target
text: ''
- BoxLayout:
- orientation: 'horizontal'
- size_hint: 1, 0.5
- Label:
- text: (_('Current rate') if root.method > 0 else _('Estimate')) + ':'
- Label:
- id: fee_estimate
- text: ''
Slider:
id: slider
range: 0, 4
step: 1
on_value: root.on_slider(self.value)
Widget:
- size_hint: 1, 1
+ size_hint: 1, 0.5
+ BoxLayout:
+ orientation: 'horizontal'
+ size_hint: 1, 0.5
+ TopLabel:
+ id: fee_estimate
+ text: ''
+ font_size: '14dp'
+ Widget:
+ size_hint: 1, 0.5
BoxLayout:
orientation: 'horizontal'
size_hint: 1, 0.5
@@ -81,10 +83,23 @@ class FeeDialog(Factory.Popup):
self.update_text()
def update_text(self):
- value = int(self.ids.slider.value)
- target, estimate = self.get_fee_text(value)
+ pos = int(self.ids.slider.value)
+ dynfees, mempool = self.get_method()
+ if self.method == 2:
+ fee_rate = self.config.depth_to_fee(pos)
+ target, estimate = self.config.get_fee_text(pos, dynfees, mempool, fee_rate)
+ msg = 'In the current network conditions, in order to be positioned %s, a transaction will require a fee of %s.' % (target, estimate)
+ elif self.method == 1:
+ fee_rate = self.config.eta_to_fee(pos)
+ target, estimate = self.config.get_fee_text(pos, dynfees, mempool, fee_rate)
+ msg = 'In the last few days, transactions that confirmed %s usually paid a fee of at least %s.' % (target.lower(), estimate)
+ else:
+ fee_rate = self.config.static_fee(pos)
+ target, estimate = self.config.get_fee_text(pos, dynfees, True, fee_rate)
+ msg = 'In the current network conditions, a transaction paying %s would be positioned %s.' % (target, estimate)
+
self.ids.fee_target.text = target
- self.ids.fee_estimate.text = estimate
+ self.ids.fee_estimate.text = msg
def get_method(self):
dynfees = self.method > 0
@@ -99,14 +114,6 @@ class FeeDialog(Factory.Popup):
slider.step = 1
slider.value = pos
- def get_fee_text(self, pos):
- dynfees, mempool = self.get_method()
- if dynfees:
- fee_rate = self.config.depth_to_fee(pos) if mempool else self.config.eta_to_fee(pos)
- else:
- fee_rate = self.config.static_fee(pos)
- return self.config.get_fee_text(pos, dynfees, mempool, fee_rate)
-
def on_ok(self):
value = int(self.ids.slider.value)
dynfees, mempool = self.get_method()