visualdynamics.gui.report_editor¶
report_editor
¶
The report editor: the exported page as the preview, with the actions on a bar above it.
The page shown is the same HTML the export writes, so it is exactly what
the reader will get, with the figures drawn by the same JavaScript the
reader's browser will run. It does two things the exported page does
not: it outlines the selected block, and it reports which block was
clicked. Everything else is in Qt. Above the page is a bar of actions
(Insert, Reference, Move Up, Move Down, Delete, and Export as HTML or as
a report template), and beside it is a settings pane for the selection:
a figure block's sources and caption, a text block's Markdown in a Qt
editor, or the report's title, marking and Report Features panel when
nothing is selected (report_features_panel). Each action is one
operation on the Report model, which the window records in the
journal, followed by a new render of the page. The exported file
carries none of the editor's controls.
Classes:
| Name | Description |
|---|---|
ReportEditor |
The report editor: the web view, the bar and the settings pane. |
Classes¶
ReportEditor
¶
Bases: QWidget
The report editor: the web view, the bar and the settings pane.
It applies each operation to the report and renders the page again.
edited is emitted after each change to the report, and
export_requested and template_requested when Export → HTML or
Export → Report template is chosen.
Methods:
| Name | Description |
|---|---|
insert |
Insert a block of |
insert_reference |
Insert |
flush_text |
Apply the text editor's Markdown to the selected block now. The |
show_report |
Open |
rebuild |
Render the page again from the report and load it, keeping the |
stand_down |
Leave the page with nothing for the view's destructor to wait on. |
Source code in src/visualdynamics/gui/report_editor.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
Methods:¶
insert
¶
Insert a block of kind, one of the Insert menu's kinds, after
the selected block or at the end, and select it.
Source code in src/visualdynamics/gui/report_editor.py
insert_reference
¶
Insert {{figure:caption}} or {{table:caption}} at the text
editor's cursor. This is the token the report stores, numbered by
the same code that numbers the page. Nothing happens unless a
text block's editor is open.
Source code in src/visualdynamics/gui/report_editor.py
flush_text
¶
Apply the text editor's Markdown to the selected block now. The
editor does this itself once typing has paused for
TEXT_DEBOUNCE_MS, and tests call it directly.
Source code in src/visualdynamics/gui/report_editor.py
show_report
¶
show_report(report: Report, objects: Callable[[], dict[str, Any]], unit_system: Any, object_groups: Callable[[], list[Any]] | None = None) -> None
Open report in the editor, with nothing selected.
objects returns the project's objects by name and
object_groups, when given, the project's object groups. Both
are called on every render, so the editor reads the project as it
stands. unit_system is the display units.
Source code in src/visualdynamics/gui/report_editor.py
rebuild
¶
Render the page again from the report and load it, keeping the
scroll position. When the render raises, the page shows the
traceback and failure holds a one-line summary of it.
Source code in src/visualdynamics/gui/report_editor.py
1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 | |
stand_down
¶
Leave the page with nothing for the view's destructor to wait on.
Call this before the editor is destroyed. A QWebEngineView
destroyed while its page is live can block the whole process,
because Chromium's teardown waits on the render process and does
not return. A hidden page can be discarded instead (its render
process shut down and the page unloaded), and a discarded page is
destroyed in about a millisecond.
So the navigation in flight and its scroll-restoring slot are stopped, the view is hidden, the page is detached from the view, the events that remove the widget are processed, and only then is the page discarded, with nothing left to wait on but the render process it is shutting down. Each step is written to the debug log.
Source code in src/visualdynamics/gui/report_editor.py
1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 | |