|
|
|
|
@ -101,8 +101,24 @@ class WordStyleMainWindow(QMainWindow):
|
|
|
|
|
"""设置窗口图标"""
|
|
|
|
|
# 使用我们创建的Word风格图标
|
|
|
|
|
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
icon_path = os.path.join(project_root, 'resources', 'icons', 'app_icon.png')
|
|
|
|
|
if os.path.exists(icon_path):
|
|
|
|
|
|
|
|
|
|
# 尝试不同的图标文件
|
|
|
|
|
icon_files = [
|
|
|
|
|
'app_icon_32*32.png',
|
|
|
|
|
'app_icon_64*64.png',
|
|
|
|
|
'app_icon_128*128.png',
|
|
|
|
|
'app_icon_256*256.png',
|
|
|
|
|
'app_icon.png'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
icon_path = None
|
|
|
|
|
for icon_file in icon_files:
|
|
|
|
|
test_path = os.path.join(project_root, 'resources', 'icons', icon_file)
|
|
|
|
|
if os.path.exists(test_path):
|
|
|
|
|
icon_path = test_path
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
if icon_path and os.path.exists(icon_path):
|
|
|
|
|
self.setWindowIcon(QIcon(icon_path))
|
|
|
|
|
else:
|
|
|
|
|
# 如果图标文件不存在,创建简单的Word风格图标
|
|
|
|
|
@ -174,17 +190,6 @@ class WordStyleMainWindow(QMainWindow):
|
|
|
|
|
}
|
|
|
|
|
print(f"格式化后的数据: {formatted_data}")
|
|
|
|
|
self.update_weather_display(formatted_data)
|
|
|
|
|
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
icon_path = os.path.join(project_root, 'resources', 'icons', 'app_icon.png')
|
|
|
|
|
if os.path.exists(icon_path):
|
|
|
|
|
self.setWindowIcon(QIcon(icon_path))
|
|
|
|
|
else:
|
|
|
|
|
# 如果图标文件不存在,创建简单的Word风格图标
|
|
|
|
|
icon = QIcon()
|
|
|
|
|
pixmap = QPixmap(32, 32)
|
|
|
|
|
pixmap.fill(QColor("#2B579A"))
|
|
|
|
|
icon.addPixmap(pixmap)
|
|
|
|
|
self.setWindowIcon(icon)
|
|
|
|
|
|
|
|
|
|
def setup_ui(self):
|
|
|
|
|
"""设置Word风格的UI界面"""
|
|
|
|
|
|