ui/pin: check maxlength

pull/25/head
Peter Jensen 6 years ago committed by Jan Pochyla
parent 9c84b742a0
commit f56aaa3b1c

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -16,8 +16,10 @@ async def request_pin(code: int = None) -> str:
def onchange():
c = dialog.cancel
if matrix.pin:
c.content = res.load(ui.ICON_CLEAR)
c.normal_style = ui.BTN_CLEAR['normal']
c.content = res.load(ui.ICON_BACK)
else:
c.normal_style = ui.BTN_CANCEL['normal']
c.content = res.load(ui.ICON_LOCK)
c.taint()
c.render()

Binary file not shown.

@ -67,5 +67,10 @@ class PinMatrix(ui.Widget):
def change(self, pin):
self.pin = pin
for btn in self.pin_buttons:
if len(self.pin) == self.maxlength:
btn.disable()
else:
btn.enable()
if self.onchange:
self.onchange()

Loading…
Cancel
Save