trezorctl: remove unused PinMatrixThread

This commit is contained in:
Pavol Rusnak 2016-11-11 19:12:30 +01:00
parent 35f789122b
commit ae3f4823ae
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
1 changed files with 0 additions and 55 deletions

View File

@ -483,61 +483,6 @@ def list_usb():
from trezorlib.transport_hid import HidTransport
return HidTransport.enumerate()
'''
class PinMatrixThread(threading.Thread):
# Hacked PinMatrixWidget into command line tool :-).
def __init__(self, input_text, message):
super(PinMatrixThread, self).__init__()
self.input_text = input_text
self.message = message
self.pin_value = ''
def run(self):
from trezorlib.pinmatrix import PinMatrixWidget
import sys
from PyQt4.Qt import QApplication, QWidget, QVBoxLayout
from PyQt4.QtGui import QPushButton, QLabel
from PyQt4.QtCore import QObject, SIGNAL
a = QApplication(sys.argv)
pass
matrix = PinMatrixWidget()
def clicked():
self.pin_value = str(matrix.get_value())
a.closeAllWindows()
ok = QPushButton('OK')
QObject.connect(ok, SIGNAL('clicked()'), clicked)
vbox = QVBoxLayout()
vbox.addWidget(QLabel(self.input_text + self.message))
vbox.addWidget(matrix)
vbox.addWidget(ok)
w = QWidget()
w.setLayout(vbox)
w.move(100, 100)
w.show()
a.exec_()
def qt_pin_func(input_text, message=None):
# This is a hack to display Qt window in non-qt application.
# Qt window just asks for PIN and closes itself, which trigger join().
if False: # os.getenv('DISPLAY'):
# Let's hope that system is configured properly and this won't crash
t = PinMatrixThread(input_text, message)
t.start()
t.join()
return t.pin_value
else:
# Most likely no X is running,
# let's fallback to default pin_func implementation
return pin_func(input_text, message)
'''
def main():
parser = init_parser(Commands)
args = parser.parse_args()