mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 22:38:08 +00:00
Simplified PinMatrix widget
This commit is contained in:
parent
a69c820f5b
commit
2a1a1e61e4
@ -24,8 +24,6 @@ class PinMatrixWidget(QWidget):
|
|||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(PinMatrixWidget, self).__init__(parent)
|
super(PinMatrixWidget, self).__init__(parent)
|
||||||
|
|
||||||
self.buttons = []
|
|
||||||
|
|
||||||
self.password = QLineEdit()
|
self.password = QLineEdit()
|
||||||
self.password.setValidator(QRegExpValidator(QRegExp('[1-9]+'), None))
|
self.password.setValidator(QRegExpValidator(QRegExp('[1-9]+'), None))
|
||||||
self.password.setEchoMode(QLineEdit.Password)
|
self.password.setEchoMode(QLineEdit.Password)
|
||||||
@ -36,15 +34,12 @@ class PinMatrixWidget(QWidget):
|
|||||||
button = PinButton(self.password, x + 1)
|
button = PinButton(self.password, x + 1)
|
||||||
button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
||||||
button.setFocusPolicy(Qt.NoFocus)
|
button.setFocusPolicy(Qt.NoFocus)
|
||||||
self.buttons.append(button)
|
|
||||||
grid.addWidget(button, x / 3, x % 3)
|
grid.addWidget(button, x / 3, x % 3)
|
||||||
|
|
||||||
vbox = QVBoxLayout()
|
vbox = QVBoxLayout()
|
||||||
vbox.addLayout(grid)
|
vbox.addLayout(grid)
|
||||||
vbox.addWidget(self.password)
|
vbox.addWidget(self.password)
|
||||||
|
|
||||||
self.setLayout(vbox)
|
self.setLayout(vbox)
|
||||||
self.move(300, 150)
|
|
||||||
|
|
||||||
def get_value(self):
|
def get_value(self):
|
||||||
return self.password.text()
|
return self.password.text()
|
||||||
@ -70,6 +65,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
w = QWidget()
|
w = QWidget()
|
||||||
w.setLayout(vbox)
|
w.setLayout(vbox)
|
||||||
|
w.move(100, 100)
|
||||||
w.show()
|
w.show()
|
||||||
|
|
||||||
a.exec_()
|
a.exec_()
|
||||||
|
Loading…
Reference in New Issue
Block a user