From 12955a0c0cb3a16b40437fa3b99c41450b6eaf10 Mon Sep 17 00:00:00 2001 From: slush0 Date: Mon, 7 Oct 2013 23:27:02 +0200 Subject: [PATCH] Allow only [1-9]+ in Pin matrix --- trezorlib/pinmatrix.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trezorlib/pinmatrix.py b/trezorlib/pinmatrix.py index 1ae17f5..12cfd5e 100644 --- a/trezorlib/pinmatrix.py +++ b/trezorlib/pinmatrix.py @@ -1,7 +1,7 @@ import sys from PyQt4.Qt import QApplication, QWidget, QGridLayout, QVBoxLayout -from PyQt4.QtGui import QPushButton, QLineEdit, QSizePolicy -from PyQt4.QtCore import QObject, SIGNAL +from PyQt4.QtGui import QPushButton, QLineEdit, QSizePolicy, QRegExpValidator +from PyQt4.QtCore import QObject, SIGNAL, QRegExp class PinButton(QPushButton): def __init__(self, password, encoded_value): @@ -27,6 +27,7 @@ class PinMatrixWidget(QWidget): self.buttons = [] self.password = QLineEdit() + self.password.setValidator(QRegExpValidator(QRegExp('[1-9]+'), None)) self.password.setEchoMode(QLineEdit.Password) grid = QGridLayout()