mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
style
This commit is contained in:
parent
eadf1f3b9d
commit
844b47ac87
@ -1,5 +1,4 @@
|
|||||||
import time
|
import time
|
||||||
import keeprefs
|
|
||||||
import os, threading
|
import os, threading
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
from myutils.config import (
|
from myutils.config import (
|
||||||
|
@ -11,7 +11,8 @@ if __name__ == "__main__":
|
|||||||
) # win7 no vcredist2015
|
) # win7 no vcredist2015
|
||||||
|
|
||||||
from myutils.config import _TR, static_data, globalconfig
|
from myutils.config import _TR, static_data, globalconfig
|
||||||
|
|
||||||
|
sys.path.append("./")
|
||||||
sys.path.append("./userconfig")
|
sys.path.append("./userconfig")
|
||||||
sys.path.insert(
|
sys.path.insert(
|
||||||
0, "./LunaTranslator/network/" + ["winhttp", "libcurl"][globalconfig["network"]]
|
0, "./LunaTranslator/network/" + ["winhttp", "libcurl"][globalconfig["network"]]
|
||||||
|
@ -14,7 +14,7 @@ from PyQt5.QtWidgets import (
|
|||||||
)
|
)
|
||||||
from PyQt5.QtGui import QResizeEvent, QFont, QFontMetrics
|
from PyQt5.QtGui import QResizeEvent, QFont, QFontMetrics
|
||||||
from PyQt5.QtWidgets import QTabWidget
|
from PyQt5.QtWidgets import QTabWidget
|
||||||
import qtawesome, gobject
|
import qtawesome, gobject, importlib, sys
|
||||||
import functools, threading, windows, winsharedutils
|
import functools, threading, windows, winsharedutils
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
from winsharedutils import isDark
|
from winsharedutils import isDark
|
||||||
@ -263,20 +263,26 @@ class Settin(closeashidewindow):
|
|||||||
winsharedutils.SetTheme(
|
winsharedutils.SetTheme(
|
||||||
int(widget.winId()), dark, globalconfig["WindowBackdrop"]
|
int(widget.winId()), dark, globalconfig["WindowBackdrop"]
|
||||||
)
|
)
|
||||||
try:
|
for _ in (0,):
|
||||||
idx = globalconfig[darklight + "theme"] - int(not dark)
|
try:
|
||||||
if idx == -1:
|
idx = globalconfig[darklight + "theme"] - int(not dark)
|
||||||
raise Exception()
|
if idx == -1:
|
||||||
with open(
|
break
|
||||||
"./files/themes/{}".format(
|
_fn = static_data["themes"][darklight][idx]["file"]
|
||||||
static_data["themes"][darklight][idx]["file"]
|
|
||||||
),
|
if _fn.endswith(".py"):
|
||||||
"r",
|
style = importlib.import_module(
|
||||||
) as ff:
|
"files.themes." + _fn[:-3]
|
||||||
style = ff.read()
|
).stylesheet()
|
||||||
except:
|
elif _fn.endswith(".qss"):
|
||||||
# print_exc()
|
with open(
|
||||||
style = ""
|
"./files/themes/{}".format(_fn),
|
||||||
|
"r",
|
||||||
|
) as ff:
|
||||||
|
style = ff.read()
|
||||||
|
except:
|
||||||
|
print_exc()
|
||||||
|
style = ""
|
||||||
style += (
|
style += (
|
||||||
"*{font: %spt '" % (globalconfig["settingfontsize"])
|
"*{font: %spt '" % (globalconfig["settingfontsize"])
|
||||||
+ (globalconfig["settingfonttype"])
|
+ (globalconfig["settingfonttype"])
|
||||||
|
@ -5,4 +5,6 @@ import xml.etree.ElementTree as ET
|
|||||||
import hashlib
|
import hashlib
|
||||||
import configparser
|
import configparser
|
||||||
from wsgiref.handlers import format_date_time
|
from wsgiref.handlers import format_date_time
|
||||||
from html.parser import HTMLParser
|
from html.parser import HTMLParser
|
||||||
|
import qdarkstyle
|
||||||
|
import qdarktheme
|
@ -2,21 +2,21 @@
|
|||||||
"themes": {
|
"themes": {
|
||||||
"dark": [
|
"dark": [
|
||||||
{
|
{
|
||||||
"file": "dark1.qss",
|
"file": "dark1.py",
|
||||||
"name": "PyQtDarkTheme"
|
"name": "PyQtDarkTheme"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "dark2.qss",
|
"file": "dark2.py",
|
||||||
"name": "QDarkStyleSheet"
|
"name": "QDarkStyleSheet"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"light": [
|
"light": [
|
||||||
{
|
{
|
||||||
"file": "light1.qss",
|
"file": "light1.py",
|
||||||
"name": "PyQtDarkTheme"
|
"name": "PyQtDarkTheme"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "light2.qss",
|
"file": "light2.py",
|
||||||
"name": "QDarkStyleSheet"
|
"name": "QDarkStyleSheet"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
3
LunaTranslator/files/themes/dark1.py
Normal file
3
LunaTranslator/files/themes/dark1.py
Normal 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
4
LunaTranslator/files/themes/dark2.py
Normal file
4
LunaTranslator/files/themes/dark2.py
Normal 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
3
LunaTranslator/files/themes/light1.py
Normal file
3
LunaTranslator/files/themes/light1.py
Normal 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
4
LunaTranslator/files/themes/light2.py
Normal file
4
LunaTranslator/files/themes/light2.py
Normal 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
@ -1,4 +1,6 @@
|
|||||||
PyQt5==5.15.10
|
PyQt5==5.15.10
|
||||||
PyQt5-Qt5==5.15.2
|
PyQt5-Qt5==5.15.2
|
||||||
webviewpy==1.2.0
|
webviewpy==1.2.0
|
||||||
pefile
|
pefile
|
||||||
|
qdarkstyle
|
||||||
|
pyqtdarktheme
|
@ -178,6 +178,10 @@ copycheck(
|
|||||||
os.path.join(py37Path, "Lib/site-packages/PyQt5/Qt5/bin/Qt5Core.dll"),
|
os.path.join(py37Path, "Lib/site-packages/PyQt5/Qt5/bin/Qt5Core.dll"),
|
||||||
os.path.join(runtime, "PyQt5/Qt5/bin"),
|
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(
|
copycheck(
|
||||||
os.path.join(py37Path, "Lib/site-packages/PyQt5/Qt5/bin/Qt5Gui.dll"),
|
os.path.join(py37Path, "Lib/site-packages/PyQt5/Qt5/bin/Qt5Gui.dll"),
|
||||||
os.path.join(runtime, "PyQt5/Qt5/bin"),
|
os.path.join(runtime, "PyQt5/Qt5/bin"),
|
||||||
@ -188,6 +192,10 @@ copycheck(
|
|||||||
os.path.join(runtime, "PyQt5/Qt5/bin"),
|
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(
|
copycheck(
|
||||||
os.path.join(py37Path, "Lib/site-packages/PyQt5/Qt5/plugins/imageformats"),
|
os.path.join(py37Path, "Lib/site-packages/PyQt5/Qt5/plugins/imageformats"),
|
||||||
os.path.join(runtime, "PyQt5/Qt5/plugins"),
|
os.path.join(runtime, "PyQt5/Qt5/plugins"),
|
||||||
@ -210,6 +218,18 @@ copycheck(
|
|||||||
),
|
),
|
||||||
os.path.join(runtime, "PyQt5/Qt5/plugins/styles"),
|
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 = []
|
collect = []
|
||||||
for _dir, _, fs in os.walk(targetdir):
|
for _dir, _, fs in os.walk(targetdir):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user