1
0

kivy: improve PIN dialog

This commit is contained in:
ThomasV
2016-02-13 10:00:20 +01:00
parent 744b74f2b5
commit 5f5e9b0a17
3 changed files with 51 additions and 30 deletions

View File

@@ -8,27 +8,31 @@ Builder.load_string('''
<PasswordDialog@Popup>
id: popup
title: _('Enter PIN Code')
title: _('PIN Code')
message: ''
size_hint: 0.9, 0.9
BoxLayout:
orientation: 'vertical'
size_hint: 0.8, 1
Widget:
size_hint: 1, 1
Label:
text: root.message
text_size: self.width, None
size: self.texture_size
Widget:
size_hint: 1, 1
Label:
id: a
text: ' * '*len(kb.password) + ' o '*(6-len(kb.password))
size_hint: 1, None
height: '48dp'
Widget:
size_hint: 1, 1
GridLayout:
id: kb
update_amount: popup.update_password
password: ''
on_password: popup.on_password(self.password)
size_hint: 1, None
height: '300dp'
height: '200dp'
cols: 3
KButton:
text: '1'
@@ -54,18 +58,25 @@ Builder.load_string('''
text: '0'
KButton:
text: '<'
Widget:
size_hint: 1, 1
BoxLayout:
size_hint: 1, None
height: '48dp'
Widget:
size_hint: 0.5, None
Button:
size_hint: 0.5, None
height: '48dp'
text: _('Cancel')
on_release: popup.dismiss()
''')
class PasswordDialog(Factory.Popup):
def __init__(self, title, cb):
def __init__(self, message, callback):
Factory.Popup.__init__(self)
self.title = title
self.callback = cb
self.message = message
self.callback = callback
def update_password(self, c):
kb = self.ids.kb