Skip to content

Commit 7ddac81

Browse files
B1A2code-sunbo
authored andcommitted
!318 merge dev into main
!317 merge dev into dev Created-by: B1A2 Commit-by: B1A2 Merged-by: bbsun Description: 清理lint 修改版本号1.3.1->1.4.0 !316 merge dev into dev !317 merge dev into dev See merge request: SMAT/ArkAnalyzer-HapRay!318
2 parents 36cadf8 + 4ded39f commit 7ddac81

File tree

16 files changed

+202
-183
lines changed

16 files changed

+202
-183
lines changed

hapray-gui/gui/main_window.py

Lines changed: 60 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
from PySide6.QtCore import Qt
99
from PySide6.QtGui import QAction, QIcon
1010
from PySide6.QtWidgets import (
11+
QFrame,
1112
QHBoxLayout,
13+
QLabel,
1214
QMainWindow,
1315
QMessageBox,
1416
QSplitter,
@@ -22,7 +24,6 @@
2224
from core.plugin_loader import PluginLoader
2325
from gui.plugin_config_dialog import PluginConfigDialog
2426
from gui.result_viewer import ResultViewer
25-
from gui.styles import apply_styles
2627
from gui.tool_pages import ToolPage
2728

2829

@@ -83,9 +84,8 @@ def create_function_tree(self):
8384
tree_layout.setContentsMargins(0, 0, 0, 0)
8485

8586
# 标题
86-
from PySide6.QtWidgets import QLabel
87-
title_label = QLabel("功能列表")
88-
title_label.setObjectName("title_label")
87+
title_label = QLabel('功能列表')
88+
title_label.setObjectName('title_label')
8989
tree_layout.addWidget(title_label)
9090

9191
# 功能树
@@ -120,7 +120,6 @@ def create_content_area(self):
120120

121121
def show_welcome_message(self):
122122
"""显示欢迎信息"""
123-
from PySide6.QtWidgets import QLabel, QFrame
124123
welcome_widget = QWidget()
125124
welcome_layout = QVBoxLayout(welcome_widget)
126125
welcome_layout.setAlignment(Qt.AlignCenter)
@@ -138,36 +137,36 @@ def show_welcome_message(self):
138137
icon_layout = QVBoxLayout(icon_frame)
139138
icon_layout.setAlignment(Qt.AlignCenter)
140139

141-
icon_label = QLabel("🚀")
142-
icon_label.setStyleSheet("font-size: 32px; color: white;")
140+
icon_label = QLabel('🚀')
141+
icon_label.setStyleSheet('font-size: 32px; color: white;')
143142
icon_layout.addWidget(icon_label)
144143

145144
welcome_layout.addWidget(icon_frame)
146145

147146
# 欢迎标题
148-
welcome_label = QLabel("欢迎使用 HapRay GUI")
149-
welcome_label.setStyleSheet("font-size: 24px; font-weight: bold; color: #667eea; margin: 8px 0px;")
147+
welcome_label = QLabel('欢迎使用 HapRay GUI')
148+
welcome_label.setStyleSheet('font-size: 24px; font-weight: bold; color: #667eea; margin: 8px 0px;')
150149
welcome_layout.addWidget(welcome_label)
151150

152151
# 副标题
153-
subtitle_label = QLabel("HapRay 工具集成平台")
154-
subtitle_label.setStyleSheet("font-size: 16px; color: #6b7280; margin-bottom: 16px;")
152+
subtitle_label = QLabel('HapRay 工具集成平台')
153+
subtitle_label.setStyleSheet('font-size: 16px; color: #6b7280; margin-bottom: 16px;')
155154
welcome_layout.addWidget(subtitle_label)
156155

157156
# 功能介绍
158157
features_layout = QVBoxLayout()
159158
features_layout.setSpacing(8)
160159

161160
feature_items = [
162-
"🔧 动态测试 - 性能测试和trace收集",
163-
"⚡ 优化检测 - 二进制文件优化级别检测",
164-
"🔍 符号恢复 - 二进制符号恢复工具",
165-
"📊 静态分析 - HAP包静态分析"
161+
'🔧 动态测试 - 性能测试和trace收集',
162+
'⚡ 优化检测 - 二进制文件优化级别检测',
163+
'🔍 符号恢复 - 二进制符号恢复工具',
164+
'📊 静态分析 - HAP包静态分析',
166165
]
167166

168167
for feature in feature_items:
169168
feature_label = QLabel(feature)
170-
feature_label.setStyleSheet("font-size: 14px; color: #4b5563; padding: 4px 0px;")
169+
feature_label.setStyleSheet('font-size: 14px; color: #4b5563; padding: 4px 0px;')
171170
features_layout.addWidget(feature_label)
172171

173172
welcome_layout.addLayout(features_layout)
@@ -183,12 +182,12 @@ def show_welcome_message(self):
183182
""")
184183
hint_layout = QVBoxLayout(hint_frame)
185184

186-
hint_title = QLabel("开始使用")
187-
hint_title.setStyleSheet("font-size: 16px; font-weight: bold; color: #667eea; margin-bottom: 8px;")
185+
hint_title = QLabel('开始使用')
186+
hint_title.setStyleSheet('font-size: 16px; font-weight: bold; color: #667eea; margin-bottom: 8px;')
188187
hint_layout.addWidget(hint_title)
189188

190-
hint_label = QLabel("请在左侧的功能列表中选择您要使用的工具")
191-
hint_label.setStyleSheet("font-size: 14px; color: #6b7280; line-height: 1.4;")
189+
hint_label = QLabel('请在左侧的功能列表中选择您要使用的工具')
190+
hint_label.setStyleSheet('font-size: 14px; color: #6b7280; line-height: 1.4;')
192191
hint_layout.addWidget(hint_label)
193192

194193
welcome_layout.addWidget(hint_frame)
@@ -211,61 +210,55 @@ def build_function_tree(self):
211210

212211
# 定义action图标映射
213212
action_icons = {
214-
"prepare": "🔧", # 用例前置条件配置
215-
"perf": "📊", # 自动化性能测试
216-
"manual": "🎯", # 手动性能测试
217-
"ui-tech-stack": "🔍", # 页面技术栈动态识别
218-
"update": "🔄", # 更新测试报告
219-
"compare": "⚖️", # 对比报告
220-
"opt": "⚡", # SO编译优化
221-
"static": "📱", # 应用技术栈分析
222-
"symbol-recovery": "🔧" # 符号恢复
213+
'prepare': '🔧', # 用例前置条件配置
214+
'perf': '📊', # 自动化性能测试
215+
'manual': '🎯', # 手动性能测试
216+
'ui-tech-stack': '🔍', # 页面技术栈动态识别
217+
'update': '🔄', # 更新测试报告
218+
'compare': '⚖️', # 对比报告
219+
'opt': '⚡', # SO编译优化
220+
'static': '📱', # 应用技术栈分析
221+
'symbol-recovery': '🔧', # 符号恢复
223222
}
224223

225224
# 定义菜单结构映射:plugin_id -> {action_key -> display_name}
226225
menu_structure = {
227-
"负载测试": {
228-
"plugin_actions": {
229-
"perf_testing": {
230-
"prepare": "用例前置条件配置",
231-
"perf": "自动化性能测试",
232-
"manual": "手动性能测试",
233-
"ui-tech-stack": "页面技术栈动态识别",
234-
"update": "更新测试报告",
235-
"compare": "对比报告"
226+
'负载测试': {
227+
'plugin_actions': {
228+
'perf_testing': {
229+
'prepare': '用例前置条件配置',
230+
'perf': '自动化性能测试',
231+
'manual': '手动性能测试',
232+
'ui-tech-stack': '页面技术栈动态识别',
233+
'update': '更新测试报告',
234+
'compare': '对比报告',
236235
}
237236
}
238237
},
239-
"应用分析": {
240-
"plugin_actions": {
241-
"optimization_detector": {
242-
"opt": "SO编译优化"
243-
},
244-
"static_analyzer": {
245-
"static": "应用技术栈分析"
246-
},
247-
"symbol_recovery": {
248-
"symbol-recovery": "符号恢复"
249-
}
238+
'应用分析': {
239+
'plugin_actions': {
240+
'optimization_detector': {'opt': 'SO编译优化'},
241+
'static_analyzer': {'static': '应用技术栈分析'},
242+
'symbol_recovery': {'symbol-recovery': '符号恢复'},
250243
}
251-
}
244+
},
252245
}
253246

254247
# 构建菜单结构
255248
for menu_name, menu_config in menu_structure.items():
256249
menu_item = QTreeWidgetItem(self.function_tree)
257250

258251
# 为一级菜单添加图标
259-
if menu_name == "负载测试":
260-
menu_item.setText(0, f"📊 {menu_name}")
261-
elif menu_name == "应用分析":
262-
menu_item.setText(0, f"🔍 {menu_name}")
263-
elif menu_name == "符号恢复":
264-
menu_item.setText(0, f"🔧 {menu_name}")
252+
if menu_name == '负载测试':
253+
menu_item.setText(0, f'📊 {menu_name}')
254+
elif menu_name == '应用分析':
255+
menu_item.setText(0, f'🔍 {menu_name}')
256+
elif menu_name == '符号恢复':
257+
menu_item.setText(0, f'🔧 {menu_name}')
265258
else:
266259
menu_item.setText(0, menu_name)
267260

268-
plugin_actions = menu_config.get("plugin_actions", {})
261+
plugin_actions = menu_config.get('plugin_actions', {})
269262

270263
for plugin_id, action_mapping in plugin_actions.items():
271264
# 检查插件是否存在且启用
@@ -284,13 +277,11 @@ def build_function_tree(self):
284277
# 创建二级菜单项
285278
action_item = QTreeWidgetItem(menu_item)
286279
# 使用对应的图标,如果没有找到则使用默认图标
287-
icon = action_icons.get(action_key, "⚙️")
288-
action_item.setText(0, f"{icon} {display_name}")
289-
action_item.setData(0, Qt.UserRole, {
290-
'type': 'action',
291-
'plugin_id': plugin_id,
292-
'action': action_key
293-
})
280+
icon = action_icons.get(action_key, '⚙️')
281+
action_item.setText(0, f'{icon} {display_name}')
282+
action_item.setData(
283+
0, Qt.UserRole, {'type': 'action', 'plugin_id': plugin_id, 'action': action_key}
284+
)
294285

295286
# 如果一级菜单下没有子项,隐藏该菜单
296287
if menu_item.childCount() == 0:
@@ -301,7 +292,7 @@ def build_function_tree(self):
301292

302293
# 添加结果查看器节点
303294
result_item = QTreeWidgetItem(self.function_tree)
304-
result_item.setText(0, "📋 结果查看")
295+
result_item.setText(0, '📋 结果查看')
305296
result_item.setData(0, Qt.UserRole, {'type': 'result_viewer'})
306297

307298
def on_function_selected(self, item, column):
@@ -327,11 +318,9 @@ def show_tool_config(self, plugin_id, action=None):
327318

328319
# 创建工具页面
329320
tool_page = ToolPage(tool)
330-
if action:
331-
# 如果指定了action,设置当前action
332-
if hasattr(tool_page, 'current_action') and hasattr(tool_page, 'rebuild_param_form'):
333-
tool_page.current_action = action
334-
tool_page.rebuild_param_form()
321+
if action and hasattr(tool_page, 'current_action') and hasattr(tool_page, 'rebuild_param_form'):
322+
tool_page.current_action = action
323+
tool_page.rebuild_param_form()
335324

336325
tool_page.execution_finished.connect(self.on_execution_finished)
337326

@@ -423,7 +412,7 @@ def show_about(self):
423412
QMessageBox.about(
424413
self,
425414
'关于 HapRay GUI',
426-
'HapRay GUI v1.3.1\n\n'
415+
'HapRay GUI v1.4.0\n\n'
427416
'工具集成平台\n'
428417
'整合了以下工具:\n'
429418
'- 动态测试 (perf_testing)\n'
@@ -440,7 +429,6 @@ def on_execution_finished(self, tool_name: str, result_path: str):
440429
# 刷新结果查看器
441430
self.result_viewer.refresh_results()
442431

443-
444432
def closeEvent(self, event):
445433
"""关闭事件"""
446434
# 保存窗口大小

hapray-gui/gui/result_viewer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def init_ui(self):
6969
left_layout = QVBoxLayout(left_widget)
7070

7171
list_label = QLabel('📋 执行历史')
72-
list_label.setStyleSheet("font-size: 16px; font-weight: bold; color: #667eea; padding: 8px 0px;")
72+
list_label.setStyleSheet('font-size: 16px; font-weight: bold; color: #667eea; padding: 8px 0px;')
7373
left_layout.addWidget(list_label)
7474

7575
self.result_list = QListWidget()
@@ -105,7 +105,7 @@ def init_ui(self):
105105
right_layout = QVBoxLayout(right_widget)
106106

107107
detail_label = QLabel('📄 结果详情')
108-
detail_label.setStyleSheet("font-size: 16px; font-weight: bold; color: #667eea; padding: 8px 0px;")
108+
detail_label.setStyleSheet('font-size: 16px; font-weight: bold; color: #667eea; padding: 8px 0px;')
109109
right_layout.addWidget(detail_label)
110110

111111
self.result_detail = QTextEdit()

hapray-gui/gui/styles.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,23 @@
99
'primary': '#667eea',
1010
'primary_dark': '#5a67d8',
1111
'primary_light': '#7c3aed',
12-
1312
# 背景色
1413
'background': '#f5f7fa',
1514
'background_light': '#ffffff',
1615
'background_dark': '#f8f9fa',
17-
1816
# 文字颜色
1917
'text_primary': '#1f2937',
2018
'text_secondary': '#6b7280',
2119
'text_light': '#9ca3af',
22-
2320
# 边框颜色
2421
'border_light': '#e5e7eb',
2522
'border_medium': '#d1d5db',
2623
'border_dark': '#9ca3af',
27-
2824
# 状态颜色
2925
'success': '#10b981',
3026
'warning': '#f59e0b',
3127
'error': '#ef4444',
3228
'info': '#3b82f6',
33-
3429
# 阴影
3530
'shadow_sm': '0 1px 2px rgba(0, 0, 0, 0.05)',
3631
'shadow_md': '0 4px 6px rgba(0, 0, 0, 0.1)',
@@ -477,10 +472,12 @@
477472
}}
478473
"""
479474

475+
480476
def apply_styles(app):
481477
"""应用样式到应用程序"""
482478
app.setStyleSheet(MAIN_STYLE)
483479

480+
484481
def get_color(name):
485482
"""获取颜色值"""
486-
return COLORS.get(name, '#000000')
483+
return COLORS.get(name, '#000000')

hapray-gui/gui/tool_pages.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"""
44

55
import sys
6+
import time
67
from pathlib import Path
78
from typing import Any
89

9-
from PySide6.QtCore import Qt, QThread, Signal, QTimer
10+
from PySide6.QtCore import Qt, QThread, QTimer, Signal
1011
from PySide6.QtWidgets import (
11-
QApplication,
1212
QCheckBox,
1313
QComboBox,
1414
QFileDialog,
@@ -57,7 +57,6 @@ def run(self):
5757
choices = FileUtils.get_testcases()
5858
elif self.choices_func_name == 'get_installed_apps':
5959
# 添加超时处理,避免长时间卡顿
60-
import time
6160
start_time = time.time()
6261
choices = FileUtils.get_installed_apps()
6362
elapsed = time.time() - start_time
@@ -404,7 +403,9 @@ def create_param_widget(self, param_name: str, param_def: dict[str, Any]) -> QWi
404403
widget.setText(str(default) if default else '')
405404
return widget
406405

407-
def _setup_dynamic_choices_async(self, param_name: str, choices_func_name: str, widget: QWidget, multi_select: bool = False, default: Any = None):
406+
def _setup_dynamic_choices_async(
407+
self, param_name: str, choices_func_name: str, widget: QWidget, multi_select: bool = False, default: Any = None
408+
):
408409
"""设置异步加载动态选项"""
409410
# 创建加载器
410411
loader = DynamicChoicesLoader(param_name, choices_func_name)

hapray-gui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hapray-gui",
3-
"version": "1.3.1",
3+
"version": "1.4.0",
44
"description": "HapRay GUI - 工具集成平台",
55
"files": [
66
"dist"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hapray",
3-
"version": "1.3.1",
3+
"version": "1.4.0",
44
"description": "Code-oriented Performance Analysis for OpenHarmony Apps",
55
"private": true,
66
"files": [],

perf_testing/hapray/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
limitations under the License.
1414
"""
1515

16-
VERSION = '1.3.1'
16+
VERSION = '1.4.0'

perf_testing/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "perf_testing",
3-
"version": "1.3.1",
3+
"version": "1.4.0",
44
"files": [
55
"dist"
66
],

tools/optimization_detector/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "optimization-detector",
3-
"version": "1.3.1",
3+
"version": "1.4.0",
44
"description": "二进制文件优化级别和LTO检测工具",
55
"files": [
66
"dist",

tools/static_analyzer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hapray-sa",
3-
"version": "1.3.1",
3+
"version": "1.4.0",
44
"main": "index.js",
55
"files": [
66
"lib"

0 commit comments

Comments
 (0)