diff --git a/bal.py b/bal.py index 7e9b230..b6945b2 100644 --- a/bal.py +++ b/bal.py @@ -109,7 +109,7 @@ class BalPlugin(BasePlugin): "base_fee": 100000, "status": "New", "info": "Bitcoin After Life Will Executor", - "address": "bcrt1qa5cntu4hgadw8zd3n6sq2nzjy34sxdtd9u0gp7", + "address": "bc1qusymuetsz2psaqzqxv8qmzcy64d9meckj3lxxf", "selected": True, } }, diff --git a/heirs.py b/heirs.py index e8a749a..7317ee6 100644 --- a/heirs.py +++ b/heirs.py @@ -341,7 +341,6 @@ class Heirs(dict, Logger): def normalize_perc( self, heir_list, total_balance, relative_balance, wallet, real=False ): - print("relative balance", relative_balance) amount = 0 for key, v in heir_list.items(): try: @@ -426,15 +425,7 @@ class Heirs(dict, Logger): self, balance, total_fees, wallet, willexecutor=False, from_locktime=0 ): if balance newbalance: - print(fixed_heirs,newbalance,fixed_amount) fixed_amount = self.normalize_perc( fixed_heirs, newbalance, fixed_amount, wallet ) @@ -485,15 +472,12 @@ class Heirs(dict, Logger): heir_list.update(fixed_heirs) newbalance -= fixed_amount - print("new balance", newbalance) if newbalance > 0: perc_amount = self.normalize_perc( percent_heirs, newbalance, percent_amount, wallet ) - print("normalize perc", perc_amount) newbalance -= perc_amount heir_list.update(percent_heirs) - print("newbalance2",newbalance) if newbalance > 0: newbalance += fixed_amount fixed_amount = self.normalize_perc( @@ -514,7 +498,6 @@ class Heirs(dict, Logger): locktimes[locktime] = {key: value} else: locktimes[locktime][key] = value - print(2) return locktimes, onlyfixed def is_perc(self, key): @@ -582,11 +565,9 @@ class Heirs(dict, Logger): continue if locktimes: try: - print(3) txs = prepare_transactions( locktimes, available_utxos[:], fees, wallet ) - print(4) if not txs: return {} except Exception as e: diff --git a/qt.py b/qt.py index 1f3d0fb..86e1b35 100644 --- a/qt.py +++ b/qt.py @@ -22,6 +22,7 @@ except Exception: QT_VERSION = 6 if QT_VERSION == 5: + from PyQt5.QtCore import QThread, QCoreApplication from PyQt5.QtCore import ( QDateTime, QModelIndex, @@ -57,6 +58,7 @@ if QT_VERSION == 5: QWidget, ) else: # QT6 + from PyQt6.QtCore import QThread, QCoreApplication from PyQt6.QtCore import ( QDateTime, QModelIndex, @@ -779,7 +781,7 @@ class BalWindow(Logger): except AmountException as e: self.show_warning( _( - f"In the inheritance process, the entire wallet will always be fully emptied. Your settings require an adjustment of the amounts.\n{e}" + f"In the inheritance process, the entire wallet will always be fully emptied. Your settings require an adjustment of the amounts.{e}" ) ) except CheckAliveException: @@ -1030,7 +1032,18 @@ class BalWindow(Logger): ) def on_failure(err): + a,b,c = err self.logger.error(f"fail to broadcast transactions:{err}") + self.logger.error(f"error: {b}") + self.logger.error(f"traceback ") + tb = c + while tb is not None: + frame = tb.tb_frame + self.logger.error("file:", frame.f_code.co_filename) + self.logger.error("name:", frame.f_code.co_name) + self.logger.error("line:", tb.tb_lineno) + self.logger.error("lasti:", tb.tb_lasti) + tb = tb.tb_next task = partial(self.push_transactions_to_willexecutors, force) msg = _("Selecting Will-Executors") @@ -1040,7 +1053,7 @@ class BalWindow(Logger): self.waiting_dialog.exe() def push_transactions_to_willexecutors(self, force=False): - willexecutors = Willexecutors.get_willexecutor_transactions(self.bal_plugin, self.willitems) + willexecutors = Willexecutors.get_willexecutor_transactions(self.willitems) def getMsg(willexecutors): msg = "Broadcasting Transactions to Will-Executors:\n" @@ -2060,14 +2073,18 @@ class BalBuildWillDialog(BalDialog): parent = bal_window.window BalDialog.__init__(self, parent, bal_window.bal_plugin, _("Building Will")) self.parent = parent - self.updatemessage.connect(self.update) + self.updatemessage.connect(self.msg_update) self.bal_window = bal_window self.bal_plugin = bal_window.bal_plugin self.message_label = QLabel(_("Building Will:")) self.vbox = QVBoxLayout(self) - self.vbox.addWidget(self.message_label) - self.qwidget = QWidget() - self.vbox.addWidget(self.qwidget) + self.vbox.addWidget(self.message_label,0) + self.qwidget = QWidget(self) + self.vbox.addWidget(self.qwidget,1) + self.labelsbox=QVBoxLayout(self.qwidget) + self.setMinimumWidth(600) + self.setMinimumHeight(100) + self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred) self.labels = [] self.check_row = None self.inval_row = None @@ -2344,9 +2361,9 @@ class BalBuildWillDialog(BalDialog): def on_success_phase1(self, result): self.have_to_sign, tx = list(result) - if not tx: - self.msg_edit_row(self.msg_error("Error, no tx was built")) - return + #if not tx: + # self.msg_edit_row(self.msg_error("Error, no tx was built")) + # return _logger.debug("have to sign {}".format(self.have_to_sign)) password = None if self.have_to_sign is None: @@ -2438,7 +2455,10 @@ class BalBuildWillDialog(BalDialog): _logger.error(f"error phase1: {b}") def on_error_phase2(self, error): - _logger.error(f"error phase2: { error}") + self.bal_window.upade_all() + a,b,c = error + self.msg_edit_row(self.msg_error(f"Error: {b}")) + _logger.error(f"error phase2: {b}") def msg_set_checking(self, status="Waiting", row=None): row = self.check_row if row is None else row @@ -2490,10 +2510,11 @@ class BalBuildWillDialog(BalDialog): def msg_edit_row(self, line, row=None): try: self.labels[row] = line - except Exception: + except Exception as e: self.labels.append(line) row = len(self.labels) - 1 + self.updatemessage.emit() return row @@ -2505,13 +2526,22 @@ class BalBuildWillDialog(BalDialog): pass self.updatemessage.emit() - def update(self): - self.vbox.removeWidget(self.qwidget) - self.qwidget = QWidget(self) - labelsbox = QVBoxLayout(self.qwidget) + def clear_layout(self,layout): + while layout.count(): + item = layout.takeAt(0) + w = item.widget() + if w: + w.setParent(None) + w.deleteLater() + + def msg_update(self): + self.clear_layout(self.labelsbox) for label in self.labels: - labelsbox.addWidget(QLabel(label)) - self.vbox.addWidget(self.qwidget) + label=label.replace("\n","
") + qlabel=QLabel(label) + self.labelsbox.addWidget(QLabel(label),1) + self.setMinimumHeight(30*(len(self.labels)+2)) + def get_text(self): return self.message_label.text() diff --git a/willexecutors.py b/willexecutors.py index 24bd715..b86655d 100644 --- a/willexecutors.py +++ b/willexecutors.py @@ -295,7 +295,6 @@ class Willexecutors: return {} def check_transaction(txid, url): - print("check transaction", txid,url) _logger.debug(f"{url}:{txid}") try: w = Willexecutors.send_request(