def _on_account_change(self, new_account_id: int, new_account: AbstractAccount) -> None:
        self._account_id = new_account_id
        self._account = new_account

        script_type = new_account.get_default_script_type()

        # Hardware wallets will not sign OP_FALSE OP_RETURN.
        self._direct_splitting_enabled = self._account.is_deterministic() and \
            new_account.can_spend() and \
            not new_account.is_hardware_wallet()
        # The faucet requires an address to send to. There are only P2PKH addresses.
        self._faucet_splitting_enabled = self._account.is_deterministic() and \
          script_type == ScriptType.P2PKH
        self.update_layout()
Exemple #2
0
    def add_menu_items(self, menu: QMenu, account: AbstractAccount, main_window: ElectrumWindow) \
            -> None:
        menu.clear()

        # This expects a reference to the main window, not the weakref.
        account_id = account.get_id()

        menu.addAction(_("&Information"),
            partial(self._show_account_information, account_id))
        seed_menu = menu.addAction(_("View &Secured Data"),
            partial(self._view_secured_data, main_window=main_window, account_id=account_id))
        seed_menu.setEnabled(
            not account.is_watching_only() and not isinstance(account, MultisigAccount) \
            and not account.is_hardware_wallet() \
            and account.type() != AccountType.IMPORTED_PRIVATE_KEY)
        menu.addAction(_("&Rename"),
            partial(self._rename_account, account_id))
        menu.addSeparator()

        private_keys_menu = menu.addMenu(_("&Private keys"))
        import_menu = private_keys_menu.addAction(_("&Import"), partial(self._import_privkey,
                main_window=main_window, account_id=account_id))
        import_menu.setEnabled(account.can_import_privkey())
        export_menu = private_keys_menu.addAction(_("&Export"), partial(self._export_privkeys,
            main_window=main_window, account_id=account_id))
        export_menu.setEnabled(account.can_export())
        if account.can_import_address():
            menu.addAction(_("Import addresses"), partial(self._import_addresses, account_id))

        menu.addSeparator()

        hist_menu = menu.addMenu(_("&History"))
        hist_menu.addAction("Export", main_window.export_history_dialog)

        labels_menu = menu.addMenu(_("&Labels"))
        action = labels_menu.addAction(_("&Import"),
            partial(self._on_menu_import_labels, account_id))
        labels_menu.addAction(_("&Export"), partial(self._on_menu_export_labels, account_id))

        invoices_menu = menu.addMenu(_("Invoices"))
        invoices_menu.addAction(_("Import"), partial(self._on_menu_import_invoices, account_id))

        payments_menu = menu.addMenu(_("Payments"))
        ed_action = payments_menu.addAction(_("Export destinations"),
            partial(self._generate_destinations, account_id))
        keystore = account.get_keystore()
        ed_action.setEnabled(keystore is not None and
            keystore.type() != KeystoreType.IMPORTED_PRIVATE_KEY)
 def _can_view_secured_data(self, account: AbstractAccount) -> None:
     return not account.is_watching_only() and not isinstance(account, MultisigAccount) \
         and not account.is_hardware_wallet() \
         and account.type() != AccountType.IMPORTED_PRIVATE_KEY
Exemple #4
0
 def _can_view_secured_data(self, account: AbstractAccount) -> None:
     return not account.is_watching_only() and not isinstance(account, MultisigAccount) \
         and not account.is_hardware_wallet()