audit-e2w 0.0.0-stage → 1.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +152 -3
  3. package/cordis.patch.yml +3 -0
  4. package/dsh_plugins/audit-e2w/lib/engine.mjs +174 -0
  5. package/dsh_plugins/audit-e2w/lib/index.js +122 -0
  6. package/dsh_plugins/audit-e2w/lib/skill.js +42 -0
  7. package/excel_word/README.md +388 -0
  8. package/excel_word/qoder_engine.py +437 -0
  9. package/excel_word/requirements.txt +4 -0
  10. package/excel_word/wesync/__init__.py +19 -0
  11. package/excel_word/wesync/__main__.py +6 -0
  12. package/excel_word/wesync/ai/__init__.py +52 -0
  13. package/excel_word/wesync/ai/actions.py +369 -0
  14. package/excel_word/wesync/ai/client.py +340 -0
  15. package/excel_word/wesync/ai/config.py +291 -0
  16. package/excel_word/wesync/ai/docs.py +177 -0
  17. package/excel_word/wesync/ai/prompts.py +288 -0
  18. package/excel_word/wesync/ai/tasks/__init__.py +26 -0
  19. package/excel_word/wesync/ai/tasks/actions_task.py +97 -0
  20. package/excel_word/wesync/ai/tasks/combined.py +123 -0
  21. package/excel_word/wesync/ai/tasks/diff_note.py +61 -0
  22. package/excel_word/wesync/ai/tasks/headings.py +119 -0
  23. package/excel_word/wesync/ai/tasks/help_task.py +69 -0
  24. package/excel_word/wesync/ai/tasks/roles.py +128 -0
  25. package/excel_word/wesync/align.py +155 -0
  26. package/excel_word/wesync/api.py +1292 -0
  27. package/excel_word/wesync/backup_history.py +100 -0
  28. package/excel_word/wesync/changelog.py +58 -0
  29. package/excel_word/wesync/cli.py +191 -0
  30. package/excel_word/wesync/commands/__init__.py +8 -0
  31. package/excel_word/wesync/commands/blank_cmd.py +279 -0
  32. package/excel_word/wesync/commands/bookmark_cmd.py +146 -0
  33. package/excel_word/wesync/commands/clear_cmd.py +50 -0
  34. package/excel_word/wesync/commands/export_cmd.py +270 -0
  35. package/excel_word/wesync/commands/incremental_cmd.py +157 -0
  36. package/excel_word/wesync/commands/marks_cmd.py +160 -0
  37. package/excel_word/wesync/commands/placeholders_cmd.py +92 -0
  38. package/excel_word/wesync/commands/writeback_cmd.py +469 -0
  39. package/excel_word/wesync/config.py +97 -0
  40. package/excel_word/wesync/console.py +85 -0
  41. package/excel_word/wesync/docx_blank.py +156 -0
  42. package/excel_word/wesync/docx_bookmarks.py +294 -0
  43. package/excel_word/wesync/docx_columns.py +257 -0
  44. package/excel_word/wesync/docx_edit.py +77 -0
  45. package/excel_word/wesync/docx_grid.py +212 -0
  46. package/excel_word/wesync/docx_marks.py +399 -0
  47. package/excel_word/wesync/docx_meta.py +157 -0
  48. package/excel_word/wesync/docx_newtable.py +220 -0
  49. package/excel_word/wesync/docx_placeholders.py +200 -0
  50. package/excel_word/wesync/docx_rows.py +67 -0
  51. package/excel_word/wesync/errors.py +5 -0
  52. package/excel_word/wesync/excel_blocks.py +502 -0
  53. package/excel_word/wesync/excel_export.py +143 -0
  54. package/excel_word/wesync/excel_marks.py +265 -0
  55. package/excel_word/wesync/excel_totals.py +53 -0
  56. package/excel_word/wesync/fsops.py +219 -0
  57. package/excel_word/wesync/gui/__init__.py +53 -0
  58. package/excel_word/wesync/gui/__main__.py +6 -0
  59. package/excel_word/wesync/gui/app.py +613 -0
  60. package/excel_word/wesync/gui/manual.py +70 -0
  61. package/excel_word/wesync/gui/pages/__init__.py +80 -0
  62. package/excel_word/wesync/gui/pages/_page.py +211 -0
  63. package/excel_word/wesync/gui/pages/ai_page.py +854 -0
  64. package/excel_word/wesync/gui/pages/batch_page.py +456 -0
  65. package/excel_word/wesync/gui/pages/blank_page.py +530 -0
  66. package/excel_word/wesync/gui/pages/bookmark_page.py +97 -0
  67. package/excel_word/wesync/gui/pages/export_page.py +141 -0
  68. package/excel_word/wesync/gui/pages/feedback_page.py +196 -0
  69. package/excel_word/wesync/gui/pages/format_page.py +551 -0
  70. package/excel_word/wesync/gui/pages/help_page.py +158 -0
  71. package/excel_word/wesync/gui/pages/history_page.py +168 -0
  72. package/excel_word/wesync/gui/pages/marks_page.py +211 -0
  73. package/excel_word/wesync/gui/pages/settings_page.py +450 -0
  74. package/excel_word/wesync/gui/pages/writeback_page.py +473 -0
  75. package/excel_word/wesync/gui/resources.py +22 -0
  76. package/excel_word/wesync/gui/runner.py +90 -0
  77. package/excel_word/wesync/gui/store.py +50 -0
  78. package/excel_word/wesync/gui/theme.py +271 -0
  79. package/excel_word/wesync/gui/widgets/__init__.py +8 -0
  80. package/excel_word/wesync/gui/widgets/ai_config.py +362 -0
  81. package/excel_word/wesync/gui/widgets/cards.py +139 -0
  82. package/excel_word/wesync/gui/widgets/chips.py +565 -0
  83. package/excel_word/wesync/gui/widgets/filebar.py +58 -0
  84. package/excel_word/wesync/gui/widgets/logpane.py +126 -0
  85. package/excel_word/wesync/gui/widgets/nav.py +294 -0
  86. package/excel_word/wesync/gui/widgets/theme_choice.py +93 -0
  87. package/excel_word/wesync/report_format.py +1585 -0
  88. package/excel_word/wesync/settings.py +35 -0
  89. package/excel_word/wesync/sort_rules.py +293 -0
  90. package/excel_word/wesync/valuefmt.py +485 -0
  91. package/package.json +53 -6
  92. package/packaging//344/275/277/347/224/250/350/257/264/346/230/216.txt +247 -0
  93. package/qoder_plugins/audit-toolbox/README.md +159 -0
  94. package/qoder_plugins/audit-toolbox/catalog.mjs +265 -0
@@ -0,0 +1,80 @@
1
+ """页面注册表:新增页面只需继承 BasePage 并调用 register_page()。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from ._page import BasePage
6
+ from .ai_page import AiPage
7
+ from .batch_page import BatchPage
8
+ from .blank_page import BlankPage
9
+ from .bookmark_page import BookmarkPage
10
+ from .export_page import ExportPage
11
+ from .feedback_page import FeedbackPage
12
+ from .format_page import FormatPage
13
+ from .help_page import HelpPage
14
+ from .history_page import HistoryPage
15
+ from .marks_page import MarksPage
16
+ from .settings_page import SettingsPage
17
+ from .writeback_page import WritebackPage
18
+
19
+ # 页面顺序即导航顺序;维护工具中的书签保持倒数第二。
20
+ _PAGES: list[type[BasePage]] = [
21
+ ExportPage,
22
+ WritebackPage,
23
+ MarksPage,
24
+ BatchPage,
25
+ AiPage,
26
+ BlankPage,
27
+ FormatPage,
28
+ BookmarkPage,
29
+ HistoryPage,
30
+ SettingsPage,
31
+ FeedbackPage,
32
+ HelpPage,
33
+ ]
34
+
35
+ # 主窗口后续按这三个分组组织导航,页面文件无需感知分组。
36
+ _NAV_GROUPS: dict[type[BasePage], str] = {
37
+ ExportPage: "日常处理",
38
+ WritebackPage: "日常处理",
39
+ MarksPage: "日常处理",
40
+ BatchPage: "日常处理",
41
+ BlankPage: "维护工具",
42
+ FormatPage: "维护工具",
43
+ BookmarkPage: "维护工具",
44
+ HistoryPage: "维护工具",
45
+ AiPage: "日常处理",
46
+ SettingsPage: "系统",
47
+ FeedbackPage: "系统",
48
+ HelpPage: "系统",
49
+ }
50
+ for _page_class in _PAGES:
51
+ _page_class.nav_group = _NAV_GROUPS[_page_class]
52
+
53
+
54
+ def register_page(page_class: type[BasePage]) -> type[BasePage]:
55
+ """注册新功能页(自动加入导航)。"""
56
+ _PAGES.append(page_class)
57
+ return page_class
58
+
59
+
60
+ def iter_pages() -> list[type[BasePage]]:
61
+ return [*_PAGES]
62
+
63
+
64
+ __all__ = [
65
+ "BasePage",
66
+ "register_page",
67
+ "iter_pages",
68
+ "ExportPage",
69
+ "WritebackPage",
70
+ "MarksPage",
71
+ "BatchPage",
72
+ "BlankPage",
73
+ "FormatPage",
74
+ "BookmarkPage",
75
+ "HistoryPage",
76
+ "AiPage",
77
+ "SettingsPage",
78
+ "FeedbackPage",
79
+ "HelpPage",
80
+ ]
@@ -0,0 +1,211 @@
1
+ """页面基类与共用构件:标题、说明、卡片、按钮行。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from PySide6.QtCore import QEvent, Qt, QTimer
6
+ from PySide6.QtWidgets import (
7
+ QCheckBox,
8
+ QComboBox,
9
+ QFrame,
10
+ QHBoxLayout,
11
+ QLabel,
12
+ QPushButton,
13
+ QScrollArea,
14
+ QVBoxLayout,
15
+ QWidget,
16
+ )
17
+
18
+ from ...settings import ZERO_LABELS
19
+
20
+ from ..widgets.cards import add_option_tile, make_card, make_option_grid
21
+
22
+
23
+ class BasePage(QWidget):
24
+ """所有功能页的基类:上方标题与说明,下方是可滚动的页面内容。"""
25
+
26
+ title = "页面"
27
+ subtitle = ""
28
+ CONTENT_MAX_WIDTH: int | None = 1120
29
+ # 内容自适应高度(默认):页面短时不留大片空白。
30
+ # 置 True 表示内容要撑满可用高度(如说明书页的分栏浏览区)。
31
+ FILL_HEIGHT = False
32
+
33
+ def __init__(self, ctx, parent=None):
34
+ super().__init__(parent)
35
+ self.ctx = ctx
36
+ layout = QVBoxLayout(self)
37
+ layout.setContentsMargins(24, 18, 24, 16)
38
+ layout.setSpacing(8)
39
+ title = QLabel(self.title)
40
+ title.setObjectName("PageTitle")
41
+ layout.addWidget(title)
42
+ if self.subtitle:
43
+ desc = QLabel(self.subtitle)
44
+ desc.setObjectName("Desc")
45
+ desc.setWordWrap(True)
46
+ desc.setMinimumWidth(0)
47
+ layout.addWidget(desc)
48
+
49
+ scroller = QScrollArea()
50
+ scroller.setWidgetResizable(True)
51
+ if self.FILL_HEIGHT:
52
+ # 内容撑满:不要 AlignTop,否则 body 会缩到内容高度、下方留白
53
+ scroller.setAlignment(Qt.AlignmentFlag.AlignLeft)
54
+ scroller.setFrameShape(QFrame.NoFrame)
55
+ else:
56
+ scroller.setAlignment(Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop)
57
+ body = QWidget()
58
+ if self.CONTENT_MAX_WIDTH is not None:
59
+ body.setMaximumWidth(self.CONTENT_MAX_WIDTH)
60
+ body_layout = QVBoxLayout(body)
61
+ body_layout.setContentsMargins(0, 8, 0, 0)
62
+ body_layout.setSpacing(14)
63
+ if not self.FILL_HEIGHT:
64
+ body_layout.addStretch(1)
65
+ scroller.setWidget(body)
66
+ layout.addWidget(scroller, 1)
67
+ self.body = body
68
+ self._default_bindings = []
69
+ self._content_height = None
70
+ self.build(body)
71
+ body.installEventFilter(self)
72
+
73
+ def eventFilter(self, watched, event):
74
+ if watched is self.body and event.type() == QEvent.Resize:
75
+ QTimer.singleShot(0, self._fit_content_height)
76
+ return super().eventFilter(watched, event)
77
+
78
+ def _fit_content_height(self) -> None:
79
+ # 撑满模式由布局自行分配高度,不能再压最小高度
80
+ if self.FILL_HEIGHT:
81
+ return
82
+ layout = self.body.layout()
83
+ layout.activate()
84
+ height = layout.sizeHint().height()
85
+ if height < 0 or height == self._content_height:
86
+ return
87
+ self._content_height = height
88
+ self.body.setMinimumHeight(height)
89
+ QTimer.singleShot(0, self._fit_content_height)
90
+
91
+ def on_show(self) -> None:
92
+ """切换到本页时调用;单次临时调整不跨页面保留。"""
93
+ for row, controls, status in self._default_bindings:
94
+ row.setChecked(False)
95
+ self._apply_defaults(controls, status)
96
+ row.setChecked(True)
97
+
98
+ def bind_defaults(self, layout, controls: dict, zero_keys=(), zero_controls: dict | None = None) -> QCheckBox:
99
+ row = QCheckBox("本次调整")
100
+ zero_controls = zero_controls if zero_controls is not None else {}
101
+ status = QLabel()
102
+ status.setObjectName("CardDesc")
103
+ status.setWordWrap(True)
104
+ adjust = QFrame()
105
+ adjust.setObjectName("AdjustBlock")
106
+ adjust_layout = QVBoxLayout(adjust)
107
+ adjust_layout.setContentsMargins(12, 10, 12, 10)
108
+ adjust_layout.setSpacing(8)
109
+ wrapper = QHBoxLayout()
110
+ wrapper.setContentsMargins(0, 0, 0, 0)
111
+ wrapper.addWidget(row)
112
+ wrapper.addWidget(status, 1)
113
+ adjust_layout.addLayout(wrapper)
114
+ zero_row = QHBoxLayout()
115
+ zero_row.setContentsMargins(0, 0, 0, 0)
116
+ zero_row.setSpacing(12)
117
+ for name, key in zero_keys:
118
+ group = QWidget()
119
+ group_layout = QHBoxLayout(group)
120
+ group_layout.setContentsMargins(0, 0, 0, 0)
121
+ group_layout.setSpacing(8)
122
+ combo = QComboBox()
123
+ combo.setMinimumWidth(120)
124
+ combo.setMaximumWidth(140)
125
+ for mode, label in ZERO_LABELS.items():
126
+ combo.addItem(label, mode)
127
+ group_layout.addWidget(QLabel(name))
128
+ group_layout.addWidget(combo)
129
+ zero_row.addWidget(group)
130
+ controls[key] = combo
131
+ zero_controls[key] = combo
132
+ if zero_keys:
133
+ zero_row.addStretch(1)
134
+ adjust_layout.addLayout(zero_row)
135
+ layout.addWidget(adjust)
136
+ row.toggled.connect(lambda checked: self._apply_defaults(controls, status, checked))
137
+ self._default_bindings.append((row, controls, status))
138
+ self._apply_defaults(controls, status)
139
+ row.setChecked(True)
140
+ return row
141
+
142
+ def build(self, body: QWidget) -> None: # pragma: no cover - 子类实现
143
+ raise NotImplementedError
144
+
145
+ def _apply_defaults(self, controls: dict, status: QLabel, editing=False) -> None:
146
+ settings = self.ctx.global_settings()
147
+ for key, control in controls.items():
148
+ control.setEnabled(editing and not self.ctx.busy)
149
+ if isinstance(control, QComboBox):
150
+ control.setCurrentIndex(control.findData(settings[key]))
151
+ elif not editing:
152
+ control.setChecked(bool(settings[key]))
153
+ status.setText("本次临时调整 · 不保存" if editing else "当前沿用全局设置")
154
+
155
+ def refresh_button_state(self) -> None:
156
+ for row, controls, status in self._default_bindings:
157
+ self._apply_defaults(controls, status, row.isChecked())
158
+
159
+ def reload_global_defaults(self) -> None:
160
+ for row, controls, status in self._default_bindings:
161
+ editing = row.isChecked()
162
+ row.setChecked(False)
163
+ self._apply_defaults(controls, status)
164
+ row.setChecked(editing)
165
+
166
+ def run_background(self, title: str, work, on_success) -> bool:
167
+ return self.ctx.run_steps([(title, work)], on_success=on_success)
168
+
169
+ # ---------- 共用构件 ----------
170
+
171
+ @staticmethod
172
+ def option_grid(card: QWidget, columns: int = 3) -> QWidget:
173
+ grid = make_option_grid(columns=columns)
174
+ card.layout().addWidget(grid)
175
+ return grid
176
+
177
+ @staticmethod
178
+ def option_tile(grid: QWidget, text: str, checked: bool = False, *, hint: str = "", risk: bool = False, columns: int = 3):
179
+ return add_option_tile(grid, text, checked, hint=hint, risk=risk, columns=columns)
180
+
181
+ @staticmethod
182
+ def card(body: QWidget) -> QWidget:
183
+ card = make_card()
184
+ # 插到末尾 stretch 之前,卡片保持从上往下排
185
+ body.layout().insertWidget(body.layout().count() - 1, card)
186
+ return card
187
+
188
+ @staticmethod
189
+ def tip_label(card: QWidget, text: str) -> QLabel:
190
+ label = QLabel(text)
191
+ label.setObjectName("CardDesc")
192
+ label.setWordWrap(True)
193
+ label.setMinimumWidth(0)
194
+ card.layout().addWidget(label)
195
+ return label
196
+
197
+ def button_row(self, card: QWidget, on_dry, on_run, dry_text="仅预演", run_text="开始执行") -> QWidget:
198
+ row = QWidget()
199
+ layout = QHBoxLayout(row)
200
+ layout.setContentsMargins(0, 0, 0, 0)
201
+ layout.setSpacing(12)
202
+ dry = QPushButton(dry_text)
203
+ dry.clicked.connect(lambda _checked=False: on_dry())
204
+ layout.addWidget(dry)
205
+ run = QPushButton(run_text)
206
+ run.setObjectName("Primary")
207
+ run.clicked.connect(lambda _checked=False: on_run())
208
+ layout.addWidget(run)
209
+ layout.addStretch(1)
210
+ card.layout().addWidget(row)
211
+ return row