black reformatted
This commit is contained in:
45
heirs.py
45
heirs.py
@@ -375,7 +375,11 @@ class Heirs(dict, Logger):
|
|||||||
Util.parse_locktime_string(self[key][HEIR_LOCKTIME]) - from_locktime
|
Util.parse_locktime_string(self[key][HEIR_LOCKTIME]) - from_locktime
|
||||||
)
|
)
|
||||||
if cmp <= 0:
|
if cmp <= 0:
|
||||||
_logger.debug("cmp < 0 {} {} {} ".format(cmp, key, self[key][HEIR_LOCKTIME], from_locktime))
|
_logger.debug(
|
||||||
|
"cmp < 0 {} {} {} ".format(
|
||||||
|
cmp, key, self[key][HEIR_LOCKTIME], from_locktime
|
||||||
|
)
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
if Util.is_perc(self[key][HEIR_AMOUNT]):
|
if Util.is_perc(self[key][HEIR_AMOUNT]):
|
||||||
percent_amount += float(self[key][HEIR_AMOUNT][:-1])
|
percent_amount += float(self[key][HEIR_AMOUNT][:-1])
|
||||||
@@ -389,11 +393,19 @@ class Heirs(dict, Logger):
|
|||||||
fixed_heirs[key].insert(HEIR_REAL_AMOUNT, heir_amount)
|
fixed_heirs[key].insert(HEIR_REAL_AMOUNT, heir_amount)
|
||||||
else:
|
else:
|
||||||
fixed_heirs[key] = list(self[key])
|
fixed_heirs[key] = list(self[key])
|
||||||
fixed_heirs[key].insert(HEIR_REAL_AMOUNT, f"DUST: {heir_amount}")
|
fixed_heirs[key].insert(
|
||||||
|
HEIR_REAL_AMOUNT, f"DUST: {heir_amount}"
|
||||||
|
)
|
||||||
fixed_heirs[key].insert(HEIR_DUST_AMOUNT, heir_amount)
|
fixed_heirs[key].insert(HEIR_DUST_AMOUNT, heir_amount)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
_logger.error(e)
|
_logger.error(e)
|
||||||
return fixed_heirs, fixed_amount, percent_heirs, percent_amount, fixed_amount_with_dust
|
return (
|
||||||
|
fixed_heirs,
|
||||||
|
fixed_amount,
|
||||||
|
percent_heirs,
|
||||||
|
percent_amount,
|
||||||
|
fixed_amount_with_dust,
|
||||||
|
)
|
||||||
|
|
||||||
def prepare_lists(
|
def prepare_lists(
|
||||||
self, balance, total_fees, wallet, willexecutor=False, from_locktime=0
|
self, balance, total_fees, wallet, willexecutor=False, from_locktime=0
|
||||||
@@ -428,10 +440,16 @@ class Heirs(dict, Logger):
|
|||||||
newbalance -= willexecutors_amount
|
newbalance -= willexecutors_amount
|
||||||
if newbalance < 0:
|
if newbalance < 0:
|
||||||
raise WillExecutorFeeException(willexecutor)
|
raise WillExecutorFeeException(willexecutor)
|
||||||
a=list(self.fixed_percent_lists_amount(from_locktime, wallet.dust_threshold()))
|
a = list(
|
||||||
fixed_heirs, fixed_amount, percent_heirs, percent_amount,fixed_amount_with_dust = (
|
|
||||||
self.fixed_percent_lists_amount(from_locktime, wallet.dust_threshold())
|
self.fixed_percent_lists_amount(from_locktime, wallet.dust_threshold())
|
||||||
)
|
)
|
||||||
|
(
|
||||||
|
fixed_heirs,
|
||||||
|
fixed_amount,
|
||||||
|
percent_heirs,
|
||||||
|
percent_amount,
|
||||||
|
fixed_amount_with_dust,
|
||||||
|
) = self.fixed_percent_lists_amount(from_locktime, wallet.dust_threshold())
|
||||||
|
|
||||||
if fixed_amount > newbalance:
|
if fixed_amount > newbalance:
|
||||||
fixed_amount = self.normalize_perc(
|
fixed_amount = self.normalize_perc(
|
||||||
@@ -543,7 +561,9 @@ class Heirs(dict, Logger):
|
|||||||
if not txs:
|
if not txs:
|
||||||
return {}
|
return {}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
_logger.error(f"build transactions: error preparing transactions: {e}")
|
_logger.error(
|
||||||
|
f"build transactions: error preparing transactions: {e}"
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
if "w!ll3x3c" in e.heirname:
|
if "w!ll3x3c" in e.heirname:
|
||||||
Willexecutors.is_selected(willexecutors[w], False)
|
Willexecutors.is_selected(willexecutors[w], False)
|
||||||
@@ -573,7 +593,9 @@ class Heirs(dict, Logger):
|
|||||||
if i >= 10:
|
if i >= 10:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
_logger.info(f"no locktimes for willexecutor {willexecutor} skipped")
|
_logger.info(
|
||||||
|
f"no locktimes for willexecutor {willexecutor} skipped"
|
||||||
|
)
|
||||||
break
|
break
|
||||||
alltxs.update(txs)
|
alltxs.update(txs)
|
||||||
|
|
||||||
@@ -733,10 +755,17 @@ class HeirExpiredException(LocktimeNotValid):
|
|||||||
|
|
||||||
class HeirAmountIsDustException(Exception):
|
class HeirAmountIsDustException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NoHeirsException(Exception):
|
class NoHeirsException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class WillExecutorFeeException(Exception):
|
class WillExecutorFeeException(Exception):
|
||||||
def __init__(self, willexecutor):
|
def __init__(self, willexecutor):
|
||||||
self.willexecutor = willexecutor
|
self.willexecutor = willexecutor
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "WillExecutorFeeException: {} fee:{}".format(self.willexecutor['url'],self.willexecutor['base_fee'])
|
return "WillExecutorFeeException: {} fee:{}".format(
|
||||||
|
self.willexecutor["url"], self.willexecutor["base_fee"]
|
||||||
|
)
|
||||||
|
|||||||
@@ -4,6 +4,5 @@
|
|||||||
"description": "Provides free and decentralized inheritance support<br> Version: 0.2.4",
|
"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",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
27
qt.py
27
qt.py
@@ -2038,9 +2038,9 @@ class bal_checkbox(QCheckBox):
|
|||||||
|
|
||||||
class BalBuildWillDialog(BalDialog):
|
class BalBuildWillDialog(BalDialog):
|
||||||
updatemessage = pyqtSignal()
|
updatemessage = pyqtSignal()
|
||||||
COLOR_WARNING='#cfa808'
|
COLOR_WARNING = "#cfa808"
|
||||||
COLOR_ERROR='#ff0000'
|
COLOR_ERROR = "#ff0000"
|
||||||
COLOR_OK='#05ad05'
|
COLOR_OK = "#05ad05"
|
||||||
|
|
||||||
def __init__(self, bal_window, parent=None):
|
def __init__(self, bal_window, parent=None):
|
||||||
if not parent:
|
if not parent:
|
||||||
@@ -2107,7 +2107,7 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
+ "the entire wallet will always be fully emptied. \n"
|
+ "the entire wallet will always be fully emptied. \n"
|
||||||
+ "Your settings require an adjustment of the amounts"
|
+ "Your settings require an adjustment of the amounts"
|
||||||
),
|
),
|
||||||
self.COLOR_WARNING
|
self.COLOR_WARNING,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.msg_set_checking()
|
self.msg_set_checking()
|
||||||
@@ -2150,7 +2150,10 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
try:
|
try:
|
||||||
if not self.bal_window.build_will():
|
if not self.bal_window.build_will():
|
||||||
self.msg_set_status(
|
self.msg_set_status(
|
||||||
_("Balance is too low. No transaction was built"),None,_("Skipped"),self.COLOR_ERROR
|
_("Balance is too low. No transaction was built"),
|
||||||
|
None,
|
||||||
|
_("Skipped"),
|
||||||
|
self.COLOR_ERROR,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.bal_window.check_will()
|
self.bal_window.check_will()
|
||||||
@@ -2159,10 +2162,7 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
self.msg_set_building(self.msg_ok())
|
self.msg_set_building(self.msg_ok())
|
||||||
except WillExecutorNotPresent as e:
|
except WillExecutorNotPresent as e:
|
||||||
self.msg_set_status(
|
self.msg_set_status(
|
||||||
_("Will-Executor excluded"),
|
_("Will-Executor excluded"), None, _("Skipped"), self.COLOR_ERROR
|
||||||
None,
|
|
||||||
_("Skipped"),
|
|
||||||
self.COLOR_ERROR
|
|
||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -2175,10 +2175,10 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
for hid, heir in heirs.items():
|
for hid, heir in heirs.items():
|
||||||
if "DUST" in str(heir[HEIR_REAL_AMOUNT]):
|
if "DUST" in str(heir[HEIR_REAL_AMOUNT]):
|
||||||
self.msg_set_status(
|
self.msg_set_status(
|
||||||
f'{hid},{heir[HEIR_DUST_AMOUNT]} is DUST',
|
f"{hid},{heir[HEIR_DUST_AMOUNT]} is DUST",
|
||||||
None,
|
None,
|
||||||
f"Excluded from will {wid}",
|
f"Excluded from will {wid}",
|
||||||
self.COLOR_WARNING
|
self.COLOR_WARNING,
|
||||||
)
|
)
|
||||||
|
|
||||||
have_to_sign = False
|
have_to_sign = False
|
||||||
@@ -2443,7 +2443,6 @@ class BalBuildWillDialog(BalDialog):
|
|||||||
line = "<font color={}>{}:\t{}</font>".format(color, _(msg), status)
|
line = "<font color={}>{}:\t{}</font>".format(color, _(msg), status)
|
||||||
return self.msg_edit_row(line, row)
|
return self.msg_edit_row(line, row)
|
||||||
|
|
||||||
|
|
||||||
def ask_password(self, msg=None):
|
def ask_password(self, msg=None):
|
||||||
self.password = self.bal_window.get_wallet_password(msg, parent=self)
|
self.password = self.bal_window.get_wallet_password(msg, parent=self)
|
||||||
|
|
||||||
@@ -2591,9 +2590,7 @@ class HeirList(MyTreeView, MessageBoxMixin):
|
|||||||
_("Edit {}").format(column_title),
|
_("Edit {}").format(column_title),
|
||||||
lambda p=persistent: self.edit(QModelIndex(p)),
|
lambda p=persistent: self.edit(QModelIndex(p)),
|
||||||
)
|
)
|
||||||
menu.addAction(
|
menu.addAction(_("Delete"), lambda: self.delete_heirs(selected_keys))
|
||||||
_("Delete"), lambda: self.delete_heirs(selected_keys)
|
|
||||||
)
|
|
||||||
menu.exec(self.viewport().mapToGlobal(position))
|
menu.exec(self.viewport().mapToGlobal(position))
|
||||||
|
|
||||||
# def get_selected_keys(self):
|
# def get_selected_keys(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user