kivy fixes

This commit is contained in:
ThomasV 2016-02-17 15:19:09 +01:00
parent 74c9a05757
commit 54897c84f8
5 changed files with 23 additions and 12 deletions

View File

@ -44,7 +44,6 @@
# Custom Global Widgets # Custom Global Widgets
<TopLabel@Label> <TopLabel@Label>
valign: 'top'
size_hint_y: None size_hint_y: None
text_size: self.width, None text_size: self.width, None
height: self.texture_size[1] height: self.texture_size[1]
@ -80,8 +79,8 @@
######################### #########################
<OutputList> <OutputList>
size_hint: 1, None
height: self.minimum_height height: self.minimum_height
size_hint_y: None
cols: 2 cols: 2
spacing: '10dp' spacing: '10dp'
padding: '10dp' padding: '10dp'

View File

@ -297,6 +297,7 @@ class ElectrumWindow(App):
if txid: if txid:
popup.ids.txid_label.text = _("Transaction ID") + ':\n' + ' '.join(map(''.join, zip(*[iter(txid)]*4))) popup.ids.txid_label.text = _("Transaction ID") + ':\n' + ' '.join(map(''.join, zip(*[iter(txid)]*4)))
popup.open() popup.open()
popup.ids.output_list.update(req.get('outputs', []))
def qr_dialog(self, title, data): def qr_dialog(self, title, data):
from uix.dialogs.qr_dialog import QRDialog from uix.dialogs.qr_dialog import QRDialog

View File

@ -197,6 +197,11 @@ class OutputList(Factory.GridLayout):
super(Factory.GridLayout, self).__init__(**kwargs) super(Factory.GridLayout, self).__init__(**kwargs)
self.app = App.get_running_app() self.app = App.get_running_app()
def update(self, outputs):
self.clear_widgets()
for (type, address, amount) in outputs:
self.add_output(address, amount)
def add_output(self, address, amount): def add_output(self, address, amount):
t = Factory.CardLabel(text = '[ref=%s]%s[/ref]'%(address,address), font_size = '6pt') t = Factory.CardLabel(text = '[ref=%s]%s[/ref]'%(address,address), font_size = '6pt')
t.shorten = True t.shorten = True

View File

@ -23,13 +23,15 @@ Builder.load_string('''
description: '' description: ''
outputs_str: '' outputs_str: ''
ScrollView: ScrollView:
BoxLayout: GridLayout:
orientation: 'vertical' height: self.minimum_height
size_hint_y: None
cols: 1
spacing: '10dp' spacing: '10dp'
padding: '10dp' padding: '10dp'
GridLayout: GridLayout:
size_hint: 1, None
height: self.minimum_height height: self.minimum_height
size_hint_y: None
cols: 2 cols: 2
spacing: '10dp' spacing: '10dp'
TopLabel: TopLabel:
@ -55,7 +57,9 @@ Builder.load_string('''
TopLabel: TopLabel:
text: _('Outputs') + ':' text: _('Outputs') + ':'
OutputList: OutputList:
id: outputs height: self.minimum_height
size_hint: 1, None
id: output_list
TopLabel: TopLabel:
text: _('Transaction ID') + ':' if root.tx_hash else '' text: _('Transaction ID') + ':' if root.tx_hash else ''
TopLabel: TopLabel:
@ -71,8 +75,8 @@ Builder.load_string('''
Rectangle: Rectangle:
size: self.size size: self.size
pos: self.pos pos: self.pos
Widget: #Widget:
size_hint: 1, 0.2 # size_hint: 1, 0.2
BoxLayout: BoxLayout:
size_hint: 1, None size_hint: 1, None
@ -106,6 +110,8 @@ class TxDialog(Factory.Popup):
self.app = app self.app = app
self.wallet = self.app.wallet self.wallet = self.app.wallet
self.tx = tx self.tx = tx
def on_open(self):
self.update() self.update()
def update(self): def update(self):
@ -142,10 +148,7 @@ class TxDialog(Factory.Popup):
self.amount_str = _("Transaction unrelated to your wallet") self.amount_str = _("Transaction unrelated to your wallet")
self.fee_str = '' self.fee_str = ''
self.can_sign = self.wallet.can_sign(self.tx) self.can_sign = self.wallet.can_sign(self.tx)
self.ids.output_list.update(self.tx.outputs())
self.ids.outputs.clear_widgets()
for (type, address, amount) in self.tx.outputs():
self.ids.outputs.add_output(address, amount)
def do_sign(self): def do_sign(self):
self.app.protected(_("Enter your PIN code in order to sign this transaction"), self._do_sign, ()) self.app.protected(_("Enter your PIN code in order to sign this transaction"), self._do_sign, ())

View File

@ -17,6 +17,7 @@ Popup:
GridLayout: GridLayout:
spacing: '10dp' spacing: '10dp'
padding: '10dp' padding: '10dp'
height: self.minimum_height
cols: 2 cols: 2
TopLabel: TopLabel:
text: _('Requestor') if popup.is_invoice else _('Address') text: _('Requestor') if popup.is_invoice else _('Address')
@ -43,6 +44,8 @@ Popup:
TopLabel: TopLabel:
text: root.status text: root.status
OutputList:
id: output_list
TopLabel: TopLabel:
id: txid_label id: txid_label
Widget: Widget: