hw wallets: introduce HardwareHandlerBase
previously, client.handler was sometimes - an InstallWizard - a QtHandlerBase where win was an ElectrumWindow - a QtHandlerBase where win was an InstallWizard - a CmdLineHandler That's just too much dynamic untyped undocumented polymorphism... Now it will never be an InstallWizard (replaced with QtHandlerBase where win is an InstallWizard), and now in all cases client.handler is an instance of HardwareHandlerBase, yay. related: #6063
This commit is contained in:
@@ -169,9 +169,6 @@ class QtPlugin(QtPluginBase):
|
||||
# icon_file
|
||||
# pin_matrix_widget_class
|
||||
|
||||
def create_handler(self, window):
|
||||
return QtHandler(window, self.pin_matrix_widget_class(), self.device)
|
||||
|
||||
@only_hook_if_libraries_available
|
||||
@hook
|
||||
def receive_menu(self, menu, addrs, wallet):
|
||||
@@ -377,6 +374,9 @@ class Plugin(TrezorPlugin, QtPlugin):
|
||||
icon_unpaired = "trezor_unpaired.png"
|
||||
icon_paired = "trezor.png"
|
||||
|
||||
def create_handler(self, window):
|
||||
return QtHandler(window, self.pin_matrix_widget_class(), self.device)
|
||||
|
||||
@classmethod
|
||||
def pin_matrix_widget_class(self):
|
||||
from trezorlib.qt.pinmatrix import PinMatrixWidget
|
||||
|
||||
@@ -282,7 +282,6 @@ class TrezorPlugin(HW_PluginBase):
|
||||
.format(self.device, client.label(), self.firmware_URL))
|
||||
raise OutdatedHwFirmwareException(msg)
|
||||
|
||||
# fixme: we should use: client.handler = wizard
|
||||
client.handler = self.create_handler(wizard)
|
||||
if not device_info.initialized:
|
||||
self.initialize_device(device_id, wizard, client.handler)
|
||||
@@ -295,7 +294,7 @@ class TrezorPlugin(HW_PluginBase):
|
||||
raise ScriptTypeNotSupported(_('This type of script is not supported with {}.').format(self.device))
|
||||
devmgr = self.device_manager()
|
||||
client = devmgr.client_by_id(device_id)
|
||||
client.handler = wizard
|
||||
client.handler = self.create_handler(wizard)
|
||||
xpub = client.get_xpub(derivation, xtype)
|
||||
client.used()
|
||||
return xpub
|
||||
|
||||
Reference in New Issue
Block a user