tchange tx size to label. small fix re connecting slider and feerate. slider changes look when its value is ignored. - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit ab5a142738c93c19495aace85ba9a8443e9479e5 DIR parent 3ba864bbca1ece32316cf60430ddc222b1f748ea HTML Author: SomberNight <somber.night@protonmail.com> Date: Tue, 19 Dec 2017 23:25:07 +0100 change tx size to label. small fix re connecting slider and feerate. slider changes look when its value is ignored. Diffstat: M gui/qt/fee_slider.py | 25 +++++++++++++++++++++++++ M gui/qt/main_window.py | 22 ++++++++++++++++------ 2 files changed, 41 insertions(+), 6 deletions(-) --- DIR diff --git a/gui/qt/fee_slider.py b/gui/qt/fee_slider.py t@@ -54,3 +54,28 @@ class FeeSlider(QSlider): self.setValue(pos) tooltip = self.get_tooltip(pos, fee_rate) 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; + } + """ + ) DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py t@@ -1067,8 +1067,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): self.config.set_key('fee_level', pos, False) else: self.config.set_key('fee_per_kb', fee_rate, False) + + 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.feerate_e.setAmount(fee_rate//1000) self.fee_slider = FeeSlider(self, self.config, fee_cb) self.fee_slider.setFixedWidth(140) t@@ -1084,10 +1088,17 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): # edit_changed was edited just now, so make sure we will # freeze the correct fee setting (this) edit_other.setModified(False) + self.fee_slider.deactivate() self.update_fee() - self.size_e = AmountEdit(lambda: 'bytes') - self.size_e.setFrozen(True) + class TxSizeLabel(QLabel): + 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.textEdited.connect(partial(on_fee_or_feerate, self.feerate_e, False)) t@@ -1118,8 +1129,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): hbox.addWidget(self.size_e) hbox.addWidget(self.fee_e) - self.size_e.setStyleSheet(ColorScheme.BLUE.as_stylesheet()) - vbox_feecontrol = QVBoxLayout() vbox_feecontrol.addWidget(self.fee_adv_controls) vbox_feecontrol.addWidget(self.fee_slider) t@@ -1643,9 +1652,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): self.payment_request = None self.payto_e.is_pr = False 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.setFrozen(False) + self.size_e.setAmount(0) self.set_pay_from([]) #self.rbf_checkbox.setChecked(False) self.tx_external_keypairs = {}