This commit is contained in:
恍兮惚兮 2024-05-27 22:26:00 +08:00
parent eadf1f3b9d
commit 844b47ac87
15 changed files with 67 additions and 4462 deletions

View File

@ -1,5 +1,4 @@
import time
import keeprefs
import os, threading
from traceback import print_exc
from myutils.config import (

View File

@ -11,7 +11,8 @@ if __name__ == "__main__":
) # win7 no vcredist2015
from myutils.config import _TR, static_data, globalconfig
sys.path.append("./")
sys.path.append("./userconfig")
sys.path.insert(
0, "./LunaTranslator/network/" + ["winhttp", "libcurl"][globalconfig["network"]]

View File

@ -14,7 +14,7 @@ from PyQt5.QtWidgets import (
)
from PyQt5.QtGui import QResizeEvent, QFont, QFontMetrics
from PyQt5.QtWidgets import QTabWidget
import qtawesome, gobject
import qtawesome, gobject, importlib, sys
import functools, threading, windows, winsharedutils
from traceback import print_exc
from winsharedutils import isDark
@ -263,20 +263,26 @@ class Settin(closeashidewindow):
winsharedutils.SetTheme(
int(widget.winId()), dark, globalconfig["WindowBackdrop"]
)
try:
idx = globalconfig[darklight + "theme"] - int(not dark)
if idx == -1:
raise Exception()
with open(
"./files/themes/{}".format(
static_data["themes"][darklight][idx]["file"]
),
"r",
) as ff:
style = ff.read()
except:
# print_exc()
style = ""
for _ in (0,):
try:
idx = globalconfig[darklight + "theme"] - int(not dark)
if idx == -1:
break
_fn = static_data["themes"][darklight][idx]["file"]
if _fn.endswith(".py"):
style = importlib.import_module(
"files.themes." + _fn[:-3]
).stylesheet()
elif _fn.endswith(".qss"):
with open(
"./files/themes/{}".format(_fn),
"r",
) as ff:
style = ff.read()
except:
print_exc()
style = ""
style += (
"*{font: %spt '" % (globalconfig["settingfontsize"])
+ (globalconfig["settingfonttype"])

View File

@ -5,4 +5,6 @@ import xml.etree.ElementTree as ET
import hashlib
import configparser
from wsgiref.handlers import format_date_time
from html.parser import HTMLParser
from html.parser import HTMLParser
import qdarkstyle
import qdarktheme

View File

@ -2,21 +2,21 @@
"themes": {
"dark": [
{
"file": "dark1.qss",
"file": "dark1.py",
"name": "PyQtDarkTheme"
},
{
"file": "dark2.qss",
"file": "dark2.py",
"name": "QDarkStyleSheet"
}
],
"light": [
{
"file": "light1.qss",
"file": "light1.py",
"name": "PyQtDarkTheme"
},
{
"file": "light2.qss",
"file": "light2.py",
"name": "QDarkStyleSheet"
}
]

View File

@ -0,0 +1,3 @@
import qdarktheme
def stylesheet():
return qdarktheme.load_stylesheet(theme='dark')

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,4 @@
import qdarkstyle
def stylesheet():
return qdarkstyle.load_stylesheet(palette=qdarkstyle.DarkPalette)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
import qdarktheme
def stylesheet():
return qdarktheme.load_stylesheet(theme='light')

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,4 @@
import qdarkstyle
def stylesheet():
return qdarkstyle.load_stylesheet(palette=qdarkstyle.LightPalette)

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,6 @@
PyQt5==5.15.10
PyQt5-Qt5==5.15.2
webviewpy==1.2.0
pefile
pefile
qdarkstyle
pyqtdarktheme

View File

@ -178,6 +178,10 @@ copycheck(
os.path.join(py37Path, "Lib/site-packages/PyQt5/Qt5/bin/Qt5Core.dll"),
os.path.join(runtime, "PyQt5/Qt5/bin"),
)
copycheck(
os.path.join(py37Path, "Lib/site-packages/PyQt5/Qt5/bin/Qt5Svg.dll"),
os.path.join(runtime, "PyQt5/Qt5/bin"),
)
copycheck(
os.path.join(py37Path, "Lib/site-packages/PyQt5/Qt5/bin/Qt5Gui.dll"),
os.path.join(runtime, "PyQt5/Qt5/bin"),
@ -188,6 +192,10 @@ copycheck(
os.path.join(runtime, "PyQt5/Qt5/bin"),
)
copycheck(
os.path.join(py37Path, "Lib/site-packages/PyQt5/Qt5/plugins/iconengines"),
os.path.join(runtime, "PyQt5/Qt5/plugins"),
)
copycheck(
os.path.join(py37Path, "Lib/site-packages/PyQt5/Qt5/plugins/imageformats"),
os.path.join(runtime, "PyQt5/Qt5/plugins"),
@ -210,6 +218,18 @@ copycheck(
),
os.path.join(runtime, "PyQt5/Qt5/plugins/styles"),
)
copycheck(
os.path.join(
py37Path, "Lib/site-packages/qdarktheme"
),
os.path.join(runtime),
)
copycheck(
os.path.join(
py37Path, "Lib/site-packages/qdarkstyle"
),
os.path.join(runtime),
)
collect = []
for _dir, _, fs in os.walk(targetdir):