mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-07-16 10:32:23 +08:00
更多组件支持设置字体大小
This commit is contained in:
parent
ef8c115df2
commit
cb0cd776a4
53
DefaultSetting.py
Normal file
53
DefaultSetting.py
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# 读取设置单独用一个 py 文件
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
import PyQt5.QtGui as QtGui
|
||||||
|
|
||||||
|
# 获取用户主目录
|
||||||
|
def get_home():
|
||||||
|
return os.path.expanduser('~')
|
||||||
|
|
||||||
|
# 读取文本文档
|
||||||
|
def readtxt(path):
|
||||||
|
f = open(path, "r") # 设置文件对象
|
||||||
|
str = f.read() # 获取内容
|
||||||
|
f.close() # 关闭文本对象
|
||||||
|
return str # 返回结果
|
||||||
|
|
||||||
|
defultProgramList = {
|
||||||
|
"Architecture": "Auto",
|
||||||
|
"Debug": True,
|
||||||
|
"DefultWine": "deepin-wine6 stable",
|
||||||
|
"DefultBotton" : get_home() + "/.wine",
|
||||||
|
"TerminalOpen": False,
|
||||||
|
"WineOption": "",
|
||||||
|
"WineBottonDifferent": False,
|
||||||
|
"CenterWindow": False,
|
||||||
|
"Theme": "",
|
||||||
|
"MonoGeckoInstaller": False,
|
||||||
|
"AutoWine": True,
|
||||||
|
"RuntimeCache": True,
|
||||||
|
"MustRead": False,
|
||||||
|
"BuildByBottleName": False,
|
||||||
|
"AutoPath": False,
|
||||||
|
"QemuUnMountHome": False,
|
||||||
|
"Chinese": True,
|
||||||
|
"FontSize": 1
|
||||||
|
}
|
||||||
|
|
||||||
|
def SetFont(app):
|
||||||
|
defaultFont = app.font()
|
||||||
|
size = setting["FontSize"]
|
||||||
|
font = QtGui.QFont(defaultFont)
|
||||||
|
if size == 1:
|
||||||
|
app.setFont(defaultFont)
|
||||||
|
return
|
||||||
|
font.setPixelSize(int(defaultFont.pixelSize() / size))
|
||||||
|
font.setPointSize(int(defaultFont.pointSize() / size))
|
||||||
|
app.setFont(font)
|
||||||
|
|
||||||
|
try:
|
||||||
|
setting = json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineSetting.json"))
|
||||||
|
except:
|
||||||
|
setting = defultProgramList
|
1
Makefile
1
Makefile
@ -30,6 +30,7 @@ package:
|
|||||||
cp -rv AllInstall.py deb/opt/apps/deepin-wine-runner
|
cp -rv AllInstall.py deb/opt/apps/deepin-wine-runner
|
||||||
cp -rv ShellList deb/opt/apps/deepin-wine-runner
|
cp -rv ShellList deb/opt/apps/deepin-wine-runner
|
||||||
cp -rv QemuDownload.py deb/opt/apps/deepin-wine-runner
|
cp -rv QemuDownload.py deb/opt/apps/deepin-wine-runner
|
||||||
|
cp -rv DefaultSetting.py deb/opt/apps/deepin-wine-runner
|
||||||
cp -rv QemuRun.py deb/opt/apps/deepin-wine-runner
|
cp -rv QemuRun.py deb/opt/apps/deepin-wine-runner
|
||||||
cp -rv kill.sh deb/opt/apps/deepin-wine-runner
|
cp -rv kill.sh deb/opt/apps/deepin-wine-runner
|
||||||
cp -rv updatekiller.py deb/opt/apps/deepin-wine-runner
|
cp -rv updatekiller.py deb/opt/apps/deepin-wine-runner
|
||||||
|
@ -11,6 +11,7 @@ import subprocess
|
|||||||
import PyQt5.QtGui as QtGui
|
import PyQt5.QtGui as QtGui
|
||||||
import PyQt5.QtCore as QtCore
|
import PyQt5.QtCore as QtCore
|
||||||
import PyQt5.QtWidgets as QtWidgets
|
import PyQt5.QtWidgets as QtWidgets
|
||||||
|
from DefaultSetting import *
|
||||||
|
|
||||||
def ShowText(text: str):
|
def ShowText(text: str):
|
||||||
if text.replace(" ", "").replace("\n", "") == "":
|
if text.replace(" ", "").replace("\n", "") == "":
|
||||||
@ -682,4 +683,6 @@ if __name__ == "__main__":
|
|||||||
pass
|
pass
|
||||||
window.resize(int(window.frameGeometry().width() * 1.2), int(window.frameGeometry().height() * 1.1))
|
window.resize(int(window.frameGeometry().width() * 1.2), int(window.frameGeometry().height() * 1.1))
|
||||||
window.show()
|
window.show()
|
||||||
|
# 设置字体
|
||||||
|
SetFont(app)
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
@ -25,6 +25,7 @@ import PyQt5.QtGui as QtGui
|
|||||||
import PyQt5.QtCore as QtCore
|
import PyQt5.QtCore as QtCore
|
||||||
import PyQt5.QtWidgets as QtWidgets
|
import PyQt5.QtWidgets as QtWidgets
|
||||||
from trans import *
|
from trans import *
|
||||||
|
from DefaultSetting import *
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# 程序所需事件
|
# 程序所需事件
|
||||||
@ -2160,16 +2161,6 @@ def LockBottleName():
|
|||||||
def get_now_lang()->"获取当前语言":
|
def get_now_lang()->"获取当前语言":
|
||||||
return os.getenv('LANG')
|
return os.getenv('LANG')
|
||||||
|
|
||||||
def SetFont(size):
|
|
||||||
font = QtGui.QFont(defaultFont)
|
|
||||||
if size == 1:
|
|
||||||
app.setFont(defaultFont)
|
|
||||||
return
|
|
||||||
font.setPixelSize(int(defaultFont.pixelSize() / size))
|
|
||||||
font.setPointSize(int(defaultFont.pointSize() / size))
|
|
||||||
app.setFont(font)
|
|
||||||
|
|
||||||
|
|
||||||
bottleNameLock = False
|
bottleNameLock = False
|
||||||
###############
|
###############
|
||||||
# 程序信息
|
# 程序信息
|
||||||
@ -2429,16 +2420,14 @@ videoHelpAction.triggered.connect(lambda: webbrowser.open_new_tab("https://space
|
|||||||
videoHelp.addAction(videoHelpAction)
|
videoHelp.addAction(videoHelpAction)
|
||||||
openFile.triggered.connect(OpenConfigFile)
|
openFile.triggered.connect(OpenConfigFile)
|
||||||
saveFile.triggered.connect(SaveConfigList)
|
saveFile.triggered.connect(SaveConfigList)
|
||||||
setMiniFont.triggered.connect(lambda: SetFont(1.2))
|
|
||||||
setDefaultFont.triggered.connect(lambda: SetFont(1))
|
|
||||||
hideShowText.triggered.connect(lambda: textbox1.setHidden(hideShowText.isChecked()))
|
hideShowText.triggered.connect(lambda: textbox1.setHidden(hideShowText.isChecked()))
|
||||||
exit.triggered.connect(window.close)
|
exit.triggered.connect(window.close)
|
||||||
tip.triggered.connect(helps)
|
tip.triggered.connect(helps)
|
||||||
programmenu.addAction(openFile)
|
programmenu.addAction(openFile)
|
||||||
programmenu.addAction(saveFile)
|
programmenu.addAction(saveFile)
|
||||||
programmenu.addSeparator()
|
#programmenu.addSeparator()
|
||||||
programmenu.addAction(setMiniFont)
|
#programmenu.addAction(setMiniFont)
|
||||||
programmenu.addAction(setDefaultFont)
|
#programmenu.addAction(setDefaultFont)
|
||||||
programmenu.addAction(hideShowText)
|
programmenu.addAction(hideShowText)
|
||||||
programmenu.addSeparator()
|
programmenu.addSeparator()
|
||||||
programmenu.addAction(exit)
|
programmenu.addAction(exit)
|
||||||
@ -2535,6 +2524,8 @@ allInfoList = {
|
|||||||
"DebArch": ["Co", debArch],
|
"DebArch": ["Co", debArch],
|
||||||
"SparkHelperConfigPath": ["Str-SparkHelperConfigPath", helperConfigPath]
|
"SparkHelperConfigPath": ["Str-SparkHelperConfigPath", helperConfigPath]
|
||||||
}
|
}
|
||||||
|
# 设置字体
|
||||||
|
SetFont(app)
|
||||||
#window.setWindowFlag(QtGui.Qt)
|
#window.setWindowFlag(QtGui.Qt)
|
||||||
window.show()
|
window.show()
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
@ -9,6 +9,7 @@ import webbrowser
|
|||||||
import urllib.parse as parse
|
import urllib.parse as parse
|
||||||
import PyQt5.QtGui as QtGui
|
import PyQt5.QtGui as QtGui
|
||||||
import PyQt5.QtWidgets as QtWidgets
|
import PyQt5.QtWidgets as QtWidgets
|
||||||
|
from DefaultSetting import *
|
||||||
|
|
||||||
# 读取文本文档
|
# 读取文本文档
|
||||||
def readtxt(path: "路径")->"读取文本文档":
|
def readtxt(path: "路径")->"读取文本文档":
|
||||||
@ -90,9 +91,18 @@ widgetLayout.addWidget(updateButton, 3, 5, 1, 1)
|
|||||||
giteeButton.clicked.connect(OpenGiteeIssues)
|
giteeButton.clicked.connect(OpenGiteeIssues)
|
||||||
githubButton.clicked.connect(OpenGithubIssues)
|
githubButton.clicked.connect(OpenGithubIssues)
|
||||||
updateButton.clicked.connect(UpdateButtonClick)
|
updateButton.clicked.connect(UpdateButtonClick)
|
||||||
|
# 禁用 bug 提交,引导到 Gitee 提交 bug
|
||||||
|
nameThings.setDisabled(True)
|
||||||
|
contactThings.setDisabled(True)
|
||||||
|
starMenu.setDisabled(True)
|
||||||
|
updateThings.setDisabled(True)
|
||||||
|
updateButton.setDisabled(True)
|
||||||
|
updateThings.setText("请移步到 Gitee 或 Github 提交 Bug(推荐使用 Gitee)")
|
||||||
widget.setLayout(widgetLayout)
|
widget.setLayout(widgetLayout)
|
||||||
window.setCentralWidget(widget)
|
window.setCentralWidget(widget)
|
||||||
window.setWindowTitle(f"Wine 运行器 {version} 问题/建议反馈")
|
window.setWindowTitle(f"Wine 运行器 {version} 问题/建议反馈")
|
||||||
window.setWindowIcon(QtGui.QIcon(iconPath))
|
window.setWindowIcon(QtGui.QIcon(iconPath))
|
||||||
window.show()
|
window.show()
|
||||||
|
# 设置字体
|
||||||
|
SetFont(app)
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
@ -37,6 +37,7 @@ except:
|
|||||||
bad = True
|
bad = True
|
||||||
from trans import *
|
from trans import *
|
||||||
from Model import *
|
from Model import *
|
||||||
|
from DefaultSetting import *
|
||||||
|
|
||||||
def PythonLower():
|
def PythonLower():
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
@ -2235,26 +2236,7 @@ def TransLog():
|
|||||||
###########################
|
###########################
|
||||||
# 加载配置
|
# 加载配置
|
||||||
###########################
|
###########################
|
||||||
defultProgramList = {
|
|
||||||
"Architecture": "Auto",
|
|
||||||
"Debug": True,
|
|
||||||
"DefultWine": "deepin-wine6 stable",
|
|
||||||
"DefultBotton" : get_home() + "/.wine",
|
|
||||||
"TerminalOpen": False,
|
|
||||||
"WineOption": "",
|
|
||||||
"WineBottonDifferent": False,
|
|
||||||
"CenterWindow": False,
|
|
||||||
"Theme": "",
|
|
||||||
"MonoGeckoInstaller": False,
|
|
||||||
"AutoWine": True,
|
|
||||||
"RuntimeCache": True,
|
|
||||||
"MustRead": False,
|
|
||||||
"BuildByBottleName": False,
|
|
||||||
"AutoPath": False,
|
|
||||||
"QemuUnMountHome": False,
|
|
||||||
"Chinese": True,
|
|
||||||
"FontSize": 1
|
|
||||||
}
|
|
||||||
if not os.path.exists(get_home() + "/.config/"): # 如果没有配置文件夹
|
if not os.path.exists(get_home() + "/.config/"): # 如果没有配置文件夹
|
||||||
os.mkdir(get_home() + "/.config/") # 创建配置文件夹
|
os.mkdir(get_home() + "/.config/") # 创建配置文件夹
|
||||||
if not os.path.exists(get_home() + "/.config/deepin-wine-runner"): # 如果没有配置文件夹
|
if not os.path.exists(get_home() + "/.config/deepin-wine-runner"): # 如果没有配置文件夹
|
||||||
@ -2654,7 +2636,7 @@ except:
|
|||||||
# Qt 窗口
|
# Qt 窗口
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
window = QtWidgets.QMainWindow()
|
window = QtWidgets.QMainWindow()
|
||||||
defaultFont = window.font()
|
defaultFont = app.font()
|
||||||
window.setWindowTitle(title)
|
window.setWindowTitle(title)
|
||||||
widget = QtWidgets.QWidget()
|
widget = QtWidgets.QWidget()
|
||||||
window.setCentralWidget(widget)
|
window.setCentralWidget(widget)
|
||||||
|
53
package-script/DefaultSetting.py
Normal file
53
package-script/DefaultSetting.py
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# 读取设置单独用一个 py 文件
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
import PyQt5.QtGui as QtGui
|
||||||
|
|
||||||
|
# 获取用户主目录
|
||||||
|
def get_home():
|
||||||
|
return os.path.expanduser('~')
|
||||||
|
|
||||||
|
# 读取文本文档
|
||||||
|
def readtxt(path):
|
||||||
|
f = open(path, "r") # 设置文件对象
|
||||||
|
str = f.read() # 获取内容
|
||||||
|
f.close() # 关闭文本对象
|
||||||
|
return str # 返回结果
|
||||||
|
|
||||||
|
defultProgramList = {
|
||||||
|
"Architecture": "Auto",
|
||||||
|
"Debug": True,
|
||||||
|
"DefultWine": "deepin-wine6 stable",
|
||||||
|
"DefultBotton" : get_home() + "/.wine",
|
||||||
|
"TerminalOpen": False,
|
||||||
|
"WineOption": "",
|
||||||
|
"WineBottonDifferent": False,
|
||||||
|
"CenterWindow": False,
|
||||||
|
"Theme": "",
|
||||||
|
"MonoGeckoInstaller": False,
|
||||||
|
"AutoWine": True,
|
||||||
|
"RuntimeCache": True,
|
||||||
|
"MustRead": False,
|
||||||
|
"BuildByBottleName": False,
|
||||||
|
"AutoPath": False,
|
||||||
|
"QemuUnMountHome": False,
|
||||||
|
"Chinese": True,
|
||||||
|
"FontSize": 1
|
||||||
|
}
|
||||||
|
|
||||||
|
def SetFont(app):
|
||||||
|
defaultFont = app.font()
|
||||||
|
size = setting["FontSize"]
|
||||||
|
font = QtGui.QFont(defaultFont)
|
||||||
|
if size == 1:
|
||||||
|
app.setFont(defaultFont)
|
||||||
|
return
|
||||||
|
font.setPixelSize(int(defaultFont.pixelSize() / size))
|
||||||
|
font.setPointSize(int(defaultFont.pointSize() / size))
|
||||||
|
app.setFont(font)
|
||||||
|
|
||||||
|
try:
|
||||||
|
setting = json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineSetting.json"))
|
||||||
|
except:
|
||||||
|
setting = defultProgramList
|
@ -20,6 +20,7 @@ import PyQt5.QtGui as QtGui
|
|||||||
import PyQt5.QtCore as QtCore
|
import PyQt5.QtCore as QtCore
|
||||||
import PyQt5.QtWidgets as QtWidgets
|
import PyQt5.QtWidgets as QtWidgets
|
||||||
from trans import *
|
from trans import *
|
||||||
|
from DefaultSetting import *
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# 程序所需事件
|
# 程序所需事件
|
||||||
@ -286,4 +287,6 @@ windowFrameInputValueList = [
|
|||||||
packageName,
|
packageName,
|
||||||
versionName
|
versionName
|
||||||
]
|
]
|
||||||
|
# 设置字体
|
||||||
|
SetFont(app)
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
Loading…
x
Reference in New Issue
Block a user