1
0

kivy addresses tab: simplify, separate actions from display updates

This commit is contained in:
ThomasV
2017-11-11 11:33:36 +01:00
parent 568afd7a17
commit 5156b60769
3 changed files with 103 additions and 230 deletions

View File

@@ -4,36 +4,27 @@
#:set mbtc_symbol chr(187)
#:set font_light 'gui/kivy/data/fonts/Roboto-Condensed.ttf'
<RequestLabel@Label>
<AddressLabel@Label>
text_size: self.width, None
halign: 'left'
valign: 'top'
<RequestItem@CardItem>
<AddressItem@CardItem>
address: ''
memo: ''
amount: ''
status: ''
date: ''
icon: ''
color: .699, .699, .699, 1
Image:
id: icon
source: root.icon
size_hint: None, 1
width: self.height *.54 if root.icon else 0
mipmap: True
BoxLayout:
spacing: '8dp'
height: '32dp'
orientation: 'vertical'
Widget
RequestLabel:
AddressLabel:
text: root.address
shorten: True
Widget
RequestLabel:
text: root.date + " " + root.memo
AddressLabel:
text: root.memo
color: .699, .699, .699, 1
font_size: '13sp'
shorten: True
@@ -43,12 +34,12 @@
height: '32dp'
orientation: 'vertical'
Widget
RequestLabel:
AddressLabel:
text: root.amount
halign: 'right'
font_size: '15sp'
Widget
RequestLabel:
AddressLabel:
text: root.status
halign: 'right'
font_size: '13sp'
@@ -58,72 +49,58 @@ AddressScreen:
id: addr_screen
name: 'address'
message: ''
addr_type: 'Receiving'
addr_status: 'New'
pr_status: 'Pending'
show_change: False
show_used: 0
on_message:
self.parent.generic_search()
self.parent.update()
BoxLayout
padding: '12dp', '70dp', '12dp', '12dp'
spacing: '12dp'
orientation: 'vertical'
size_hint: 1, 1.1
BoxLayout:
spacing: '6dp'
size_hint: 1, None
orientation: 'horizontal'
AddressFilter:
id: blue_bottom
opacity: 1
size_hint: 1, None
height: self.minimum_height
spacing: '5dp'
AddressButton:
id: search
text: addr_screen.addr_type
on_release: Clock.schedule_once(lambda dt: app.address_screen.search(0))
AddressFilter:
id: blue_bottom
opacity: 1
size_hint: 1, None
height: self.minimum_height
spacing: '5dp'
AddressButton:
id: search
text: addr_screen.addr_status
on_release: Clock.schedule_once(lambda dt: app.address_screen.search(1))
AddressFilter:
id: blue_bottom
opacity: 1
size_hint: 1, None
height: self.minimum_height
spacing: '5dp'
AddressButton:
id: pending
text: addr_screen.pr_status
on_release: Clock.schedule_once(lambda dt: app.address_screen.search(2))
AddressFilter:
id: blue_bottom
opacity: 1
size_hint: 1, None
height: self.minimum_height
spacing: '5dp'
canvas.before:
Color:
rgba: 0.9, 0.9, 0.9, 1
AddressButton:
id: change
text: addr_screen.message if addr_screen.message else _('Search')
on_release: Clock.schedule_once(lambda dt: app.description_dialog(addr_screen))
ScrollView:
GridLayout:
cols: 1
id: search_container
size_hint_y: None
height: self.minimum_height
spacing: '2dp'
BoxLayout:
spacing: '6dp'
size_hint: 1, None
orientation: 'horizontal'
AddressFilter:
opacity: 1
size_hint: 1, None
height: self.minimum_height
spacing: '5dp'
AddressButton:
id: search
text: _('Change') if root.show_change else _('Receiving')
on_release:
root.show_change = not root.show_change
Clock.schedule_once(lambda dt: app.address_screen.update())
AddressFilter:
opacity: 1
size_hint: 1, None
height: self.minimum_height
spacing: '5dp'
AddressButton:
id: search
text: {0:_('All'), 1:_('Unused'), 2:_('Funded'), 3:_('Used')}[root.show_used]
on_release:
root.show_used = (root.show_used + 1) % 4
Clock.schedule_once(lambda dt: app.address_screen.update())
AddressFilter:
opacity: 1
size_hint: 1, None
height: self.minimum_height
spacing: '5dp'
canvas.before:
Color:
rgba: 0.9, 0.9, 0.9, 1
AddressButton:
id: change
text: root.message if root.message else _('Search')
on_release: Clock.schedule_once(lambda dt: app.description_dialog(addr_screen))
ScrollView:
GridLayout:
cols: 1
id: search_container
size_hint_y: None
height: self.minimum_height
spacing: '2dp'