Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba1d50cdfc | ||
|
|
e9454cf01f | ||
|
|
3cec9adc5f | ||
|
|
c1ad438591 | ||
|
|
2b2fdad56f | ||
|
|
c96c369161 | ||
|
|
4ef08e06d2 | ||
|
|
cd9431985e | ||
|
|
dba01d42d0 | ||
|
|
344a2797b0 | ||
|
|
caa79e7fcf | ||
|
|
df250e04ba | ||
|
|
efe7e8c813 | ||
|
|
b80988ccf7 |
No files matched your search
@@ -0,0 +1,64 @@
|
||||
name: Core regression
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, 'codex/**']
|
||||
tags: ['v*']
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
portable-regression:
|
||||
name: Python core and release configuration
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- name: Checkout tested commit
|
||||
run: |
|
||||
git init .
|
||||
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
||||
git fetch --depth=1 origin "${GITHUB_SHA}"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- name: Install runner Python and test dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3 python3-pytest
|
||||
python3 --version
|
||||
- name: Compile application and build helpers
|
||||
run: python3 -m compileall -q src packaging tools
|
||||
- name: Core regression (no CAD or production credentials)
|
||||
run: >-
|
||||
python3 -m pytest -q
|
||||
tests/dsh/test_core.py
|
||||
tests/dsh/test_failure_policy.py
|
||||
tests/dsh/test_decision_log.py
|
||||
tests/dsh/test_experience.py
|
||||
tests/dsh/test_issue_broker.py
|
||||
tests/packaging/test_dsh_runtime_staging.py
|
||||
tests/packaging/test_release_configuration.py
|
||||
--junitxml=build/ci-results.xml --tb=short
|
||||
- name: Windows release scope
|
||||
run: |
|
||||
echo 'Windows PyInstaller, Qt WebEngine startup, full runtime file hashes and extracted EXE smoke are validated on the Windows build host.'
|
||||
echo 'This Linux job does not claim Windows/CAD or live model acceptance.'
|
||||
|
||||
javascript-regression:
|
||||
name: JavaScript syntax
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout tested commit
|
||||
run: |
|
||||
git init .
|
||||
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
||||
git fetch --depth=1 origin "${GITHUB_SHA}"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- name: Check runtime syntax
|
||||
run: |
|
||||
node --check integration/dsh/start.mjs
|
||||
node --check integration/dsh/task-plugin/host.mjs
|
||||
node --check integration/dsh/task-plugin/client.js
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
面向 **Windows + DxDesigner / Expedition Enterprise 7.9.5** 的器件批量替换工具。一个工程对应一个任务,可以只替换同料号下的部分位号;支持直接编辑和 Excel BOM 导入,同批工程按顺序执行。
|
||||
|
||||
**最新版本:V1.1.4 Beta 4(预发布)** · [下载便携包](https://git.simgreek.com/simgreek/dxdesigner-part-replacement/releases/download/v1.1.4-beta.4/DxPartReplace-1.1.4-beta.4.zip) · [版本说明与附件](https://git.simgreek.com/simgreek/dxdesigner-part-replacement/releases/tag/v1.1.4-beta.4) · [完整使用说明](docs/user/v1.1.0-project-tasks.md)
|
||||
**最新版本:V1.2.1(预发布)** · [下载便携包](https://git.simgreek.com/Skyworth_Digital_Hardware/dxdesigner-part-replacement/releases/download/v1.2.1/DxPartReplace-1.2.1.zip) · [版本说明与附件](https://git.simgreek.com/Skyworth_Digital_Hardware/dxdesigner-part-replacement/releases/tag/v1.2.1) · [完整使用说明](docs/user/v1.1.0-project-tasks.md)
|
||||
|
||||
所有发布均标记为 **Beta 预发布**。V1.1.4 Beta 1 因 BOM 导入缺少 `win32timezone` 已撤回,请使用 Beta 4;旧 Git 标签保留供回溯。升级前备份 `data`,完整更新 EXE 与 `_internal`,不要只替换 EXE。
|
||||
V1.2.1 提供完整 Node/Qt 运行时、DSH 任务功能和全部 UI 资源。升级前备份 data,完整更新 EXE 与 _internal,不要只替换 EXE。
|
||||
|
||||
Beta 4 面向停止与资源收尾复测:普通暂停等待当前项保存核验,写入中无进度不再自动杀进程;新增明确确认的强制结束,保留中断证据与恢复入口。[本版变更和复测说明](docs/releases/v1.1.4-beta.4.md)。
|
||||
本版修复冻结应用缺少 SVG 资源的问题,保留维护者配置的工单上报能力,并增加云端 CI。[本版变更](docs/releases/v1.2.1.md)。
|
||||
|
||||
本版提供[目标封装选择](docs/user/target-cell-selection.md):目标封装可留空,此时工具不主动覆写封装,可后续与中心库同步;需要指定时,在料号规则中读取并选择合法封装。BOM 保持原 11 列。
|
||||
|
||||
@@ -44,7 +44,7 @@ node tools/verify_dsh_runtime.mjs
|
||||
|
||||
### 第 1 步:解压并打开应用
|
||||
|
||||
[下载 V1.1.4 Beta 4 便携包](https://git.simgreek.com/simgreek/dxdesigner-part-replacement/releases/download/v1.1.4-beta.4/DxPartReplace-1.1.4-beta.4.zip),**完整解压**,双击 `DxPartReplace.exe`。保留它与 `_internal` 的相对位置,无需安装 Python;本机需要可用的 DxDesigner、许可证和中央库。
|
||||
[下载 V1.2.1 便携包](https://git.simgreek.com/Skyworth_Digital_Hardware/dxdesigner-part-replacement/releases/download/v1.2.1/DxPartReplace-1.2.1.zip),**完整解压**,双击 `DxPartReplace.exe`。保留它与 `_internal` 的相对位置,无需安装 Python;本机需要可用的 DxDesigner、许可证和中央库。
|
||||
|
||||
打开后看到下图主窗口。首次使用请准备完整的工程副本,执行前保存并关闭待处理工程。
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# V1.2.1
|
||||
|
||||
本版合并 PR #14 的 DSH 启动错误提示,并提供完整 Windows 便携运行包。
|
||||
|
||||
- 包含整个已安装的 DSH Node 依赖目录、Node 可执行文件、官方前端、任务插件、Qt WebEngine 运行库和全部 UI 图标。
|
||||
- 按维护者的部署要求保留 issue reporter 配置;模型 API 密钥及个人任务数据不随包分发。
|
||||
- 应用标题、Python 项目元数据和 Windows 产品版本统一为 1.2.1。
|
||||
- 新增 Gitea Actions 回归,覆盖平台无关核心逻辑与发行配置。Windows 冻结程序另在构建机验收。
|
||||
|
||||
完整解压 `DxPartReplace-1.2.1.zip`,运行目录内的 `DxPartReplace.exe`。请保留 `_internal` 的完整目录结构,升级前备份旧版 `data`。
|
||||
|
||||
旧版在本版通过验证并公开后转为草稿下架,历史标签保留。运行和云端验证的实际结果见发行附件中的 build-validation.json。
|
||||
@@ -0,0 +1,17 @@
|
||||
# DSH 运行包与入口修复验证
|
||||
|
||||
## 问题
|
||||
|
||||
发布规格此前把 `integration/dsh/node_modules` 整个目录递归复制进 PyInstaller,包含非 Windows 平台二进制、实验包、测试目录、TypeScript 源码、source map 和文档,导致包体偏大。另一个问题是 DSH 懒启动发生导入、Qt WebEngine 或 Node 运行包异常时,异常从 QAction 槽冒出,桌面上看起来像点击没有反应。
|
||||
|
||||
## 修复
|
||||
|
||||
- 打包前生成 Windows x64 DSH 运行时暂存目录:保留当前平台依赖、JavaScript/JSON/原生运行文件和官方 Harness 包;去除其他平台包、测试/示例/缓存目录、TypeScript 源码、source map 和文档。优先使用硬链接暂存,跨卷时自动回退复制,不修改源 `node_modules`。
|
||||
- DSH助手入口捕获懒启动异常,写入现有应用错误日志,并在任务中心操作栏显示“DSH助手启动失败,请检查发布包中的运行时和 Node.js”,避免无反馈点击。
|
||||
|
||||
## 验证
|
||||
|
||||
- 精简运行时单元回归和 DSH UI/打包/原生运行时回归:**48 passed**。
|
||||
- 精简后的实际 Harness 暂存目录运行 `start.mjs --doctor`:返回 `status=ready`,官方前端、7 个受控工具和 Node 版本信息正常。
|
||||
- 源码真实 Qt/CDP 点击验收:报告 `build/dsh-click-after-fix-9267/desktop-report.json`,直接导航、官方三栏页面、SVG/动画、模型选择、原生取消确认、草稿保留和正常退出通过;`uncaughtErrors=false`、`unexpectedUiErrors=false`。
|
||||
- 本轮未构建发布 EXE,未操作真实 CAD 或远端工单;PyInstaller 发布时会使用新的暂存逻辑。
|
||||
@@ -0,0 +1,18 @@
|
||||
# Issue #16: Acrylic after returning from the browser workspace
|
||||
|
||||
Scope: UI rendering only. Provider/model configuration, runtime protocol, tools and task operations are unchanged.
|
||||
|
||||
The browser workspace previously shared its native composition parent with the Acrylic main window. Showing a real QWebEngineView made the parent surface opaque; hiding the browser did not restore the live backdrop. The alpha-buffer size, transparency attribute and Acrylic property still reported enabled. Reapplying Windows composition alone did not fix the rendering.
|
||||
|
||||
The browser workspace now uses `WA_NativeWindow` so Chromium composes into its own child native surface. This keeps its opaque browser background separate from the task-center backdrop and retains the existing stacked-page navigation.
|
||||
|
||||
Validation on Windows 11 build 26200, 125% scaling:
|
||||
|
||||
- Regression test uses a real QWebEngineView and checks its native composition parent. It failed before the fix and passed afterward.
|
||||
- `python -m pytest -q tests/ui --tb=short --junitxml=build/issue16-ui-tests.xml`: **172 passed**.
|
||||
- `python tools/accept_acrylic_ui.py --output build/issue16-final --webengine-roundtrip`: passed. The test uses sample projects and an owned changing backdrop. It displays a local HTML page in real Chromium, without launching the Harness server, model requests or CAD.
|
||||
- Before the fix, changing the background after returning produced a sidebar pixel difference of **0.0**. After the fix, two consecutive round trips each produced **20.79** (threshold > 2); the solid table difference stayed **0.0** (threshold < 1.5).
|
||||
- With reduced transparency enabled, the same navigation produced a sidebar difference of **0.0** as expected. Search, empty results, solid fallback, 980×700 layout and visible stop controls also passed.
|
||||
- An initial focused run reported one existing Qt fixture teardown race (`TrialTaskCenterWindow already deleted`); the subsequent complete UI run passed without errors.
|
||||
|
||||
Screenshots and machine-readable results are local artifacts under `build/issue16-final/`. No release package was built. PR #15 is synchronized with main `3cec9ad`; unrelated main-workspace changes were left untouched.
|
||||
@@ -18,7 +18,7 @@ if viewdraw_api is None:
|
||||
shutil.copyfile(viewdraw_api.__file__, generated_root / "viewdraw_api.py")
|
||||
legacy_runtime_datas = [
|
||||
(
|
||||
str(project_root / 'src/dx_productivity/trial_task_center/assets/app.ico'),
|
||||
str(project_root / 'src/dx_productivity/trial_task_center/assets'),
|
||||
'dx_productivity/trial_task_center/assets',
|
||||
),
|
||||
(
|
||||
@@ -38,11 +38,14 @@ if (dsh_root / 'issue-bootstrap.json').is_file():
|
||||
if (dsh_root / 'node_modules' / '@deepseek-ai' / 'dsh' / 'package.json').is_file():
|
||||
if not (dsh_root / 'issue-bootstrap.json').is_file():
|
||||
raise RuntimeError('Provision the DSH issue-only reporter before packaging the native assistant.')
|
||||
# Release distribution keeps the complete installed runtime, including
|
||||
# lazily loaded packages, native binaries, frontend assets and metadata.
|
||||
staged_node_modules = dsh_root / 'node_modules'
|
||||
legacy_runtime_datas.extend([
|
||||
(str(dsh_root / 'start.mjs'), 'dsh-runtime'),
|
||||
(str(dsh_root / 'package.json'), 'dsh-runtime'),
|
||||
(str(dsh_root / 'task-plugin'), 'dsh-runtime/task-plugin'),
|
||||
(str(dsh_root / 'node_modules'), 'dsh-runtime/node_modules'),
|
||||
(str(staged_node_modules), 'dsh-runtime/node_modules'),
|
||||
(shutil.which('node'), 'dsh-runtime'),
|
||||
(str(project_root / 'licenses' / 'DeepSeek-Harness-MIT.txt'), 'licenses'),
|
||||
])
|
||||
@@ -65,19 +68,19 @@ a = Analysis(
|
||||
"pywinauto.controls.uiawrapper",
|
||||
"PySide6.QtWebEngineCore",
|
||||
"PySide6.QtWebEngineWidgets",
|
||||
"PySide6.QtWebChannel",
|
||||
"PySide6.QtQml",
|
||||
"PySide6.QtQuick",
|
||||
"PySide6.QtQuickWidgets",
|
||||
"PySide6.QtOpenGL",
|
||||
"PySide6.QtOpenGLWidgets",
|
||||
],
|
||||
excludes=[
|
||||
"PySide6.QtDesigner",
|
||||
"PySide6.QtMultimedia",
|
||||
"PySide6.QtMultimediaWidgets",
|
||||
"PySide6.QtOpenGL",
|
||||
"PySide6.QtOpenGLWidgets",
|
||||
"PySide6.QtPdf",
|
||||
"PySide6.QtPdfWidgets",
|
||||
"PySide6.QtQml",
|
||||
"PySide6.QtQuick",
|
||||
"PySide6.QtQuickWidgets",
|
||||
"PySide6.QtWebChannel",
|
||||
],
|
||||
noarchive=False,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
"""Create a small, Windows-only copy of the installed DSH Node runtime."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
|
||||
_PRUNED_DIRS = frozenset({
|
||||
".bin", ".cache", ".github", "__tests__", "benchmark", "benchmarks",
|
||||
"coverage", "example", "examples", "test", "tests",
|
||||
})
|
||||
_PRUNED_SUFFIXES = frozenset({".map", ".ts", ".tsx"})
|
||||
_PRUNED_NAMES = frozenset({"changelog", "changelog.md", "history.md", "readme", "readme.md"})
|
||||
|
||||
|
||||
def _matches(value: str, rule: str) -> bool:
|
||||
return value.casefold() == rule.lstrip("!").casefold()
|
||||
|
||||
|
||||
def _compatible(package: Path, *, platform: str, arch: str) -> bool:
|
||||
try:
|
||||
value = json.loads((package / "package.json").read_text(encoding="utf8"))
|
||||
except (OSError, ValueError, TypeError):
|
||||
return True
|
||||
if not isinstance(value, dict):
|
||||
return True
|
||||
for field, current in (("os", platform), ("cpu", arch)):
|
||||
rules = value.get(field)
|
||||
if not isinstance(rules, list):
|
||||
continue
|
||||
if any(isinstance(rule, str) and rule.startswith("!") and _matches(current, rule)
|
||||
for rule in rules):
|
||||
return False
|
||||
positive = [rule for rule in rules if isinstance(rule, str) and not rule.startswith("!")]
|
||||
if positive and not any(_matches(current, rule) for rule in positive):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def _ignore(directory: str, names: list[str], *, platform: str, arch: str) -> set[str]:
|
||||
ignored: set[str] = set()
|
||||
for name in names:
|
||||
path = Path(directory) / name
|
||||
if path.is_dir():
|
||||
if name.casefold() in _PRUNED_DIRS or not _compatible(path, platform=platform, arch=arch):
|
||||
ignored.add(name)
|
||||
elif Path(name).suffix.casefold() in _PRUNED_SUFFIXES or name.casefold() in _PRUNED_NAMES:
|
||||
ignored.add(name)
|
||||
return ignored
|
||||
|
||||
|
||||
def stage_node_modules(source: Path, destination: Path, *, platform: str = "win32", arch: str = "x64") -> Path:
|
||||
"""Stage runtime packages without other-platform binaries or documentation."""
|
||||
source = Path(source)
|
||||
destination = Path(destination)
|
||||
if not (source / "@deepseek-ai" / "dsh" / "package.json").is_file():
|
||||
raise FileNotFoundError("DSH runtime package is not installed")
|
||||
if destination.exists():
|
||||
shutil.rmtree(destination)
|
||||
destination.parent.mkdir(parents=True, exist_ok=True)
|
||||
def link_or_copy(source_file: str, destination_file: str) -> None:
|
||||
try:
|
||||
os.link(source_file, destination_file)
|
||||
except OSError:
|
||||
shutil.copy2(source_file, destination_file)
|
||||
|
||||
shutil.copytree(source, destination, ignore=lambda directory, names: _ignore(
|
||||
directory, names, platform=platform, arch=arch), copy_function=link_or_copy,
|
||||
symlinks=False)
|
||||
return destination
|
||||
@@ -1,8 +1,8 @@
|
||||
# UTF-8
|
||||
VSVersionInfo(
|
||||
ffi=FixedFileInfo(
|
||||
filevers=(1, 1, 4, 4),
|
||||
prodvers=(1, 1, 4, 4),
|
||||
filevers=(1, 2, 1, 0),
|
||||
prodvers=(1, 2, 1, 0),
|
||||
mask=0x3f,
|
||||
flags=0x2,
|
||||
OS=0x40004,
|
||||
@@ -15,11 +15,11 @@ VSVersionInfo(
|
||||
StringTable('040904B0', [
|
||||
StringStruct('CompanyName', 'DxProductivity'),
|
||||
StringStruct('FileDescription', 'DxDesigner Part Replacement'),
|
||||
StringStruct('FileVersion', '1.1.4.4'),
|
||||
StringStruct('FileVersion', '1.2.1.0'),
|
||||
StringStruct('InternalName', 'DxPartReplace'),
|
||||
StringStruct('OriginalFilename', 'DxPartReplace.exe'),
|
||||
StringStruct('ProductName', 'DxDesigner Part Replacement'),
|
||||
StringStruct('ProductVersion', '1.1.4-beta.4')
|
||||
StringStruct('ProductVersion', '1.2.1')
|
||||
])
|
||||
]),
|
||||
VarFileInfo([VarStruct('Translation', [1033, 1200])])
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "dx-productivity"
|
||||
version = "1.1.4b4"
|
||||
version = "1.2.1"
|
||||
requires-python = ">=3.12,<3.13"
|
||||
dependencies = ["PySide6>=6.7,<7", "pywin32>=306", "pywinauto>=0.6.9,<1", "openpyxl>=3.1,<4"]
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import json
|
||||
import codecs
|
||||
from pathlib import Path
|
||||
|
||||
from PySide6.QtCore import QProcess, QProcessEnvironment, QTimer, QUrl, Signal
|
||||
from PySide6.QtCore import QProcess, QProcessEnvironment, QTimer, QUrl, Signal, Qt
|
||||
from PySide6.QtWebEngineCore import QWebEnginePage, QWebEngineProfile, QWebEngineSettings
|
||||
from PySide6.QtWebEngineWidgets import QWebEngineView
|
||||
from PySide6.QtWidgets import QLabel, QPushButton, QVBoxLayout, QWidget
|
||||
@@ -37,6 +37,10 @@ class NativeHarnessView(QWidget):
|
||||
|
||||
def __init__(self, data_root: Path, parent=None):
|
||||
super().__init__(parent)
|
||||
# Give Chromium its own native composition boundary. Otherwise its
|
||||
# texture compositor turns the shared Acrylic top-level surface opaque,
|
||||
# even after this workspace is hidden again.
|
||||
self.setAttribute(Qt.WidgetAttribute.WA_NativeWindow)
|
||||
self.setObjectName('dshNativeWorkspace')
|
||||
self.setStyleSheet('QWidget#dshNativeWorkspace {background:white;}')
|
||||
self.data_root = Path(data_root)
|
||||
|
||||
@@ -30,6 +30,7 @@ def icon(name: str, primary: bool = False) -> QIcon:
|
||||
BUTTON_ICONS = {
|
||||
'task_center_navigation': 'grid', 'dsh_navigation': 'chat',
|
||||
'newTaskButton': 'plus', 'editTaskButton': 'sliders', 'deleteTaskButton': 'trash',
|
||||
'selectAllTasks': 'check', 'clearTaskSelection': 'close',
|
||||
'restoreTaskButton': 'refresh', 'taskRecycleBin': 'trash',
|
||||
'moveTaskUp': 'arrow-up', 'moveTaskDown': 'sort', 'executeProjectTasks': 'play',
|
||||
'addMappingButton': 'plus', 'editMappingButton': 'sliders', 'deleteMappingButton': 'trash',
|
||||
|
||||
@@ -370,7 +370,18 @@ class TrialTaskCenterWindow(MaterialMainWindow):
|
||||
if deleted else self.service.tasks(read_control=control), received, self._show_error, cancellable=True)
|
||||
|
||||
def open_task(self, task_id):
|
||||
if not task_id or (self._workers and self._batch_stop is None):
|
||||
if not task_id:
|
||||
if self._workers and self._batch_stop is None:
|
||||
return
|
||||
self._task_id = None
|
||||
self.plan_panel.bind_task(None)
|
||||
self.project_summary.populate(None)
|
||||
self.mapping_table.populate(())
|
||||
self._message = ''
|
||||
self._log_presenter.bind(None)
|
||||
self._load_task_data()
|
||||
return
|
||||
if self._workers and self._batch_stop is None:
|
||||
return
|
||||
if self._task_id != task_id:
|
||||
self.plan_panel.bind_task(None)
|
||||
@@ -476,6 +487,8 @@ class TrialTaskCenterWindow(MaterialMainWindow):
|
||||
self.task_list.filter.setEnabled(not self._workers or self._batch_stop is not None)
|
||||
self.task_list.search.setEnabled(not self._workers or self._batch_stop is not None)
|
||||
self.task_list.recycle_button.setEnabled(not busy)
|
||||
self.task_list.select_all_button.setEnabled(not busy and bool(self.task_list.list.count()))
|
||||
self.task_list.clear_selection_button.setEnabled(not busy)
|
||||
self.task_list.sort.setEnabled(not self._workers or self._batch_stop is not None)
|
||||
self.task_list.new_button.setEnabled(not busy)
|
||||
exists = bool(context)
|
||||
@@ -1028,10 +1041,21 @@ class TrialTaskCenterWindow(MaterialMainWindow):
|
||||
self.run_panel.operator_band.style().polish(self.run_panel.operator_band)
|
||||
|
||||
def _open_dsh(self):
|
||||
self._ensure_dsh_view()
|
||||
self.content_stack.setCurrentWidget(self._dsh_view)
|
||||
if self._dsh_automation is not None and self._dsh_automation.latest:
|
||||
self._dsh_automation._publish_context()
|
||||
try:
|
||||
self._ensure_dsh_view()
|
||||
self.content_stack.setCurrentWidget(self._dsh_view)
|
||||
if self._dsh_automation is not None and self._dsh_automation.latest:
|
||||
self._dsh_automation._publish_context()
|
||||
except Exception as error:
|
||||
# QAction slots do not surface exceptions visibly in a frozen Qt
|
||||
# app. Route lazy import/WebEngine failures through the operator
|
||||
# error path instead of making the click appear to do nothing.
|
||||
try:
|
||||
self.service.report_ui_error(error)
|
||||
except Exception:
|
||||
pass
|
||||
self._show_error(TaskCenterError(
|
||||
'dsh_startup', 'DSH助手启动失败,请检查发布包中的运行时和 Node.js。'))
|
||||
|
||||
def _ensure_dsh_view(self):
|
||||
if self._dsh_view is None:
|
||||
|
||||
@@ -4,6 +4,7 @@ import json
|
||||
import re
|
||||
|
||||
ERROR_TEXT = {
|
||||
"dsh_startup": "DSH助手启动失败,请检查发布包中的运行时和 Node.js。",
|
||||
'user_forced_stop': '操作已强制中断,结果待核验。',
|
||||
'application_shutdown_failed': '业务结果已保留,但应用收尾异常。',
|
||||
"batch_resources_pending": "后台资源尚未确认释放,请使用“重新清理资源”后再开始下一批。",
|
||||
|
||||
@@ -8,7 +8,7 @@ from typing import Iterable
|
||||
|
||||
from PySide6.QtCore import Qt, QSignalBlocker, Signal, QSize, QRect
|
||||
from PySide6.QtGui import QColor,QFont,QIcon,QPalette
|
||||
from PySide6.QtWidgets import (QComboBox,QHBoxLayout,QLabel,QLineEdit,QListWidget,
|
||||
from PySide6.QtWidgets import (QAbstractItemView,QComboBox,QHBoxLayout,QLabel,QLineEdit,QListWidget,
|
||||
QListWidgetItem,QPushButton,QVBoxLayout,QWidget,QToolButton,QMenu,
|
||||
QStyledItemDelegate,QStyleOptionViewItem,QStyle,QApplication)
|
||||
from .command_menu import CommandMenu
|
||||
@@ -62,6 +62,7 @@ class TaskList(QWidget):
|
||||
super().__init__()
|
||||
self.setObjectName("taskNavigation")
|
||||
self.setAttribute(Qt.WidgetAttribute.WA_StyledBackground, True)
|
||||
self._on_open = on_open
|
||||
self._tasks = ()
|
||||
self._selected_task_id = None
|
||||
from .icons import icon
|
||||
@@ -83,9 +84,12 @@ class TaskList(QWidget):
|
||||
self.filter.setMaximumHeight(0)
|
||||
self.list = QListWidget(objectName="taskList")
|
||||
self.list.setItemDelegate(TaskItemDelegate(self.list))
|
||||
self.list.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.list.setTextElideMode(Qt.TextElideMode.ElideRight)
|
||||
self.list.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
||||
self.new_button = QPushButton("新建", objectName="newTaskButton")
|
||||
self.select_all_button = QPushButton('全选', objectName='selectAllTasks')
|
||||
self.clear_selection_button = QPushButton('清空选择', objectName='clearTaskSelection')
|
||||
self.edit_button = QPushButton("编辑", objectName="editTaskButton")
|
||||
self.delete_button = QPushButton("删除", objectName="deleteTaskButton")
|
||||
self.restore_button = QPushButton("恢复", objectName="restoreTaskButton")
|
||||
@@ -96,6 +100,8 @@ class TaskList(QWidget):
|
||||
self.new_button.setProperty('appearance','quiet')
|
||||
self.new_button.setText('新建任务')
|
||||
self.new_button.setToolTip('从目录创建工程任务')
|
||||
for button in (self.select_all_button, self.clear_selection_button):
|
||||
button.setProperty('appearance', 'quiet')
|
||||
self.manage_menu=CommandMenu(self)
|
||||
for button in (self.edit_button,self.restore_button,self.up_button,self.down_button):
|
||||
self.manage_menu.add_button(button)
|
||||
@@ -121,6 +127,8 @@ class TaskList(QWidget):
|
||||
sort_button.setProperty('appearance','quiet')
|
||||
heading=QHBoxLayout();heading.addWidget(QLabel('工程任务',objectName='taskSectionTitle'));heading.addStretch();heading.addWidget(self.new_button)
|
||||
batch=QHBoxLayout();batch.addWidget(self.count,1);batch.addWidget(sort_button)
|
||||
selection=QHBoxLayout();selection.setSpacing(3)
|
||||
selection.addWidget(self.select_all_button);selection.addWidget(self.clear_selection_button);selection.addStretch()
|
||||
footer=QHBoxLayout();footer.addWidget(self.recycle_button);footer.addStretch();footer.addWidget(self.manage_button)
|
||||
self.recycle_button.setProperty('appearance','quiet')
|
||||
self.queue_button.setProperty('appearance','batch')
|
||||
@@ -130,13 +138,19 @@ class TaskList(QWidget):
|
||||
layout.addLayout(heading)
|
||||
layout.addWidget(self.search)
|
||||
layout.addLayout(batch)
|
||||
layout.addLayout(selection)
|
||||
layout.addWidget(self.list, 1)
|
||||
layout.addWidget(self.queue_button)
|
||||
layout.addLayout(footer)
|
||||
def selected():
|
||||
self._selected_task_id = self.current_task_id()
|
||||
on_open(self._selected_task_id or '')
|
||||
task_id = self.current_task_id()
|
||||
if task_id != self._selected_task_id:
|
||||
self._selected_task_id = task_id
|
||||
self._on_open(task_id or '')
|
||||
self.list.itemSelectionChanged.connect(selected)
|
||||
self.list.itemSelectionChanged.connect(self._update_selection_state)
|
||||
self.select_all_button.clicked.connect(self.select_all_tasks)
|
||||
self.clear_selection_button.clicked.connect(self.clear_task_selection)
|
||||
self.search.textChanged.connect(self._render)
|
||||
self.sort.currentIndexChanged.connect(self._render)
|
||||
|
||||
@@ -154,6 +168,35 @@ class TaskList(QWidget):
|
||||
self._selected_task_id = task_id
|
||||
self._render()
|
||||
|
||||
def select_all_tasks(self) -> None:
|
||||
if not self.list.count():
|
||||
return
|
||||
self.list.selectAll()
|
||||
if self.list.currentItem() is None:
|
||||
self.list.setCurrentRow(0)
|
||||
self._update_selection_state()
|
||||
|
||||
def clear_task_selection(self) -> None:
|
||||
with QSignalBlocker(self.list):
|
||||
self.list.clearSelection()
|
||||
self.list.setCurrentItem(None)
|
||||
for row in range(self.list.count()):
|
||||
self.list.item(row).setSelected(False)
|
||||
self._selected_task_id = None
|
||||
self._on_open('')
|
||||
self._update_selection_state()
|
||||
self.view_changed.emit()
|
||||
|
||||
def _update_selection_state(self) -> None:
|
||||
selected = len(self.list.selectedItems())
|
||||
total = self.list.count()
|
||||
suffix = f' · 已选 {selected}' if selected else ''
|
||||
current = self.count.text()
|
||||
if ' · 已选 ' in current:
|
||||
current = current.split(' · 已选 ', 1)[0]
|
||||
if current:
|
||||
self.count.setText(current + suffix)
|
||||
|
||||
def _render(self):
|
||||
selected = self._selected_task_id
|
||||
query = self.search.text().strip().casefold().replace('\\', '/')
|
||||
@@ -190,4 +233,5 @@ class TaskList(QWidget):
|
||||
self.list.setCurrentItem(item)
|
||||
hidden = selected and self.current_task_id() is None
|
||||
self.count.setText(f'{len(tasks)} / {len(self._tasks)} 个任务' + (' · 当前任务已隐藏' if hidden else ''))
|
||||
self._update_selection_state()
|
||||
self.view_changed.emit()
|
||||
@@ -1 +1 @@
|
||||
VERSION = "1.1.4-beta.4"
|
||||
VERSION = "1.2.1"
|
||||
@@ -0,0 +1,40 @@
|
||||
from pathlib import Path
|
||||
import importlib.util
|
||||
|
||||
_MODULE = Path(__file__).resolve().parents[2] / 'packaging' / 'dsh_runtime_staging.py'
|
||||
_SPEC = importlib.util.spec_from_file_location('dsh_runtime_staging', _MODULE)
|
||||
_LOADED = importlib.util.module_from_spec(_SPEC)
|
||||
assert _SPEC and _SPEC.loader
|
||||
_SPEC.loader.exec_module(_LOADED)
|
||||
stage_node_modules = _LOADED.stage_node_modules
|
||||
|
||||
|
||||
def _package(root: Path, name: str, *, os=None, cpu=None, files=()):
|
||||
path = root / name
|
||||
path.mkdir(parents=True)
|
||||
manifest = {'name': name, 'version': '1.0.0'}
|
||||
if os is not None:
|
||||
manifest['os'] = os
|
||||
if cpu is not None:
|
||||
manifest['cpu'] = cpu
|
||||
import json
|
||||
(path / 'package.json').write_text(json.dumps(manifest), encoding='utf8')
|
||||
for relative, content in files:
|
||||
target = path / relative
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
target.write_text(content, encoding='utf8')
|
||||
|
||||
|
||||
def test_stage_dsh_runtime_keeps_windows_runtime_and_prunes_other_platforms(tmp_path):
|
||||
source = tmp_path / 'node_modules'
|
||||
(source / '@deepseek-ai' / 'dsh').mkdir(parents=True)
|
||||
(source / '@deepseek-ai' / 'dsh' / 'package.json').write_text('{}', encoding='utf8')
|
||||
_package(source, 'win-addon', os=['win32'], cpu=['x64'], files=[('index.js', 'ok')])
|
||||
_package(source, 'linux-addon', os=['linux'], files=[('index.js', 'drop')])
|
||||
_package(source, 'docs-only', files=[('index.js', 'ok'), ('README.md', 'drop'), ('source.ts', 'drop')])
|
||||
staged = stage_node_modules(source, tmp_path / 'staged')
|
||||
assert (staged / 'win-addon' / 'index.js').read_text(encoding='utf8') == 'ok'
|
||||
assert not (staged / 'linux-addon').exists()
|
||||
assert (staged / 'docs-only' / 'index.js').is_file()
|
||||
assert not (staged / 'docs-only' / 'README.md').exists()
|
||||
assert not (staged / 'docs-only' / 'source.ts').exists()
|
||||
@@ -0,0 +1,36 @@
|
||||
"""Catch missing runtime assets and mismatched version identity before release."""
|
||||
import ast
|
||||
from pathlib import Path
|
||||
import tomllib
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def test_release_version_matches_python_and_windows_resources():
|
||||
namespace = {}
|
||||
exec((ROOT / 'src/dx_productivity/trial_task_center/version.py').read_text(), namespace)
|
||||
version = namespace['VERSION']
|
||||
assert tomllib.loads((ROOT / 'pyproject.toml').read_text())['project']['version'] == version
|
||||
info = (ROOT / 'packaging/windows-version-info.txt').read_text()
|
||||
assert f"StringStruct('ProductVersion', '{version}')" in info
|
||||
parts = tuple(int(n) for n in version.split('.')) + (0,)
|
||||
assert f'filevers={parts}' in info and f'prodvers={parts}' in info
|
||||
|
||||
|
||||
def test_release_spec_includes_all_assets_and_complete_runtime():
|
||||
tree = ast.parse((ROOT / 'packaging/DxPartReplace.spec').read_text())
|
||||
constants = {node.value for node in ast.walk(tree) if isinstance(node, ast.Constant) and isinstance(node.value, str)}
|
||||
assert 'src/dx_productivity/trial_task_center/assets' in constants
|
||||
assert not any(isinstance(node, ast.Call) and isinstance(node.func, ast.Name)
|
||||
and node.func.id == 'stage_node_modules' for node in ast.walk(tree))
|
||||
assert {'dsh-runtime/node_modules', 'dsh-runtime/task-plugin',
|
||||
'issue-bootstrap.json', 'PySide6.QtWebEngineCore',
|
||||
'PySide6.QtWebEngineWidgets'} <= constants
|
||||
analysis = next(node for node in ast.walk(tree) if isinstance(node, ast.Call)
|
||||
and isinstance(node.func, ast.Name) and node.func.id == 'Analysis')
|
||||
options = {arg.arg: ast.literal_eval(arg.value) for arg in analysis.keywords
|
||||
if arg.arg in {'hiddenimports', 'excludes'}}
|
||||
web_dependencies = {'PySide6.QtWebChannel', 'PySide6.QtQml', 'PySide6.QtQuick',
|
||||
'PySide6.QtOpenGL', 'PySide6.QtOpenGLWidgets'}
|
||||
assert web_dependencies <= set(options['hiddenimports'])
|
||||
assert web_dependencies.isdisjoint(options['excludes'])
|
||||
@@ -93,6 +93,19 @@ def test_repeated_refresh_does_not_reconfigure_composition(qtbot):
|
||||
assert len(backend.calls)==1
|
||||
|
||||
|
||||
def test_webengine_has_its_own_native_composition_parent(qtbot, tmp_path):
|
||||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtWidgets import QVBoxLayout
|
||||
from dx_productivity.trial_task_center.ui.dsh_native import NativeHarnessView
|
||||
window=QWidget();qtbot.addWidget(window)
|
||||
window.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
||||
view=NativeHarnessView(tmp_path,window)
|
||||
QVBoxLayout(window).addWidget(view)
|
||||
window.show()
|
||||
# The browser must compose into its child HWND, not the Acrylic HWND.
|
||||
assert view.web.nativeParentWidget() is view
|
||||
|
||||
|
||||
def test_deferred_material_refresh_never_uses_a_destroyed_window(qtbot,qapp):
|
||||
from PySide6.QtCore import QCoreApplication,QEvent
|
||||
window=QWidget() # This test owns destruction rather than pytest-qt teardown.
|
||||
|
||||
@@ -58,6 +58,15 @@ def test_direct_navigation_opens_harness_and_returns_without_losing_task(ui, mon
|
||||
assert window._dsh_view.starts == 1
|
||||
|
||||
|
||||
def test_dsh_navigation_surfaces_lazy_startup_failure(ui, monkeypatch, qtbot):
|
||||
window = ui.window
|
||||
def fail(_self):
|
||||
raise RuntimeError('controlled missing WebEngine')
|
||||
monkeypatch.setattr(type(window), '_create_dsh_view', fail)
|
||||
qtbot.mouseClick(window.dsh_navigation, Qt.MouseButton.LeftButton)
|
||||
assert 'DSH助手启动失败' in window.run_panel.operator_band.text()
|
||||
|
||||
|
||||
def test_cross_task_harness_action_never_reaches_task_service(ui, monkeypatch):
|
||||
window = ui.window
|
||||
monkeypatch.setattr(type(window), '_create_dsh_view', lambda self: HarnessView(self), raising=False)
|
||||
|
||||
@@ -31,6 +31,27 @@ def test_task_management_is_a_menu_and_new_task_is_at_the_top(ui):
|
||||
assert panel.list.itemDelegate().__class__.__name__=='TaskItemDelegate'
|
||||
|
||||
|
||||
def test_task_list_has_explicit_select_all_clear_and_new_task_controls(ui):
|
||||
panel=ui.window.task_list
|
||||
assert panel.list.selectionMode().name=='ExtendedSelection'
|
||||
assert panel.select_all_button.isVisible()
|
||||
assert panel.clear_selection_button.isVisible()
|
||||
assert panel.new_button.isVisible()
|
||||
assert panel.select_all_button.isEnabled()
|
||||
assert panel.clear_selection_button.isEnabled()
|
||||
assert panel.list.count()>1
|
||||
|
||||
panel.select_all_button.click()
|
||||
assert len(panel.list.selectedItems())==panel.list.count()
|
||||
assert '已选' in panel.count.text()
|
||||
|
||||
panel.clear_selection_button.click()
|
||||
assert panel.list.selectedItems()==[]
|
||||
assert panel.current_task_id() is None
|
||||
assert ui.window._task_id is None
|
||||
assert panel.count.text().endswith('个任务')
|
||||
|
||||
|
||||
def test_plan_search_shares_toolbar_and_save_is_below_table(ui):
|
||||
window=ui.window;window.mapping_tabs.setCurrentIndex(1)
|
||||
plan=window.plan_panel
|
||||
|
||||
@@ -16,8 +16,8 @@ import time
|
||||
|
||||
os.environ.pop('QT_QPA_PLATFORM',None)
|
||||
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src'))
|
||||
from PySide6.QtCore import Qt,QRectF
|
||||
from PySide6.QtGui import QColor,QFont,QPainter,QLinearGradient,QPen
|
||||
from PySide6.QtCore import Qt,QRectF,QPoint
|
||||
from PySide6.QtGui import QColor,QFont,QPainter,QLinearGradient,QPen,QCursor
|
||||
from PySide6.QtWidgets import QApplication,QWidget,QToolTip
|
||||
from PIL import ImageGrab,ImageChops,ImageStat
|
||||
from dx_productivity.trial_task_center.store import TaskStore
|
||||
@@ -29,6 +29,7 @@ from dx_productivity.trial_task_center.target_plan import ComponentTarget,Target
|
||||
def main():
|
||||
parser=argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--output',type=Path,default=Path('build/acrylic-acceptance'))
|
||||
parser.add_argument('--webengine-roundtrip',action='store_true')
|
||||
args=parser.parse_args();out=args.output.resolve();out.mkdir(parents=True,exist_ok=True)
|
||||
app=QApplication([]);app.setFont(QFont('Microsoft YaHei UI',9))
|
||||
def settle(seconds=.2):
|
||||
@@ -80,6 +81,7 @@ def main():
|
||||
assert window.property('acrylicEnabled'),'Native Acrylic not available under current system policy'
|
||||
report['native_enabled']=True
|
||||
def capture(name):
|
||||
QCursor.setPos(window.mapToGlobal(QPoint(12,12)))
|
||||
settle(.7)
|
||||
QToolTip.hideText();settle(.12)
|
||||
geo=window.geometry();scale=screen.devicePixelRatio()
|
||||
@@ -121,6 +123,31 @@ def main():
|
||||
assert report['right_header_backdrop_difference']>2,report
|
||||
assert report['right_execution_backdrop_difference']>2,report
|
||||
assert report['opaque_table_backdrop_difference']<1.5,report
|
||||
if args.webengine_roundtrip:
|
||||
from dx_productivity.trial_task_center.ui.dsh_native import NativeHarnessView
|
||||
report['before_webengine_surface']={'alpha':window.windowHandle().format().alphaBufferSize(),
|
||||
'translucent':window.testAttribute(Qt.WidgetAttribute.WA_TranslucentBackground),
|
||||
'acrylic':window.property('acrylicEnabled'),'contrast':window.property('highContrastFallback')}
|
||||
def create_view():
|
||||
view=NativeHarnessView(root/'dsh',window)
|
||||
view.start=lambda:None # Real Chromium surface; no server, model or CAD.
|
||||
view.web.setHtml('<html><body>Owned DSH WebEngine surface</body></html>')
|
||||
return view
|
||||
window._create_dsh_view=create_view
|
||||
for index in range(2):
|
||||
window.dsh_action.trigger();settle(2)
|
||||
window.task_center_action.trigger();settle(1)
|
||||
report['after_webengine_surface']={'alpha':window.windowHandle().format().alphaBufferSize(),
|
||||
'translucent':window.testAttribute(Qt.WidgetAttribute.WA_TranslucentBackground),
|
||||
'acrylic':window.property('acrylicEnabled'),'contrast':window.property('highContrastFallback')}
|
||||
background.phase=0;background.update();capture(f'roundtrip-{index}-a')
|
||||
background.phase=1;background.update();capture(f'roundtrip-{index}-b')
|
||||
delta=ImageChops.difference(captures[f'roundtrip-{index}-a'],captures[f'roundtrip-{index}-b'])
|
||||
report[f'roundtrip_{index}_sidebar_difference']=mean(delta.crop(sidebar))
|
||||
report[f'roundtrip_{index}_table_difference']=mean(delta.crop(table))
|
||||
(out/'roundtrip-probe.json').write_text(json.dumps(report,indent=2),encoding='utf8')
|
||||
assert report[f'roundtrip_{index}_sidebar_difference']>2,report
|
||||
assert report[f'roundtrip_{index}_table_difference']<1.5,report
|
||||
window.plan_panel.find_text.setText('RV');window.plan_panel.find()
|
||||
report['visible_search_feedback']=window.plan_panel.find_result.isVisible()
|
||||
assert '2 / 6'in window.plan_panel.find_result.text()
|
||||
@@ -136,6 +163,15 @@ def main():
|
||||
report['solid_sidebar_mean']=ImageStat.Stat(solid.crop(sidebar)).mean
|
||||
assert min(report['solid_sidebar_mean'])>200,report
|
||||
report['solid_fallback']=True
|
||||
if args.webengine_roundtrip:
|
||||
window.dsh_action.trigger();settle(.3)
|
||||
window.task_center_action.trigger();settle(.3)
|
||||
assert not window.property('acrylicEnabled')
|
||||
background.phase=0;background.update();capture('roundtrip-solid-a')
|
||||
background.phase=1;background.update();capture('roundtrip-solid-b')
|
||||
delta=ImageChops.difference(captures['roundtrip-solid-a'],captures['roundtrip-solid-b'])
|
||||
report['roundtrip_reduced_sidebar_difference']=mean(delta.crop(sidebar))
|
||||
assert report['roundtrip_reduced_sidebar_difference']<1.5,report
|
||||
window.reduced_transparency_button.setChecked(False);settle(.3)
|
||||
window.resize(980,700);capture('native-app-compact')
|
||||
report['compact_size']=[window.width(),window.height()]
|
||||
|
||||
Reference in new issue
Block a user