From 37a3beb7576b48fb8529d68dcaac865ffa99b42a Mon Sep 17 00:00:00 2001 From: svatantrya Date: Wed, 20 May 2026 06:22:25 -0400 Subject: [PATCH] wizard test --- qt.py | 43 ++++++++++++++++++++++++++++++++++++------- willexecutors.py | 2 +- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/qt.py b/qt.py index c7b8a39..c6e6d25 100644 --- a/qt.py +++ b/qt.py @@ -1052,6 +1052,8 @@ class BalWindow: error = False for url in willexecutors: + if self.waiting_dialog._stopping: + return willexecutor = willexecutors[url] self.waiting_dialog.update(getMsg(willexecutors)) if "txs" in willexecutor: @@ -1070,6 +1072,8 @@ class BalWindow: del willexecutor["txs"] except Willexecutors.AlreadyPresentException: for wid in willexecutor["txsids"]: + if self.waiting_dialog._stopping: + return self.waiting_dialog.update( "checking {} - {} : {}".format( self.willitems[wid].we["url"], wid, "Waiting" @@ -1124,6 +1128,8 @@ class BalWindow: def check_transactions_task(self, will): start = time.time() for wid, w in will.items(): + if self.waiting_dialog._stopping: + return if w.we: self.waiting_dialog.update( "checking transaction: {}\n willexecutor: {}".format(wid, w.we["url"]) @@ -1164,7 +1170,7 @@ class BalWindow: def download_list(self, willexecutors, fn_on_success, fn_on_failure=None): def on_success(result): - # self.willexecutors.update(result) + self.willexecutors.update(result) fn_on_success(result) def on_failure(exec_info): @@ -1875,7 +1881,15 @@ class PercAmountEdit(BTCAmountEdit): class BalDialog(QDialog,MessageBoxMixin): + _stopping = False def __init__(self, parent, bal_plugin, title=None, icon="icons/bal16x16.png"): + import signal + from PyQt6.QtCore import QMetaObject, Qt + from PyQt6.QtWidgets import QApplication + def handler(signum, frame): + QMetaObject.invokeMethod(self, "close", Qt.ConnectionType.QueuedConnection) + + #signal.signal(signal.SIGINT, handler) self.parent = parent self.thread = None super().__init__(parent) @@ -1888,12 +1902,13 @@ class BalDialog(QDialog,MessageBoxMixin): self._stopping = True #if self.thread: # self.thread.stop() + super().closeEvent(event) def hideEvent(self, event): self._stopping = True #if self.thread: # self.thread.stop() - + super().hideEvent(event) class BalWizardDialog(BalDialog): def __init__(self, bal_window: "BalWindow"): @@ -2159,6 +2174,7 @@ class BalWizardWEDownloadWidget(BalWizardWidget): # TODO DO NOTHING pass + self.bal_window.will_list_widget.update() if self.validate(): return self.on_next() @@ -2249,11 +2265,11 @@ class BalWaitingDialog(BalDialog): pass def finished(self): - _logger.info("finished") + pass def on_accepted(self): - self.thread.stop() + pass def update_message(self, msg): self.message_label.setText(msg) @@ -2264,9 +2280,6 @@ class BalWaitingDialog(BalDialog): def getText(self): return self.message_label.text() - def closeEvent(self, event): - self._stopping = True - self.thread.stop() class BalBlockingWaitingDialog(BalDialog): @@ -2368,6 +2381,8 @@ class BalBuildWillDialog(BalDialog): self.exec() def task_phase1(self): + if self._stopping: + return txs = None _logger.debug("close plugin phase 1 started") varrow = self.msg_set_status("checking variables") @@ -2511,6 +2526,8 @@ class BalBuildWillDialog(BalDialog): self.msg_del_row(wait_row) def loop_broadcast_invalidating(self, tx): + if self._stopping: + return self.msg_set_invalidating("Broadcasting") try: tx.add_info_from_wallet(self.bal_window.wallet) @@ -2530,6 +2547,8 @@ class BalBuildWillDialog(BalDialog): self.msg_set_invalidating(self.msg_error(e)) def loop_push(self): + if self._stopping: + return self.msg_set_pushing(_("Broadcasting")) retry = False try: @@ -2538,6 +2557,8 @@ class BalBuildWillDialog(BalDialog): self.bal_window.willitems ) for url, willexecutor in willexecutors.items(): + if self._stopping: + return try: if Willexecutors.is_selected( self.bal_window.willexecutors.get(url) @@ -2558,6 +2579,8 @@ class BalBuildWillDialog(BalDialog): ) except Willexecutors.AlreadyPresentException: for wid in willexecutor["txsids"]: + if self._stopping: + return row = self.msg_edit_row( "checking {} - {} : {}".format( self.bal_window.willitems[wid].we["url"], wid, "Waiting" @@ -2592,6 +2615,8 @@ class BalBuildWillDialog(BalDialog): # self.loop_push() def invalidate_task(self, password, bal_window, tx): + if self._stopping: + return _logger.debug(f"invalidate tx: {tx}") # fee_per_byte = bal_window.will_settings.get("baltx_fees", 1) tx = self.bal_window.wallet.sign_transaction(tx, password) @@ -2618,6 +2643,8 @@ class BalBuildWillDialog(BalDialog): ) def on_success_phase1(self, result): + if self._stopping: + return self.have_to_sign, tx = list(result) # if not tx: # self.msg_edit_row(self.msg_error("Error, no tx was built")) @@ -2673,6 +2700,8 @@ class BalBuildWillDialog(BalDialog): self.thread.stop() def task_phase2(self, password): + if self._stopping: + return if self.have_to_sign: try: if txs := self.bal_window.sign_transactions(password): diff --git a/willexecutors.py b/willexecutors.py index 717f359..8812cd8 100644 --- a/willexecutors.py +++ b/willexecutors.py @@ -284,7 +284,7 @@ class Willexecutors: for w in willexecutors: if w not in ("status", "url"): Willexecutors.initialize_willexecutor( - willexecutors[w], w, None, old_willexecutors.get(w,{}) + willexecutors[w], w, None, old_willexecutors.get(w,None) ) # bal_plugin.WILLEXECUTORS.set(l) # bal_plugin.config.set_key(bal_plugin.WILLEXECUTORS,l,save=True)