mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1987337 [The colors of the library access persmission window make the text illegible in dark mode](https://bugs.launchpad.net/calibre/+bug/1987337)
This commit is contained in:
parent
a450731c6a
commit
4991254b7c
@ -23,8 +23,9 @@ from threading import Lock, RLock
|
|||||||
import calibre.gui2.pyqt6_compat as pqc
|
import calibre.gui2.pyqt6_compat as pqc
|
||||||
from calibre import as_unicode, prints
|
from calibre import as_unicode, prints
|
||||||
from calibre.constants import (
|
from calibre.constants import (
|
||||||
DEBUG, __appname__ as APP_UID, __version__, config_dir, is_running_from_develop,
|
DEBUG, __appname__ as APP_UID, __version__, builtin_colors_dark,
|
||||||
isbsd, isfrozen, islinux, ismacos, iswindows, isxp, numeric_version, plugins_loc
|
builtin_colors_light, config_dir, is_running_from_develop, isbsd, isfrozen,
|
||||||
|
islinux, ismacos, iswindows, isxp, numeric_version, plugins_loc
|
||||||
)
|
)
|
||||||
from calibre.ebooks.metadata import MetaInformation
|
from calibre.ebooks.metadata import MetaInformation
|
||||||
from calibre.gui2.linux_file_dialogs import (
|
from calibre.gui2.linux_file_dialogs import (
|
||||||
@ -1200,6 +1201,10 @@ class Application(QApplication):
|
|||||||
def is_dark_theme(self):
|
def is_dark_theme(self):
|
||||||
return self.palette_manager.is_dark_theme
|
return self.palette_manager.is_dark_theme
|
||||||
|
|
||||||
|
@property
|
||||||
|
def emphasis_window_background_color(self):
|
||||||
|
return (builtin_colors_dark if self.is_dark_theme else builtin_colors_light)['yellow']
|
||||||
|
|
||||||
@pyqtSlot(int, result=QIcon)
|
@pyqtSlot(int, result=QIcon)
|
||||||
def get_qt_standard_icon(self, standard_pixmap):
|
def get_qt_standard_icon(self, standard_pixmap):
|
||||||
return self.palette_manager.get_qt_standard_icon(standard_pixmap)
|
return self.palette_manager.get_qt_standard_icon(standard_pixmap)
|
||||||
|
@ -62,11 +62,7 @@ class SelectFormats(QDialog):
|
|||||||
self.fview.doubleClicked.connect(self.double_clicked,
|
self.fview.doubleClicked.connect(self.double_clicked,
|
||||||
type=Qt.ConnectionType.QueuedConnection)
|
type=Qt.ConnectionType.QueuedConnection)
|
||||||
if exclude:
|
if exclude:
|
||||||
if QApplication.instance().is_dark_theme:
|
self.fview.setStyleSheet(f'QListView {{ background-color: {QApplication.instance().emphasis_window_background_color} }}')
|
||||||
sheet = 'background-color: #DAA520; color: black'
|
|
||||||
else:
|
|
||||||
sheet = 'background-color: #fae7b5'
|
|
||||||
self.fview.setStyleSheet('QListView { %s }' % sheet)
|
|
||||||
self._l.addWidget(self.fview)
|
self._l.addWidget(self.fview)
|
||||||
self.fview.setModel(self.formats)
|
self.fview.setModel(self.formats)
|
||||||
self.fview.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection if single else
|
self.fview.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection if single else
|
||||||
|
@ -8,12 +8,11 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from qt.core import (
|
from qt.core import (
|
||||||
QCheckBox, QComboBox, QDialog, QDialogButtonBox, QDoubleSpinBox, QFormLayout,
|
QApplication, QCheckBox, QComboBox, QDialog, QDialogButtonBox, QDoubleSpinBox,
|
||||||
QFrame, QHBoxLayout, QIcon, QLabel, QLineEdit, QListWidget, QPlainTextEdit, QLayout,
|
QFormLayout, QFrame, QHBoxLayout, QIcon, QLabel, QLayout, QLineEdit, QListWidget,
|
||||||
QPushButton, QScrollArea, QSize, QSizePolicy, QSpinBox, Qt, QTabWidget, QTimer,
|
QPlainTextEdit, QPushButton, QScrollArea, QSize, QSizePolicy, QSpinBox, Qt,
|
||||||
QToolButton, QUrl, QVBoxLayout, QWidget, pyqtSignal, sip
|
QTabWidget, QTimer, QToolButton, QUrl, QVBoxLayout, QWidget, pyqtSignal, sip
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre import as_unicode
|
from calibre import as_unicode
|
||||||
@ -26,8 +25,8 @@ from calibre.gui2.preferences import AbortCommit, ConfigWidgetBase, test_widget
|
|||||||
from calibre.gui2.widgets import HistoryLineEdit
|
from calibre.gui2.widgets import HistoryLineEdit
|
||||||
from calibre.srv.code import custom_list_template as default_custom_list_template
|
from calibre.srv.code import custom_list_template as default_custom_list_template
|
||||||
from calibre.srv.embedded import custom_list_template, search_the_net_urls
|
from calibre.srv.embedded import custom_list_template, search_the_net_urls
|
||||||
from calibre.srv.loop import parse_trusted_ips
|
|
||||||
from calibre.srv.library_broker import load_gui_libraries
|
from calibre.srv.library_broker import load_gui_libraries
|
||||||
|
from calibre.srv.loop import parse_trusted_ips
|
||||||
from calibre.srv.opts import change_settings, options, server_config
|
from calibre.srv.opts import change_settings, options, server_config
|
||||||
from calibre.srv.users import (
|
from calibre.srv.users import (
|
||||||
UserManager, create_user_data, validate_password, validate_username
|
UserManager, create_user_data, validate_password, validate_username
|
||||||
@ -36,7 +35,6 @@ from calibre.utils.icu import primary_sort_key
|
|||||||
from calibre.utils.shared_file import share_open
|
from calibre.utils.shared_file import share_open
|
||||||
from polyglot.builtins import as_bytes
|
from polyglot.builtins import as_bytes
|
||||||
|
|
||||||
|
|
||||||
if iswindows and not isportable:
|
if iswindows and not isportable:
|
||||||
from calibre_extensions import winutil
|
from calibre_extensions import winutil
|
||||||
|
|
||||||
@ -698,7 +696,7 @@ class ChangeRestriction(QDialog):
|
|||||||
else:
|
else:
|
||||||
m = _('{} is allowed access to all libraries, <b>except</b> those'
|
m = _('{} is allowed access to all libraries, <b>except</b> those'
|
||||||
' whose names match one of the names specified below.')
|
' whose names match one of the names specified below.')
|
||||||
sheet += 'QWidget#libraries { background-color: #FAE7B5}'
|
sheet += f'QWidget#libraries {{ background-color: {QApplication.instance().emphasis_window_background_color} }}'
|
||||||
self.libraries.setEnabled(True), self.la.setEnabled(True)
|
self.libraries.setEnabled(True), self.la.setEnabled(True)
|
||||||
self.items = self.items
|
self.items = self.items
|
||||||
self.msg.setText(m.format(self.username))
|
self.msg.setText(m.format(self.username))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user