Browse Source

kivy updates

283
ThomasV 9 years ago
parent
commit
6ec610c359
  1. 6
      gui/kivy/main.kv
  2. 10
      gui/kivy/main_window.py
  3. 1
      gui/kivy/tools/buildozer.spec
  4. 1
      gui/kivy/uix/screens.py
  5. 12
      gui/kivy/uix/ui_screens/amount.kv
  6. 12
      gui/kivy/uix/ui_screens/history.kv
  7. 10
      gui/kivy/uix/ui_screens/network.kv
  8. 16
      gui/kivy/uix/ui_screens/plugins.kv
  9. 15
      gui/kivy/uix/ui_screens/settings.kv
  10. 16
      gui/kivy/uix/ui_screens/wallets.kv
  11. 4
      gui/qt/main_window.py
  12. 2
      plugins/exchange_rate/exchange_rate.py

6
gui/kivy/main.kv

@ -301,7 +301,7 @@
<ActionOvrButton@ActionButton> <ActionOvrButton@ActionButton>
on_release: on_release:
if self.parent: self.parent.parent.dismiss() if self.parent: self.parent.parent.dismiss()
app.popup_dialog(self.text.lower()) app.popup_dialog(self.name)
BoxLayout: BoxLayout:
@ -345,15 +345,19 @@ BoxLayout:
id: ao id: ao
ActionOvrButton: ActionOvrButton:
text: _('Network') text: _('Network')
name: 'network'
on_parent: on_parent:
# when widget overflow drop down is shown, adjust the width # when widget overflow drop down is shown, adjust the width
parent = args[1] parent = args[1]
if parent: ao._dropdown.width = sp(200) if parent: ao._dropdown.width = sp(200)
ActionOvrButton: ActionOvrButton:
name: 'settings'
text: _('Settings') text: _('Settings')
ActionOvrButton: ActionOvrButton:
name: 'wallets'
text: _('Wallets') text: _('Wallets')
ActionOvrButton: ActionOvrButton:
name: 'plugins'
text: _('Plugins') text: _('Plugins')
ScreenManager: ScreenManager:

10
gui/kivy/main_window.py

@ -96,6 +96,16 @@ class ElectrumWindow(App):
'''Number of zeros used while representing the value in base_unit. '''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): def get_amount(self, amount_str):
a, u = amount_str.split() a, u = amount_str.split()
assert u == self.base_unit assert u == self.base_unit

1
gui/kivy/tools/buildozer.spec

@ -128,6 +128,7 @@ android.add_libs_armeabi = lib/android/*.so
#ios.codesign.release = %(ios.codesign.debug)s #ios.codesign.release = %(ios.codesign.debug)s
[buildozer] [buildozer]
# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output)) # (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))

1
gui/kivy/uix/screens.py

@ -143,7 +143,6 @@ class HistoryScreen(CScreen):
if count == 8 and not see_all: if count == 8 and not see_all:
break break
history_card.ids.btn_see_all.opacity = (0 if count < 8 else 1)
class ScreenAddress(CScreen): class ScreenAddress(CScreen):

12
gui/kivy/uix/ui_screens/amount.kv

@ -11,16 +11,22 @@ Popup:
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
size_hint: 0.8, 1 size_hint: 0.8, 1
BoxLayout: BoxLayout:
size_hint: 1, None size_hint: 1, None
height: '48dp' height: '48dp'
Label: Label:
id: a id: a
amount: '' 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: Widget:
size_hint_x: 1 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: Widget:
size_hint: 1, 1 size_hint: 1, 1
@ -72,8 +78,6 @@ Popup:
text: 'Max' text: 'Max'
on_release: a.amount = app.get_max_amount() on_release: a.amount = app.get_max_amount()
BoxLayout: BoxLayout:
size_hint: 1, None size_hint: 1, None
height: '48dp' height: '48dp'

12
gui/kivy/uix/ui_screens/history.kv

@ -103,18 +103,6 @@
CardSeparator CardSeparator
<CardRecentActivity@Card> <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: GridLayout:
id: content id: content
spacing: '7dp' spacing: '7dp'

10
gui/kivy/uix/ui_screens/network.kv

@ -23,14 +23,12 @@ Popup:
text: '' text: ''
values: app.network.get_servers() values: app.network.get_servers()
Widget:
size_hint: 1, 1
BoxLayout: BoxLayout:
Button: Widget:
size_hint: 0.5, None size_hint: 0.5, None
height: '48dp'
text: _('Cancel')
on_release:
nd.dismiss()
Button: Button:
size_hint: 0.5, None size_hint: 0.5, None
height: '48dp' height: '48dp'
@ -39,5 +37,3 @@ Popup:
app.network.set_parameters(host.text, nd.port, nd.protocol, nd.proxy, auto_connect.active) app.network.set_parameters(host.text, nd.port, nd.protocol, nd.proxy, auto_connect.active)
nd.dismiss() nd.dismiss()
Widget:
size_hint: 1, 1

16
gui/kivy/uix/ui_screens/plugins.kv

@ -11,11 +11,17 @@ Popup:
id: plugins_list id: plugins_list
on_parent: on_parent:
app.show_plugins(plugins_list) app.show_plugins(plugins_list)
Widget:
size_hint: 1, 1
BoxLayout:
Widget:
size_hint: 0.5, None
Button: Button:
size_hint: 1, None size_hint: 0.5, None
height: '48dp' height: '48dp'
text: _('Close') text: _('OK')
on_release: popup.dismiss() on_release:
popup.dismiss()
Widget:
size_hint: 1, 0.8

15
gui/kivy/uix/ui_screens/settings.kv

@ -29,12 +29,17 @@ Popup:
size_hint: 1, None size_hint: 1, None
height: '48dp' height: '48dp'
multiline: False multiline: False
Button:
size_hint: 1, None
height: '48dp'
text: _('Close')
on_release: settings.dismiss()
Widget: Widget:
size_hint: 1, 1 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()

16
gui/kivy/uix/ui_screens/wallets.kv

@ -8,6 +8,8 @@
Popup: Popup:
title: _('Wallets')
id: popup
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
GridLayout: GridLayout:
@ -27,8 +29,14 @@ Popup:
id: wallet_selector id: wallet_selector
path: os.path.dirname(app.wallet.storage.path) path: os.path.dirname(app.wallet.storage.path)
on_selection: text_input.text = os.path.basename(self.selection[0]) if self.selection else '' on_selection: text_input.text = os.path.basename(self.selection[0]) if self.selection else ''
size_hint: 1, 1
#WalletSelector: BoxLayout:
# id: wallet_selection Widget:
# size_hint: 1, None size_hint: 0.5, None
# height: blue_bottom.item_height Button:
size_hint: 0.5, None
height: '48dp'
text: _('OK')
on_release:
popup.dismiss()

4
gui/qt/main_window.py

@ -504,8 +504,8 @@ class ElectrumWindow(QMainWindow, PrintError):
def format_amount_and_units(self, amount): def format_amount_and_units(self, amount):
text = self.format_amount(amount) + ' '+ self.base_unit() text = self.format_amount(amount) + ' '+ self.base_unit()
x = run_hook('format_amount_and_units', amount) x = run_hook('format_amount_and_units', amount)
if x: if text and x:
text += x text += ' (%s)'%x
return text return text
def get_decimal_point(self): def get_decimal_point(self):

2
plugins/exchange_rate/exchange_rate.py

@ -313,7 +313,7 @@ class FxPlugin(BasePlugin, ThreadJob):
@hook @hook
def format_amount_and_units(self, btc_balance): def format_amount_and_units(self, btc_balance):
rate = self.exchange_rate() 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 @hook
def get_fiat_status_text(self, btc_balance): def get_fiat_status_text(self, btc_balance):

Loading…
Cancel
Save