tkivy updates - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 6ec610c3599583582bcc855457f619d84559300d DIR parent 95bf92b683a6620b90aae52e017c30374aebeefc HTML Author: ThomasV <thomasv@electrum.org> Date: Wed, 2 Dec 2015 12:11:28 +0100 kivy updates Diffstat: M gui/kivy/main.kv | 6 +++++- M gui/kivy/main_window.py | 12 +++++++++++- M gui/kivy/tools/buildozer.spec | 1 + M gui/kivy/uix/screens.py | 1 - M gui/kivy/uix/ui_screens/amount.kv | 12 ++++++++---- M gui/kivy/uix/ui_screens/history.kv | 12 ------------ M gui/kivy/uix/ui_screens/network.kv | 10 +++------- M gui/kivy/uix/ui_screens/plugins.kv | 18 ++++++++++++------ M gui/kivy/uix/ui_screens/settings.kv | 15 ++++++++++----- M gui/kivy/uix/ui_screens/wallets.kv | 16 ++++++++++++---- M gui/qt/main_window.py | 4 ++-- M plugins/exchange_rate/exchange_rat… | 2 +- 12 files changed, 65 insertions(+), 44 deletions(-) --- DIR diff --git a/gui/kivy/main.kv b/gui/kivy/main.kv t@@ -301,7 +301,7 @@ <ActionOvrButton@ActionButton> on_release: if self.parent: self.parent.parent.dismiss() - app.popup_dialog(self.text.lower()) + app.popup_dialog(self.name) BoxLayout: t@@ -345,15 +345,19 @@ BoxLayout: id: ao ActionOvrButton: text: _('Network') + name: 'network' on_parent: # when widget overflow drop down is shown, adjust the width parent = args[1] if parent: ao._dropdown.width = sp(200) ActionOvrButton: + name: 'settings' text: _('Settings') ActionOvrButton: + name: 'wallets' text: _('Wallets') ActionOvrButton: + name: 'plugins' text: _('Plugins') ScreenManager: DIR diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py t@@ -96,6 +96,16 @@ class ElectrumWindow(App): '''Number of zeros used while representing the value in base_unit. ''' + def get_amount_text(self, amount_str, is_fiat): + text = amount_str + ' ' + self.base_unit if amount_str else '' + if text: + amount = self.get_amount(text) + x = run_hook('format_amount_and_units', amount) + if x: + text += ' / ' + x + return text + + def get_amount(self, amount_str): a, u = amount_str.split() assert u == self.base_unit t@@ -733,7 +743,7 @@ class ElectrumWindow(App): info_bubble.background_image = 'atlas://data/images/defaulttheme/bubble' info_bubble.message = text if not pos: - pos = (win.center[0], win.center[1] - (info_bubble.height/2)) + pos = (win.center[0], win.center[1] - (info_bubble.height/2)) info_bubble.show(pos, duration, width, modal=modal, exit=exit) def tx_dialog(self, tx_hash): DIR diff --git a/gui/kivy/tools/buildozer.spec b/gui/kivy/tools/buildozer.spec t@@ -128,6 +128,7 @@ android.add_libs_armeabi = lib/android/*.so #ios.codesign.release = %(ios.codesign.debug)s + [buildozer] # (int) Log level (0 = error only, 1 = info, 2 = debug (with command output)) DIR diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py t@@ -143,7 +143,6 @@ class HistoryScreen(CScreen): if count == 8 and not see_all: break - history_card.ids.btn_see_all.opacity = (0 if count < 8 else 1) class ScreenAddress(CScreen): DIR diff --git a/gui/kivy/uix/ui_screens/amount.kv b/gui/kivy/uix/ui_screens/amount.kv t@@ -11,16 +11,22 @@ Popup: BoxLayout: orientation: 'vertical' size_hint: 0.8, 1 - BoxLayout: size_hint: 1, None height: '48dp' Label: id: a amount: '' - text: self.amount + ' ' + app.base_unit if self.amount else '' + is_fiat: False + text: app.get_amount_text(self.amount, self.is_fiat) Widget: size_hint_x: 1 + Button: + id: button_fiat + size_hint: 1, None + height: '48dp' + text: '<->' + on_release: a.is_fiat = not a.is_fiat Widget: size_hint: 1, 1 t@@ -72,8 +78,6 @@ Popup: text: 'Max' on_release: a.amount = app.get_max_amount() - - BoxLayout: size_hint: 1, None height: '48dp' DIR diff --git a/gui/kivy/uix/ui_screens/history.kv b/gui/kivy/uix/ui_screens/history.kv t@@ -103,18 +103,6 @@ CardSeparator <CardRecentActivity@Card> - BoxLayout: - size_hint: 1, None - height: lbl.height - CardLabel: - id: lbl - text: _('RECENT ACTIVITY') - CardButton: - id: btn_see_all - disabled: True if not self.opacity else False - text: _('SEE ALL') - font_size: '12sp' - on_release: app.update_history_tab(see_all=True) GridLayout: id: content spacing: '7dp' DIR diff --git a/gui/kivy/uix/ui_screens/network.kv b/gui/kivy/uix/ui_screens/network.kv t@@ -23,14 +23,12 @@ Popup: text: '' values: app.network.get_servers() + Widget: + size_hint: 1, 1 BoxLayout: - Button: + Widget: size_hint: 0.5, None - height: '48dp' - text: _('Cancel') - on_release: - nd.dismiss() Button: size_hint: 0.5, None height: '48dp' t@@ -39,5 +37,3 @@ Popup: app.network.set_parameters(host.text, nd.port, nd.protocol, nd.proxy, auto_connect.active) nd.dismiss() - Widget: - size_hint: 1, 1 DIR diff --git a/gui/kivy/uix/ui_screens/plugins.kv b/gui/kivy/uix/ui_screens/plugins.kv t@@ -11,11 +11,17 @@ Popup: id: plugins_list on_parent: app.show_plugins(plugins_list) - Button: - size_hint: 1, None - height: '48dp' - text: _('Close') - on_release: popup.dismiss() Widget: - size_hint: 1, 0.8 + size_hint: 1, 1 + + BoxLayout: + Widget: + size_hint: 0.5, None + Button: + size_hint: 0.5, None + height: '48dp' + text: _('OK') + on_release: + popup.dismiss() + DIR diff --git a/gui/kivy/uix/ui_screens/settings.kv b/gui/kivy/uix/ui_screens/settings.kv t@@ -29,12 +29,17 @@ Popup: size_hint: 1, None height: '48dp' multiline: False - Button: - size_hint: 1, None - height: '48dp' - text: _('Close') - on_release: settings.dismiss() Widget: size_hint: 1, 1 + BoxLayout: + Widget: + size_hint: 0.5, None + Button: + size_hint: 0.5, None + height: '48dp' + text: _('OK') + on_release: + settings.dismiss() + DIR diff --git a/gui/kivy/uix/ui_screens/wallets.kv b/gui/kivy/uix/ui_screens/wallets.kv t@@ -8,6 +8,8 @@ Popup: + title: _('Wallets') + id: popup BoxLayout: orientation: 'vertical' GridLayout: t@@ -27,8 +29,14 @@ Popup: id: wallet_selector path: os.path.dirname(app.wallet.storage.path) on_selection: text_input.text = os.path.basename(self.selection[0]) if self.selection else '' + size_hint: 1, 1 - #WalletSelector: - # id: wallet_selection - # size_hint: 1, None - # height: blue_bottom.item_height + BoxLayout: + Widget: + size_hint: 0.5, None + Button: + size_hint: 0.5, None + height: '48dp' + text: _('OK') + on_release: + popup.dismiss() DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py t@@ -504,8 +504,8 @@ class ElectrumWindow(QMainWindow, PrintError): def format_amount_and_units(self, amount): text = self.format_amount(amount) + ' '+ self.base_unit() x = run_hook('format_amount_and_units', amount) - if x: - text += x + if text and x: + text += ' (%s)'%x return text def get_decimal_point(self): DIR diff --git a/plugins/exchange_rate/exchange_rate.py b/plugins/exchange_rate/exchange_rate.py t@@ -313,7 +313,7 @@ class FxPlugin(BasePlugin, ThreadJob): @hook def format_amount_and_units(self, btc_balance): rate = self.exchange_rate() - return '' if rate is None else " (%s %s)" % (self.value_str(btc_balance, rate), self.ccy) + return '' if rate is None else "%s %s" % (self.value_str(btc_balance, rate), self.ccy) @hook def get_fiat_status_text(self, btc_balance):