checkalive sulla finestra will

This commit is contained in:
2026-04-10 16:02:40 -04:00
parent 56586ef0a7
commit a59b5c47b6
3 changed files with 94 additions and 40 deletions

122
qt.py
View File

@@ -404,9 +404,13 @@ class BalWindow(Logger):
self.bal_plugin.get_decimal_point = self.window.get_decimal_point
if self.window.wallet:
self.wallet = self.window.wallet
if not self.will_settings:
self.will_settings = self.wallet.db.get_dict("will_settings")
Util.fix_will_settings_tx_fees(self.will_settings)
self.heirs_tab = self.create_heirs_tab()
self.will_tab = self.create_will_tab()
self.wallet = self.window.wallet
self.heirs_tab.wallet = self.wallet
self.will_tab.wallet = self.wallet
@@ -732,6 +736,38 @@ class BalWindow(Logger):
def show_critical(self, text):
self.window.show_critical(text)
def update_locktime_widgets(self,locktime):
locktime = self.will_settings["locktime"] = (
locktime
if locktime
else "1y"
)
self.bal_plugin.WILL_SETTINGS.set(self.will_settings)
try:
self.heir_list_widget.heir_locktime.set_locktime(locktime)
except Exception as e:
print("error heir locktime",e)
pass
#self.preview_list.heirs_locktime.set_locktim(will_settings['thershold'])
def update_threshold_widgets(self,threshold):
threshold = self.will_settings["thershold"] = (
threshold
if threshold
else "1y"
)
self.bal_plugin.WILL_SETTINGS.set(self.will_settings)
try:
self.heir_list_widget.heir_threshold.set_locktime(threshold)
except Exception as e:
print("error heir threshold",e)
pass
try:
self.will_list.heir_threshold.set_locktime(threshold)
except Exception as e:
print("error will threshold",e)
pass
def init_heirs_to_locktime(self, multiverse=False):
for heir in self.heirs:
h = self.heirs[heir]
@@ -1872,12 +1908,7 @@ class BalWizardLocktimeAndFeeWidget(BalWizardWidget):
def on_heir_locktime():
if not self.heir_locktime.get_locktime():
self.heir_locktime.set_locktime("1y")
self.bal_window.will_settings["locktime"] = (
self.heir_locktime.get_locktime()
if self.heir_locktime.get_locktime()
else "1y"
)
self.bal_window.bal_plugin.WILL_SETTINGS.set(self.bal_window.will_settings)
self.bal_window.update_locktime_widgets(self.heir_locktime.get_locktime())
self.heir_locktime.valueEdited.connect(on_heir_locktime)
@@ -1887,11 +1918,7 @@ class BalWizardLocktimeAndFeeWidget(BalWizardWidget):
def on_heir_threshold():
if not self.heir_threshold.get_locktime():
self.heir_threshold.set_locktime("180d")
self.bal_window.will_settings["threshold"] = (
self.heir_threshold.get_locktime()
)
self.bal_window.bal_plugin.WILL_SETTINGS.set(self.bal_window.will_settings)
self.bal_window.update_threshold_widgets(self.heir_threshold.get_locktime())
self.heir_threshold.valueEdited.connect(on_heir_threshold)
@@ -2150,15 +2177,12 @@ class BalBuildWillDialog(BalDialog):
_logger.debug("variables ok")
self.msg_set_status("checking variables:", varrow, "Ok", self.COLOR_OK)
except AmountException:
self.msg_set_status(
"checking variables",
varrow,
_(
self.msg_set_checking(
self.msg_warning(
"In the inheritance process, "
+ "the entire wallet will always be fully emptied. \n"
+ "Your settings require an adjustment of the amounts"
),
self.COLOR_WARNING,
)
)
self.msg_set_checking()
@@ -2749,32 +2773,28 @@ class HeirListWidget(MyTreeView, MessageBoxMixin):
menu.addAction(_("Import"), self.bal_window.import_heirs)
menu.addAction(_("Export"), lambda: self.bal_window.export_heirs())
self.heir_locktime = HeirsLockTimeEdit(self, 0)
threshold = self.bal_window.will_settings.get('threshold',None) if self.bal_window.will_settings else self.bal_window.window.wallet.db.get_dict("will_settings")['threshold']
locktime = self.bal_window.will_settings.get('locktime',None) if self.bal_window.will_settings else self.bal_window.window.wallet.db.get_dict("will_settings")['locktime']
self.heir_locktime = HeirsLockTimeEdit(self, 0)
def on_heir_locktime():
if not self.heir_locktime.get_locktime():
self.heir_locktime.set_locktime("1y")
self.bal_window.will_settings["locktime"] = (
self.heir_locktime.get_locktime()
if self.heir_locktime.get_locktime()
else "1y"
)
self.bal_window.bal_plugin.WILL_SETTINGS.set(self.bal_window.will_settings)
self.bal_window.update_locktime_widgets(self.heir_locktime.get_locktime())
self.heir_locktime.valueEdited.connect(on_heir_locktime)
self.heir_locktime.set_locktime(locktime)
self.heir_threshold = HeirsLockTimeEdit(self, 0)
def on_heir_threshold():
if not self.heir_threshold.get_locktime():
self.heir_threshold.set_locktime("180d")
self.bal_window.will_settings["threshold"] = (
self.heir_threshold.get_locktime()
)
self.bal_window.bal_plugin.WILL_SETTINGS.set(self.bal_window.will_settings)
self.bal_window.update_threshold_widgets(self.heir_threshold.get_locktime())
self.heir_threshold.valueEdited.connect(on_heir_threshold)
self.heir_threshold.set_locktime(threshold)
self.heir_tx_fees = QSpinBox()
self.heir_tx_fees.setMinimum(1)
@@ -3059,6 +3079,21 @@ class PreviewList(MyTreeView):
menu.addAction(_("Check"), self.check)
menu.addAction(_("Invalidate"), self.invalidate_will)
def make_hlayout(label, twidget, help_text):
tw = QWidget()
hlayout = QHBoxLayout(tw)
hlayout.addWidget(QLabel(label))
hlayout.addWidget(twidget)
hlayout.addWidget(HelpButton(help_text))
hlayout.addStretch(1)
spacer_widget = QWidget()
spacer_widget.setSizePolicy(
QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding
)
hlayout.addWidget(spacer_widget)
return tw
wizard = QPushButton(_("Setup Wizard"))
wizard.clicked.connect(self.bal_window.init_wizard)
#display = QPushButton(_("Display"))
@@ -3069,6 +3104,33 @@ class PreviewList(MyTreeView):
widget = QWidget()
hlayout = QHBoxLayout(widget)
hlayout.addWidget(QLabel(_("Check Alive:")))
threshold = self.bal_window.will_settings.get('threshold',None) if self.bal_window.will_settings else self.bal_window.window.wallet.db.get_dict("will_settings")['threshold']
self.heir_threshold = HeirsLockTimeEdit(widget, 0)
self.heir_threshold.set_locktime(threshold)
def on_heir_threshold():
if not self.heir_threshold.get_locktime():
self.heir_threshold.set_locktime("180d")
print("no threshold")
self.bal_window.update_threshold_widgets(self.heir_threshold.get_locktime())
self.heir_threshold.valueEdited.connect(on_heir_threshold)
hlayout.addWidget(self.heir_threshold)
hlayout.addWidget(
HelpButton(
_(
"Check to ask for invalidation.\n"
+ "When less then this time is missing, ask to invalidate.\n"
+ "If you fail to invalidate during this time, your transactions will be delivered to your heirs.\n"
+ "if you choose Raw, you can insert various options based on suffix:\n"
+ " - d: number of days after current day(ex: 1d means tomorrow).\n"
+ " - y: number of years after currrent day(ex: 1y means one year from today).\n\n"
)
)
)
hlayout.addWidget(wizard)
hlayout.addWidget(refresh)
toolbar.insertWidget(2, widget)