Optimized some methods

This commit is contained in:
zhaoyafan 2025-02-10 00:06:03 +08:00
parent 35499a5784
commit 904708344d
1 changed files with 10 additions and 5 deletions

View File

@ -35,7 +35,7 @@ from PyQt5.QtNetwork import QNetworkProxyFactory
from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox, QSystemTrayIcon, QMenu, QAction, QDesktopWidget
from PyQt5.QtCore import Qt, QCoreApplication, QTimer, QUrl
from PyQt5.QtGui import QIcon
from typing import List, Tuple, Any
from typing import List
from fastapi import FastAPI, Response, UploadFile, File, HTTPException
from pydantic import BaseModel
from starlette.responses import JSONResponse, FileResponse
@ -2081,8 +2081,14 @@ class MainRunner:
self.application.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
self.application.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
self.application_scale_rate = self.application.screens()[0].logicalDotsPerInch() / 96
self.window = MainWindow(runner=self, app_name=self.app_name, app_version=self.app_version, scale_rate=self.application_scale_rate, web_listen_host=self.web_server_host,
web_listen_port=self.web_server_port)
self.window = MainWindow(
runner=self,
app_name=self.app_name,
app_version=self.app_version,
scale_rate=self.application_scale_rate,
web_listen_host=self.web_server_host,
web_listen_port=self.web_server_port
)
sys.exit(self.application.exec_())
def build(self):
@ -2133,8 +2139,7 @@ class MainRunner:
file=sys.stderr)
return None
Path(compile_file).write_text(
Path(compile_template).read_text().replace('%APPNAME%', self.app_name).replace('%APPEXEC%', os.path.splitext(os.path.basename(__file__))[0]).replace('%APPVERSION%',
self.app_version))
Path(compile_template).read_text().replace('%APPNAME%', self.app_name).replace('%APPEXEC%', os.path.splitext(os.path.basename(__file__))[0]).replace('%APPVERSION%', self.app_version))
subprocess.run([compiler, compile_file])
def _handle_interrupt(self, _signal, _frame):