mirror of
https://github.com/hyb-oyqq/FRAISEMOE-Addons-Installer-NEXT.git
synced 2026-01-06 17:10:14 +00:00
refactor(source): 优化窗口大小和背景图显示
- 设置窗口最小和最大尺寸 - 优化背景图加载和显示,使用setScaledContents简化处理 - 调整标题栏和菜单区域的大小和位置 - 重构部分UI代码,提高可读性和维护性
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
from .logger import Logger
|
||||
from .helpers import (
|
||||
load_base64_image, HashManager, AdminPrivileges, msgbox_frame,
|
||||
load_config, save_config, HostsManager, censor_url, resource_path
|
||||
load_config, save_config, HostsManager, censor_url, resource_path,
|
||||
load_image_from_file
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
'Logger',
|
||||
'load_base64_image',
|
||||
'load_image_from_file',
|
||||
'HashManager',
|
||||
'AdminPrivileges',
|
||||
'msgbox_frame',
|
||||
|
||||
@@ -37,6 +37,19 @@ def load_base64_image(base64_str):
|
||||
pixmap.loadFromData(base64.b64decode(base64_str))
|
||||
return pixmap
|
||||
|
||||
def load_image_from_file(file_path):
|
||||
"""加载图像文件到QPixmap
|
||||
|
||||
Args:
|
||||
file_path: 图像文件路径
|
||||
|
||||
Returns:
|
||||
QPixmap: 加载的图像
|
||||
"""
|
||||
if os.path.exists(file_path):
|
||||
return QPixmap(file_path)
|
||||
return QPixmap()
|
||||
|
||||
def msgbox_frame(title, text, buttons=QtWidgets.QMessageBox.StandardButton.NoButton):
|
||||
msg_box = QtWidgets.QMessageBox()
|
||||
msg_box.setWindowTitle(title)
|
||||
|
||||
Reference in New Issue
Block a user