Skip to content

Commit

Permalink
Merge commit 'f947ecf414d30c8070cf1362a8a1caca5c514a0a' of https://gi…
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiHuaDou committed Feb 16, 2024
2 parents 60468a9 + f947ecf commit 9fa09e8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# - title by author
# }}}

{{{ 7.5.0 2024-02-09
{{{ 7.5.1 2024-02-09

:: new features

Expand Down Expand Up @@ -52,6 +52,8 @@

- Fix a regression in 7.2 that caused the popup used for editing fields in the book list to be mis-positioned on very wide monitors

- Version 7.5.1 fixes a bug in 7.5.0 where calibre would not start up using dark colors when the system was in dark mode on some windows installs

:: improved recipes
- El Diplo
- Science News
Expand Down
2 changes: 1 addition & 1 deletion src/calibre/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys, locale, codecs, os, collections, collections.abc

__appname__ = 'calibre'
numeric_version = (7, 5, 0)
numeric_version = (7, 5, 1)
__version__ = '.'.join(map(str, numeric_version))
git_version = None
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
Expand Down
12 changes: 8 additions & 4 deletions src/calibre/gui2/palette.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,17 @@ def initialize(self):
# Since Qt is using the fusion style anyway, specialize it
self.using_calibre_style = True

@property
def use_dark_palette(self):
app = QApplication.instance()
system_is_dark = app.styleHints().colorScheme() == Qt.ColorScheme.Dark
return self.color_palette == 'dark' or (self.color_palette == 'system' and system_is_dark)

def setup_styles(self):
if self.using_calibre_style:
app = QApplication.instance()
system_is_dark = app.styleHints().colorScheme() == Qt.ColorScheme.Dark
app.styleHints().colorSchemeChanged.connect(self.color_scheme_changed)
use_dark_palette = self.color_palette == 'dark' or (self.color_palette == 'system' and system_is_dark)
self.set_dark_mode_palette() if use_dark_palette else self.set_light_mode_palette()
self.set_dark_mode_palette() if self.use_dark_palette else self.set_light_mode_palette()
QApplication.instance().setAttribute(Qt.ApplicationAttribute.AA_SetPalette, True)

if DEBUG:
Expand Down Expand Up @@ -371,7 +375,7 @@ def on_qt_palette_change(self):
if DEBUG:
print('ApplicationPaletteChange event received', file=sys.stderr)
if self.using_calibre_style:
pal = dark_palette() if self.color_palette == 'dark' else light_palette()
pal = dark_palette() if self.use_dark_palette else light_palette()
if QApplication.instance().palette().color(QPalette.ColorRole.Window) != pal.color(QPalette.ColorRole.Window):
if DEBUG:
print('Detected a spontaneous palette change by Qt, reverting it', file=sys.stderr)
Expand Down

0 comments on commit 9fa09e8

Please sign in to comment.