From 6ec610c3599583582bcc855457f619d84559300d Mon Sep 17 00:00:00 2001 From: ThomasV Date: Wed, 2 Dec 2015 12:11:28 +0100 Subject: [PATCH] kivy updates --- gui/kivy/main.kv | 6 +++++- gui/kivy/main_window.py | 12 +++++++++++- gui/kivy/tools/buildozer.spec | 1 + gui/kivy/uix/screens.py | 1 - gui/kivy/uix/ui_screens/amount.kv | 12 ++++++++---- gui/kivy/uix/ui_screens/history.kv | 12 ------------ gui/kivy/uix/ui_screens/network.kv | 10 +++------- gui/kivy/uix/ui_screens/plugins.kv | 18 ++++++++++++------ gui/kivy/uix/ui_screens/settings.kv | 15 ++++++++++----- gui/kivy/uix/ui_screens/wallets.kv | 16 ++++++++++++---- gui/qt/main_window.py | 4 ++-- plugins/exchange_rate/exchange_rate.py | 2 +- 12 files changed, 65 insertions(+), 44 deletions(-) diff --git a/gui/kivy/main.kv b/gui/kivy/main.kv index 2e8d9368d..fa5d45c51 100644 --- a/gui/kivy/main.kv +++ b/gui/kivy/main.kv @@ -301,7 +301,7 @@ on_release: if self.parent: self.parent.parent.dismiss() - app.popup_dialog(self.text.lower()) + app.popup_dialog(self.name) BoxLayout: @@ -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: diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py index 063c1680d..c4b38e841 100644 --- a/gui/kivy/main_window.py +++ b/gui/kivy/main_window.py @@ -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 @@ -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): diff --git a/gui/kivy/tools/buildozer.spec b/gui/kivy/tools/buildozer.spec index e50b13a73..6fc6af7d8 100644 --- a/gui/kivy/tools/buildozer.spec +++ b/gui/kivy/tools/buildozer.spec @@ -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)) diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py index 83c3c985d..06583a560 100644 --- a/gui/kivy/uix/screens.py +++ b/gui/kivy/uix/screens.py @@ -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): diff --git a/gui/kivy/uix/ui_screens/amount.kv b/gui/kivy/uix/ui_screens/amount.kv index 25d0bd6b0..9eca9930f 100644 --- a/gui/kivy/uix/ui_screens/amount.kv +++ b/gui/kivy/uix/ui_screens/amount.kv @@ -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 @@ -72,8 +78,6 @@ Popup: text: 'Max' on_release: a.amount = app.get_max_amount() - - BoxLayout: size_hint: 1, None height: '48dp' diff --git a/gui/kivy/uix/ui_screens/history.kv b/gui/kivy/uix/ui_screens/history.kv index 8ef4ea9e8..6bb5059a6 100644 --- a/gui/kivy/uix/ui_screens/history.kv +++ b/gui/kivy/uix/ui_screens/history.kv @@ -103,18 +103,6 @@ CardSeparator - 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' diff --git a/gui/kivy/uix/ui_screens/network.kv b/gui/kivy/uix/ui_screens/network.kv index 83ed345e9..c4d937ac0 100644 --- a/gui/kivy/uix/ui_screens/network.kv +++ b/gui/kivy/uix/ui_screens/network.kv @@ -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' @@ -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 diff --git a/gui/kivy/uix/ui_screens/plugins.kv b/gui/kivy/uix/ui_screens/plugins.kv index 38fd16cca..ddf908b04 100644 --- a/gui/kivy/uix/ui_screens/plugins.kv +++ b/gui/kivy/uix/ui_screens/plugins.kv @@ -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() + diff --git a/gui/kivy/uix/ui_screens/settings.kv b/gui/kivy/uix/ui_screens/settings.kv index 2f5d0019d..b4e3e5bc2 100644 --- a/gui/kivy/uix/ui_screens/settings.kv +++ b/gui/kivy/uix/ui_screens/settings.kv @@ -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() + diff --git a/gui/kivy/uix/ui_screens/wallets.kv b/gui/kivy/uix/ui_screens/wallets.kv index af1be08a6..5191ab444 100644 --- a/gui/kivy/uix/ui_screens/wallets.kv +++ b/gui/kivy/uix/ui_screens/wallets.kv @@ -8,6 +8,8 @@ Popup: + title: _('Wallets') + id: popup BoxLayout: orientation: 'vertical' GridLayout: @@ -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() diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index 5a42d5e0f..d6f911600 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -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): diff --git a/plugins/exchange_rate/exchange_rate.py b/plugins/exchange_rate/exchange_rate.py index 670855caf..8a50fcf3d 100644 --- a/plugins/exchange_rate/exchange_rate.py +++ b/plugins/exchange_rate/exchange_rate.py @@ -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):