wizard test
This commit is contained in:
43
qt.py
43
qt.py
@@ -1052,6 +1052,8 @@ class BalWindow:
|
|||||||
|
|
||||||
error = False
|
error = False
|
||||||
for url in willexecutors:
|
for url in willexecutors:
|
||||||
|
if self.waiting_dialog._stopping:
|
||||||
|
return
|
||||||
willexecutor = willexecutors[url]
|
willexecutor = willexecutors[url]
|
||||||
self.waiting_dialog.update(getMsg(willexecutors))
|
self.waiting_dialog.update(getMsg(willexecutors))
|
||||||
if "txs" in willexecutor:
|
if "txs" in willexecutor:
|
||||||
@@ -1070,6 +1072,8 @@ class BalWindow:
|
|||||||
del willexecutor["txs"]
|
del willexecutor["txs"]
|
||||||
except Willexecutors.AlreadyPresentException:
|
except Willexecutors.AlreadyPresentException:
|
||||||
for wid in willexecutor["txsids"]:
|
for wid in willexecutor["txsids"]:
|
||||||
|
if self.waiting_dialog._stopping:
|
||||||
|
return
|
||||||
self.waiting_dialog.update(
|
self.waiting_dialog.update(
|
||||||
"checking {} - {} : {}".format(
|
"checking {} - {} : {}".format(
|
||||||
self.willitems[wid].we["url"], wid, "Waiting"
|
self.willitems[wid].we["url"], wid, "Waiting"
|
||||||
@@ -1124,6 +1128,8 @@ class BalWindow:
|
|||||||
def check_transactions_task(self, will):
|
def check_transactions_task(self, will):
|
||||||
start = time.time()
|
start = time.time()
|
||||||
for wid, w in will.items():
|
for wid, w in will.items():
|
||||||
|
if self.waiting_dialog._stopping:
|
||||||
|
return
|
||||||
if w.we:
|
if w.we:
|
||||||
self.waiting_dialog.update(
|
self.waiting_dialog.update(
|
||||||
"checking transaction: {}\n willexecutor: {}".format(wid, w.we["url"])
|
"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 download_list(self, willexecutors, fn_on_success, fn_on_failure=None):
|
||||||
|
|
||||||
def on_success(result):
|
def on_success(result):
|
||||||
# self.willexecutors.update(result)
|
self.willexecutors.update(result)
|
||||||
fn_on_success(result)
|
fn_on_success(result)
|
||||||
|
|
||||||
def on_failure(exec_info):
|
def on_failure(exec_info):
|
||||||
@@ -1875,7 +1881,15 @@ class PercAmountEdit(BTCAmountEdit):
|
|||||||
|
|
||||||
|
|
||||||
class BalDialog(QDialog,MessageBoxMixin):
|
class BalDialog(QDialog,MessageBoxMixin):
|
||||||
|
_stopping = False
|
||||||
def __init__(self, parent, bal_plugin, title=None, icon="icons/bal16x16.png"):
|
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.parent = parent
|
||||||
self.thread = None
|
self.thread = None
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
@@ -1888,12 +1902,13 @@ class BalDialog(QDialog,MessageBoxMixin):
|
|||||||
self._stopping = True
|
self._stopping = True
|
||||||
#if self.thread:
|
#if self.thread:
|
||||||
# self.thread.stop()
|
# self.thread.stop()
|
||||||
|
super().closeEvent(event)
|
||||||
|
|
||||||
def hideEvent(self, event):
|
def hideEvent(self, event):
|
||||||
self._stopping = True
|
self._stopping = True
|
||||||
#if self.thread:
|
#if self.thread:
|
||||||
# self.thread.stop()
|
# self.thread.stop()
|
||||||
|
super().hideEvent(event)
|
||||||
|
|
||||||
class BalWizardDialog(BalDialog):
|
class BalWizardDialog(BalDialog):
|
||||||
def __init__(self, bal_window: "BalWindow"):
|
def __init__(self, bal_window: "BalWindow"):
|
||||||
@@ -2159,6 +2174,7 @@ class BalWizardWEDownloadWidget(BalWizardWidget):
|
|||||||
# TODO DO NOTHING
|
# TODO DO NOTHING
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
self.bal_window.will_list_widget.update()
|
||||||
if self.validate():
|
if self.validate():
|
||||||
return self.on_next()
|
return self.on_next()
|
||||||
|
|
||||||
@@ -2249,11 +2265,11 @@ class BalWaitingDialog(BalDialog):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def finished(self):
|
def finished(self):
|
||||||
_logger.info("finished")
|
pass
|
||||||
|
|
||||||
|
|
||||||
def on_accepted(self):
|
def on_accepted(self):
|
||||||
self.thread.stop()
|
pass
|
||||||
|
|
||||||
def update_message(self, msg):
|
def update_message(self, msg):
|
||||||
self.message_label.setText(msg)
|
self.message_label.setText(msg)
|
||||||
@@ -2264,9 +2280,6 @@ class BalWaitingDialog(BalDialog):
|
|||||||
def getText(self):
|
def getText(self):
|
||||||
return self.message_label.text()
|
return self.message_label.text()
|
||||||
|
|
||||||
def closeEvent(self, event):
|
|
||||||
self._stopping = True
|
|
||||||
self.thread.stop()
|
|
||||||
|
|
||||||
|
|
||||||
class BalBlockingWaitingDialog(BalDialog):
|
class BalBlockingWaitingDialog(BalDialog):
|
||||||
@@ -2368,6 +2381,8 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
self.exec()
|
self.exec()
|
||||||
|
|
||||||
def task_phase1(self):
|
def task_phase1(self):
|
||||||
|
if self._stopping:
|
||||||
|
return
|
||||||
txs = None
|
txs = None
|
||||||
_logger.debug("close plugin phase 1 started")
|
_logger.debug("close plugin phase 1 started")
|
||||||
varrow = self.msg_set_status("checking variables")
|
varrow = self.msg_set_status("checking variables")
|
||||||
@@ -2511,6 +2526,8 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
self.msg_del_row(wait_row)
|
self.msg_del_row(wait_row)
|
||||||
|
|
||||||
def loop_broadcast_invalidating(self, tx):
|
def loop_broadcast_invalidating(self, tx):
|
||||||
|
if self._stopping:
|
||||||
|
return
|
||||||
self.msg_set_invalidating("Broadcasting")
|
self.msg_set_invalidating("Broadcasting")
|
||||||
try:
|
try:
|
||||||
tx.add_info_from_wallet(self.bal_window.wallet)
|
tx.add_info_from_wallet(self.bal_window.wallet)
|
||||||
@@ -2530,6 +2547,8 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
self.msg_set_invalidating(self.msg_error(e))
|
self.msg_set_invalidating(self.msg_error(e))
|
||||||
|
|
||||||
def loop_push(self):
|
def loop_push(self):
|
||||||
|
if self._stopping:
|
||||||
|
return
|
||||||
self.msg_set_pushing(_("Broadcasting"))
|
self.msg_set_pushing(_("Broadcasting"))
|
||||||
retry = False
|
retry = False
|
||||||
try:
|
try:
|
||||||
@@ -2538,6 +2557,8 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
self.bal_window.willitems
|
self.bal_window.willitems
|
||||||
)
|
)
|
||||||
for url, willexecutor in willexecutors.items():
|
for url, willexecutor in willexecutors.items():
|
||||||
|
if self._stopping:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
if Willexecutors.is_selected(
|
if Willexecutors.is_selected(
|
||||||
self.bal_window.willexecutors.get(url)
|
self.bal_window.willexecutors.get(url)
|
||||||
@@ -2558,6 +2579,8 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
)
|
)
|
||||||
except Willexecutors.AlreadyPresentException:
|
except Willexecutors.AlreadyPresentException:
|
||||||
for wid in willexecutor["txsids"]:
|
for wid in willexecutor["txsids"]:
|
||||||
|
if self._stopping:
|
||||||
|
return
|
||||||
row = self.msg_edit_row(
|
row = self.msg_edit_row(
|
||||||
"checking {} - {} : {}".format(
|
"checking {} - {} : {}".format(
|
||||||
self.bal_window.willitems[wid].we["url"], wid, "Waiting"
|
self.bal_window.willitems[wid].we["url"], wid, "Waiting"
|
||||||
@@ -2592,6 +2615,8 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
# self.loop_push()
|
# self.loop_push()
|
||||||
|
|
||||||
def invalidate_task(self, password, bal_window, tx):
|
def invalidate_task(self, password, bal_window, tx):
|
||||||
|
if self._stopping:
|
||||||
|
return
|
||||||
_logger.debug(f"invalidate tx: {tx}")
|
_logger.debug(f"invalidate tx: {tx}")
|
||||||
# fee_per_byte = bal_window.will_settings.get("baltx_fees", 1)
|
# fee_per_byte = bal_window.will_settings.get("baltx_fees", 1)
|
||||||
tx = self.bal_window.wallet.sign_transaction(tx, password)
|
tx = self.bal_window.wallet.sign_transaction(tx, password)
|
||||||
@@ -2618,6 +2643,8 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def on_success_phase1(self, result):
|
def on_success_phase1(self, result):
|
||||||
|
if self._stopping:
|
||||||
|
return
|
||||||
self.have_to_sign, tx = list(result)
|
self.have_to_sign, tx = list(result)
|
||||||
# if not tx:
|
# if not tx:
|
||||||
# self.msg_edit_row(self.msg_error("Error, no tx was built"))
|
# self.msg_edit_row(self.msg_error("Error, no tx was built"))
|
||||||
@@ -2673,6 +2700,8 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
self.thread.stop()
|
self.thread.stop()
|
||||||
|
|
||||||
def task_phase2(self, password):
|
def task_phase2(self, password):
|
||||||
|
if self._stopping:
|
||||||
|
return
|
||||||
if self.have_to_sign:
|
if self.have_to_sign:
|
||||||
try:
|
try:
|
||||||
if txs := self.bal_window.sign_transactions(password):
|
if txs := self.bal_window.sign_transactions(password):
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ class Willexecutors:
|
|||||||
for w in willexecutors:
|
for w in willexecutors:
|
||||||
if w not in ("status", "url"):
|
if w not in ("status", "url"):
|
||||||
Willexecutors.initialize_willexecutor(
|
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.WILLEXECUTORS.set(l)
|
||||||
# bal_plugin.config.set_key(bal_plugin.WILLEXECUTORS,l,save=True)
|
# bal_plugin.config.set_key(bal_plugin.WILLEXECUTORS,l,save=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user