Skip to content

Commit

Permalink
Make is_dark_theme() not raise an exception when no QApplication is c…
Browse files Browse the repository at this point in the history
…onstructed
  • Loading branch information
kovidgoyal committed Sep 25, 2024
1 parent a87958e commit 4c3a160
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/calibre/gui2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,8 +1002,11 @@ def choose_files_and_remember_all_files(


def is_dark_theme():
pal = QApplication.instance().palette()
return pal.is_dark_theme()
app = QApplication.instance()
if app is not None:
pal = QApplication.instance().palette()
return pal.is_dark_theme()
return False


def choose_osx_app(window, name, title, default_dir='/Applications'):
Expand Down

0 comments on commit 4c3a160

Please sign in to comment.