Fix compatibility issues with Qt/PyQt6 versions
- Add null check for message.message in search filter - Handle missing colorScheme/colorSchemeChanged methods for older Qt versions - Add display check to prevent hanging in headless environments - Update build documentation with system package alternative - Update PyInstaller spec for Python 3.12 - Improve run.sh script with venv management
This commit is contained in:
@@ -3,14 +3,21 @@ from gotify_tray.utils import get_abs_path
|
||||
|
||||
|
||||
themes = {
|
||||
QtCore.Qt.ColorScheme.Dark: "dark",
|
||||
QtCore.Qt.ColorScheme.Light: "light",
|
||||
QtCore.Qt.ColorScheme.Unknown: "light",
|
||||
2: "dark", # Dark
|
||||
1: "light", # Light
|
||||
0: "light", # Unknown
|
||||
}
|
||||
|
||||
|
||||
def set_theme(app: QtWidgets.QApplication):
|
||||
theme = themes.get(app.styleHints().colorScheme(), "light")
|
||||
if hasattr(app.styleHints(), "colorScheme"):
|
||||
color_scheme = app.styleHints().colorScheme()
|
||||
theme = themes.get(
|
||||
color_scheme.value if hasattr(color_scheme, "value") else color_scheme,
|
||||
"light",
|
||||
)
|
||||
else:
|
||||
theme = "light" # Default to light theme if colorScheme not available
|
||||
|
||||
stylesheet = ""
|
||||
with open(get_abs_path(f"gotify_tray/gui/themes/base.qss"), "r") as f:
|
||||
@@ -23,5 +30,12 @@ def set_theme(app: QtWidgets.QApplication):
|
||||
|
||||
def get_theme_file(file: str) -> str:
|
||||
app = QtCore.QCoreApplication.instance()
|
||||
theme = themes.get(app.styleHints().colorScheme(), "light")
|
||||
if hasattr(app.styleHints(), "colorScheme"):
|
||||
color_scheme = app.styleHints().colorScheme()
|
||||
theme = themes.get(
|
||||
color_scheme.value if hasattr(color_scheme, "value") else color_scheme,
|
||||
"light",
|
||||
)
|
||||
else:
|
||||
theme = "light" # Default to light theme if colorScheme not available
|
||||
return get_abs_path(f"gotify_tray/gui/themes/{theme}/{file}")
|
||||
|
||||
Reference in New Issue
Block a user