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:
size_hint: 1, None
height: blue_bottom.item_height
Image:
source: 'atlas://gui/kivy/theming/light/bit_logo'
size_hint: None, None
size: '22dp', '22dp'
pos_hint: {'center_y': .5}
Button: Button:
id: amount id: amount
text: '' default_text: 'Amount (optional)'
text: self.default_text
text_size: (amount.width-15, None)
halign: 'left'
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) on_release: app.amount_dialog(amount, receive_screen.parent.update_qr)
Label: background_color: 0, 0, 0, 0
text: 'Description' CardSeparator:
size_hint: 0.5, None opacity: message_selection.opacity
height: '48dp' color: blue_bottom.foreground_color
TextInput: BoxLayout:
text: '' id: message_selection
on_text: receive_screen.parent.update_qr opacity: 1
multiline: False size_hint: 1, None
size_hint: 0.5, None height: blue_bottom.item_height
height: '38dp' 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,36 +85,12 @@ 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
cols: 1
size_hint: 1, None
height: self.minimum_height
SendReceiveBlueBottom: SendReceiveBlueBottom:
id: blue_bottom id: blue_bottom
size_hint: 1, None size_hint: 1, None
height: self.minimum_height height: self.minimum_height
BoxLayout BoxLayout:
size_hint: 1, None
height: blue_bottom.item_height
Image:
source: 'atlas://gui/kivy/theming/light/bit_logo'
size_hint: None, None
size: '22dp', '22dp'
pos_hint: {'center_y': .5}
Button:
id: amount_e
text: 'Amount'
size_hint: 0.5, None
height: '38dp'
on_release: app.amount_dialog(amount_e, None)
background_color: .238, .585, .878, 0
CardSeparator
opacity: message_selection.opacity
color: blue_bottom.foreground_color
BoxLayout
size_hint: 1, None size_hint: 1, None
height: blue_bottom.item_height height: blue_bottom.item_height
spacing: '5dp' spacing: '5dp'
@ -125,13 +101,28 @@ SendScreen:
pos_hint: {'center_y': .5} pos_hint: {'center_y': .5}
TextInputSendBlue: TextInputSendBlue:
id: payto_e id: payto_e
hint_text: "Enter Contact or adress" hint_text: "Recipient"
on_text_validate: CardSeparator:
Factory.Animation(opacity=1,\ opacity: message_selection.opacity
height=blue_bottom.item_height)\ color: blue_bottom.foreground_color
.start(message_selection) BoxLayout:
message_e.focus = True size_hint: 1, None
CardSeparator height: blue_bottom.item_height
Image:
source: 'atlas://gui/kivy/theming/light/bit_logo'
size_hint: None, None
size: '22dp', '22dp'
pos_hint: {'center_y': .5}
Button:
id: amount_e
text: 'Amount'
text_size: (amount_e.width-15, None)
halign: 'left'
size_hint: 0.5, None
height: '38dp'
on_release: app.amount_dialog(amount_e, None)
background_color: .238, .585, .878, 0
CardSeparator:
opacity: message_selection.opacity opacity: message_selection.opacity
color: blue_bottom.foreground_color color: blue_bottom.foreground_color
BoxLayout: BoxLayout:
@ -147,12 +138,9 @@ SendScreen:
pos_hint: {'center_y': .5} pos_hint: {'center_y': .5}
TextInputSendBlue: TextInputSendBlue:
id: message_e id: message_e
hint_text: 'Enter description here' hint_text: 'Optional description'
#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