TxEditor: set locktime
This commit is contained in:
@@ -77,6 +77,7 @@ class TxEditor(WindowModalDialog):
|
|||||||
self.is_preview = False
|
self.is_preview = False
|
||||||
|
|
||||||
self.locktime_e = LockTimeEdit(self)
|
self.locktime_e = LockTimeEdit(self)
|
||||||
|
self.locktime_e.valueEdited.connect(self._trigger_update)
|
||||||
self.locktime_label = QLabel(_("LockTime") + ": ")
|
self.locktime_label = QLabel(_("LockTime") + ": ")
|
||||||
self.io_widget = TxInOutWidget(self.main_window, self.wallet)
|
self.io_widget = TxInOutWidget(self.main_window, self.wallet)
|
||||||
self.create_fee_controls()
|
self.create_fee_controls()
|
||||||
@@ -109,6 +110,7 @@ class TxEditor(WindowModalDialog):
|
|||||||
def timer_actions(self):
|
def timer_actions(self):
|
||||||
if self.needs_update:
|
if self.needs_update:
|
||||||
self.update_tx()
|
self.update_tx()
|
||||||
|
self.set_locktime()
|
||||||
self.update()
|
self.update()
|
||||||
self.needs_update = False
|
self.needs_update = False
|
||||||
|
|
||||||
@@ -559,6 +561,13 @@ class ConfirmTxDialog(TxEditor):
|
|||||||
raise
|
raise
|
||||||
self.tx.set_rbf(True)
|
self.tx.set_rbf(True)
|
||||||
|
|
||||||
|
def set_locktime(self):
|
||||||
|
if not self.tx:
|
||||||
|
return
|
||||||
|
locktime = self.locktime_e.get_locktime()
|
||||||
|
if locktime is not None:
|
||||||
|
self.tx.locktime = locktime
|
||||||
|
|
||||||
def have_enough_funds_assuming_zero_fees(self) -> bool:
|
def have_enough_funds_assuming_zero_fees(self) -> bool:
|
||||||
# called in send_tab.py
|
# called in send_tab.py
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import time
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Optional, Any
|
from typing import Optional, Any
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QDateTime
|
from PyQt5.QtCore import Qt, QDateTime, pyqtSignal
|
||||||
from PyQt5.QtGui import QPalette, QPainter
|
from PyQt5.QtGui import QPalette, QPainter
|
||||||
from PyQt5.QtWidgets import (QWidget, QLineEdit, QStyle, QStyleOptionFrame, QComboBox,
|
from PyQt5.QtWidgets import (QWidget, QLineEdit, QStyle, QStyleOptionFrame, QComboBox,
|
||||||
QHBoxLayout, QDateTimeEdit)
|
QHBoxLayout, QDateTimeEdit)
|
||||||
@@ -19,6 +19,8 @@ from .util import char_width_in_lineedit, ColorScheme
|
|||||||
|
|
||||||
class LockTimeEdit(QWidget):
|
class LockTimeEdit(QWidget):
|
||||||
|
|
||||||
|
valueEdited = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
QWidget.__init__(self, parent)
|
QWidget.__init__(self, parent)
|
||||||
|
|
||||||
@@ -63,6 +65,11 @@ class LockTimeEdit(QWidget):
|
|||||||
hbox.addWidget(w)
|
hbox.addWidget(w)
|
||||||
hbox.addStretch(1)
|
hbox.addStretch(1)
|
||||||
|
|
||||||
|
self.locktime_height_e.textEdited.connect(self.valueEdited.emit)
|
||||||
|
self.locktime_raw_e.textEdited.connect(self.valueEdited.emit)
|
||||||
|
self.locktime_date_e.dateTimeChanged.connect(self.valueEdited.emit)
|
||||||
|
self.combo.currentIndexChanged.connect(self.valueEdited.emit)
|
||||||
|
|
||||||
def get_locktime(self) -> Optional[int]:
|
def get_locktime(self) -> Optional[int]:
|
||||||
return self.editor.get_locktime()
|
return self.editor.get_locktime()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user