From 100252258bb28aa8308dd4ad02c0bd578cd4d3c9 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Thu, 18 Feb 2016 07:26:31 +0100 Subject: [PATCH] kivy: OutputItem --- gui/kivy/main.kv | 24 +++++++++++++++++++++++- gui/kivy/main_window.py | 2 +- gui/kivy/uix/dialogs/__init__.py | 18 +++++------------- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/gui/kivy/main.kv b/gui/kivy/main.kv index 48a9a0736..ec8457f1d 100644 --- a/gui/kivy/main.kv +++ b/gui/kivy/main.kv @@ -90,10 +90,32 @@ id: lbl2 text: root.value + + address: '' + value: '' + size_hint_y: None + height: max(lbl1.height, lbl2.height) + TopLabel + id: lbl1 + text: '[ref=%s]%s[/ref]'%(root.address, root.address) + font_size: '6pt' + shorten: True + size_hint_x: 0.65 + on_ref_press: + app._clipboard.copy(root.address) + app.show_info(_('Address copied to clipboard') + ' ' + root.address) + TopLabel + id: lbl2 + text: root.value + font_size: '6pt' + size_hint_x: 0.35 + halign: 'right' + + height: self.minimum_height size_hint_y: None - cols: 2 + cols: 1 spacing: '10dp' padding: '10dp' canvas.before: diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py index 401247a4b..df383d141 100644 --- a/gui/kivy/main_window.py +++ b/gui/kivy/main_window.py @@ -31,10 +31,10 @@ from kivy.lang import Builder Factory.register('InstallWizard', module='electrum_gui.kivy.uix.dialogs.installwizard') Factory.register('InfoBubble', module='electrum_gui.kivy.uix.dialogs') -#Factory.register('ELTextInput', module='electrum_gui.kivy.uix.screens') Factory.register('OutputList', module='electrum_gui.kivy.uix.dialogs') + #from kivy.core.window import Window #Window.softinput_mode = 'below_target' diff --git a/gui/kivy/uix/dialogs/__init__.py b/gui/kivy/uix/dialogs/__init__.py index 825bdc119..b412f1997 100644 --- a/gui/kivy/uix/dialogs/__init__.py +++ b/gui/kivy/uix/dialogs/__init__.py @@ -191,6 +191,7 @@ class InfoBubble(Factory.Bubble): anim.start(self) + class OutputList(Factory.GridLayout): def __init__(self, **kwargs): @@ -203,17 +204,8 @@ class OutputList(Factory.GridLayout): self.add_output(address, amount) def add_output(self, address, amount): - t = Factory.CardLabel(text = '[ref=%s]%s[/ref]'%(address,address), font_size = '6pt') - t.shorten = True - t.size_hint_x = 0.65 - t.on_ref_press = self.do_copy_address - self.add_widget(t) - t = Factory.CardLabel(text = self.app.format_amount_and_units(amount), font_size='6pt') - t.size_hint_x = 0.35 - t.halign = 'right' - self.add_widget(t) - - def do_copy_address(self, text): - self.app._clipboard.copy(text) - self.app.show_info(_('Address copied to clipboard') + ' ' + text) + b = Factory.OutputItem( + address = address, + value = self.app.format_amount_and_units(amount)) + self.add_widget(b)