balconfig

This commit is contained in:
2025-08-11 16:44:55 -04:00
parent a7b778e0b2
commit d6b37005e8
6 changed files with 135 additions and 110 deletions

43
qt.py
View File

@@ -446,14 +446,14 @@ class Plugin(BalPlugin,Logger):
lbl_logo = QLabel()
lbl_logo.setPixmap(qicon)
heir_ping_willexecutors = bal_checkbox(self, BalPlugin.PING_WILLEXECUTORS)
heir_ask_ping_willexecutors = bal_checkbox(self, BalPlugin.ASK_PING_WILLEXECUTORS)
heir_no_willexecutor = bal_checkbox(self, BalPlugin.NO_WILLEXECUTOR)
heir_ping_willexecutors = bal_checkbox(self.PING_WILLEXECUTORS)
heir_ask_ping_willexecutors = bal_checkbox(self.ASK_PING_WILLEXECUTORS)
heir_no_willexecutor = bal_checkbox(self.NO_WILLEXECUTOR)
heir_hide_replaced = bal_checkbox(self,BalPlugin.HIDE_REPLACED,self)
heir_hide_replaced = bal_checkbox(self.HIDE_REPLACED,self)
heir_hide_invalidated = bal_checkbox(self,BalPlugin.HIDE_INVALIDATED,self)
heir_hide_invalidated = bal_checkbox(self.HIDE_INVALIDATED,self)
heir_repush = QPushButton("Rebroadcast transactions")
heir_repush.clicked.connect(partial(self.broadcast_transactions,True))
grid=QGridLayout(d)
@@ -641,13 +641,13 @@ class BalWindow(Logger):
except Exception as e:
self.show_error(str(e))
def export_inheritance_handler(self,path):
txs = self.build_inheritance_transaction(ignore_duplicate=True, keep_original=False)
with open(path,"w") as f:
for tx in txs:
tx['status']+="."+BalPlugin.STATUS_EXPORTED
f.write(str(tx['tx']))
f.write('\n')
#def export_inheritance_handler(self,path):
# txs = self.build_inheritance_transaction(ignore_duplicate=True, keep_original=False)
# with open(path,"w") as f:
# for tx in txs:
# tx['status']+="."+BalPlugin.STATUS_EXPORTED
# f.write(str(tx['tx']))
# f.write('\n')
def set_heir(self,heir):
heir=list(heir)
@@ -750,10 +750,10 @@ class BalWindow(Logger):
try:
self.date_to_check = Util.parse_locktime_string(self.will_settings['threshold'])
found = False
self.locktime_blocks=self.bal_plugin.config_get(BalPlugin.LOCKTIME_BLOCKS)
self.locktime_blocks=self.bal_plugin.LOCKTIME_BLOCKS.get()
self.current_block = Util.get_current_height(self.wallet.network)
self.block_to_check = self.current_block + self.locktime_blocks
self.no_willexecutor = self.bal_plugin.config_get(BalPlugin.NO_WILLEXECUTOR)
self.no_willexecutor = self.bal_plugin.NO_WILLEXECUTOR.get()
self.willexecutors = Willexecutors.get_willexecutors(self.bal_plugin,update=True,bal_window=self,task=False)
self.init_heirs_to_locktime()
@@ -1511,12 +1511,12 @@ class BalBlockingWaitingDialog(BalDialog):
self.accept()
class bal_checkbox(QCheckBox):
def __init__(self, plugin,variable,window=None):
def __init__(self, variable,window=None):
QCheckBox.__init__(self)
self.setChecked(plugin.config_get(variable))
self.setChecked(variable.get())
def on_check(v):
plugin.config.set_key(variable, v == 2)
plugin.config_get(variable)
variable.set(v == 2)
variable.get()
self.stateChanged.connect(on_check)
@@ -2584,8 +2584,10 @@ class WillExecutorList(MyTreeView):
for k in selected_keys:
wout[k]=self.parent.willexecutors_list[k]
self.parent.update_willexecutors(wout)
self.update()
def get_edit_key_from_coordinate(self, row, col):
a= self.get_role_data_from_coordinate(row, col, role=self.ROLE_HEIR_KEY+col)
return a
@@ -2625,6 +2627,7 @@ class WillExecutorList(MyTreeView):
pass
def update(self):
if self.parent.willexecutors_list is None:
return
try:
@@ -2676,7 +2679,9 @@ class WillExecutorList(MyTreeView):
idx = self.model().index(row_count, self.Columns.NAME)
set_current = QPersistentModelIndex(idx)
self.set_current_idx(set_current)
self.parent.save_willexecutors()
except Exception as e:
_logger.error(e)
@@ -2779,5 +2784,5 @@ class WillExecutorDialog(BalDialog,MessageBoxMixin):
event.accept()
def save_willexecutors(self):
self.bal_plugin.config.set_key(self.bal_plugin.WILLEXECUTORS,self.willexecutors_list,save=True)
self.bal_plugin.WILLEXECUTORS.set(self.willexecutors_list)