URI: 
       tkivy: update fee slider - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 07dc4ebc1c2f6eb819b2765ff7c86b5a69460aaf
   DIR parent ac53585a40e437743db168380e2478f6b9d0a337
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Sun, 22 Jan 2017 11:22:16 +0100
       
       kivy: update fee slider
       
       Diffstat:
         M gui/kivy/main.kv                    |       3 ++-
         M gui/kivy/uix/dialogs/fee_dialog.py  |      26 +++++++++++++++-----------
         M gui/kivy/uix/dialogs/settings.py    |       6 ++----
       
       3 files changed, 19 insertions(+), 16 deletions(-)
       ---
   DIR diff --git a/gui/kivy/main.kv b/gui/kivy/main.kv
       t@@ -337,9 +337,10 @@
        
        
        <ActionOvrButton@ActionButton>
       -    on_release:
       +    #on_release:
                # fixme: the following line was commented out because it does no seem to do what it is intended
                # Clock.schedule_once(lambda dt: self.parent.parent.dismiss() if self.parent else None, 0.05)
       +    on_press:
                Clock.schedule_once(lambda dt: app.popup_dialog(self.name), 0.05)
        
        
   DIR diff --git a/gui/kivy/uix/dialogs/fee_dialog.py b/gui/kivy/uix/dialogs/fee_dialog.py
       t@@ -3,7 +3,6 @@ from kivy.factory import Factory
        from kivy.properties import ObjectProperty
        from kivy.lang import Builder
        
       -from electrum.bitcoin import FEE_STEP, RECOMMENDED_FEE
        from electrum.util import fee_levels
        from electrum_gui.kivy.i18n import _
        
       t@@ -59,6 +58,8 @@ class FeeDialog(Factory.Popup):
                Factory.Popup.__init__(self)
                self.app = app
                self.config = config
       +        self.fee_step = self.config.max_fee_rate() / 10
       +        self.fee_rate = self.config.fee_per_kb()
                self.callback = callback
                self.dynfees = self.config.get('dynamic_fees', True)
                self.ids.dynfees.active = self.dynfees
       t@@ -76,20 +77,23 @@ class FeeDialog(Factory.Popup):
                    slider.step = 1
                    slider.value = self.config.get('fee_level', 2)
                else:
       -            slider.range = (FEE_STEP, 2*RECOMMENDED_FEE)
       -            slider.step = FEE_STEP
       -            slider.value = self.config.get('fee_per_kb', RECOMMENDED_FEE)
       +            slider.range = (1, 10)
       +            slider.step = 1
       +            slider.value = min(self.fee_rate / self.fee_step, 10)
        
            def get_fee_text(self, value):
                if self.ids.dynfees.active:
                    tooltip = fee_levels[value]
       -            if self.app.network:
       -                dynfee = self.app.network.dynfee(value)
       -                if dynfee:
       -                    tooltip += '\n' + (self.app.format_amount_and_units(dynfee)) + '/kB'
       -            return tooltip
       +            if self.config.has_fee_estimates():
       +                dynfee = self.config.dynfee(value)
       +                tooltip += '\n' + (self.app.format_amount_and_units(dynfee)) + '/kB'
                else:
       -            return self.app.format_amount_and_units(value) + '/kB'
       +            fee_rate = value * self.fee_step
       +            tooltip = self.app.format_amount_and_units(fee_rate) + '/kB'
       +            if self.config.has_fee_estimates():
       +                i = self.config.reverse_dynfee(fee_rate)
       +                tooltip += '\n' + (_('low fee') if i < 0 else 'Within %d blocks'%i)
       +        return tooltip
        
            def on_ok(self):
                value = int(self.ids.slider.value)
       t@@ -97,7 +101,7 @@ class FeeDialog(Factory.Popup):
                if self.dynfees:
                    self.config.set_key('fee_level', value, True)
                else:
       -            self.config.set_key('fee_per_kb', value, True)
       +            self.config.set_key('fee_per_kb', value * self.fee_step, True)
                self.callback()
        
            def on_slider(self, value):
   DIR diff --git a/gui/kivy/uix/dialogs/settings.py b/gui/kivy/uix/dialogs/settings.py
       t@@ -7,8 +7,8 @@ from electrum.util import base_units
        from electrum.i18n import languages
        from electrum_gui.kivy.i18n import _
        from electrum.plugins import run_hook
       -from electrum.bitcoin import RECOMMENDED_FEE
        from electrum import coinchooser
       +from electrum.util import fee_levels
        
        from choice_dialog import ChoiceDialog
        
       t@@ -211,11 +211,9 @@ class SettingsDialog(Factory.Popup):
        
            def fee_status(self):
                if self.config.get('dynamic_fees', True):
       -            from electrum.util import fee_levels
                    return fee_levels[self.config.get('fee_level', 2)]
                else:
       -            F = self.config.get('fee_per_kb', RECOMMENDED_FEE)
       -            return self.app.format_amount_and_units(F) + '/kB'
       +            return self.app.format_amount_and_units(self.config.fee_per_kb()) + '/kB'
        
            def fee_dialog(self, label, dt):
                if self._fee_dialog is None: