will settings widget improved

export event to calendar
bug fixes
This commit is contained in:
2026-05-09 02:29:09 -04:00
parent b5eda4f05a
commit 861355393d
4 changed files with 807 additions and 585 deletions

View File

@@ -1 +0,0 @@

61
bal.py
View File

@@ -107,6 +107,8 @@ class BalPlugin(BasePlugin):
self.ALLOW_REPUSH = BalConfig(config, "bal_allow_repush", True)
self.FIRST_EXECUTION = BalConfig(config, "bal_first_execution", True)
self.WELIST_SERVER = BalConfig(config,"bal_welist_server","https://welist.bitcoin-after.life/")
self.EVENT_DESCRIPTION = BalConfig(config,"bal_event_description", "Will execution for $wallet_name\n $heirs_complete\n")
self.EVENT_SUMMARY = BalConfig(config,"bal_event_summary", "Will execution of $wallet_name\n")
self.WILLEXECUTORS = BalConfig(
config,
"bal_willexecutors",
@@ -184,9 +186,62 @@ class BalPlugin(BasePlugin):
@staticmethod
def default_will_settings():
will_settings ={"baltx_fees":100}
will_settings.update(BalPlugin.default_will_settings_absolute())
return will_settings
@staticmethod
def default_will_settings_absolute():
relative_dates=BalPlugin.default_will_settings_relative()
today = date.today()
dt = datetime(today.year, today.month, today.day, 0, 0, 0)
threshold =(dt + timedelta(days=180)).timestamp()
locktime =(dt + timedelta(days=365)).timestamp()
threshold =(dt + timedelta(days=BalTimestamp(relative_dates["threshold"]).duration_to_days())).timestamp()
locktime =(dt + timedelta(days=BalTimestamp(relative_dates["locktime"]).duration_to_days())).timestamp()
return {"threshold": threshold, "locktime": locktime}
@staticmethod
def default_will_settings_relative():
return {"threshold" : "30d", "locktime": "1y"}
return {"baltx_fees": 100, "threshold": threshold, "locktime": locktime}
class BalTimestamp:
value = None
unit = None
def __init__(self,value):
str_value = str(value)
if str_value and str_value[-1].lower() in ("y","d"):
self.value = int(str_value[:-1])
self.unit = str_value[-1]
else:
try:
self.value = int(value)
except Exception as _e:
self.value=1
self.unit = None
def duration_to_days(self):
return self.value*365 if self.unit=='y' else self.value
def to_date(self,from_date=None,reverse=False):
if self.unit is None:
return datetime.fromtimestamp(self.value)
else:
if from_date is None:
from_date = datetime.now()
if isinstance(from_date, (int, float)):
from_date = datetime.fromtimestamp(from_date)
reverse = 1 if not reverse else -1
return (from_date + (reverse * timedelta(days = self.duration_to_days()))).replace(hour=0,minute=0,second=0,microsecond=0)
def to_timestamp(self,from_date=None,reverse=False):
return self.to_date(from_date,reverse).timestamp()
def __str__(self):
if self.unit is None:
return datetime.fromtimestamp(self.value).isoformat()
else:
return f"{self.value}{self.unit}"
def __repr__(self):
if self.unit is None:
return datetime.fromtimestamp(self.value).to_date().timestamp()
else:
return f"{self.value}{self.unit}"

1328
qt.py

File diff suppressed because it is too large Load Diff

View File

@@ -526,7 +526,7 @@ class Will:
@staticmethod
def get_min_locktime(will,default_value=None):
return min((v.tx.locktime for v in will.values() if v.get_status('VALID')), default=default_value)
return min((v.tx.locktime for v in will.values() if v.get_status('VALID')), default=default_value)