mirror of
http://git.xinwangdao.com/cnnc-embedded-parts-detect/detect-gui.git
synced 2025-06-24 05:04:12 +08:00
29 lines
799 B
Python
29 lines
799 B
Python
import platform
|
|
from PyQt5.QtCore import QFile, QTextStream
|
|
|
|
|
|
def load_stylesheet(file_path):
|
|
"""加载 QSS 文件"""
|
|
file = QFile(file_path)
|
|
if not file.open(QFile.ReadOnly | QFile.Text):
|
|
print(f"无法打开样式表文件 {file_path}")
|
|
return ""
|
|
stream = QTextStream(file)
|
|
stylesheet = stream.readAll()
|
|
file.close()
|
|
return stylesheet
|
|
|
|
|
|
def get_system_and_library_suffix():
|
|
system = platform.system().lower()
|
|
machine = platform.machine().lower()
|
|
|
|
if system == 'windows':
|
|
return 'win', 'dll'
|
|
elif system == 'linux':
|
|
if 'linux_arm64' in machine or 'aarch64' in machine:
|
|
return 'linux_arm64', 'so'
|
|
else:
|
|
return 'linux', 'so'
|
|
else:
|
|
raise ValueError(f"Unsupported system: {system}") |