Esempio n. 1
0
 def load_wallet(self: Union['QtPluginBase', HW_PluginBase],
                 wallet: 'Abstract_Wallet', window: ElectrumWindow):
     for keystore in wallet.get_keystores():
         if not isinstance(keystore, self.keystore_class):
             continue
         if not self.libraries_available:
             message = keystore.plugin.get_library_not_available_message()
             window.show_error(message)
             return
         tooltip = self.device + '\n' + (keystore.label or 'unnamed')
         cb = partial(self.show_settings_dialog, window, keystore)
         button = StatusBarButton(read_QIcon(self.icon_unpaired), tooltip,
                                  cb)
         button.icon_paired = self.icon_paired
         button.icon_unpaired = self.icon_unpaired
         window.statusBar().addPermanentWidget(button)
         handler = self.create_handler(window)
         handler.button = button
         keystore.handler = handler
         keystore.thread = TaskThread(window,
                                      on_error=partial(
                                          self.on_task_thread_error, window,
                                          keystore))
         self.add_show_address_on_hw_device_button_for_receive_addr(
             wallet, keystore, window)
         # Trigger a pairing
         keystore.thread.add(partial(self.get_client, keystore))
Esempio n. 2
0
 def load_wallet(self, wallet, window):
     for keystore in wallet.get_keystores():
         if not isinstance(keystore, self.keystore_class):
             continue
         if not self.libraries_available:
             if hasattr(self, 'libraries_available_message'):
                 message = self.libraries_available_message + '\n'
             else:
                 message = _("Cannot find python library for"
                             ) + " '%s'.\n" % self.name
             message += _("Make sure you install it with python3")
             window.show_error(message)
             return
         tooltip = self.device + '\n' + (keystore.label or 'unnamed')
         cb = partial(self.show_settings_dialog, window, keystore)
         button = StatusBarButton(QIcon(self.icon_unpaired), tooltip, cb)
         button.icon_paired = self.icon_paired
         button.icon_unpaired = self.icon_unpaired
         window.statusBar().addPermanentWidget(button)
         handler = self.create_handler(window)
         handler.button = button
         keystore.handler = handler
         keystore.thread = TaskThread(window, window.on_error)
         self.add_show_address_on_hw_device_button_for_receive_addr(
             wallet, keystore, window)
         # Trigger a pairing
         keystore.thread.add(partial(self.get_client, keystore))
Esempio n. 3
0
    def load_wallet(self: Union['QtPluginBase', HW_PluginBase], wallet: 'Abstract_Wallet', window: ElectrumWindow):
        relevant_keystores = [keystore for keystore in wallet.get_keystores()
                              if isinstance(keystore, self.keystore_class)]
        if not relevant_keystores:
            return
        for keystore in relevant_keystores:
            if not self.libraries_available:
                message = keystore.plugin.get_library_not_available_message()
                window.show_error(message)
                return
            tooltip = self.device + '\n' + (keystore.label or 'unnamed')
            cb = partial(self._on_status_bar_button_click, window=window, keystore=keystore)
            button = StatusBarButton(read_QIcon(self.icon_unpaired), tooltip, cb)
            button.icon_paired = self.icon_paired
            button.icon_unpaired = self.icon_unpaired
            window.statusBar().addPermanentWidget(button)
            handler = self.create_handler(window)
            handler.button = button
            keystore.handler = handler
            keystore.thread = TaskThread(window, on_error=partial(self.on_task_thread_error, window, keystore))
            self.add_show_address_on_hw_device_button_for_receive_addr(wallet, keystore, window)
        # Trigger pairings
        def trigger_pairings():
            devmgr = self.device_manager()
            devices = devmgr.scan_devices()
            # first pair with all devices that can be auto-selected
            for keystore in relevant_keystores:
                try:
                    self.get_client(keystore=keystore,
                                    force_pair=True,
                                    allow_user_interaction=False,
                                    devices=devices)
                except UserCancelled:
                    pass
            # now do manual selections
            for keystore in relevant_keystores:
                try:
                    self.get_client(keystore=keystore,
                                    force_pair=True,
                                    allow_user_interaction=True,
                                    devices=devices)
                except UserCancelled:
                    pass

        some_keystore = relevant_keystores[0]
        some_keystore.thread.add(trigger_pairings)
Esempio n. 4
0
 def load_wallet(self, wallet, window):
     for keystore in wallet.get_keystores():
         if not isinstance(keystore, self.keystore_class):
             continue
         if not self.libraries_available:
             message = keystore.plugin.get_library_not_available_message()
             window.show_error(message)
             return
         tooltip = self.device + '\n' + (keystore.label or 'unnamed')
         cb = partial(self.show_settings_dialog, window, keystore)
         button = StatusBarButton(read_QIcon(self.icon_unpaired), tooltip, cb)
         button.icon_paired = self.icon_paired
         button.icon_unpaired = self.icon_unpaired
         window.statusBar().addPermanentWidget(button)
         handler = self.create_handler(window)
         handler.button = button
         keystore.handler = handler
         keystore.thread = TaskThread(window, window.on_error)
         self.add_show_address_on_hw_device_button_for_receive_addr(wallet, keystore, window)
         # Trigger a pairing
         keystore.thread.add(partial(self.get_client, keystore))
Esempio n. 5
0
 def create_status_bar(self, parent):
     b = StatusBarButton(read_QIcon('revealer.png'), "Revealer "+_("secret backup utility"),
                         partial(self.setup_dialog, parent))
     parent.addPermanentWidget(b)