Detect default theme and use it
This commit is contained in:
parent
687a91f587
commit
33aa358a28
|
@ -61,6 +61,7 @@ from PyQt5.QtWebKitWidgets import *
|
|||
import qdarktheme # Dark style for PyQt5
|
||||
import pypresence # Discord RPC
|
||||
from PIL import Image
|
||||
import darkdetect
|
||||
|
||||
# Load dark theme
|
||||
dark_stylesheet = qdarktheme.load_stylesheet()
|
||||
|
@ -80,6 +81,11 @@ if not os.path.exists(f"/home/{USER}/.minecraft-pi/overrides/images/mob/"):
|
|||
# else:
|
||||
# TODO: Add a tab with a button to import features from gMCPIL
|
||||
|
||||
if darkdetect.isDark():
|
||||
theme = "dark"
|
||||
else:
|
||||
theme = "light"
|
||||
|
||||
|
||||
class ConfigPluto(QDialog):
|
||||
"""Startup configurator for Planet. Based on QDialog."""
|
||||
|
@ -235,7 +241,7 @@ class Planet(QMainWindow):
|
|||
"hidelauncher": True,
|
||||
"profile": "Modded MCPE",
|
||||
"render_distance": "Short",
|
||||
"theme": "dark",
|
||||
"theme": theme,
|
||||
"discord_rpc": True,
|
||||
}
|
||||
|
||||
|
@ -570,6 +576,8 @@ if __name__ == "__main__":
|
|||
if os.path.exists(f"/home/{USER}/.planet-launcher/config.json"):
|
||||
with open(f"/home/{USER}/.planet-launcher/config.json") as file:
|
||||
app.setPalette(qdarktheme.load_palette(json.loads(file.read())["theme"]))
|
||||
else:
|
||||
app.setPalette(qdarktheme.load_palette(theme))
|
||||
|
||||
if not os.path.exists(f"/home/{USER}/.planet-launcher/minecraft.AppImage"):
|
||||
pluto = ConfigPluto()
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
|
@ -4,7 +4,6 @@ Architecture: all
|
|||
Maintainer: mcpiscript <mcpiscript@gmail.com>
|
||||
Depends: python3-pyqt5, python3:any, python3-pyqt5.qtwebkit, python3-pyqt5.qtsvg, python3-pyqt5.qtwebkit, python3-pyqt5.qtmultimedia
|
||||
Replaces: mcpil, mcpil-r
|
||||
Provides: python3-pypresence
|
||||
Recommends: minecraft-pi-reborn-client, minecraft-pi-reborn-server, python3-pyqtdarkmode, python3-mcpi, python3-minecraft-pi, python3-morpheus-mcpi
|
||||
Section: games
|
||||
Priority: optional
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pip3 install pyqtdarktheme pypresence pillow
|
||||
pip3 install pyqtdarktheme pypresence pillow darkdetect
|
||||
link /usr/lib/planet-launcher/main.py /usr/bin/planet-launcher
|
||||
chmod 755 /usr/lib/planet-launcher/main.py
|
||||
link /usr/lib/planet-launcher/assets/planet-launcher.desktop /usr/share/applications/planet-launcher.desktop
|
||||
|
|
Loading…
Reference in New Issue