electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 0d7bcde2db0fe72c29d61e6261adb963bab375c2
parent 93a4969fba90ef524caf4ae400c7a3dfb41e59f4
Author: SomberNight <somber.night@protonmail.com>
Date:   Sun, 28 Jun 2020 03:50:34 +0200

qt dark theme: on mac, AmountEdit units were using dark text on dark bg

see #6281

Diffstat:
Melectrum/gui/qt/amountedit.py | 5++---
Melectrum/gui/qt/locktimeedit.py | 5++---
Melectrum/gui/qt/util.py | 1+
3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/electrum/gui/qt/amountedit.py b/electrum/gui/qt/amountedit.py @@ -7,7 +7,7 @@ from PyQt5.QtCore import pyqtSignal, Qt from PyQt5.QtGui import QPalette, QPainter from PyQt5.QtWidgets import (QLineEdit, QStyle, QStyleOptionFrame) -from .util import char_width_in_lineedit +from .util import char_width_in_lineedit, ColorScheme from electrum.util import (format_satoshis_plain, decimal_point_to_base_unit_name, FEERATE_PRECISION, quantize_feerate) @@ -32,7 +32,6 @@ class AmountEdit(FreezableLineEdit): self.textChanged.connect(self.numbify) self.is_int = is_int self.is_shortcut = False - self.help_palette = QPalette() self.extra_precision = 0 def decimal_point(self): @@ -69,7 +68,7 @@ class AmountEdit(FreezableLineEdit): textRect = self.style().subElementRect(QStyle.SE_LineEditContents, panel, self) textRect.adjust(2, 0, -10, 0) painter = QPainter(self) - painter.setPen(self.help_palette.brush(QPalette.Disabled, QPalette.Text).color()) + painter.setPen(ColorScheme.GRAY.as_color()) painter.drawText(textRect, Qt.AlignRight | Qt.AlignVCenter, self.base_unit()) def get_amount(self) -> Union[None, Decimal, int]: diff --git a/electrum/gui/qt/locktimeedit.py b/electrum/gui/qt/locktimeedit.py @@ -14,7 +14,7 @@ from PyQt5.QtWidgets import (QWidget, QLineEdit, QStyle, QStyleOptionFrame, QCom from electrum.i18n import _ from electrum.bitcoin import NLOCKTIME_MIN, NLOCKTIME_MAX, NLOCKTIME_BLOCKHEIGHT_MAX -from .util import char_width_in_lineedit +from .util import char_width_in_lineedit, ColorScheme class LockTimeEdit(QWidget): @@ -133,7 +133,6 @@ class LockTimeHeightEdit(LockTimeRawEdit): def __init__(self, parent=None): LockTimeRawEdit.__init__(self, parent) self.setFixedWidth(20 * char_width_in_lineedit()) - self.help_palette = QPalette() def paintEvent(self, event): super().paintEvent(event) @@ -142,7 +141,7 @@ class LockTimeHeightEdit(LockTimeRawEdit): textRect = self.style().subElementRect(QStyle.SE_LineEditContents, panel, self) textRect.adjust(2, 0, -10, 0) painter = QPainter(self) - painter.setPen(self.help_palette.brush(QPalette.Disabled, QPalette.Text).color()) + painter.setPen(ColorScheme.GRAY.as_color()) painter.drawText(textRect, Qt.AlignRight | Qt.AlignVCenter, "height") diff --git a/electrum/gui/qt/util.py b/electrum/gui/qt/util.py @@ -870,6 +870,7 @@ class ColorScheme: RED = ColorSchemeItem("#7c1111", "#f18c8c") BLUE = ColorSchemeItem("#123b7c", "#8cb3f2") DEFAULT = ColorSchemeItem("black", "white") + GRAY = ColorSchemeItem("gray", "gray") @staticmethod def has_dark_background(widget):