change tx size to label. small fix re connecting slider and feerate. slider changes look when its value is ignored.

This commit is contained in:
SomberNight 2017-12-19 23:25:07 +01:00 committed by ThomasV
parent 3ba864bbca
commit ab5a142738
2 changed files with 41 additions and 6 deletions

View file

@ -54,3 +54,28 @@ class FeeSlider(QSlider):
self.setValue(pos) self.setValue(pos)
tooltip = self.get_tooltip(pos, fee_rate) tooltip = self.get_tooltip(pos, fee_rate)
self.setToolTip(tooltip) self.setToolTip(tooltip)
def activate(self):
self.setStyleSheet('')
def deactivate(self):
# TODO it would be nice to find a platform-independent solution
# that makes the slider look as if it was disabled
self.setStyleSheet(
"""
QSlider::groove:horizontal {
border: 1px solid #999999;
height: 8px;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #B1B1B1);
margin: 2px 0;
}
QSlider::handle:horizontal {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);
border: 1px solid #5c5c5c;
width: 12px;
margin: -2px 0;
border-radius: 3px;
}
"""
)

View file

@ -1067,8 +1067,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.config.set_key('fee_level', pos, False) self.config.set_key('fee_level', pos, False)
else: else:
self.config.set_key('fee_per_kb', fee_rate, False) self.config.set_key('fee_per_kb', fee_rate, False)
self.spend_max() if self.is_max else self.update_fee()
self.feerate_e.setAmount(fee_rate // 1000) self.feerate_e.setAmount(fee_rate // 1000)
self.fee_e.setModified(False)
self.fee_slider.activate()
self.spend_max() if self.is_max else self.update_fee()
self.fee_slider = FeeSlider(self, self.config, fee_cb) self.fee_slider = FeeSlider(self, self.config, fee_cb)
self.fee_slider.setFixedWidth(140) self.fee_slider.setFixedWidth(140)
@ -1084,10 +1088,17 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
# edit_changed was edited just now, so make sure we will # edit_changed was edited just now, so make sure we will
# freeze the correct fee setting (this) # freeze the correct fee setting (this)
edit_other.setModified(False) edit_other.setModified(False)
self.fee_slider.deactivate()
self.update_fee() self.update_fee()
self.size_e = AmountEdit(lambda: 'bytes') class TxSizeLabel(QLabel):
self.size_e.setFrozen(True) def setAmount(self, byte_size):
self.setText('x %s bytes =' % byte_size)
self.size_e = TxSizeLabel()
self.size_e.setAlignment(Qt.AlignCenter)
self.size_e.setAmount(0)
self.size_e.setStyleSheet(ColorScheme.DEFAULT.as_stylesheet())
self.feerate_e = FeerateEdit(lambda: 2 if self.fee_unit else 0) self.feerate_e = FeerateEdit(lambda: 2 if self.fee_unit else 0)
self.feerate_e.textEdited.connect(partial(on_fee_or_feerate, self.feerate_e, False)) self.feerate_e.textEdited.connect(partial(on_fee_or_feerate, self.feerate_e, False))
@ -1118,8 +1129,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
hbox.addWidget(self.size_e) hbox.addWidget(self.size_e)
hbox.addWidget(self.fee_e) hbox.addWidget(self.fee_e)
self.size_e.setStyleSheet(ColorScheme.BLUE.as_stylesheet())
vbox_feecontrol = QVBoxLayout() vbox_feecontrol = QVBoxLayout()
vbox_feecontrol.addWidget(self.fee_adv_controls) vbox_feecontrol.addWidget(self.fee_adv_controls)
vbox_feecontrol.addWidget(self.fee_slider) vbox_feecontrol.addWidget(self.fee_slider)
@ -1643,9 +1652,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.payment_request = None self.payment_request = None
self.payto_e.is_pr = False self.payto_e.is_pr = False
for e in [self.payto_e, self.message_e, self.amount_e, self.fiat_send_e, for e in [self.payto_e, self.message_e, self.amount_e, self.fiat_send_e,
self.fee_e, self.feerate_e, self.size_e]: self.fee_e, self.feerate_e]:
e.setText('') e.setText('')
e.setFrozen(False) e.setFrozen(False)
self.size_e.setAmount(0)
self.set_pay_from([]) self.set_pay_from([])
#self.rbf_checkbox.setChecked(False) #self.rbf_checkbox.setChecked(False)
self.tx_external_keypairs = {} self.tx_external_keypairs = {}