Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tab for (slow) unlocking all devices #31

Merged
merged 1 commit into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions bitcoin_usb/tool_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,23 @@ def __init__(self, network: bdk.Network):
tab_widget = QTabWidget(self)
main_widget_layout.addWidget(tab_widget)

# Tab 0: Unlock
unlock_tab = QWidget()
unlock_layout = QVBoxLayout(unlock_tab)
button = SpinningButton(
text=self.tr("Unlock Devices"), enable_signal=self.usb.signal_end_hwi_blocker, parent=unlock_tab
)
button.clicked.connect(self.on_button_unlock_clicked)
unlock_layout.addWidget(button)
tab_widget.addTab(unlock_tab, self.tr("Unlock"))

# Tab 1: XPUBs
xpubs_tab = QWidget()
xpubs_layout = QVBoxLayout(xpubs_tab)
self.button = SpinningButton(
text=self.tr("Get xpubs"), enable_signal=self.usb.signal_end_hwi_blocker, parent=xpubs_tab
)
self.button.clicked.connect(self.on_button_clicked)
self.button.clicked.connect(self.on_button_xpubs_clicked)
xpubs_layout.addWidget(self.button)
self.xpubs_text_edit = QTextEdit(xpubs_tab)
self.xpubs_text_edit.setReadOnly(True)
Expand Down Expand Up @@ -146,7 +156,10 @@ def sign(self) -> None:
if signed_psbt:
self.psbt_text_edit.setText(signed_psbt.serialize())

def on_button_clicked(self) -> None:
def on_button_unlock_clicked(self) -> None:
self.usb.get_fingerprint_and_xpubs(slow_hwi_listing=True)

def on_button_xpubs_clicked(self) -> None:
self.xpubs_text_edit.setText("")
fingerprint_and_xpus = self.usb.get_fingerprint_and_xpubs()

Expand Down
42 changes: 18 additions & 24 deletions bitcoin_usb/usb_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,10 @@ def sign(self, psbt: bdk.PartiallySignedTransaction) -> Optional[bdk.PartiallySi

return None

def get_fingerprint_and_xpubs(self) -> Optional[Tuple[Dict[str, Any], str, Dict[AddressType, str]]]:
selected_device = self.get_device()
def get_fingerprint_and_xpubs(
self, slow_hwi_listing=False
) -> Optional[Tuple[Dict[str, Any], str, Dict[AddressType, str]]]:
selected_device = self.get_device(slow_hwi_listing=slow_hwi_listing)
if not selected_device:
return None

Expand All @@ -152,8 +154,10 @@ def get_fingerprint_and_xpubs(self) -> Optional[Tuple[Dict[str, Any], str, Dict[
self.signal_end_hwi_blocker.emit()
return None

def get_fingerprint_and_xpub(self, key_origin: str) -> Optional[Tuple[Dict[str, Any], str, str]]:
selected_device = self.get_device()
def get_fingerprint_and_xpub(
self, key_origin: str, slow_hwi_listing=False
) -> Optional[Tuple[Dict[str, Any], str, str]]:
selected_device = self.get_device(slow_hwi_listing=slow_hwi_listing)
if not selected_device:
return None

Expand All @@ -171,8 +175,8 @@ def get_fingerprint_and_xpub(self, key_origin: str) -> Optional[Tuple[Dict[str,
self.signal_end_hwi_blocker.emit()
return None

def sign_message(self, message: str, bip32_path: str) -> Optional[str]:
selected_device = self.get_device()
def sign_message(self, message: str, bip32_path: str, slow_hwi_listing=False) -> Optional[str]:
selected_device = self.get_device(slow_hwi_listing=slow_hwi_listing)
if not selected_device:
return None

Expand All @@ -190,11 +194,8 @@ def sign_message(self, message: str, bip32_path: str) -> Optional[str]:
self.signal_end_hwi_blocker.emit()
return None

def display_address(
self,
address_descriptor: str,
) -> Optional[str]:
selected_device = self.get_device()
def display_address(self, address_descriptor: str, slow_hwi_listing=False) -> Optional[str]:
selected_device = self.get_device(slow_hwi_listing=slow_hwi_listing)
if not selected_device:
return None

Expand All @@ -214,10 +215,8 @@ def display_address(
self.signal_end_hwi_blocker.emit()
return None

def wipe_device(
self,
) -> Optional[bool]:
selected_device = self.get_device()
def wipe_device(self, slow_hwi_listing=False) -> Optional[bool]:
selected_device = self.get_device(slow_hwi_listing=slow_hwi_listing)
if not selected_device:
return None

Expand All @@ -235,10 +234,8 @@ def wipe_device(
self.signal_end_hwi_blocker.emit()
return None

def write_down_seed(
self,
) -> Optional[bool]:
selected_device = self.get_device()
def write_down_seed(self, slow_hwi_listing=False) -> Optional[bool]:
selected_device = self.get_device(slow_hwi_listing=slow_hwi_listing)
if not selected_device:
return None

Expand All @@ -261,11 +258,8 @@ def write_down_seed(
self.signal_end_hwi_blocker.emit()
return None

def register_multisig(
self,
address_descriptor: str,
) -> Optional[str]:
selected_device = self.get_device()
def register_multisig(self, address_descriptor: str, slow_hwi_listing=False) -> Optional[str]:
selected_device = self.get_device(slow_hwi_listing=slow_hwi_listing)
if not selected_device:
return None

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ disable_error_code = "assignment"

[tool.poetry]
name = "bitcoin-usb"
version = "0.7.6"
version = "0.7.7"
authors = ["andreasgriffin <[email protected]>"]
license = "GPL-3.0"
readme = "README.md"
Expand Down