Browse Source

device manager: remove seemingly unused parameter

master
ThomasV 9 years ago
parent
commit
0520eda628
  1. 10
      lib/plugins.py
  2. 5
      plugins/trezor/plugin.py
  3. 2
      plugins/trezor/qt_generic.py

10
lib/plugins.py

@ -379,15 +379,15 @@ class DeviceMgr(ThreadJob, PrintError):
return client return client
return None return None
def client_by_id(self, id_, handler): def client_by_id(self, id_):
'''Returns a client for the device ID if one is registered. If '''Returns a client for the device ID if one is registered. If
a device is wiped or in bootloader mode pairing is impossible; a device is wiped or in bootloader mode pairing is impossible;
in such cases we communicate by device ID and not wallet.''' in such cases we communicate by device ID and not wallet.'''
self.scan_devices(handler) self.scan_devices()
return self.client_lookup(id_) return self.client_lookup(id_)
def client_for_xpub(self, plugin, xpub, derivation, handler, force_pair): def client_for_xpub(self, plugin, xpub, derivation, handler, force_pair):
devices = self.scan_devices(handler) devices = self.scan_devices()
_id = self.xpub_id(xpub) _id = self.xpub_id(xpub)
client = self.client_lookup(_id) client = self.client_lookup(_id)
if client: if client:
@ -436,7 +436,7 @@ class DeviceMgr(ThreadJob, PrintError):
'''Returns a list of DeviceInfo objects: one for each connected, '''Returns a list of DeviceInfo objects: one for each connected,
unpaired device accepted by the plugin.''' unpaired device accepted by the plugin.'''
if devices is None: if devices is None:
devices = self.scan_devices(handler) devices = self.scan_devices()
devices = [dev for dev in devices if not self.xpub_by_id(dev.id_)] devices = [dev for dev in devices if not self.xpub_by_id(dev.id_)]
states = [_("wiped"), _("initialized")] states = [_("wiped"), _("initialized")]
@ -474,7 +474,7 @@ class DeviceMgr(ThreadJob, PrintError):
descriptions = [info.description for info in infos] descriptions = [info.description for info in infos]
return infos[handler.query_choice(msg, descriptions)] return infos[handler.query_choice(msg, descriptions)]
def scan_devices(self, handler): def scan_devices(self):
# All currently supported hardware libraries use hid, so we # All currently supported hardware libraries use hid, so we
# assume it here. This can be easily abstracted if necessary. # assume it here. This can be easily abstracted if necessary.
# Note this import must be local so those without hardware # Note this import must be local so those without hardware

5
plugins/trezor/plugin.py

@ -178,7 +178,7 @@ class TrezorCompatiblePlugin(HW_PluginBase):
language = 'english' language = 'english'
devmgr = self.device_manager() devmgr = self.device_manager()
client = devmgr.client_by_id(device_id, handler) client = devmgr.client_by_id(device_id)
if method == TIM_NEW: if method == TIM_NEW:
strength = 64 * (item + 2) # 128, 192 or 256 strength = 64 * (item + 2) # 128, 192 or 256
@ -209,8 +209,7 @@ class TrezorCompatiblePlugin(HW_PluginBase):
device_id = device_info.device.id_ device_id = device_info.device.id_
if not device_info.initialized: if not device_info.initialized:
self.initialize_device(device_id, wizard, handler) self.initialize_device(device_id, wizard, handler)
client = devmgr.client_by_id(device_id)
client = devmgr.client_by_id(device_id, handler)
client.used() client.used()
return client.get_xpub(derivation) return client.get_xpub(derivation)

2
plugins/trezor/qt_generic.py

@ -333,7 +333,7 @@ class SettingsDialog(WindowModalDialog):
unpair_after = kw_args.pop('unpair_after', False) unpair_after = kw_args.pop('unpair_after', False)
def task(): def task():
client = devmgr.client_by_id(device_id, handler) client = devmgr.client_by_id(device_id)
if not client: if not client:
raise RuntimeError("Device not connected") raise RuntimeError("Device not connected")
if method: if method:

Loading…
Cancel
Save