bugfixes
This commit is contained in:
parent
29c63fc5c8
commit
2ec5d060d3
2
bal.py
2
bal.py
@ -31,7 +31,7 @@ class BalConfig():
|
||||
if not default is None:
|
||||
v = default
|
||||
else:
|
||||
v = v.default
|
||||
v = self.default
|
||||
return v
|
||||
|
||||
def set(self,value,save=True):
|
||||
|
91
qt.py
91
qt.py
@ -600,26 +600,34 @@ class BalWindow(Logger):
|
||||
tab.is_shown_cv = shown_cv(True)
|
||||
return tab
|
||||
|
||||
def new_heir_dialog(self,heir=None):
|
||||
d = BalDialog(self.window, self.bal_plugin.get_window_title("New heir"))
|
||||
def new_heir_dialog(self,heir_key=None):
|
||||
heir = self.heirs.get(heir_key)
|
||||
title = "New heir"
|
||||
if heir:
|
||||
title = f"Edit: {heir_key}"
|
||||
|
||||
d = BalDialog(self.window, self.bal_plugin.get_window_title(_(title)))
|
||||
|
||||
vbox = QVBoxLayout(d)
|
||||
grid = QGridLayout()
|
||||
|
||||
heir_name = QLineEdit()
|
||||
heir_name.setFixedWidth(32 * char_width_in_lineedit())
|
||||
if heir:
|
||||
heir_name.setText(heir[0])
|
||||
heir_name.setText(str(heir_key))
|
||||
heir_address = QLineEdit()
|
||||
heir_address.setFixedWidth(32 * char_width_in_lineedit())
|
||||
if heir:
|
||||
heir_address.setText(heir[1])
|
||||
heir_address.setText(str(heir[0]))
|
||||
heir_amount = PercAmountEdit(self.window.get_decimal_point)
|
||||
if heir:
|
||||
heir_amount.setText(heir[2])
|
||||
heir_amount.setText(str(heir[1]))
|
||||
heir_locktime = HeirsLockTimeEdit(self.window,0)
|
||||
if heir:
|
||||
heir_locktime.setText(heir[3])
|
||||
heir_locktime.set_locktime(heir[2])
|
||||
|
||||
heir_is_xpub = QCheckBox()
|
||||
|
||||
new_heir_button=QPushButton(_("Add another heir"))
|
||||
self.add_another_heir=False
|
||||
def new_heir():
|
||||
@ -631,18 +639,21 @@ class BalWindow(Logger):
|
||||
|
||||
grid.addWidget(QLabel(_("Name")), 1, 0)
|
||||
grid.addWidget(heir_name, 1, 1)
|
||||
grid.addWidget(HelpButton("Unique name or description about heir"),1,2)
|
||||
grid.addWidget(HelpButton(_("Unique name or description about heir")),1,2)
|
||||
|
||||
grid.addWidget(QLabel(_("Address")), 2, 0)
|
||||
grid.addWidget(heir_address, 2, 1)
|
||||
grid.addWidget(HelpButton("heir bitcoin address"),2,2)
|
||||
grid.addWidget(HelpButton(_("heir bitcoin address")),2,2)
|
||||
|
||||
grid.addWidget(QLabel(_("Amount")),3,0)
|
||||
grid.addWidget(heir_amount,3,1)
|
||||
grid.addWidget(HelpButton("Fixed or Percentage amount if end with %"),3,2)
|
||||
grid.addWidget(HelpButton(_("Fixed or Percentage amount if end with %")),3,2)
|
||||
|
||||
vbox.addLayout(grid)
|
||||
vbox.addLayout(Buttons(CancelButton(d), OkButton(d),new_heir_button))
|
||||
buttons=[CancelButton(d), OkButton(d)]
|
||||
if not heir:
|
||||
buttons.append(new_heir_button)
|
||||
vbox.addLayout(Buttons(*buttons))
|
||||
while d.exec():
|
||||
#TODO SAVE HEIR
|
||||
heir = [
|
||||
@ -1139,7 +1150,7 @@ class BalWindow(Logger):
|
||||
try:
|
||||
self.willexecutor_dialog.willexecutor_list.update()
|
||||
except Exception as e:
|
||||
_logger.error("error updating willexecutors {e}")
|
||||
_logger.error(f"error updating willexecutors {e}")
|
||||
pass
|
||||
def on_failure(e):
|
||||
self.logger.error(e)
|
||||
@ -1199,8 +1210,14 @@ class HeirsLockTimeEdit(QWidget):
|
||||
|
||||
hbox.addWidget(self.combo)
|
||||
for w in self.editors:
|
||||
#print("addwidget")
|
||||
hbox.addWidget(w)
|
||||
hbox.addStretch(1)
|
||||
#spacer_widget = QWidget()
|
||||
#spacer_widget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
||||
#hbox.addWidget(spacer_widget)
|
||||
|
||||
|
||||
|
||||
self.locktime_raw_e.editingFinished.connect(self.valueEdited.emit)
|
||||
self.locktime_date_e.dateTimeChanged.connect(self.valueEdited.emit)
|
||||
@ -1497,14 +1514,18 @@ class BalWizardDialog(BalDialog):
|
||||
self.next_widget(BalWizardWEDownloadWidget(self.bal_window,self,self.on_next_wedonwload,self.on_next_heir,self.on_cancel_heir))
|
||||
def on_accept(self):
|
||||
print("accepted")
|
||||
pass
|
||||
def on_reject(self):
|
||||
print("rejected")
|
||||
pass
|
||||
def on_close(self):
|
||||
print("close")
|
||||
pass
|
||||
def closeEvent(self,event):
|
||||
self.bal_window.update_all()
|
||||
self.bal_window.heir_list.update_will_settings()
|
||||
print("close event")
|
||||
pass
|
||||
|
||||
|
||||
class BalWizardWidget(QWidget):
|
||||
@ -1685,6 +1706,10 @@ class BalWizardLocktimeAndFeeWidget(BalWizardWidget):
|
||||
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
|
||||
|
||||
|
||||
@ -2161,6 +2186,13 @@ class HeirList(MyTreeView,MessageBoxMixin):
|
||||
|
||||
self.update()
|
||||
|
||||
def on_activated(self,idx):
|
||||
self.on_double_click(idx)
|
||||
|
||||
def on_double_click(self,idx):
|
||||
edit_key = self.get_edit_key_from_coordinate(idx.row(),idx.column())
|
||||
heir= self.bal_window.heirs.get(edit_key)
|
||||
self.bal_window.new_heir_dialog(edit_key)
|
||||
|
||||
def on_edited(self, idx, edit_key, *, text):
|
||||
original = prior_name = self.bal_window.heirs.get(edit_key)
|
||||
@ -2331,7 +2363,7 @@ class HeirList(MyTreeView,MessageBoxMixin):
|
||||
self.heir_threshold.set_locktime(self.bal_window.will_settings['threshold'])
|
||||
|
||||
except Exception as e:
|
||||
print("Exception update_will_settings",e)
|
||||
_logger.error(f"Exception update_will_settings {e}")
|
||||
|
||||
def build_transactions(self):
|
||||
will = self.bal_window.prepare_will()
|
||||
@ -2379,6 +2411,13 @@ class PreviewList(MyTreeView):
|
||||
self.bal_plugin=self.bal_window.bal_plugin
|
||||
|
||||
self.update()
|
||||
def on_activated(self,idx):
|
||||
self.on_double_click(idx)
|
||||
|
||||
def on_double_click(self,idx):
|
||||
idx = self.model().index(idx.row(), self.Columns.TXID)
|
||||
sel_key = self.model().itemFromIndex(idx).data(0)
|
||||
self.show_transaction([sel_key])
|
||||
|
||||
def create_menu(self, position):
|
||||
menu = QMenu()
|
||||
@ -2508,22 +2547,9 @@ class PreviewList(MyTreeView):
|
||||
wizard=QPushButton(_("Setup Wizard"))
|
||||
wizard.clicked.connect(self.bal_window.init_wizard)
|
||||
|
||||
prepareButton = QPushButton(_("Prepare"))
|
||||
prepareButton.clicked.connect(self.build_transactions)
|
||||
signButton = QPushButton(_("Sign"))
|
||||
signButton.clicked.connect(self.ask_password_and_sign_transactions)
|
||||
pushButton = QPushButton(_("Broadcast"))
|
||||
pushButton.clicked.connect(self.broadcast)
|
||||
displayButton = QPushButton(_("Display"))
|
||||
displayButton.clicked.connect(self.bal_window.preview_modal_dialog)
|
||||
hlayout = QHBoxLayout()
|
||||
widget = QWidget()
|
||||
hlayout = QHBoxLayout(widget)
|
||||
hlayout.addWidget(wizard)
|
||||
hlayout.addWidget(prepareButton)
|
||||
hlayout.addWidget(signButton)
|
||||
hlayout.addWidget(pushButton)
|
||||
hlayout.addWidget(displayButton)
|
||||
widget.setLayout(hlayout)
|
||||
toolbar.insertWidget(2,widget)
|
||||
|
||||
return toolbar
|
||||
@ -3003,10 +3029,11 @@ class WillExecutorWidget(QWidget,MessageBoxMixin):
|
||||
vbox.addWidget(self.willexecutor_list)
|
||||
buttonbox = QHBoxLayout()
|
||||
|
||||
b = QPushButton(_('Ping'))
|
||||
b.clicked.connect(self.update_willexecutors)
|
||||
b = QPushButton(_('Add'))
|
||||
b.clicked.connect(self.add)
|
||||
buttonbox.addWidget(b)
|
||||
|
||||
|
||||
b = QPushButton(_('Download List'))
|
||||
b.clicked.connect(self.download_list)
|
||||
buttonbox.addWidget(b)
|
||||
@ -3019,10 +3046,11 @@ class WillExecutorWidget(QWidget,MessageBoxMixin):
|
||||
b.clicked.connect(self.export_file)
|
||||
buttonbox.addWidget(b)
|
||||
|
||||
b = QPushButton(_('Add'))
|
||||
b.clicked.connect(self.add)
|
||||
b = QPushButton(_('Ping All'))
|
||||
b.clicked.connect(self.update_willexecutors)
|
||||
buttonbox.addWidget(b)
|
||||
|
||||
|
||||
vbox.addLayout(buttonbox)
|
||||
self.willexecutor_list.update()
|
||||
def add(self):
|
||||
@ -3075,7 +3103,8 @@ class WillExecutorDialog(BalDialog,MessageBoxMixin):
|
||||
self.setMinimumSize(1000, 200)
|
||||
|
||||
vbox = QVBoxLayout(self)
|
||||
vbox.addWidget(WillExecutorWidget(self,self.bal_window,self.willexecutors_list))
|
||||
self.willexecutor_list= WillExecutorWidget(self,self.bal_window,self.willexecutors_list)
|
||||
vbox.addWidget(self.willexecutor_list)
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user