tkivy: add context button for tx details - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 2f13910bf1431ff0f610fd746868e81589e859fe DIR parent 9b2885e697008445ba4a929d18bdf1d476a9cfc4 HTML Author: ThomasV <thomasv@electrum.org> Date: Sun, 6 Dec 2015 10:25:02 +0100 kivy: add context button for tx details Diffstat: M gui/kivy/main.kv | 10 ++++++++++ M gui/kivy/main_window.py | 14 +++++++++++++- M gui/kivy/uix/ui_screens/history.kv | 6 +++--- 3 files changed, 26 insertions(+), 4 deletions(-) --- DIR diff --git a/gui/kivy/main.kv b/gui/kivy/main.kv t@@ -353,6 +353,16 @@ BoxLayout: .format(app.status) font_size: '22dp' minimum_width: '1dp' + on_release: + app.context_action() + + ActionButton: + id: context_button + text: app.context + width: 0 + on_text: + self.width = 20 if self.text else 0 + on_release: app.context_action() ActionOverflow: id: ao DIR diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py t@@ -76,8 +76,9 @@ class ElectrumWindow(App): keys = sorted(base_units.keys()) self.base_unit = keys[ (keys.index(self.base_unit) + 1) % len(keys)] + context = StringProperty('') + context_action = lambda: None status = StringProperty(_('Not Connected')) - fiat_unit = StringProperty('') def decimal_point(self): t@@ -759,6 +760,17 @@ class ElectrumWindow(App): popup.tx_hash = tx_hash popup.open() + def tx_selected(self, txid, state): + if state == 'down': + self.context = 'tx' + self.context_action = lambda: self.tx_dialog(txid) + else: + self.reset_context() + + def reset_context(self): + self.context = '' + self.context_action = lambda: None + def amount_dialog(self, screen, show_max): popup = Builder.load_file('gui/kivy/uix/ui_screens/amount.kv') but_max = popup.ids.but_max DIR diff --git a/gui/kivy/uix/ui_screens/history.kv b/gui/kivy/uix/ui_screens/history.kv t@@ -38,7 +38,7 @@ size: self.texture_size[0] + dp(32), self.texture_size[1] + dp(7) -<CardItem@ButtonBehavior+GridLayout> +<CardItem@ToggleButtonBehavior+GridLayout> canvas.before: Color: rgba: 0.192, .498, 0.745, 1 if self.state == 'down' else 0 t@@ -50,6 +50,7 @@ spacing: '2dp' size_hint: 1, None height: self.minimum_height + group: 'history' <RecentActivityItem@CardItem> icon: 'atlas://gui/kivy/theming/light/important' t@@ -60,10 +61,9 @@ confirmations: 0 date: '0/0/0' quote_text: '.' - spacing: '9dp' on_release: - app.tx_dialog(root.tx_hash) + app.tx_selected(root.tx_hash, self.state) BoxLayout: size_hint: 1, None spacing: '8dp'