1
0

kivy: improve amount dialog

This commit is contained in:
ThomasV
2015-10-16 14:59:26 +02:00
parent 274dc256b5
commit 6e9c58783e
3 changed files with 100 additions and 84 deletions

View File

@@ -1,79 +1,93 @@
<KButton@Button>:
size_hint: 1, None
height: '38dp'
#:import Decimal decimal.Decimal
Popup:
id: popup
title: _('Amount')
BoxLayout:
orientation: 'vertical'
halign: 'center'
AnchorLayout:
anchor_x: 'center'
BoxLayout:
Label:
id: amount_label
text: ''
value: ''
on_value:
self.text = self.value + ' ' + app.base_unit
orientation: 'vertical'
size_hint: 0.8, 1
BoxLayout:
size_hint: 1, None
height: '48dp'
id: 'spendable'
Label:
text: _('Spendable:')
size_hint_x: 1
Button:
size_hint_x: 1
height: '48dp'
text: ''
on_release: a.value = "max"
BoxLayout:
size_hint: 1, None
height: '48dp'
Label:
id: a
amount: ''
text: self.amount + ' ' + app.base_unit if self.amount else ''
Widget:
size_hint_x: 1
Widget:
size_hint_x: 1
size_hint: 1, 1
GridLayout:
cols: 3
size_hint: 0.5, 1
KButton:
text: '1'
on_release: amount_label.value += self.text
KButton:
text: '2'
on_release: amount_label.value += self.text
KButton:
text: '3'
on_release: amount_label.value += self.text
KButton:
text: '4'
on_release: amount_label.value += self.text
KButton:
text: '5'
on_release: amount_label.value += self.text
KButton:
text: '6'
on_release: amount_label.value += self.text
KButton:
text: '7'
on_release: amount_label.value += self.text
KButton:
text: '8'
on_release: amount_label.value += self.text
KButton:
text: '9'
on_release: amount_label.value += self.text
KButton:
text: '.'
on_release: amount_label.value += self.text
KButton:
text: '0'
on_release: amount_label.value += self.text
KButton:
text: '<'
on_release: amount_label.value = amount_label.value[:-1]
GridLayout:
size_hint: 1, None
height: '300dp'
cols: 3
KButton:
text: '1'
label: a
KButton:
text: '2'
label: a
KButton:
text: '3'
label: a
KButton:
text: '4'
label: a
KButton:
text: '5'
label: a
KButton:
text: '6'
label: a
KButton:
text: '7'
label: a
KButton:
text: '8'
label: a
KButton:
text: '9'
label: a
KButton:
text: '.'
label: a
KButton:
text: '0'
label: a
KButton:
text: '<'
label: a
BoxLayout:
size_hint: 0.5, None
Button:
size_hint: 0.5, None
BoxLayout:
size_hint: 1, None
height: '48dp'
text: _('Max')
on_release: popup.dismiss()
Button:
size_hint: 0.5, None
height: '48dp'
text: _('OK')
on_release: popup.dismiss()
Widget:
size_hint: 1, None
Widget:
size_hint: 0.7, None
height: '48dp'
Button:
size_hint: 0.3, None
height: '48dp'
text: _('OK')
on_release: popup.dismiss()