This commit is contained in:
2026-05-10 11:24:03 -04:00
parent b87e55c10f
commit fbfe0a1966

41
qt.py
View File

@@ -1284,7 +1284,7 @@ class BalTxFeesWidget(QWidget):
#label = ClickableLabel("") #label = ClickableLabel("")
#label.doubleClicked.connect(self.doubleclick) #label.doubleClicked.connect(self.doubleclick)
#layout.addWidget(label) #layout.addWidget(label)
button = HelpButton(_("mining fees expressed in sats/vbyte to be used in the bitcooin transaction.\nHigher value ensure your transaction will be confirmed")) button = HelpButton(_("mining fees expressed in sats/vbyte to be used in the Bitcoin transaction.\nHigher value ensure your transaction will be confirmed"))
button.setText("") button.setText("")
button.setStyleSheet("font-size: 16px;") button.setStyleSheet("font-size: 16px;")
layout.addWidget(button) layout.addWidget(button)
@@ -1408,7 +1408,7 @@ class BalTimeEditWidget(QWidget, _LockTimeEditor):
#hbox.addWidget(QLabel(self.label_text)) #hbox.addWidget(QLabel(self.label_text))
help_button=HelpButton(self.help_text) help_button=HelpButton(self.help_text)
help_button.setText(self.label_text) help_button.setText(self.label_text)
help_button.setStyleSheet("font-size: 17px;"); help_button.setStyleSheet("font-size: 16px;");
hbox.addWidget(help_button) hbox.addWidget(help_button)
self.combo.currentIndexChanged.connect(self.on_current_index_changed) self.combo.currentIndexChanged.connect(self.on_current_index_changed)
@@ -1728,10 +1728,12 @@ class WillSettingsWidget(QWidget):
days_difference = (locktime - threshold).days days_difference = (locktime - threshold).days
heirs_details = "\r\n".join(f" {heir} - {self.bal_window.heirs[heir][0]}, {self.bal_window.heirs[heir][1]}" for heir in self.bal_window.heirs) heirs_details = "\r\n".join(f" {heir} - {self.bal_window.heirs[heir][0]}, {self.bal_window.heirs[heir][1]}" for heir in self.bal_window.heirs)
print("heirs",heirs_details)
event_description = BalCalendar.ical_escape( event_description = BalCalendar.ical_escape(
f"{self.bal_window.bal_plugin.EVENT_DESCRIPTION.get()}".replace("$wallet_name",str(self.bal_window.wallet)).replace("$heirs_complete",heirs_details) f"{self.bal_window.bal_plugin.EVENT_DESCRIPTION.get()}".replace("$wallet_name",str(self.bal_window.wallet)).replace("$heirs_complete",heirs_details)
) )
event_description =f"{event_description}{heirs_details}" #event_description =f"{event_description}{heirs_details}"
print("event description",event_description)
uid = f"bal-{str(self.bal_window.wallet)}" uid = f"bal-{str(self.bal_window.wallet)}"
summary = BalCalendar.ical_escape( summary = BalCalendar.ical_escape(
f"{self.bal_window.bal_plugin.EVENT_SUMMARY.get()}".replace("$wallet_name",str(self.bal_window.wallet)) f"{self.bal_window.bal_plugin.EVENT_SUMMARY.get()}".replace("$wallet_name",str(self.bal_window.wallet))
@@ -1755,6 +1757,7 @@ class WillSettingsWidget(QWidget):
]) ])
ics_content = "\r\n".join(lines) + "\r\n" ics_content = "\r\n".join(lines) + "\r\n"
print(ics_content)
self.temp_path = BalCalendar.write_temp_ics(ics_content) self.temp_path = BalCalendar.write_temp_ics(ics_content)
opened = BalCalendar.open_with_default_app( opened = BalCalendar.open_with_default_app(
self.bal_window.bal_plugin.CALENDAR_APP.get(), self.temp_path self.bal_window.bal_plugin.CALENDAR_APP.get(), self.temp_path
@@ -4047,12 +4050,36 @@ class BalCalendar:
@staticmethod @staticmethod
def ical_escape(text: str) -> str: def ical_escape(text: str) -> str:
# escape per RFC5545: backslash, ; , newlines # escape per RFC5545: backslash, ; , newlines
text = text.encode("utf-8")
text = ( text = (
text.replace("\\", "\\\\") text.replace(b"\\", b"\\\\")
.replace(";", r"\;") .replace(b";", b"\\;")
.replace(",", r"\,") .replace(b",", b"\\,")
) )
return BalCalendar.fold_ical_line(text) print("escaped",text)
out =""
temp=text.split(b"\r\n")
print("temp",temp)
for s in temp:
encoded= s
print("encoded",encoded)
cut =0
while len(encoded) >75:
cut+=5
encoded=f"{s[:len(s)-cut]}"
print("encoded -1",encoded[-1])
if encoded[-1]==b"\\" and encoded[-2]!=b"\\\\":
cut += 1
encoded=f"{s[:len(s)-cut]}"
encoded=f"{encoded}...\r\n".encode("utf-8")
print("cut",encoded,cut)
if cut>0:
out+=str(f"{s[:len(s)-cut].decode()}...\r\n")
else:
out+=str(f"{s.decode()}\r\n")
print("out",out)
return out[:-2]
@staticmethod @staticmethod
def fold_ical_line(line: str, limit: int = 75) -> str: def fold_ical_line(line: str, limit: int = 75) -> str: