request fee historgam every minute. show fee in the send tab of kivy gui
This commit is contained in:
@@ -82,7 +82,9 @@ class ElectrumWindow(App):
|
|||||||
server_port = StringProperty('')
|
server_port = StringProperty('')
|
||||||
num_chains = NumericProperty(0)
|
num_chains = NumericProperty(0)
|
||||||
blockchain_name = StringProperty('')
|
blockchain_name = StringProperty('')
|
||||||
|
fee_status = StringProperty('Fee')
|
||||||
blockchain_checkpoint = NumericProperty(0)
|
blockchain_checkpoint = NumericProperty(0)
|
||||||
|
_fee_dialog = None
|
||||||
|
|
||||||
auto_connect = BooleanProperty(False)
|
auto_connect = BooleanProperty(False)
|
||||||
def on_auto_connect(self, instance, x):
|
def on_auto_connect(self, instance, x):
|
||||||
@@ -271,6 +273,7 @@ class ElectrumWindow(App):
|
|||||||
# cached dialogs
|
# cached dialogs
|
||||||
self._settings_dialog = None
|
self._settings_dialog = None
|
||||||
self._password_dialog = None
|
self._password_dialog = None
|
||||||
|
self.fee_status = self.electrum_config.get_fee_status()
|
||||||
|
|
||||||
def wallet_name(self):
|
def wallet_name(self):
|
||||||
return os.path.basename(self.wallet.storage.path) if self.wallet else ' '
|
return os.path.basename(self.wallet.storage.path) if self.wallet else ' '
|
||||||
@@ -457,6 +460,7 @@ class ElectrumWindow(App):
|
|||||||
if self.network:
|
if self.network:
|
||||||
interests = ['updated', 'status', 'new_transaction', 'verified', 'interfaces']
|
interests = ['updated', 'status', 'new_transaction', 'verified', 'interfaces']
|
||||||
self.network.register_callback(self.on_network_event, interests)
|
self.network.register_callback(self.on_network_event, interests)
|
||||||
|
self.network.register_callback(self.on_fee, ['fee'])
|
||||||
self.network.register_callback(self.on_quotes, ['on_quotes'])
|
self.network.register_callback(self.on_quotes, ['on_quotes'])
|
||||||
self.network.register_callback(self.on_history, ['on_history'])
|
self.network.register_callback(self.on_history, ['on_history'])
|
||||||
# URI passed in config
|
# URI passed in config
|
||||||
@@ -828,6 +832,18 @@ class ElectrumWindow(App):
|
|||||||
popup = AmountDialog(show_max, amount, cb)
|
popup = AmountDialog(show_max, amount, cb)
|
||||||
popup.open()
|
popup.open()
|
||||||
|
|
||||||
|
def fee_dialog(self, label, dt):
|
||||||
|
if self._fee_dialog is None:
|
||||||
|
from .uix.dialogs.fee_dialog import FeeDialog
|
||||||
|
def cb():
|
||||||
|
c = self.electrum_config
|
||||||
|
self.fee_status = c.get_fee_status()
|
||||||
|
self._fee_dialog = FeeDialog(self, self.electrum_config, cb)
|
||||||
|
self._fee_dialog.open()
|
||||||
|
|
||||||
|
def on_fee(self, event, *arg):
|
||||||
|
self.fee_status = self.electrum_config.get_fee_status()
|
||||||
|
|
||||||
def protected(self, msg, f, args):
|
def protected(self, msg, f, args):
|
||||||
if self.wallet.has_password():
|
if self.wallet.has_password():
|
||||||
self.password_dialog(msg, f, args)
|
self.password_dialog(msg, f, args)
|
||||||
|
|||||||
@@ -48,12 +48,6 @@ Builder.load_string('''
|
|||||||
description: _("Base unit for Bitcoin amounts.")
|
description: _("Base unit for Bitcoin amounts.")
|
||||||
action: partial(root.unit_dialog, self)
|
action: partial(root.unit_dialog, self)
|
||||||
CardSeparator
|
CardSeparator
|
||||||
SettingsItem:
|
|
||||||
status: root.fee_status()
|
|
||||||
title: _('Fees') + ': ' + self.status
|
|
||||||
description: _("Fees paid to the Bitcoin miners.")
|
|
||||||
action: partial(root.fee_dialog, self)
|
|
||||||
CardSeparator
|
|
||||||
SettingsItem:
|
SettingsItem:
|
||||||
status: root.fx_status()
|
status: root.fx_status()
|
||||||
title: _('Fiat Currency') + ': ' + self.status
|
title: _('Fiat Currency') + ': ' + self.status
|
||||||
@@ -112,7 +106,6 @@ class SettingsDialog(Factory.Popup):
|
|||||||
layout.bind(minimum_height=layout.setter('height'))
|
layout.bind(minimum_height=layout.setter('height'))
|
||||||
# cached dialogs
|
# cached dialogs
|
||||||
self._fx_dialog = None
|
self._fx_dialog = None
|
||||||
self._fee_dialog = None
|
|
||||||
self._proxy_dialog = None
|
self._proxy_dialog = None
|
||||||
self._language_dialog = None
|
self._language_dialog = None
|
||||||
self._unit_dialog = None
|
self._unit_dialog = None
|
||||||
@@ -205,14 +198,6 @@ class SettingsDialog(Factory.Popup):
|
|||||||
def fee_status(self):
|
def fee_status(self):
|
||||||
return self.config.get_fee_status()
|
return self.config.get_fee_status()
|
||||||
|
|
||||||
def fee_dialog(self, label, dt):
|
|
||||||
if self._fee_dialog is None:
|
|
||||||
from .fee_dialog import FeeDialog
|
|
||||||
def cb():
|
|
||||||
label.status = self.fee_status()
|
|
||||||
self._fee_dialog = FeeDialog(self.app, self.config, cb)
|
|
||||||
self._fee_dialog.open()
|
|
||||||
|
|
||||||
def boolean_dialog(self, name, title, message, dt):
|
def boolean_dialog(self, name, title, message, dt):
|
||||||
from .checkbox_dialog import CheckBoxDialog
|
from .checkbox_dialog import CheckBoxDialog
|
||||||
CheckBoxDialog(title, message, getattr(self.app, name), lambda x: setattr(self.app, name, x)).open()
|
CheckBoxDialog(title, message, getattr(self.app, name), lambda x: setattr(self.app, name, x)).open()
|
||||||
|
|||||||
@@ -71,6 +71,24 @@ SendScreen:
|
|||||||
text: s.message if s.message else (_('No Description') if root.is_pr else _('Description'))
|
text: s.message if s.message else (_('No Description') if root.is_pr else _('Description'))
|
||||||
disabled: root.is_pr
|
disabled: root.is_pr
|
||||||
on_release: Clock.schedule_once(lambda dt: app.description_dialog(s))
|
on_release: Clock.schedule_once(lambda dt: app.description_dialog(s))
|
||||||
|
CardSeparator:
|
||||||
|
opacity: int(not root.is_pr)
|
||||||
|
color: blue_bottom.foreground_color
|
||||||
|
BoxLayout:
|
||||||
|
size_hint: 1, None
|
||||||
|
height: blue_bottom.item_height
|
||||||
|
spacing: '5dp'
|
||||||
|
Image:
|
||||||
|
source: 'atlas://gui/kivy/theming/light/star_big_inactive'
|
||||||
|
opacity: 0.7
|
||||||
|
size_hint: None, None
|
||||||
|
size: '22dp', '22dp'
|
||||||
|
pos_hint: {'center_y': .5}
|
||||||
|
BlueButton:
|
||||||
|
id: fee_e
|
||||||
|
default_text: _('Fee')
|
||||||
|
text: app.fee_status
|
||||||
|
on_release: Clock.schedule_once(lambda dt: app.fee_dialog(s, True))
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ class SimpleConfig(PrintError):
|
|||||||
pos = self.get_depth_level() if mempool else self.get_fee_level()
|
pos = self.get_depth_level() if mempool else self.get_fee_level()
|
||||||
fee_rate = self.fee_per_kb()
|
fee_rate = self.fee_per_kb()
|
||||||
target, tooltip = self.get_fee_text(pos, dyn, mempool, fee_rate)
|
target, tooltip = self.get_fee_text(pos, dyn, mempool, fee_rate)
|
||||||
return target
|
return target + ' [%s]'%tooltip
|
||||||
|
|
||||||
def get_fee_text(self, pos, dyn, mempool, fee_rate):
|
def get_fee_text(self, pos, dyn, mempool, fee_rate):
|
||||||
"""Returns (text, tooltip) where
|
"""Returns (text, tooltip) where
|
||||||
@@ -469,11 +469,7 @@ class SimpleConfig(PrintError):
|
|||||||
Returns True if an update should be requested.
|
Returns True if an update should be requested.
|
||||||
"""
|
"""
|
||||||
now = time.time()
|
now = time.time()
|
||||||
prev_updates = self.fee_estimates_last_updated.values()
|
return = now - self.last_time_fee_estimates_requested > 60
|
||||||
oldest_fee_time = min(prev_updates) if prev_updates else 0
|
|
||||||
stale_fees = now - oldest_fee_time > 7200
|
|
||||||
old_request = now - self.last_time_fee_estimates_requested > 60
|
|
||||||
return stale_fees and old_request
|
|
||||||
|
|
||||||
def requested_fee_estimates(self):
|
def requested_fee_estimates(self):
|
||||||
self.last_time_fee_estimates_requested = time.time()
|
self.last_time_fee_estimates_requested = time.time()
|
||||||
|
|||||||
Reference in New Issue
Block a user