diff --git a/.github/workflows/build-mac-arm.yml b/.github/workflows/build-mac-arm.yml deleted file mode 100644 index 629712e..0000000 --- a/.github/workflows/build-mac-arm.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Build MacOsX Arm64 dmg -on: - workflow_dispatch: - inputs: - commitHash: - description: 'Enter the commit hash to build (leave empty to use the default branch or the branch that triggered the workflow)' - required: false - type: string - build: - description: 'Build DMG (Arm64)' - required: false - type: boolean - - # push: - # branches: [ "main" ] - # pull_request: - # branches: [ "main" ] - -jobs: - build: - runs-on: macos-14 # see available: https://github.com/actions/runner-images?tab=readme-ov-file#available-images - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Fetch all history for all branches and tags - ref: ${{ github.event.inputs.commitHash || github.sha }} - - - - name: Run build script - run: tools/build-mac/make_osx.sh - - - - name: Check for DMG file - run: | - if [ -z "$(find dist -type f -name '*.dmg')" ]; then - echo "dmg file is missing" - exit 1 - fi - - - - name: Upload DMG Files from dist/ - uses: actions/upload-artifact@v4 - with: - name: dmgs - path: dist/*.dmg \ No newline at end of file diff --git a/bitcoin_safe/__init__.py b/bitcoin_safe/__init__.py index 446fde1..d342006 100644 --- a/bitcoin_safe/__init__.py +++ b/bitcoin_safe/__init__.py @@ -1,2 +1,2 @@ # this is the source of the version information -__version__ = "1.0.3" +__version__ = "1.0.4" diff --git a/bitcoin_safe/gui/qt/qt_wallet.py b/bitcoin_safe/gui/qt/qt_wallet.py index 6ee3e77..3f890f4 100644 --- a/bitcoin_safe/gui/qt/qt_wallet.py +++ b/bitcoin_safe/gui/qt/qt_wallet.py @@ -38,7 +38,7 @@ import bdkpython as bdk from bitcoin_qr_tools.data import Data -from PyQt6.QtCore import Qt, QTimer, pyqtSignal +from PyQt6.QtCore import Qt, QTimer, pyqtBoundSignal, pyqtSignal from PyQt6.QtGui import QIcon from PyQt6.QtWidgets import ( QApplication, @@ -287,15 +287,17 @@ def __init__( self.quick_receive.update_content(UpdateFilter(refresh_all=True)) #### connect signals - self.signal_on_change_sync_status.connect(self.update_status_visualization) - self.signals.language_switch.connect(self.updateUi) - self.wallet_signals.updated.connect(self.signals.any_wallet_updated.emit) - self.wallet_signals.export_labels.connect(self.export_labels) - self.wallet_signals.export_bip329_labels.connect(self.export_bip329_labels) - self.wallet_signals.import_labels.connect(self.import_labels) - self.wallet_signals.import_bip329_labels.connect(self.import_bip329_labels) - self.wallet_signals.import_electrum_wallet_labels.connect(self.import_electrum_wallet_labels) - self.signal_on_change_sync_status.connect(self.update_display_balance) + self.connect_signal(self.signal_on_change_sync_status, self.update_status_visualization) + self.connect_signal(self.signals.language_switch, self.updateUi) + self.connect_signal(self.wallet_signals.updated, self.signals.any_wallet_updated.emit) + self.connect_signal(self.wallet_signals.export_labels, self.export_labels) + self.connect_signal(self.wallet_signals.export_bip329_labels, self.export_bip329_labels) + self.connect_signal(self.wallet_signals.import_labels, self.import_labels) + self.connect_signal(self.wallet_signals.import_bip329_labels, self.import_bip329_labels) + self.connect_signal( + self.wallet_signals.import_electrum_wallet_labels, self.import_electrum_wallet_labels + ) + self.connect_signal(self.signal_on_change_sync_status, self.update_display_balance) self._start_sync_retry_timer() self._start_sync_regularly_timer() @@ -427,6 +429,27 @@ def stop_sync_timer(self) -> None: self.timer_sync_retry.stop() self.timer_sync_regularly.stop() + def disconnect_signals(self) -> None: + def discon_sig(signal: pyqtBoundSignal): + """ + Disconnect only breaks one connection at a time, + so loop to be safe. + """ + while True: + try: + signal.disconnect() + except TypeError: + break + return + + super().disconnect_signals() + signals = self.wallet_signals + for signal_name in dir(signals): + signal = getattr(signals, signal_name) + if not isinstance(signal, pyqtBoundSignal): + continue + discon_sig(signal) + def close(self) -> None: self.disconnect_signals() self.label_syncer.send_all_labels_to_myself() diff --git a/bitcoin_safe/gui/qt/signal_carrying_object.py b/bitcoin_safe/gui/qt/signal_carrying_object.py index 0ef7880..67dc35e 100644 --- a/bitcoin_safe/gui/qt/signal_carrying_object.py +++ b/bitcoin_safe/gui/qt/signal_carrying_object.py @@ -30,7 +30,9 @@ import logging from typing import Callable, List, Tuple -from PyQt6.QtCore import QObject +from PyQt6.QtCore import QObject, pyqtBoundSignal + +from bitcoin_safe.typestubs import TypedPyQtSignal, TypedPyQtSignalNo from ...signals import SignalFunction @@ -40,9 +42,16 @@ class SignalCarryingObject(QObject): def __init__(self, parent=None, **kwargs) -> None: super().__init__(parent, **kwargs) - self._connected_signals: List[Tuple[SignalFunction, Callable]] = [] - - def connect_signal(self, signal, f, **kwargs) -> None: + self._connected_signals: List[ + Tuple[SignalFunction | pyqtBoundSignal | TypedPyQtSignalNo | TypedPyQtSignal, Callable] + ] = [] + + def connect_signal( + self, + signal: SignalFunction | pyqtBoundSignal | TypedPyQtSignalNo | TypedPyQtSignal, + f: Callable, + **kwargs + ) -> None: signal.connect(f, **kwargs) self._connected_signals.append((signal, f)) diff --git a/poetry.lock b/poetry.lock index 7959f04..3279e80 100644 --- a/poetry.lock +++ b/poetry.lock @@ -67,13 +67,13 @@ files = [ [[package]] name = "bitcoin-nostr-chat" -version = "0.6.1" +version = "0.6.2" description = "A Nostr Chat with participant discovery" optional = false python-versions = "<3.13,>=3.9" files = [ - {file = "bitcoin_nostr_chat-0.6.1-py3-none-any.whl", hash = "sha256:7e58bcf7c6285c0d84cb20496a8223a71cbb8d3a7dab22921d501f639c50316a"}, - {file = "bitcoin_nostr_chat-0.6.1.tar.gz", hash = "sha256:f82e3ad2787be5abc6c47281348205f4a1384a984db0382c48dcfae8c7293138"}, + {file = "bitcoin_nostr_chat-0.6.2-py3-none-any.whl", hash = "sha256:f578dc29cf4e694414be3903a6f941c81b7793df2b0a20e01ce31e08aa1b697d"}, + {file = "bitcoin_nostr_chat-0.6.2.tar.gz", hash = "sha256:f2da5eda38be9c2ac0ed7c5dd8b17aa0a8a28dad70aeda40bb0e2947a690453d"}, ] [package.dependencies] @@ -2903,4 +2903,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.13" -content-hash = "a6b00c64503f23653b582636a2bff1fc014ab339bb36683b4823469f03f460af" +content-hash = "b22908aa5e308fc1caf720c70e2321e5d934f2bb0f253eebae2c3c4ac0578892" diff --git a/pyproject.toml b/pyproject.toml index a875130..4870bd0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ line-length = 110 name = "bitcoin-safe" # the version here and in all other places in this toml are updated automatically # from the source: bitcoin_safe/__init__.py -version = "1.0.3" +version = "1.0.4" description = "A bitcoin savings wallet for the entire family." authors = [ "andreasgriffin ",] license = "GPL-3.0" @@ -42,7 +42,7 @@ numpy = "2.2.1" # error in wine/pyinstaller when increased # bitcoin-nostr-chat = {path="../bitcoin-nostr-chat"} # "^0.2.6" # bitcoin-usb = {path="../bitcoin-usb"} # "^0.3.3" bitcoin-qr-tools = "^1.0.3" -bitcoin-nostr-chat = "^0.6.1" # { git = "https://github.com/andreasgriffin/bitcoin-nostr-chat.git", rev = "1707c7479d9de4c1915f2b0d907b27f58703e7c0" } +bitcoin-nostr-chat = "^0.6.2" # { git = "https://github.com/andreasgriffin/bitcoin-nostr-chat.git", rev = "fda38f7c4879fbced753a8d3466d50c571c06769" } bitcoin-usb = "^0.7.4" pysocks = "^1.7.1" diff --git a/tools/build-mac/make_osx.sh b/tools/build-mac/make_osx.sh index 15cec06..2a1b0ac 100755 --- a/tools/build-mac/make_osx.sh +++ b/tools/build-mac/make_osx.sh @@ -228,12 +228,21 @@ info "Finished building unsigned dist/${PACKAGE}.app. This hash should be reprod find "dist/${PACKAGE}.app" -type f -print0 | sort -z | xargs -0 shasum -a 256 | shasum -a 256 info "Creating unsigned .DMG" -hdiutil create \ - -fs HFS+ \ - -volname "$PACKAGE" \ - -srcfolder "dist/$PACKAGE.app" \ - "dist/bitcoin_safe-$VERSION-unsigned.dmg" \ - || fail "Could not create .DMG" +# Workaround resource busy bug on github on MacOS 13 +# https://github.com/actions/runner-images/issues/7522 +i=0 +until hdiutil create \ + -fs HFS+ \ + -volname "$PACKAGE" \ + -srcfolder "dist/$PACKAGE.app" \ + "dist/bitcoin_safe-$VERSION-unsigned.dmg" +do + if [ $i -eq 10 ]; then + fail "Could not create .DMG"; + fi + i=$((i+1)) + sleep 1 +done info "Done. The .app and .dmg are *unsigned* and will trigger macOS Gatekeeper warnings." info "To ship, you’ll need to sign and notarize. See: sign_osx.sh"