Compare commits
8 Commits
v0.2.3
...
2a4eab81fd
| Author | SHA1 | Date | |
|---|---|---|---|
|
2a4eab81fd
|
|||
|
d86b941fcb
|
|||
|
1836cdd892
|
|||
|
2416d0ce8d
|
|||
|
8e4e401d1b
|
|||
|
b8859ee5c1
|
|||
|
faeff1ff3c
|
|||
|
437105477d
|
18
bal.py
18
bal.py
@@ -68,15 +68,9 @@ class BalPlugin(BasePlugin):
|
|||||||
self.base_dir = os.path.join(config.electrum_path(), "bal")
|
self.base_dir = os.path.join(config.electrum_path(), "bal")
|
||||||
self.plugin_dir = os.path.split(os.path.realpath(__file__))[0]
|
self.plugin_dir = os.path.split(os.path.realpath(__file__))[0]
|
||||||
zipfile = "/".join(self.plugin_dir.split("/")[:-1])
|
zipfile = "/".join(self.plugin_dir.split("/")[:-1])
|
||||||
# print("real path",os.path.realpath(__file__))
|
|
||||||
# self.logger.info(self.base_dir)
|
|
||||||
# print("base_dir:", self.base_dir)
|
|
||||||
# print("suca:",zipfile)
|
|
||||||
# print("plugin_dir:", self.plugin_dir)
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.insert(0, zipfile)
|
sys.path.insert(0, zipfile)
|
||||||
# print("sono state listate?")
|
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.config = config
|
self.config = config
|
||||||
self.name = name
|
self.name = name
|
||||||
@@ -96,10 +90,10 @@ class BalPlugin(BasePlugin):
|
|||||||
self.PREVIEW = BalConfig(config, "bal_preview", True)
|
self.PREVIEW = BalConfig(config, "bal_preview", True)
|
||||||
self.SAVE_TXS = BalConfig(config, "bal_save_txs", True)
|
self.SAVE_TXS = BalConfig(config, "bal_save_txs", True)
|
||||||
self.WILLEXECUTORS = BalConfig(config, "bal_willexecutors", True)
|
self.WILLEXECUTORS = BalConfig(config, "bal_willexecutors", True)
|
||||||
self.PING_WILLEXECUTORS = BalConfig(config, "bal_ping_willexecutors", True)
|
#self.PING_WILLEXECUTORS = BalConfig(config, "bal_ping_willexecutors", True)
|
||||||
self.ASK_PING_WILLEXECUTORS = BalConfig(
|
#self.ASK_PING_WILLEXECUTORS = BalConfig(
|
||||||
config, "bal_ask_ping_willexecutors", True
|
# config, "bal_ask_ping_willexecutors", True
|
||||||
)
|
#)
|
||||||
self.NO_WILLEXECUTOR = BalConfig(config, "bal_no_willexecutor", True)
|
self.NO_WILLEXECUTOR = BalConfig(config, "bal_no_willexecutor", True)
|
||||||
self.HIDE_REPLACED = BalConfig(config, "bal_hide_replaced", True)
|
self.HIDE_REPLACED = BalConfig(config, "bal_hide_replaced", True)
|
||||||
self.HIDE_INVALIDATED = BalConfig(config, "bal_hide_invalidated", True)
|
self.HIDE_INVALIDATED = BalConfig(config, "bal_hide_invalidated", True)
|
||||||
@@ -145,13 +139,11 @@ class BalPlugin(BasePlugin):
|
|||||||
self.HIDE_REPLACED.set(self._hide_replaced)
|
self.HIDE_REPLACED.set(self._hide_replaced)
|
||||||
|
|
||||||
def validate_will_settings(self, will_settings):
|
def validate_will_settings(self, will_settings):
|
||||||
# print(type(will_settings))
|
|
||||||
# print(will_settings.get('baltx_fees',1),1)
|
|
||||||
if int(will_settings.get("baltx_fees", 1)) < 1:
|
if int(will_settings.get("baltx_fees", 1)) < 1:
|
||||||
will_settings["baltx_fees"] = 1
|
will_settings["baltx_fees"] = 1
|
||||||
if not will_settings.get("threshold"):
|
if not will_settings.get("threshold"):
|
||||||
will_settings["threshold"] = "180d"
|
will_settings["threshold"] = "180d"
|
||||||
if not will_settings.get("locktime") == "":
|
if not will_settings.get("locktime"):
|
||||||
will_settings["locktime"] = "1y"
|
will_settings["locktime"] = "1y"
|
||||||
return will_settings
|
return will_settings
|
||||||
|
|
||||||
|
|||||||
BIN
icons/confirmed.png
Normal file
BIN
icons/confirmed.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
BIN
icons/status_connected.png
Normal file
BIN
icons/status_connected.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
BIN
icons/unconfirmed.png
Normal file
BIN
icons/unconfirmed.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "BAL",
|
"name": "BAL",
|
||||||
"fullname": "Bitcoin After Life",
|
"fullname": "Bitcoin After Life",
|
||||||
"description": "Provides free and decentralized inheritance support<br> Version: 0.2.3",
|
"description": "Provides free and decentralized inheritance support<br> Version: 0.2.4",
|
||||||
"author":"Svatantrya",
|
"author":"Svatantrya",
|
||||||
"available_for": ["qt"],
|
"available_for": ["qt"],
|
||||||
"icon":"icons/bal32x32.png"
|
"icon":"icons/bal32x32.png"
|
||||||
|
|||||||
169
qt.py
169
qt.py
@@ -295,8 +295,8 @@ class Plugin(BalPlugin, Logger):
|
|||||||
lbl_logo = QLabel()
|
lbl_logo = QLabel()
|
||||||
lbl_logo.setPixmap(qicon)
|
lbl_logo.setPixmap(qicon)
|
||||||
|
|
||||||
heir_ping_willexecutors = bal_checkbox(self.PING_WILLEXECUTORS)
|
#heir_ping_willexecutors = bal_checkbox(self.PING_WILLEXECUTORS)
|
||||||
heir_ask_ping_willexecutors = bal_checkbox(self.ASK_PING_WILLEXECUTORS)
|
#heir_ask_ping_willexecutors = bal_checkbox(self.ASK_PING_WILLEXECUTORS)
|
||||||
heir_no_willexecutor = bal_checkbox(self.NO_WILLEXECUTOR)
|
heir_no_willexecutor = bal_checkbox(self.NO_WILLEXECUTOR)
|
||||||
|
|
||||||
def on_multiverse_change():
|
def on_multiverse_change():
|
||||||
@@ -327,27 +327,27 @@ class Plugin(BalPlugin, Logger):
|
|||||||
2,
|
2,
|
||||||
"Hide invalidated transactions from will detail and list",
|
"Hide invalidated transactions from will detail and list",
|
||||||
)
|
)
|
||||||
add_widget(
|
#add_widget(
|
||||||
grid,
|
# grid,
|
||||||
"Ping Willexecutors",
|
# "Ping Willexecutors",
|
||||||
heir_ping_willexecutors,
|
# heir_ping_willexecutors,
|
||||||
3,
|
# 3,
|
||||||
"Ping willexecutors to get payment info before compiling will",
|
# "Ping willexecutors to get payment info before compiling will",
|
||||||
)
|
#)
|
||||||
add_widget(
|
#add_widget(
|
||||||
grid,
|
# grid,
|
||||||
" - Ask before",
|
# " - Ask before",
|
||||||
heir_ask_ping_willexecutors,
|
# heir_ask_ping_willexecutors,
|
||||||
4,
|
# 4,
|
||||||
"Ask before to ping willexecutor",
|
# "Ask before to ping willexecutor",
|
||||||
)
|
#)
|
||||||
add_widget(
|
#add_widget(
|
||||||
grid,
|
# grid,
|
||||||
"Backup Transaction",
|
# "Backup Transaction",
|
||||||
heir_no_willexecutor,
|
# heir_no_willexecutor,
|
||||||
5,
|
# 5,
|
||||||
"Add transactions without willexecutor",
|
# "Add transactions without willexecutor",
|
||||||
)
|
#)
|
||||||
# add_widget(grid,"Enable Multiverse(EXPERIMENTAL/BROKEN)",heir_enable_multiverse,6,"enable multiple locktimes, will import.... ")
|
# add_widget(grid,"Enable Multiverse(EXPERIMENTAL/BROKEN)",heir_enable_multiverse,6,"enable multiple locktimes, will import.... ")
|
||||||
grid.addWidget(heir_repush, 7, 0)
|
grid.addWidget(heir_repush, 7, 0)
|
||||||
grid.addWidget(
|
grid.addWidget(
|
||||||
@@ -401,13 +401,13 @@ class BalWindow(Logger):
|
|||||||
self.willitems = {}
|
self.willitems = {}
|
||||||
self.willexecutors = {}
|
self.willexecutors = {}
|
||||||
self.will_settings = None
|
self.will_settings = None
|
||||||
self.heirs_tab = self.create_heirs_tab()
|
|
||||||
self.will_tab = self.create_will_tab()
|
|
||||||
self.ok = False
|
self.ok = False
|
||||||
self.disable_plugin = True
|
self.disable_plugin = True
|
||||||
self.bal_plugin.get_decimal_point = self.window.get_decimal_point
|
self.bal_plugin.get_decimal_point = self.window.get_decimal_point
|
||||||
|
|
||||||
if self.window.wallet:
|
if self.window.wallet:
|
||||||
|
self.heirs_tab = self.create_heirs_tab()
|
||||||
|
self.will_tab = self.create_will_tab()
|
||||||
self.wallet = self.window.wallet
|
self.wallet = self.window.wallet
|
||||||
self.heirs_tab.wallet = self.wallet
|
self.heirs_tab.wallet = self.wallet
|
||||||
self.will_tab.wallet = self.wallet
|
self.will_tab.wallet = self.wallet
|
||||||
@@ -419,7 +419,7 @@ class BalWindow(Logger):
|
|||||||
tab.tab_icon = icon
|
tab.tab_icon = icon
|
||||||
tab.tab_description = description
|
tab.tab_description = description
|
||||||
tab.tab_pos = len(tabs)
|
tab.tab_pos = len(tabs)
|
||||||
if tab.is_shown_cv:
|
if tab.is_shown_cv.get():
|
||||||
tabs.addTab(tab, icon, description.replace("&", ""))
|
tabs.addTab(tab, icon, description.replace("&", ""))
|
||||||
|
|
||||||
def add_toggle_action(tab):
|
def add_toggle_action(tab):
|
||||||
@@ -498,7 +498,6 @@ class BalWindow(Logger):
|
|||||||
if not self.will_settings:
|
if not self.will_settings:
|
||||||
Util.copy(self.will_settings, self.bal_plugin.default_will_settings())
|
Util.copy(self.will_settings, self.bal_plugin.default_will_settings())
|
||||||
self.logger.debug("not_will_settings {}".format(self.will_settings))
|
self.logger.debug("not_will_settings {}".format(self.will_settings))
|
||||||
|
|
||||||
self.bal_plugin.validate_will_settings(self.will_settings)
|
self.bal_plugin.validate_will_settings(self.will_settings)
|
||||||
self.heir_list.update_will_settings()
|
self.heir_list.update_will_settings()
|
||||||
|
|
||||||
@@ -514,7 +513,7 @@ class BalWindow(Logger):
|
|||||||
self.heir_list = l = HeirList(self, self.window)
|
self.heir_list = l = HeirList(self, self.window)
|
||||||
|
|
||||||
tab = self.window.create_list_tab(l)
|
tab = self.window.create_list_tab(l)
|
||||||
tab.is_shown_cv = shown_cv(True)
|
tab.is_shown_cv = shown_cv(False)
|
||||||
return tab
|
return tab
|
||||||
|
|
||||||
def create_will_tab(self):
|
def create_will_tab(self):
|
||||||
@@ -523,6 +522,7 @@ class BalWindow(Logger):
|
|||||||
tab.is_shown_cv = shown_cv(True)
|
tab.is_shown_cv = shown_cv(True)
|
||||||
return tab
|
return tab
|
||||||
|
|
||||||
|
|
||||||
def new_heir_dialog(self, heir_key=None):
|
def new_heir_dialog(self, heir_key=None):
|
||||||
heir = self.heirs.get(heir_key)
|
heir = self.heirs.get(heir_key)
|
||||||
title = "New heir"
|
title = "New heir"
|
||||||
@@ -655,7 +655,6 @@ class BalWindow(Logger):
|
|||||||
Will.normalize_will(self.willitems, self.wallet)
|
Will.normalize_will(self.willitems, self.wallet)
|
||||||
|
|
||||||
def build_will(self, ignore_duplicate=True, keep_original=True):
|
def build_will(self, ignore_duplicate=True, keep_original=True):
|
||||||
|
|
||||||
will = {}
|
will = {}
|
||||||
willtodelete = []
|
willtodelete = []
|
||||||
willtoappend = {}
|
willtoappend = {}
|
||||||
@@ -664,7 +663,6 @@ class BalWindow(Logger):
|
|||||||
self.willexecutors = Willexecutors.get_willexecutors(
|
self.willexecutors = Willexecutors.get_willexecutors(
|
||||||
self.bal_plugin, update=False, bal_window=self
|
self.bal_plugin, update=False, bal_window=self
|
||||||
)
|
)
|
||||||
|
|
||||||
if not self.no_willexecutor:
|
if not self.no_willexecutor:
|
||||||
|
|
||||||
f = False
|
f = False
|
||||||
@@ -1577,7 +1575,7 @@ class BalWizardDialog(BalDialog):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def on_next_we(self):
|
def on_next_we(self):
|
||||||
close_window = BalBuildWillDialog(self.bal_window, self)
|
close_window = BalBuildWillDialog(self.bal_window)
|
||||||
close_window.build_will_task()
|
close_window.build_will_task()
|
||||||
self.close()
|
self.close()
|
||||||
# self.next_widget(BalWizardLocktimeAndFeeWidget(self.bal_window,self,self.on_next_locktimeandfee,self.on_next_wedonwload,self.on_next_wedonwload.on_cancel_heir))
|
# self.next_widget(BalWizardLocktimeAndFeeWidget(self.bal_window,self,self.on_next_locktimeandfee,self.on_next_wedonwload,self.on_next_wedonwload.on_cancel_heir))
|
||||||
@@ -1687,7 +1685,7 @@ class BalWizardHeirsWidget(BalWizardWidget):
|
|||||||
button_import = QPushButton(_("Import"))
|
button_import = QPushButton(_("Import"))
|
||||||
button_import.clicked.connect(self.import_from_file)
|
button_import.clicked.connect(self.import_from_file)
|
||||||
button_export = QPushButton(_("Export"))
|
button_export = QPushButton(_("Export"))
|
||||||
button_import.clicked.connect(self.export_to_file)
|
button_export.clicked.connect(self.export_to_file)
|
||||||
widget = QWidget()
|
widget = QWidget()
|
||||||
vbox = QVBoxLayout(widget)
|
vbox = QVBoxLayout(widget)
|
||||||
vbox.addWidget(self.heirs_list)
|
vbox.addWidget(self.heirs_list)
|
||||||
@@ -1759,7 +1757,7 @@ class BalWizardWEDownloadWidget(BalWizardWidget):
|
|||||||
|
|
||||||
def on_success(willexecutors):
|
def on_success(willexecutors):
|
||||||
self.bal_window.willexecutors.update(willexecutors)
|
self.bal_window.willexecutors.update(willexecutors)
|
||||||
self.bal_window.ping_willexecutors(self.bal_window.willexecutors)
|
self.bal_window.ping_willexecutors(self.bal_window.willexecutors,False)
|
||||||
if index < 1:
|
if index < 1:
|
||||||
for we in self.bal_window.willexecutors:
|
for we in self.bal_window.willexecutors:
|
||||||
if self.bal_window.willexecutors[we]["status"] == 200:
|
if self.bal_window.willexecutors[we]["status"] == 200:
|
||||||
@@ -1820,6 +1818,7 @@ class BalWizardLocktimeAndFeeWidget(BalWizardWidget):
|
|||||||
widget = QWidget()
|
widget = QWidget()
|
||||||
self.heir_locktime = HeirsLockTimeEdit(widget, 0)
|
self.heir_locktime = HeirsLockTimeEdit(widget, 0)
|
||||||
will_settings = self.bal_window.bal_plugin.WILL_SETTINGS.get()
|
will_settings = self.bal_window.bal_plugin.WILL_SETTINGS.get()
|
||||||
|
will_settings = self.bal_window.will_settings
|
||||||
self.heir_locktime.set_locktime(will_settings["locktime"])
|
self.heir_locktime.set_locktime(will_settings["locktime"])
|
||||||
|
|
||||||
def on_heir_locktime():
|
def on_heir_locktime():
|
||||||
@@ -1829,6 +1828,7 @@ class BalWizardLocktimeAndFeeWidget(BalWizardWidget):
|
|||||||
self.heir_locktime.get_locktime()
|
self.heir_locktime.get_locktime()
|
||||||
if self.heir_locktime.get_locktime()
|
if self.heir_locktime.get_locktime()
|
||||||
else "1y"
|
else "1y"
|
||||||
|
|
||||||
)
|
)
|
||||||
self.bal_window.bal_plugin.WILL_SETTINGS.set(self.bal_window.will_settings)
|
self.bal_window.bal_plugin.WILL_SETTINGS.set(self.bal_window.will_settings)
|
||||||
|
|
||||||
@@ -1846,6 +1846,7 @@ class BalWizardLocktimeAndFeeWidget(BalWizardWidget):
|
|||||||
)
|
)
|
||||||
self.bal_window.bal_plugin.WILL_SETTINGS.set(self.bal_window.will_settings)
|
self.bal_window.bal_plugin.WILL_SETTINGS.set(self.bal_window.will_settings)
|
||||||
|
|
||||||
|
|
||||||
self.heir_threshold.valueEdited.connect(on_heir_threshold)
|
self.heir_threshold.valueEdited.connect(on_heir_threshold)
|
||||||
|
|
||||||
self.heir_tx_fees = QSpinBox(widget)
|
self.heir_tx_fees = QSpinBox(widget)
|
||||||
@@ -2028,6 +2029,7 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
if not parent:
|
if not parent:
|
||||||
parent = bal_window.window
|
parent = bal_window.window
|
||||||
BalDialog.__init__(self, parent, bal_window.bal_plugin, "Building Will")
|
BalDialog.__init__(self, parent, bal_window.bal_plugin, "Building Will")
|
||||||
|
self.parent=parent
|
||||||
self.updatemessage.connect(self.update)
|
self.updatemessage.connect(self.update)
|
||||||
self.bal_window = bal_window
|
self.bal_window = bal_window
|
||||||
self.message_label = QLabel("Building Will:")
|
self.message_label = QLabel("Building Will:")
|
||||||
@@ -2571,9 +2573,9 @@ class HeirList(MyTreeView, MessageBoxMixin):
|
|||||||
items[self.Columns.NAME].setEditable(True)
|
items[self.Columns.NAME].setEditable(True)
|
||||||
items[self.Columns.ADDRESS].setEditable(True)
|
items[self.Columns.ADDRESS].setEditable(True)
|
||||||
items[self.Columns.AMOUNT].setEditable(True)
|
items[self.Columns.AMOUNT].setEditable(True)
|
||||||
items[self.Columns.NAME].setData(key, self.ROLE_HEIR_KEY + 1)
|
items[self.Columns.NAME].setData(key, self.ROLE_HEIR_KEY + self.Columns.NAME)
|
||||||
items[self.Columns.ADDRESS].setData(key, self.ROLE_HEIR_KEY + 2)
|
items[self.Columns.ADDRESS].setData(key, self.ROLE_HEIR_KEY + self.Columns.ADDRESS)
|
||||||
items[self.Columns.AMOUNT].setData(key, self.ROLE_HEIR_KEY + 3)
|
items[self.Columns.AMOUNT].setData(key, self.ROLE_HEIR_KEY + self.Columns.AMOUNT)
|
||||||
|
|
||||||
row_count = self.model().rowCount()
|
row_count = self.model().rowCount()
|
||||||
self.model().insertRow(row_count, items)
|
self.model().insertRow(row_count, items)
|
||||||
@@ -2592,10 +2594,10 @@ class HeirList(MyTreeView, MessageBoxMixin):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def get_edit_key_from_coordinate(self, row, col):
|
def get_edit_key_from_coordinate(self, row, col):
|
||||||
return self.get_role_data_from_coordinate(
|
a= self.get_role_data_from_coordinate(
|
||||||
row, col, role=self.ROLE_HEIR_KEY + col + 1
|
row, col, role=self.ROLE_HEIR_KEY + col
|
||||||
)
|
)
|
||||||
|
return a
|
||||||
def create_toolbar(self, config):
|
def create_toolbar(self, config):
|
||||||
toolbar, menu = self.create_toolbar_with_menu("")
|
toolbar, menu = self.create_toolbar_with_menu("")
|
||||||
menu.addAction(_("&New Heir"), self.bal_window.new_heir_dialog)
|
menu.addAction(_("&New Heir"), self.bal_window.new_heir_dialog)
|
||||||
@@ -2603,7 +2605,6 @@ class HeirList(MyTreeView, MessageBoxMixin):
|
|||||||
menu.addAction(_("Export"), lambda: self.bal_window.export_heirs())
|
menu.addAction(_("Export"), lambda: self.bal_window.export_heirs())
|
||||||
|
|
||||||
self.heir_locktime = HeirsLockTimeEdit(self, 0)
|
self.heir_locktime = HeirsLockTimeEdit(self, 0)
|
||||||
|
|
||||||
def on_heir_locktime():
|
def on_heir_locktime():
|
||||||
if not self.heir_locktime.get_locktime():
|
if not self.heir_locktime.get_locktime():
|
||||||
self.heir_locktime.set_locktime("1y")
|
self.heir_locktime.set_locktime("1y")
|
||||||
@@ -2691,8 +2692,9 @@ class HeirList(MyTreeView, MessageBoxMixin):
|
|||||||
def update_will_settings(self):
|
def update_will_settings(self):
|
||||||
try:
|
try:
|
||||||
self.heir_locktime.set_locktime(self.bal_window.will_settings["locktime"])
|
self.heir_locktime.set_locktime(self.bal_window.will_settings["locktime"])
|
||||||
self.heir_tx_fees.setValue(int(self.bal_window.will_settings["baltx_fees"]))
|
|
||||||
self.heir_threshold.set_locktime(self.bal_window.will_settings["threshold"])
|
self.heir_threshold.set_locktime(self.bal_window.will_settings["threshold"])
|
||||||
|
self.heir_tx_fees.setValue(int(self.bal_window.will_settings["baltx_fees"]))
|
||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
_logger.debug(f"Exception update_will_settings {e}")
|
_logger.debug(f"Exception update_will_settings {e}")
|
||||||
@@ -2737,6 +2739,7 @@ class PreviewList(MyTreeView):
|
|||||||
|
|
||||||
self.wallet = bal_window.window.wallet
|
self.wallet = bal_window.window.wallet
|
||||||
self.setModel(QStandardItemModel(self))
|
self.setModel(QStandardItemModel(self))
|
||||||
|
self.sortByColumn(self.Columns.LOCKTIME, Qt.SortOrder.AscendingOrder)
|
||||||
self.setSortingEnabled(True)
|
self.setSortingEnabled(True)
|
||||||
self.std_model = self.model()
|
self.std_model = self.model()
|
||||||
self.config = bal_window.bal_plugin.config
|
self.config = bal_window.bal_plugin.config
|
||||||
@@ -2895,6 +2898,8 @@ class PreviewList(MyTreeView):
|
|||||||
tmp = self.replace(set_current, current_key, txid, bal_tx)
|
tmp = self.replace(set_current, current_key, txid, bal_tx)
|
||||||
if tmp:
|
if tmp:
|
||||||
set_current = tmp
|
set_current = tmp
|
||||||
|
self.sortByColumn(self.Columns.LOCKTIME, Qt.SortOrder.AscendingOrder)
|
||||||
|
self.setSortingEnabled(True)
|
||||||
|
|
||||||
def create_toolbar(self, config):
|
def create_toolbar(self, config):
|
||||||
toolbar, menu = self.create_toolbar_with_menu("")
|
toolbar, menu = self.create_toolbar_with_menu("")
|
||||||
@@ -2913,6 +2918,9 @@ class PreviewList(MyTreeView):
|
|||||||
display = QPushButton(_("Display"))
|
display = QPushButton(_("Display"))
|
||||||
display.clicked.connect(self.bal_window.preview_modal_dialog)
|
display.clicked.connect(self.bal_window.preview_modal_dialog)
|
||||||
|
|
||||||
|
display = QPushButton(_("refresh"))
|
||||||
|
display.clicked.connect(self.check)
|
||||||
|
|
||||||
widget = QWidget()
|
widget = QWidget()
|
||||||
hlayout = QHBoxLayout(widget)
|
hlayout = QHBoxLayout(widget)
|
||||||
hlayout.addWidget(wizard)
|
hlayout.addWidget(wizard)
|
||||||
@@ -2954,11 +2962,20 @@ class PreviewList(MyTreeView):
|
|||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def check(self):
|
def check(self):
|
||||||
|
Will.add_willtree(self.bal_window.willitems)
|
||||||
|
all_utxos =self.bal_window.wallet.get_utxos()
|
||||||
|
utxos_list = Will.utxos_strs(all_utxos)
|
||||||
|
Will.check_invalidated(self.bal_window.willitems,utxos_list,self.bal_window.wallet)
|
||||||
|
|
||||||
|
close_window = BalBuildWillDialog(self.bal_window)
|
||||||
|
close_window.build_will_task()
|
||||||
|
|
||||||
will = {}
|
will = {}
|
||||||
for wid, w in self.bal_window.willitems.items():
|
for wid, w in self.bal_window.willitems.items():
|
||||||
if w.get_status("VALID"):
|
if w.get_status("VALID") and w.get_status("PUSHED") and not w.get_status("CHECKED"):
|
||||||
will[wid] = w
|
will[wid] = w
|
||||||
self.bal_window.check_transactions(will)
|
if will:
|
||||||
|
self.bal_window.check_transactions(will)
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def invalidate_will(self):
|
def invalidate_will(self):
|
||||||
@@ -2991,6 +3008,10 @@ class PreviewDialog(BalDialog, MessageBoxMixin):
|
|||||||
self.setMinimumSize(1000, 200)
|
self.setMinimumSize(1000, 200)
|
||||||
self.size_label = QLabel()
|
self.size_label = QLabel()
|
||||||
self.transactions_list = PreviewList(self.bal_window, self.will)
|
self.transactions_list = PreviewList(self.bal_window, self.will)
|
||||||
|
|
||||||
|
self.bal_window.init_class_variables()
|
||||||
|
self.check_will()
|
||||||
|
|
||||||
vbox = QVBoxLayout(self)
|
vbox = QVBoxLayout(self)
|
||||||
vbox.addWidget(self.size_label)
|
vbox.addWidget(self.size_label)
|
||||||
vbox.addWidget(self.transactions_list)
|
vbox.addWidget(self.transactions_list)
|
||||||
@@ -3041,14 +3062,6 @@ class PreviewDialog(BalDialog, MessageBoxMixin):
|
|||||||
event.accept()
|
event.accept()
|
||||||
|
|
||||||
|
|
||||||
def read_bal_QIcon(icon_basename: str = DEFAULT_ICON) -> QIcon:
|
|
||||||
return QIcon(icon_path(icon_basename))
|
|
||||||
|
|
||||||
|
|
||||||
def read_bal_QPixmap(icon_basename: str = DEFAULT_ICON) -> QPixmap:
|
|
||||||
return QPixmap(icon_path(icon_basename))
|
|
||||||
|
|
||||||
|
|
||||||
class WillDetailDialog(BalDialog):
|
class WillDetailDialog(BalDialog):
|
||||||
def __init__(self, bal_window):
|
def __init__(self, bal_window):
|
||||||
|
|
||||||
@@ -3246,24 +3259,27 @@ class WillExecutorList(MyTreeView):
|
|||||||
class Columns(MyTreeView.BaseColumnsEnum):
|
class Columns(MyTreeView.BaseColumnsEnum):
|
||||||
SELECTED = enum.auto()
|
SELECTED = enum.auto()
|
||||||
URL = enum.auto()
|
URL = enum.auto()
|
||||||
|
STATUS = enum.auto()
|
||||||
BASE_FEE = enum.auto()
|
BASE_FEE = enum.auto()
|
||||||
INFO = enum.auto()
|
INFO = enum.auto()
|
||||||
ADDRESS = enum.auto()
|
ADDRESS = enum.auto()
|
||||||
STATUS = enum.auto()
|
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
Columns.SELECTED: _(""),
|
Columns.SELECTED: _(""),
|
||||||
Columns.URL: _("Url"),
|
Columns.URL: _("Url"),
|
||||||
|
Columns.STATUS: _("S"),
|
||||||
Columns.BASE_FEE: _("Base fee"),
|
Columns.BASE_FEE: _("Base fee"),
|
||||||
Columns.INFO: _("Info"),
|
Columns.INFO: _("Info"),
|
||||||
Columns.ADDRESS: _("Default Address"),
|
Columns.ADDRESS: _("Default Address"),
|
||||||
Columns.STATUS: _("S"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ROLE_HEIR_KEY = Qt.ItemDataRole.UserRole + 2000
|
filter_columns = [Columns.URL]
|
||||||
|
|
||||||
|
ROLE_SORT_ORDER = Qt.ItemDataRole.UserRole + 3000
|
||||||
|
ROLE_HEIR_KEY = Qt.ItemDataRole.UserRole + 3001
|
||||||
key_role = ROLE_HEIR_KEY
|
key_role = ROLE_HEIR_KEY
|
||||||
|
|
||||||
def __init__(self, parent: "WillExecutorDialog"):
|
def __init__(self, parent: "WillExecutorWidget"):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
parent=parent,
|
parent=parent,
|
||||||
stretch_column=self.Columns.ADDRESS,
|
stretch_column=self.Columns.ADDRESS,
|
||||||
@@ -3274,8 +3290,13 @@ class WillExecutorList(MyTreeView):
|
|||||||
self.Columns.INFO,
|
self.Columns.INFO,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
self.parent = parent
|
self.parent=parent
|
||||||
self.setModel(QStandardItemModel(self))
|
try:
|
||||||
|
self.setModel(QStandardItemModel(self))
|
||||||
|
self.sortByColumn(self.Columns.SELECTED, Qt.SortOrder.AscendingOrder)
|
||||||
|
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
self.setSortingEnabled(True)
|
self.setSortingEnabled(True)
|
||||||
self.std_model = self.model()
|
self.std_model = self.model()
|
||||||
self.config = parent.bal_plugin.config
|
self.config = parent.bal_plugin.config
|
||||||
@@ -3335,8 +3356,9 @@ class WillExecutorList(MyTreeView):
|
|||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def get_edit_key_from_coordinate(self, row, col):
|
def get_edit_key_from_coordinate(self, row, col):
|
||||||
a = self.get_role_data_from_coordinate(row, col, role=self.ROLE_HEIR_KEY + col)
|
role=self.ROLE_HEIR_KEY+col
|
||||||
return a
|
a = self.get_role_data_from_coordinate(row, col, role=role)
|
||||||
|
return a
|
||||||
|
|
||||||
def delete(self, selected_keys):
|
def delete(self, selected_keys):
|
||||||
for key in selected_keys:
|
for key in selected_keys:
|
||||||
@@ -3423,17 +3445,17 @@ class WillExecutorList(MyTreeView):
|
|||||||
items[self.Columns.BASE_FEE].setEditable(True)
|
items[self.Columns.BASE_FEE].setEditable(True)
|
||||||
items[self.Columns.STATUS].setEditable(False)
|
items[self.Columns.STATUS].setEditable(False)
|
||||||
|
|
||||||
items[self.Columns.URL].setData(url, self.ROLE_HEIR_KEY + 1)
|
items[self.Columns.URL].setData(url, self.ROLE_HEIR_KEY + self.Columns.URL)
|
||||||
items[self.Columns.BASE_FEE].setData(url, self.ROLE_HEIR_KEY + 2)
|
items[self.Columns.BASE_FEE].setData(url, self.ROLE_HEIR_KEY + self.Columns.BASE_FEE)
|
||||||
items[self.Columns.INFO].setData(url, self.ROLE_HEIR_KEY + 3)
|
items[self.Columns.INFO].setData(url, self.ROLE_HEIR_KEY + self.Columns.INFO)
|
||||||
items[self.Columns.ADDRESS].setData(url, self.ROLE_HEIR_KEY + 4)
|
items[self.Columns.ADDRESS].setData(url, self.ROLE_HEIR_KEY + self.Columns.ADDRESS)
|
||||||
row_count = self.model().rowCount()
|
row_count = self.model().rowCount()
|
||||||
self.model().insertRow(row_count, items)
|
self.model().insertRow(row_count, items)
|
||||||
if url == current_key:
|
if url == current_key:
|
||||||
idx = self.model().index(row_count, self.Columns.NAME)
|
idx = self.model().index(row_count, self.Columns.URL)
|
||||||
set_current = QPersistentModelIndex(idx)
|
set_current = QPersistentModelIndex(idx)
|
||||||
self.set_current_idx(set_current)
|
self.set_current_idx(set_current)
|
||||||
|
self.filter()
|
||||||
self.parent.save_willexecutors()
|
self.parent.save_willexecutors()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -3494,7 +3516,7 @@ class WillExecutorWidget(QWidget, MessageBoxMixin):
|
|||||||
buttonbox.addWidget(b)
|
buttonbox.addWidget(b)
|
||||||
|
|
||||||
vbox.addLayout(buttonbox)
|
vbox.addLayout(buttonbox)
|
||||||
self.willexecutor_list.update()
|
#self.willexecutor_list.update()
|
||||||
|
|
||||||
def add(self):
|
def add(self):
|
||||||
self.willexecutors_list["http://localhost:8080"] = {
|
self.willexecutors_list["http://localhost:8080"] = {
|
||||||
@@ -3526,17 +3548,10 @@ class WillExecutorWidget(QWidget, MessageBoxMixin):
|
|||||||
|
|
||||||
def update_willexecutors(self, wes=None):
|
def update_willexecutors(self, wes=None):
|
||||||
if not wes:
|
if not wes:
|
||||||
self.willexecutors_list = Willexecutors.get_willexecutors(
|
wes=self.willexecutors_list
|
||||||
self.bal_plugin,
|
self.bal_window.ping_willexecutors(wes, self.parent)
|
||||||
update=True,
|
self.willexecutors_list.update(wes)
|
||||||
bal_window=self.bal_window,
|
self.willexecutor_list.update()
|
||||||
force=True,
|
|
||||||
task=self,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
self.bal_window.ping_willexecutors(wes, self.parent)
|
|
||||||
self.willexecutors_list.update(wes)
|
|
||||||
self.willexecutor_list.update()
|
|
||||||
|
|
||||||
def import_json_file(self, path):
|
def import_json_file(self, path):
|
||||||
data = read_json_file(path)
|
data = read_json_file(path)
|
||||||
|
|||||||
28
will.py
28
will.py
@@ -82,8 +82,6 @@ class Will:
|
|||||||
for txin in will[wid].tx.inputs():
|
for txin in will[wid].tx.inputs():
|
||||||
txid = txin.prevout.txid.hex()
|
txid = txin.prevout.txid.hex()
|
||||||
if txid in will:
|
if txid in will:
|
||||||
# print(will[txid].tx.outputs())
|
|
||||||
# print(txin.prevout.out_idx)
|
|
||||||
change = will[txid].tx.outputs()[txin.prevout.out_idx]
|
change = will[txid].tx.outputs()[txin.prevout.out_idx]
|
||||||
txin._trusted_value_sats = change.value
|
txin._trusted_value_sats = change.value
|
||||||
try:
|
try:
|
||||||
@@ -421,18 +419,20 @@ class Will:
|
|||||||
# check if transactions are stil valid tecnically valid
|
# check if transactions are stil valid tecnically valid
|
||||||
def check_invalidated(willtree, utxos_list, wallet):
|
def check_invalidated(willtree, utxos_list, wallet):
|
||||||
for wid, w in willtree.items():
|
for wid, w in willtree.items():
|
||||||
if not w.father:
|
#if not w.father:
|
||||||
for inp in w.tx.inputs():
|
for inp in w.tx.inputs():
|
||||||
inp_str = Util.utxo_to_str(inp)
|
inp_str = Util.utxo_to_str(inp)
|
||||||
if not inp_str in utxos_list:
|
if not inp_str in utxos_list:
|
||||||
if wallet:
|
if wallet:
|
||||||
height = Will.check_tx_height(w.tx, wallet)
|
height = Will.check_tx_height(w.tx, wallet)
|
||||||
if height < 0:
|
if height < 0:
|
||||||
Will.set_invalidate(wid, willtree)
|
Will.set_invalidate(wid, willtree)
|
||||||
elif height == 0:
|
elif height == 0:
|
||||||
w.set_status("PENDING", True)
|
w.set_status("PENDING", True)
|
||||||
else:
|
else:
|
||||||
w.set_status("CONFIRMED", True)
|
w.set_status("CONFIRMED", True)
|
||||||
|
#else:
|
||||||
|
# print("father",w.father)
|
||||||
|
|
||||||
def reflect_to_children(treeitem):
|
def reflect_to_children(treeitem):
|
||||||
if not treeitem.get_status("VALID"):
|
if not treeitem.get_status("VALID"):
|
||||||
|
|||||||
@@ -42,27 +42,27 @@ class Willexecutors:
|
|||||||
if not bal_url in willexecutors:
|
if not bal_url in willexecutors:
|
||||||
_logger.debug(f"force add {bal_url} willexecutor")
|
_logger.debug(f"force add {bal_url} willexecutor")
|
||||||
willexecutors[bal_url] = bal_executor
|
willexecutors[bal_url] = bal_executor
|
||||||
if update:
|
#if update:
|
||||||
found = False
|
# found = False
|
||||||
for url, we in willexecutors.items():
|
# for url, we in willexecutors.items():
|
||||||
if Willexecutors.is_selected(we):
|
# if Willexecutors.is_selected(we):
|
||||||
found = True
|
# found = True
|
||||||
if found or force:
|
# if found or force:
|
||||||
if bal_plugin.PING_WILLEXECUTORS.get() or force:
|
# if bal_plugin.PING_WILLEXECUTORS.get() or force:
|
||||||
ping_willexecutors = True
|
# ping_willexecutors = True
|
||||||
if bal_plugin.ASK_PING_WILLEXECUTORS.get() and not force:
|
# if bal_plugin.ASK_PING_WILLEXECUTORS.get() and not force:
|
||||||
if bal_window:
|
# if bal_window:
|
||||||
ping_willexecutors = bal_window.window.question(
|
# ping_willexecutors = bal_window.window.question(
|
||||||
_(
|
# _(
|
||||||
"Contact willexecutors servers to update payment informations?"
|
# "Contact willexecutors servers to update payment informations?"
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
|
|
||||||
if ping_willexecutors:
|
# if ping_willexecutors:
|
||||||
if task:
|
# if task:
|
||||||
bal_window.ping_willexecutors(willexecutors, task)
|
# bal_window.ping_willexecutors(willexecutors, task)
|
||||||
else:
|
# else:
|
||||||
bal_window.ping_willexecutors_task(willexecutors)
|
# bal_window.ping_willexecutors_task(willexecutors)
|
||||||
w_sorted = dict(
|
w_sorted = dict(
|
||||||
sorted(
|
sorted(
|
||||||
willexecutors.items(), key=lambda w: w[1].get("sort", 0), reverse=True
|
willexecutors.items(), key=lambda w: w[1].get("sort", 0), reverse=True
|
||||||
|
|||||||
Reference in New Issue
Block a user