kivy: improve send and receive layouts

This commit is contained in:
ThomasV 2015-10-14 16:52:10 +02:00
parent 3f473e6915
commit 0024980e2f
3 changed files with 100 additions and 94 deletions

View File

@ -792,11 +792,11 @@ class ElectrumWindow(App):
def amount_dialog(self, label, callback): def amount_dialog(self, label, callback):
popup = Builder.load_file('gui/kivy/uix/ui_screens/amount.kv') popup = Builder.load_file('gui/kivy/uix/ui_screens/amount.kv')
if label.text != 'Amount': if label.text != label.default_text:
popup.ids.amount_label.text = label.text popup.ids.amount_label.text = label.text
def cb(): def cb():
o = popup.ids.amount_label.text o = popup.ids.amount_label.text
label.text = o if o else 'Amount' label.text = o if o else label.default_text
if callback: if callback:
callback() callback()
popup.on_dismiss = cb popup.on_dismiss = cb

View File

@ -27,34 +27,51 @@ ReceiveScreen:
if self.collide_point(*args[1].pos):\ if self.collide_point(*args[1].pos):\
app.show_info_bubble(icon=self.ids.qrimage.texture, text='texture') app.show_info_bubble(icon=self.ids.qrimage.texture, text='texture')
GridLayout:
id: grid SendReceiveBlueBottom:
cols: 2 id: blue_bottom
Label: size_hint: 1, None
text: 'Address' height: self.minimum_height
size_hint: 0.5, None
height: '38dp'
AddressSelector: AddressSelector:
id: address id: address
size_hint: 0.5, None size_hint: 0.5, None
height: '38dp' height: '38dp'
Label: CardSeparator:
text: 'Amount' opacity: message_selection.opacity
size_hint: 0.5, None color: blue_bottom.foreground_color
height: '38dp' BoxLayout:
Button: size_hint: 1, None
id: amount height: blue_bottom.item_height
text: '' Image:
size_hint: 0.5, None source: 'atlas://gui/kivy/theming/light/bit_logo'
height: '38dp' size_hint: None, None
on_release: app.amount_dialog(amount, receive_screen.parent.update_qr) size: '22dp', '22dp'
Label: pos_hint: {'center_y': .5}
text: 'Description' Button:
size_hint: 0.5, None id: amount
height: '48dp' default_text: 'Amount (optional)'
TextInput: text: self.default_text
text: '' text_size: (amount.width-15, None)
on_text: receive_screen.parent.update_qr halign: 'left'
multiline: False size_hint: 0.5, None
size_hint: 0.5, None height: '38dp'
height: '38dp' on_release: app.amount_dialog(amount, receive_screen.parent.update_qr)
background_color: 0, 0, 0, 0
CardSeparator:
opacity: message_selection.opacity
color: blue_bottom.foreground_color
BoxLayout:
id: message_selection
opacity: 1
size_hint: 1, None
height: blue_bottom.item_height
spacing: '5dp'
Image:
source: 'atlas://gui/kivy/theming/light/pen'
size_hint: None, None
size: '22dp', '22dp'
pos_hint: {'center_y': .5}
TextInputSendBlue:
id: message_e
hint_text: 'Description (optional)'

View File

@ -85,74 +85,62 @@ SendScreen:
state: 'normal' state: 'normal'
source: 'atlas://gui/kivy/theming/light/nfc' source: 'atlas://gui/kivy/theming/light/nfc'
background_down: 'atlas://gui/kivy/theming/light/btn_send_nfc' background_down: 'atlas://gui/kivy/theming/light/btn_send_nfc'
GridLayout:
id: grid SendReceiveBlueBottom:
cols: 1 id: blue_bottom
size_hint: 1, None size_hint: 1, None
height: self.minimum_height height: self.minimum_height
BoxLayout:
SendReceiveBlueBottom:
id: blue_bottom
size_hint: 1, None size_hint: 1, None
height: self.minimum_height height: blue_bottom.item_height
BoxLayout spacing: '5dp'
size_hint: 1, None Image:
height: blue_bottom.item_height source: 'atlas://gui/kivy/theming/light/contact'
Image: size_hint: None, None
source: 'atlas://gui/kivy/theming/light/bit_logo' size: '22dp', '22dp'
size_hint: None, None pos_hint: {'center_y': .5}
size: '22dp', '22dp' TextInputSendBlue:
pos_hint: {'center_y': .5} id: payto_e
Button: hint_text: "Recipient"
id: amount_e CardSeparator:
text: 'Amount' opacity: message_selection.opacity
size_hint: 0.5, None color: blue_bottom.foreground_color
height: '38dp' BoxLayout:
on_release: app.amount_dialog(amount_e, None) size_hint: 1, None
background_color: .238, .585, .878, 0 height: blue_bottom.item_height
Image:
CardSeparator source: 'atlas://gui/kivy/theming/light/bit_logo'
opacity: message_selection.opacity size_hint: None, None
color: blue_bottom.foreground_color size: '22dp', '22dp'
BoxLayout pos_hint: {'center_y': .5}
size_hint: 1, None Button:
height: blue_bottom.item_height id: amount_e
spacing: '5dp' text: 'Amount'
Image: text_size: (amount_e.width-15, None)
source: 'atlas://gui/kivy/theming/light/contact' halign: 'left'
size_hint: None, None size_hint: 0.5, None
size: '22dp', '22dp' height: '38dp'
pos_hint: {'center_y': .5} on_release: app.amount_dialog(amount_e, None)
TextInputSendBlue: background_color: .238, .585, .878, 0
id: payto_e CardSeparator:
hint_text: "Enter Contact or adress" opacity: message_selection.opacity
on_text_validate: color: blue_bottom.foreground_color
Factory.Animation(opacity=1,\ BoxLayout:
height=blue_bottom.item_height)\ id: message_selection
.start(message_selection) opacity: 1
message_e.focus = True size_hint: 1, None
CardSeparator height: blue_bottom.item_height
opacity: message_selection.opacity spacing: '5dp'
color: blue_bottom.foreground_color Image:
BoxLayout: source: 'atlas://gui/kivy/theming/light/pen'
id: message_selection size_hint: None, None
opacity: 1 size: '22dp', '22dp'
size_hint: 1, None pos_hint: {'center_y': .5}
height: blue_bottom.item_height TextInputSendBlue:
spacing: '5dp' id: message_e
Image: hint_text: 'Optional description'
source: 'atlas://gui/kivy/theming/light/pen'
size_hint: None, None
size: '22dp', '22dp'
pos_hint: {'center_y': .5}
TextInputSendBlue:
id: message_e
hint_text: 'Enter description here'
#on_text_validate:
# anim = Factory.Animation(opacity=1, height=blue_bottom.item_height)
# anim.start(wallet_selection)
BoxLayout: BoxLayout:
size_hint: 1, None
Button: Button:
text: _('Clear') text: _('Clear')
size_hint_y: None size_hint_y: None
@ -163,6 +151,7 @@ SendScreen:
size_hint_y: None size_hint_y: None
height: '38dp' height: '38dp'
on_release: send_screen.do_send() on_release: send_screen.do_send()
Widget Widget:
size_hint: 1, None