trequest fee historgam every minute. show fee in the send tab of kivy gui - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit fb761b7c126b87c5397bb4128e7a9629a84c1f48 DIR parent 848f4b9ae0a9445c328b4d53635558e22c5c7dbb HTML Author: ThomasV <thomasv@electrum.org> Date: Thu, 1 Mar 2018 18:28:54 +0100 request fee historgam every minute. show fee in the send tab of kivy gui Diffstat: M gui/kivy/main_window.py | 16 ++++++++++++++++ M gui/kivy/uix/dialogs/settings.py | 15 --------------- M gui/kivy/uix/ui_screens/send.kv | 18 ++++++++++++++++++ M lib/simple_config.py | 8 ++------ 4 files changed, 36 insertions(+), 21 deletions(-) --- DIR diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py t@@ -82,7 +82,9 @@ class ElectrumWindow(App): server_port = StringProperty('') num_chains = NumericProperty(0) blockchain_name = StringProperty('') + fee_status = StringProperty('Fee') blockchain_checkpoint = NumericProperty(0) + _fee_dialog = None auto_connect = BooleanProperty(False) def on_auto_connect(self, instance, x): t@@ -271,6 +273,7 @@ class ElectrumWindow(App): # cached dialogs self._settings_dialog = None self._password_dialog = None + self.fee_status = self.electrum_config.get_fee_status() def wallet_name(self): return os.path.basename(self.wallet.storage.path) if self.wallet else ' ' t@@ -457,6 +460,7 @@ class ElectrumWindow(App): if self.network: interests = ['updated', 'status', 'new_transaction', 'verified', 'interfaces'] 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_history, ['on_history']) # URI passed in config t@@ -828,6 +832,18 @@ class ElectrumWindow(App): popup = AmountDialog(show_max, amount, cb) 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): if self.wallet.has_password(): self.password_dialog(msg, f, args) DIR diff --git a/gui/kivy/uix/dialogs/settings.py b/gui/kivy/uix/dialogs/settings.py t@@ -49,12 +49,6 @@ Builder.load_string(''' action: partial(root.unit_dialog, self) 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: status: root.fx_status() title: _('Fiat Currency') + ': ' + self.status description: _("Display amounts in fiat currency.") t@@ -112,7 +106,6 @@ class SettingsDialog(Factory.Popup): layout.bind(minimum_height=layout.setter('height')) # cached dialogs self._fx_dialog = None - self._fee_dialog = None self._proxy_dialog = None self._language_dialog = None self._unit_dialog = None t@@ -205,14 +198,6 @@ class SettingsDialog(Factory.Popup): def fee_status(self): 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): from .checkbox_dialog import CheckBoxDialog CheckBoxDialog(title, message, getattr(self.app, name), lambda x: setattr(self.app, name, x)).open() DIR diff --git a/gui/kivy/uix/ui_screens/send.kv b/gui/kivy/uix/ui_screens/send.kv t@@ -71,6 +71,24 @@ SendScreen: text: s.message if s.message else (_('No Description') if root.is_pr else _('Description')) disabled: root.is_pr 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: size_hint: 1, None height: '48dp' DIR diff --git a/lib/simple_config.py b/lib/simple_config.py t@@ -348,7 +348,7 @@ class SimpleConfig(PrintError): pos = self.get_depth_level() if mempool else self.get_fee_level() fee_rate = self.fee_per_kb() 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): """Returns (text, tooltip) where t@@ -469,11 +469,7 @@ class SimpleConfig(PrintError): Returns True if an update should be requested. """ now = time.time() - prev_updates = self.fee_estimates_last_updated.values() - 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 + return = now - self.last_time_fee_estimates_requested > 60 def requested_fee_estimates(self): self.last_time_fee_estimates_requested = time.time()