gratinglab 0.3.10__tar.gz → 0.3.11__tar.gz

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 (228) hide show
  1. {gratinglab-0.3.10/src/gratinglab.egg-info → gratinglab-0.3.11}/PKG-INFO +3 -3
  2. {gratinglab-0.3.10 → gratinglab-0.3.11}/pyproject.toml +2 -2
  3. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/__init__.py +1 -1
  4. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/docs.py +36 -0
  5. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/launcher.py +25 -1
  6. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/help_menu.py +32 -16
  7. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/launcher.py +14 -7
  8. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/main_window.py +69 -101
  9. gratinglab-0.3.11/src/gratinglab/gui/qt/worker.py +208 -0
  10. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/gui/qt/main_window.py +18 -28
  11. gratinglab-0.3.11/src/gratinglab/metrology/gui/qt/worker.py +35 -0
  12. {gratinglab-0.3.10 → gratinglab-0.3.11/src/gratinglab.egg-info}/PKG-INFO +3 -3
  13. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab.egg-info/requires.txt +2 -2
  14. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_cmethod_tab.py +13 -3
  15. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_compare_tab.py +23 -12
  16. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_help_menu.py +55 -6
  17. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_launcher.py +41 -1
  18. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_qt.py +161 -123
  19. gratinglab-0.3.10/src/gratinglab/gui/qt/worker.py +0 -321
  20. gratinglab-0.3.10/src/gratinglab/metrology/gui/qt/worker.py +0 -60
  21. {gratinglab-0.3.10 → gratinglab-0.3.11}/LICENSE +0 -0
  22. {gratinglab-0.3.10 → gratinglab-0.3.11}/MANIFEST.in +0 -0
  23. {gratinglab-0.3.10 → gratinglab-0.3.11}/README.md +0 -0
  24. {gratinglab-0.3.10 → gratinglab-0.3.11}/docs/conventions.md +0 -0
  25. {gratinglab-0.3.10 → gratinglab-0.3.11}/docs/theory/cmethod.md +0 -0
  26. {gratinglab-0.3.10 → gratinglab-0.3.11}/docs/theory/integral.md +0 -0
  27. {gratinglab-0.3.10 → gratinglab-0.3.11}/docs/theory/metrology.md +0 -0
  28. {gratinglab-0.3.10 → gratinglab-0.3.11}/docs/theory/rcwa.md +0 -0
  29. {gratinglab-0.3.10 → gratinglab-0.3.11}/docs/theory/scalar.md +0 -0
  30. {gratinglab-0.3.10 → gratinglab-0.3.11}/setup.cfg +0 -0
  31. {gratinglab-0.3.10 → gratinglab-0.3.11}/setup.py +0 -0
  32. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/checks.py +0 -0
  33. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/compare.py +0 -0
  34. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/convergence.py +0 -0
  35. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/geometry.py +0 -0
  36. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/__init__.py +0 -0
  37. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/app.py +0 -0
  38. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/cmethod_options.py +0 -0
  39. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/comparison.py +0 -0
  40. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/diagram.py +0 -0
  41. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/diagram3d.py +0 -0
  42. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/efficiency_plot.py +0 -0
  43. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/failures.py +0 -0
  44. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/icon.py +0 -0
  45. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/integral_options.py +0 -0
  46. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/orders.py +0 -0
  47. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/provenance.py +0 -0
  48. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/__init__.py +0 -0
  49. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/cmethod_tab.py +0 -0
  50. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/compare_tab.py +0 -0
  51. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/geometry_panel.py +0 -0
  52. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/geometry_tab.py +0 -0
  53. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/integral_tab.py +0 -0
  54. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/profile_plot_panel.py +0 -0
  55. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/provenance_panel.py +0 -0
  56. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/rcwa_tab.py +0 -0
  57. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/recent.py +0 -0
  58. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/scalar_tab.py +0 -0
  59. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/scene3d_panel.py +0 -0
  60. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/setup_tab.py +0 -0
  61. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/sizing.py +0 -0
  62. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/theming.py +0 -0
  63. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/qt/theory_viewer.py +0 -0
  64. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/rcwa_options.py +0 -0
  65. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/richtext.py +0 -0
  66. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/scalar_options.py +0 -0
  67. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/state.py +0 -0
  68. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/gui/theme.py +0 -0
  69. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/illumination.py +0 -0
  70. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/io/__init__.py +0 -0
  71. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/io/boundary.py +0 -0
  72. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/io/efficiency_table.py +0 -0
  73. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/io/ggp.py +0 -0
  74. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/io/txl.py +0 -0
  75. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/materials/__init__.py +0 -0
  76. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/materials/data/SOURCES.md +0 -0
  77. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/materials/fresnel.py +0 -0
  78. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/materials/optical.py +0 -0
  79. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/materials/refractiveindex.py +0 -0
  80. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/materials/typical.py +0 -0
  81. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/measured.py +0 -0
  82. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/__init__.py +0 -0
  83. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/_analyzer_summary.py +0 -0
  84. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/analyzer.py +0 -0
  85. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/boundary/__init__.py +0 -0
  86. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/boundary/average.py +0 -0
  87. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/boundary/cross_section.py +0 -0
  88. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/boundary/pipeline.py +0 -0
  89. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/boundary/swaths.py +0 -0
  90. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/cli.py +0 -0
  91. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/config.py +0 -0
  92. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/core/__init__.py +0 -0
  93. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/core/analysis.py +0 -0
  94. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/core/image_flatten.py +0 -0
  95. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/core/orientation.py +0 -0
  96. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/core/processing.py +0 -0
  97. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/core/region_mask.py +0 -0
  98. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/core/scars.py +0 -0
  99. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/core/tip.py +0 -0
  100. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/data/__init__.py +0 -0
  101. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/data/aggregation.py +0 -0
  102. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/gui/__init__.py +0 -0
  103. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/gui/icon.py +0 -0
  104. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/gui/qt/__init__.py +0 -0
  105. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/gui/qt/app.py +0 -0
  106. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/gui/qt/boundary_view.py +0 -0
  107. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/gui/qt/canvas.py +0 -0
  108. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/gui/qt/efficiency_dialog.py +0 -0
  109. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/gui/qt/import_view.py +0 -0
  110. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/gui/qt/layout.py +0 -0
  111. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/gui/qt/swath_dialog.py +0 -0
  112. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/gui/qt/wiki_view.py +0 -0
  113. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/gui/state.py +0 -0
  114. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/io/__init__.py +0 -0
  115. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/io/file_io.py +0 -0
  116. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/io/ibw.py +0 -0
  117. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/io/metrics.py +0 -0
  118. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/io/sem.py +0 -0
  119. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/io/spm.py +0 -0
  120. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/settings.py +0 -0
  121. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/stats/__init__.py +0 -0
  122. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/stats/analysis.py +0 -0
  123. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/stats/icc.py +0 -0
  124. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/visualization/__init__.py +0 -0
  125. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/visualization/diagnostics.py +0 -0
  126. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/visualization/profiles.py +0 -0
  127. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/visualization/statistics.py +0 -0
  128. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/wiki/__init__.py +0 -0
  129. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/wiki/facet-fitting.md +0 -0
  130. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/wiki/file-formats.md +0 -0
  131. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/wiki/flattening.md +0 -0
  132. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/wiki/groove-orientation.md +0 -0
  133. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/wiki/icc-correction.md +0 -0
  134. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/wiki/overview.md +0 -0
  135. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/wiki/reading-outputs.md +0 -0
  136. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/wiki/row-groups.md +0 -0
  137. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/wiki/scars-and-masking.md +0 -0
  138. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/wiki/swath-statistics.md +0 -0
  139. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/wiki/tip-correction.md +0 -0
  140. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/metrology/workflows.py +0 -0
  141. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/problem.py +0 -0
  142. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/profiles/__init__.py +0 -0
  143. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/profiles/_base.py +0 -0
  144. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/profiles/_polyline.py +0 -0
  145. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/profiles/_shapes.py +0 -0
  146. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/profiles/_trapezoid.py +0 -0
  147. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/profiles/_types.py +0 -0
  148. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/resolution.py +0 -0
  149. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/result.py +0 -0
  150. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/__init__.py +0 -0
  151. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/_conditioning.py +0 -0
  152. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/_execution.py +0 -0
  153. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/_scalar_groove.py +0 -0
  154. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/base.py +0 -0
  155. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/cmethod/__init__.py +0 -0
  156. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/cmethod/_core.py +0 -0
  157. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/cmethod/_series.py +0 -0
  158. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/integral/__init__.py +0 -0
  159. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/integral/_boundary.py +0 -0
  160. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/integral/_core.py +0 -0
  161. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/integral/_finite.py +0 -0
  162. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/integral/_greens.py +0 -0
  163. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/integral/_kernels.py +0 -0
  164. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/integral/_nystrom.py +0 -0
  165. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/rcwa/__init__.py +0 -0
  166. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/rcwa/_core.py +0 -0
  167. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/rcwa/_stack.py +0 -0
  168. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab/solvers/scalar.py +0 -0
  169. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab.egg-info/SOURCES.txt +0 -0
  170. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab.egg-info/dependency_links.txt +0 -0
  171. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab.egg-info/entry_points.txt +0 -0
  172. {gratinglab-0.3.10 → gratinglab-0.3.11}/src/gratinglab.egg-info/top_level.txt +0 -0
  173. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_changelog.py +0 -0
  174. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_checks.py +0 -0
  175. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_cmethod.py +0 -0
  176. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_compare.py +0 -0
  177. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_conditioning.py +0 -0
  178. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_convergence.py +0 -0
  179. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_cross_method.py +0 -0
  180. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_efficiency_table.py +0 -0
  181. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_four_way.py +0 -0
  182. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_fresnel.py +0 -0
  183. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_geometry.py +0 -0
  184. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_ggp.py +0 -0
  185. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_cmethod_options.py +0 -0
  186. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_diagram.py +0 -0
  187. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_diagram3d.py +0 -0
  188. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_docs.py +0 -0
  189. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_integral_options.py +0 -0
  190. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_mathtext.py +0 -0
  191. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_orders.py +0 -0
  192. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_polish.py +0 -0
  193. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_provenance.py +0 -0
  194. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_provenance_panel.py +0 -0
  195. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_rcwa_options.py +0 -0
  196. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_richtext.py +0 -0
  197. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_scalar_options.py +0 -0
  198. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_state.py +0 -0
  199. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_gui_theme.py +0 -0
  200. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_illumination.py +0 -0
  201. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_integral_core.py +0 -0
  202. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_integral_corpus.py +0 -0
  203. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_integral_finite.py +0 -0
  204. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_integral_graded.py +0 -0
  205. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_integral_greens.py +0 -0
  206. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_integral_kernels.py +0 -0
  207. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_integral_measured_polygon.py +0 -0
  208. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_integral_operators.py +0 -0
  209. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_integral_solver.py +0 -0
  210. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_io_boundary.py +0 -0
  211. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_littrow.py +0 -0
  212. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_materials.py +0 -0
  213. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_measured.py +0 -0
  214. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_perturbation.py +0 -0
  215. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_profiles.py +0 -0
  216. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_rayleigh_anomaly.py +0 -0
  217. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_rcwa.py +0 -0
  218. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_rcwa_benchmarks.py +0 -0
  219. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_refractiveindex.py +0 -0
  220. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_resolution.py +0 -0
  221. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_result.py +0 -0
  222. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_scalar.py +0 -0
  223. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_solver_conformance.py +0 -0
  224. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_solver_execution.py +0 -0
  225. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_solver_progress.py +0 -0
  226. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_trapezoidal_solvers.py +0 -0
  227. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_txl.py +0 -0
  228. {gratinglab-0.3.10 → gratinglab-0.3.11}/tests/test_typical.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gratinglab
3
- Version: 0.3.10
3
+ Version: 0.3.11
4
4
  Summary: Open platform for diffraction grating groove metrology and efficiency analysis
5
5
  Author: Jake McCoy, Aditi Gangadharan
6
6
  License-Expression: BSD-3-Clause
@@ -21,7 +21,7 @@ License-File: LICENSE
21
21
  Requires-Dist: numpy>=1.26
22
22
  Requires-Dist: scipy>=1.11
23
23
  Requires-Dist: pydantic>=2.6
24
- Requires-Dist: endstation>=0.4.0
24
+ Requires-Dist: endstation>=0.5.1
25
25
  Requires-Dist: threadpoolctl>=3.1
26
26
  Provides-Extra: dev
27
27
  Requires-Dist: pytest>=9.2; extra == "dev"
@@ -33,7 +33,7 @@ Provides-Extra: gui
33
33
  Requires-Dist: matplotlib>=3.8; extra == "gui"
34
34
  Requires-Dist: PySide6-Essentials!=6.12.0,>=6.7; python_version < "3.12" and extra == "gui"
35
35
  Requires-Dist: PySide6-Essentials>=6.7; python_version >= "3.12" and extra == "gui"
36
- Requires-Dist: endstation[qt]>=0.4.0; extra == "gui"
36
+ Requires-Dist: endstation[qt]>=0.5.1; extra == "gui"
37
37
  Provides-Extra: metrology
38
38
  Requires-Dist: matplotlib>=3.9; extra == "metrology"
39
39
  Provides-Extra: refractiveindex
@@ -54,7 +54,7 @@ dependencies = [
54
54
  # `dependencies = []` and has a test that fails if that stops being true,
55
55
  # so this line adds no transitive weight -- the Qt and matplotlib parts sit
56
56
  # behind its own extras, which our `gui` extra asks for by name.
57
- "endstation>=0.4.0",
57
+ "endstation>=0.5.1",
58
58
  # The rigorous solvers cap BLAS threads for the length of a solve
59
59
  # (solvers/_execution.py): OpenBLAS's thread-per-core default made RCWA
60
60
  # up to 135x slower on a busy machine, measured in benchmarks/
@@ -101,7 +101,7 @@ gui = [
101
101
  "matplotlib>=3.8",
102
102
  "PySide6-Essentials>=6.7,!=6.12.0; python_version < '3.12'",
103
103
  "PySide6-Essentials>=6.7; python_version >= '3.12'",
104
- "endstation[qt]>=0.4.0",
104
+ "endstation[qt]>=0.5.1",
105
105
  ]
106
106
  # Groove metrology: reading AFM scans and averaging them into a boundary
107
107
  # profile. An extra for the same reason the GUI is one -- `pip install
@@ -22,7 +22,7 @@ from .measured import MeasuredEfficiency, MeasurementProvenance
22
22
  from .resolution import ResolvingPower, resolving_power
23
23
  from .result import EfficiencyScan, OrderEfficiency, Provenance
24
24
 
25
- __version__ = "0.3.10"
25
+ __version__ = "0.3.11"
26
26
 
27
27
  #: The day this version was released, ISO 8601. It sits beside the version
28
28
  #: rather than being read from CHANGELOG.md at run time because the changelog
@@ -220,6 +220,42 @@ def general_pages() -> tuple[TheoryPage, ...]:
220
220
  )
221
221
 
222
222
 
223
+ def help_groups() -> tuple[tuple[tuple[str, TheoryPage], ...], ...]:
224
+ """The efficiency window's Help pages, as ``(label, page)`` groups.
225
+
226
+ The solver-independent reference first (the generalized grating equation
227
+ and the angle conventions), then one page per method. A page that has not
228
+ been written yet still appears, and says so.
229
+ """
230
+
231
+ def missing(page: TheoryPage) -> str:
232
+ return "" if page.available else " (not written yet)"
233
+
234
+ return (
235
+ tuple((page.title + missing(page), page) for page in general_pages()),
236
+ tuple((page.title + " Theory" + missing(page), page) for page in theory_pages()),
237
+ )
238
+
239
+
240
+ def wiki_help_groups() -> tuple[tuple[tuple[str, TheoryPage], ...], ...]:
241
+ """The metrology window's wiki pages, as one Help group.
242
+
243
+ The same pages the window's Wiki tab shows, in its order, as pages the
244
+ theory viewer can open. They describe a measurement rather than a solver,
245
+ so none carries the approximate-method banner, and they link to nothing,
246
+ so they need no file behind them.
247
+ """
248
+ from ..metrology.wiki import pages
249
+
250
+ return (
251
+ tuple(
252
+ (page.title, TheoryPage(name=page.slug, title=page.title, available=True,
253
+ path=None, text=page.markdown, rigorous=True))
254
+ for page in pages()
255
+ ),
256
+ )
257
+
258
+
223
259
  def resolve_link(
224
260
  page: TheoryPage, href: str, pages: tuple[TheoryPage, ...] | None = None
225
261
  ) -> TheoryPage | str | None:
@@ -41,6 +41,14 @@ class Mode:
41
41
  so this module stays free of Qt and of the cost of importing either
42
42
  window. ``script`` is the console script that opens the same window
43
43
  directly, which the chooser shows so that a reader learns the shortcut.
44
+
45
+ ``summary`` is the clause the chooser's opening sentence uses for this
46
+ window, lower case and without a full stop; the sentence joins every
47
+ window's, so a new one joins it too, and one without a summary is left
48
+ out of it. ``help`` names, as
49
+ ``"module:function"``, the function returning this window's Help pages:
50
+ groups of ``(label, page)`` pairs, which the Help menu shows as one
51
+ submenu titled ``title``. Empty means the window has no pages yet.
44
52
  """
45
53
 
46
54
  key: str
@@ -48,10 +56,22 @@ class Mode:
48
56
  blurb: str
49
57
  window: str
50
58
  script: str
59
+ summary: str = ""
60
+ help: str = ""
61
+
62
+ def help_groups(self) -> tuple:
63
+ """This window's Help pages, imported only when asked for."""
64
+ if not self.help:
65
+ return ()
66
+ from importlib import import_module
67
+
68
+ module_name, _, attribute = self.help.partition(":")
69
+ return tuple(getattr(import_module(module_name), attribute)())
51
70
 
52
71
 
53
72
  #: The metrology window comes first because it is the half in regular use.
54
- #: Adding a third window is one entry here and nothing else.
73
+ #: Adding a third window is one entry here and nothing else: the chooser's
74
+ #: card and sentence, the Go menu and the Help submenu are all built from it.
55
75
  MODES = (
56
76
  Mode(
57
77
  key="metrology",
@@ -61,6 +81,8 @@ MODES = (
61
81
  "profile to export.",
62
82
  window="gratinglab.metrology.gui.qt.main_window:MainWindow",
63
83
  script="gratinglab-metrology-gui",
84
+ summary="measure a grating's grooves from an AFM scan",
85
+ help="gratinglab.gui.docs:wiki_help_groups",
64
86
  ),
65
87
  Mode(
66
88
  key="efficiency",
@@ -70,6 +92,8 @@ MODES = (
70
92
  "results.",
71
93
  window="gratinglab.gui.qt.main_window:MainWindow",
72
94
  script="gratinglab-gui",
95
+ summary="compute its diffraction efficiency",
96
+ help="gratinglab.gui.docs:help_groups",
73
97
  ),
74
98
  )
75
99
 
@@ -9,9 +9,12 @@ half itself. A user measuring a scan was the one user who could not read
9
9
  either.
10
10
 
11
11
  So the menu lives here and each window installs it, the same arrangement as
12
- the Go menu in :mod:`gratinglab.gui.qt.launcher`: neither window knows the
13
- other has it, and a page added to :mod:`gratinglab.gui.docs` appears in both
14
- at once.
12
+ the Go menu in :mod:`gratinglab.gui.qt.launcher`: no window knows the others
13
+ have it. After About, it holds one submenu per window in
14
+ :data:`gratinglab.gui.launcher.MODES`, titled as the chooser titles it and
15
+ filled from that window's ``help`` pages, so every window's pages are a
16
+ submenu away from every window, and a window added to ``MODES`` brings its
17
+ pages with it.
15
18
 
16
19
  ``menu_bar`` exists because the chooser is a plain ``QWidget`` and has no
17
20
  ``menuBar()`` of its own; it hands in the one it put in its layout. The
@@ -56,6 +59,15 @@ def show_theory(page, parent=None):
56
59
  return viewer
57
60
 
58
61
 
62
+ def _opener(page, window):
63
+ """A callback taking no arguments, so Qt passes no `checked` to it.
64
+
65
+ A lambda with a default argument would receive `checked` in that
66
+ argument's place, which is why the page is bound here instead.
67
+ """
68
+ return lambda: show_theory(page, window)
69
+
70
+
59
71
  def install_help_menu(window, menu_bar=None):
60
72
  """Add the Help menu to ``window`` and return it.
61
73
 
@@ -66,26 +78,30 @@ def install_help_menu(window, menu_bar=None):
66
78
  is also stored on the window, so a caller that forgets still cannot lose
67
79
  it.
68
80
  """
69
- from ..docs import general_pages, theory_pages
81
+ from ..launcher import MODES
70
82
  from ..richtext import menu_label
71
83
 
72
- def entry(page, suffix):
73
- return (menu_label(page.title, suffix), lambda: show_theory(page, window))
74
-
75
- def missing(page):
76
- return "" if page.available else " (not written yet)"
77
-
78
- # Foundational, solver-independent reference first -- the generalized
79
- # grating equation and the angle conventions -- then one page per method.
80
84
  menu = _install(
81
85
  window,
82
86
  about_title="About gratinglab",
83
87
  about_text=_about_text,
84
- pages=[
85
- [entry(page, missing(page)) for page in general_pages()],
86
- [entry(page, " Theory" + missing(page)) for page in theory_pages()],
87
- ],
88
88
  menu_bar=menu_bar,
89
89
  )
90
+ menu.addSeparator()
91
+ # Held on the window: under PySide6 a QMenu reached back through its
92
+ # parent is not reliably usable, so whatever builds one keeps it.
93
+ sections = {}
94
+ for mode in MODES:
95
+ groups = [list(group) for group in mode.help_groups() if group]
96
+ if not groups:
97
+ continue
98
+ section = menu.addMenu(menu_label(mode.title))
99
+ for index, group in enumerate(groups):
100
+ if index:
101
+ section.addSeparator()
102
+ for label, page in group:
103
+ section.addAction(menu_label(label), _opener(page, window))
104
+ sections[mode.key] = section
105
+ window._gratinglab_help_sections = sections
90
106
  window._gratinglab_help_menu = menu
91
107
  return menu
@@ -225,6 +225,14 @@ def show_chooser():
225
225
  return shown
226
226
 
227
227
 
228
+ def _either(items):
229
+ """``a``, ``a or b``, ``a, b, or c``: a list read as alternatives."""
230
+ items = list(items)
231
+ if len(items) < 3:
232
+ return " or ".join(items)
233
+ return ", ".join(items[:-1]) + ", or " + items[-1]
234
+
235
+
228
236
  class LauncherWindow(QWidget):
229
237
  """Two buttons and a sentence each, so neither half can be missed.
230
238
 
@@ -256,10 +264,9 @@ class LauncherWindow(QWidget):
256
264
  heading.setFont(font)
257
265
  layout.addWidget(heading)
258
266
 
259
- subtitle = QLabel(
260
- "Measure a grating's grooves from an AFM scan, or compute its "
261
- "diffraction efficiency."
262
- )
267
+ opening = _either([m.summary for m in MODES if m.summary])
268
+ # Only the first letter: str.capitalize() would lower "AFM" too.
269
+ subtitle = QLabel(opening[:1].upper() + opening[1:] + ".")
263
270
  subtitle.setWordWrap(True)
264
271
  subtitle.setStyleSheet("color: palette(mid);")
265
272
  layout.addWidget(subtitle)
@@ -271,9 +278,9 @@ class LauncherWindow(QWidget):
271
278
  layout.addStretch(1)
272
279
 
273
280
  hint = QLabel(
274
- "The <b>Go</b> menu in either window switches to the other window "
275
- "or back to this one. To open a window directly, run "
276
- + " or ".join(f"<code>{m.script}</code>" for m in MODES)
281
+ "The <b>Go</b> menu in each window switches to another window or "
282
+ "back to this one. To open a window directly, run "
283
+ + _either([f"<code>{m.script}</code>" for m in MODES])
277
284
  + "."
278
285
  )
279
286
  hint.setWordWrap(True)
@@ -25,10 +25,10 @@ slow solver to justify concurrent workers per tab.
25
25
 
26
26
  from __future__ import annotations
27
27
 
28
- import threading
28
+ from functools import partial
29
29
 
30
- from endstation.qt.tokens import StaleGuard
31
- from PySide6.QtCore import Qt, QThread, QTimer, Signal
30
+ from endstation.qt.jobs import JobRunner
31
+ from PySide6.QtCore import Qt, QTimer, Signal
32
32
  from PySide6.QtGui import QKeySequence
33
33
  from PySide6.QtWidgets import (
34
34
  QDockWidget,
@@ -38,6 +38,7 @@ from PySide6.QtWidgets import (
38
38
  QWidget,
39
39
  )
40
40
 
41
+ from ..failures import describe_failure
41
42
  from ..state import FieldError, FormErrors, build, validate
42
43
  from . import recent, theming
43
44
  from .cmethod_tab import CMethodTab
@@ -49,13 +50,13 @@ from .rcwa_tab import RcwaTab
49
50
  from .scalar_tab import ScalarTab
50
51
  from .setup_tab import SetupTab
51
52
  from .sizing import fit_width_to_contents
52
- from .worker import SolveWorker
53
+ from . import worker
53
54
 
54
55
  __all__ = ["MainWindow"]
55
56
 
56
57
  #: Stack for the solve thread, matching the platform's own main-thread default.
57
58
  #: Not a tuning knob: a rigorous solver factors dense matrices through LAPACK,
58
- #: and LAPACK expects the stack the main thread has. See `_start_worker`.
59
+ #: and LAPACK expects the stack the main thread has. See `__init__`.
59
60
  _WORKER_STACK_BYTES = 8 * 1024 * 1024
60
61
 
61
62
  #: A solve faster than this never shows a progress bar. The scalar solver takes
@@ -114,19 +115,6 @@ class MainWindow(QMainWindow):
114
115
  #: sleeping, which is what keeps the widget suite fast and deterministic.
115
116
  solved = Signal()
116
117
 
117
- #: How work reaches the worker. It must be a signal, not a method call:
118
- #: `moveToThread` only redirects *signal* delivery, so calling
119
- #: `worker.run(...)` directly would run the solve on the UI thread and
120
- #: freeze the window -- the exact thing this design exists to prevent.
121
- _requested = Signal(int, str, object, dict, object)
122
- #: The same payload, routed to the worker's sweep slot instead. A second
123
- #: signal rather than a mode flag: `moveToThread` dispatches per slot, and
124
- #: a flag would put the branch on the worker thread instead of here.
125
- _convergence_requested = Signal(int, str, object, dict, object)
126
- #: A comparison: token, geometry, the ticked solvers in run order, their
127
- #: options, the ones the window already refused, and the cancel event.
128
- _comparison_requested = Signal(int, object, object, dict, dict, object)
129
-
130
118
  def __init__(self, parent: QWidget | None = None) -> None:
131
119
  super().__init__(parent)
132
120
  self.setWindowTitle("gratinglab")
@@ -141,12 +129,18 @@ class MainWindow(QMainWindow):
141
129
  guard(self)
142
130
 
143
131
  self._parsed = None
144
- self._tokens = StaleGuard()
145
132
  self._running = False
146
133
  self._active_name: str | None = None
147
- # Replaced per solve rather than reused, so a Cancel clicked between
148
- # the request and the worker picking it up cannot be lost to a clear().
149
- self._cancel = threading.Event()
134
+ # One worker thread, shared by every tab, since only one solve is ever
135
+ # in flight in the window. Its stack is the main thread's: a QThread's
136
+ # default is far smaller, and LAPACK's dense complex solve overran it,
137
+ # so `np.linalg.solve` on a few-hundred-square matrix segfaulted the
138
+ # process and the integral tab returned nothing in the real window
139
+ # while every headless test passed. The runner drops a cancelled job's
140
+ # late result, and words a refusal as a refusal rather than a bug.
141
+ self._runner = JobRunner(
142
+ self, stack_size=_WORKER_STACK_BYTES, describe=describe_failure
143
+ )
150
144
 
151
145
  # Coalesces a burst of keystrokes into one redraw. Restartable and
152
146
  # single-shot, parented to the window so it dies with it -- a bare
@@ -162,7 +156,6 @@ class MainWindow(QMainWindow):
162
156
  self._build_layout()
163
157
  self._build_menu()
164
158
  recent.restore_layout(self, "efficiency")
165
- self._start_worker()
166
159
  # Geometry first: it needs no solver, so it can be right before any
167
160
  # result exists rather than showing an empty panel until one does.
168
161
  self._refresh_geometry_tab()
@@ -350,32 +343,6 @@ class MainWindow(QMainWindow):
350
343
  """Switch theme by key, or ``"system"``; the menu calls this."""
351
344
  self._themes.set_choice(choice)
352
345
 
353
- def _start_worker(self) -> None:
354
- self._thread = QThread(self)
355
- # A QThread starts with a much smaller stack than the main thread's,
356
- # and LAPACK's dense complex solve overruns it: `np.linalg.solve` on a
357
- # few-hundred-square matrix segfaults the *process* here while running
358
- # fine on the main thread and on a plain `threading.Thread`. That made
359
- # the integral tab unusable in the real window -- both boundary
360
- # conditions -- while every headless test passed, because nothing but
361
- # the GUI ran a solve off the main thread. The scalar solver never
362
- # tripped it: it factors nothing.
363
- self._thread.setStackSize(_WORKER_STACK_BYTES)
364
- self._worker = SolveWorker()
365
- self._worker.moveToThread(self._thread)
366
- # Cross-thread, so both directions are queued automatically: requests
367
- # arrive on the worker's thread, results back on this one.
368
- self._requested.connect(self._worker.run)
369
- self._worker.finished.connect(self._on_solved)
370
- self._worker.failed.connect(self._on_failed)
371
- self._worker.cancelled.connect(self._on_cancelled)
372
- self._worker.progress.connect(self._on_progress)
373
- self._worker.converged.connect(self._on_converged)
374
- self._convergence_requested.connect(self._worker.run_convergence)
375
- self._comparison_requested.connect(self._worker.run_comparison)
376
- self._worker.compared.connect(self._on_compared)
377
- self._thread.start()
378
-
379
346
  # -- actions ---------------------------------------------------------
380
347
 
381
348
  def open_boundary(self, path) -> None:
@@ -441,10 +408,10 @@ class MainWindow(QMainWindow):
441
408
  it contained.
442
409
 
443
410
  ``sweep`` runs the convergence harness instead of a single solve. It
444
- shares all of the machinery below (one token, one cancel event, and
445
- the rule that only one solve runs in the window at a time), because a
446
- sweep is the same kind of operation, only longer. Only the destination
447
- slot differs.
411
+ shares all of the machinery below (the one runner, Cancel, and the
412
+ rule that only one solve runs in the window at a time), because a
413
+ sweep is the same kind of operation, only longer. Only the function
414
+ the runner calls differs.
448
415
  """
449
416
  if self._running:
450
417
  return
@@ -462,8 +429,6 @@ class MainWindow(QMainWindow):
462
429
 
463
430
  self._active_name = name
464
431
  self._parsed = geometry
465
- token = self._tokens.issue()
466
- self._cancel = threading.Event()
467
432
  self._set_running(True)
468
433
  tab.show_solving(len(geometry.wavelengths))
469
434
  # `tab` as the context object, not a bare singleShot: Qt then cancels
@@ -475,8 +440,12 @@ class MainWindow(QMainWindow):
475
440
  QTimer.singleShot(
476
441
  _PROGRESS_DELAY_MS, tab, lambda: self._show_progress_if_still_running(tab)
477
442
  )
478
- signal = self._convergence_requested if sweep else self._requested
479
- signal.emit(token, name, geometry, options, self._cancel)
443
+ if sweep:
444
+ self._start(worker.converge, name, geometry, options,
445
+ on_done=partial(self._on_converged, name))
446
+ else:
447
+ self._start(worker.solve, name, geometry, options,
448
+ on_done=partial(self._on_solved, name))
480
449
 
481
450
  def compare(self) -> None:
482
451
  """Solve the geometry with every solver ticked on the Compare tab.
@@ -488,10 +457,10 @@ class MainWindow(QMainWindow):
488
457
  refusals with the reason, its tab shows the error on the field, and
489
458
  the others still run. A refusal only the solver itself can detect
490
459
  (the C-method on a vertical facet) is caught the same way on the
491
- worker; see `SolveWorker.run_comparison`.
460
+ worker; see `worker.compare`.
492
461
 
493
- It is one operation to the rest of the window: one token, one cancel
494
- event, every Solve button disabled until it ends.
462
+ It is one operation to the rest of the window: one job, one Cancel,
463
+ every Solve button disabled until it ends.
495
464
  """
496
465
  if self._running:
497
466
  return
@@ -523,20 +492,30 @@ class MainWindow(QMainWindow):
523
492
 
524
493
  self._active_name = tab.name
525
494
  self._parsed = geometry
526
- token = self._tokens.issue()
527
- self._cancel = threading.Event()
528
495
  self._set_running(True)
529
496
  tab.show_solving(tuple(options), len(geometry.wavelengths))
530
497
  QTimer.singleShot(
531
498
  _PROGRESS_DELAY_MS, tab, lambda: self._show_progress_if_still_running(tab)
532
499
  )
533
- self._comparison_requested.emit(
534
- token, geometry, names, options, refused, self._cancel
500
+ self._start(worker.compare, geometry, names, options, refused,
501
+ on_done=self._on_compared)
502
+
503
+ def _start(self, fn, *args, on_done) -> None:
504
+ """Hand one piece of work to the runner, with the window's handlers.
505
+
506
+ A failure is reported against the tab that asked, which is the
507
+ active one. A solve started straight after a Cancel queues behind the
508
+ cancelled one while it unwinds.
509
+ """
510
+ self._runner.start(
511
+ fn, *args,
512
+ on_done=on_done,
513
+ on_fail=partial(self._on_failed, self._active_name),
514
+ on_progress=self._on_progress,
515
+ on_cancel=self._on_cancelled,
535
516
  )
536
517
 
537
- def _on_compared(self, token: int, outcome) -> None:
538
- if self._tokens.is_stale(token):
539
- return
518
+ def _on_compared(self, outcome) -> None:
540
519
  self._set_running(False)
541
520
  self.geometry_tab.show_geometry(self._parsed)
542
521
  self.compare_tab.show_outcome(outcome)
@@ -551,29 +530,22 @@ class MainWindow(QMainWindow):
551
530
  def cancel(self) -> None:
552
531
  """Stop the running solve.
553
532
 
554
- Setting the event stops it: the solver checks the event at every
555
- wavelength and raises out of its own loop (see `worker.py`).
556
-
557
- Incrementing the token as well is not redundant. The worker may
558
- already have finished when Cancel is clicked, in which case a result
559
- is already in flight and the event will never be read; the token
560
- marks that result as stale when it arrives. The two mechanisms handle
561
- two different situations.
533
+ The runner's progress callback raises at the solver's next
534
+ wavelength, so the work itself stops (see `worker.py`). A result that
535
+ was already on its way when Cancel landed is dropped by the runner
536
+ rather than drawn.
562
537
 
563
538
  There is only ever one thing that could be running, so it does not
564
539
  matter which tab's Cancel button was clicked.
565
540
  """
566
541
  if not self._running:
567
542
  return
568
- self._cancel.set()
569
- self._tokens.invalidate()
543
+ self._runner.cancel()
570
544
  self._set_running(False)
571
545
  if self._active_name is not None:
572
546
  self._tab_for(self._active_name).show_cancelled()
573
547
 
574
- def _on_solved(self, token: int, method: str, result) -> None:
575
- if self._tokens.is_stale(token):
576
- return # cancelled or superseded; the window has moved on
548
+ def _on_solved(self, method: str, result) -> None:
577
549
  self._set_running(False)
578
550
  # No `profile_panel.draw` here any more: the groove's shape owes
579
551
  # nothing to a solver, so redrawing it on solve completion was a false
@@ -584,30 +556,28 @@ class MainWindow(QMainWindow):
584
556
  )
585
557
  self.solved.emit()
586
558
 
587
- def _on_progress(self, token: int, done: int, total: int) -> None:
559
+ def _on_progress(self, done: int, total: int) -> None:
588
560
  """Advance the originating tab's bar, and nobody else's.
589
561
 
590
- A stale token means that a cancelled solve is still reporting while it
591
- leaves its own loop. This lasts a few wavelengths at most, but it would
592
- be enough to move a bar backwards over a result the window has already
593
- replaced.
562
+ A cancelled solve's last reports, from the wavelength it was in, never
563
+ arrive here: the runner drops them, so they cannot walk the bar over a
564
+ result the window has moved on from.
594
565
  """
595
- if self._tokens.is_stale(token) or self._active_name is None:
566
+ if self._active_name is None:
596
567
  return
597
568
  self._tab_for(self._active_name).show_progress_value(done, total)
598
569
 
599
- def _on_cancelled(self, token: int, method: str) -> None:
570
+ def _on_cancelled(self) -> None:
600
571
  """Acknowledge that the solve has stopped.
601
572
 
602
573
  There is nothing to show: `cancel()` has already updated the panel and
603
574
  re-enabled the buttons, and the previous result is still on screen.
604
- This slot exists so that the worker can report somewhere other than
605
- `failed`, since a stop that the user requested is not an error.
575
+ This handler exists so that a cancelled job reports somewhere other
576
+ than `on_fail`, since a stop that the user requested is not an error.
606
577
  """
607
578
 
608
- def _on_converged(self, token: int, method: str, result, report) -> None:
609
- if self._tokens.is_stale(token):
610
- return
579
+ def _on_converged(self, method: str, outcome) -> None:
580
+ result, report = outcome
611
581
  self._set_running(False)
612
582
  self.geometry_tab.show_geometry(self._parsed)
613
583
  self.tabs[method].show_convergence(
@@ -615,9 +585,7 @@ class MainWindow(QMainWindow):
615
585
  )
616
586
  self.solved.emit()
617
587
 
618
- def _on_failed(self, token: int, method: str, message: str) -> None:
619
- if self._tokens.is_stale(token):
620
- return
588
+ def _on_failed(self, method: str, message: str) -> None:
621
589
  self._set_running(False)
622
590
  self._tab_for(method).show_error(message)
623
591
 
@@ -657,14 +625,14 @@ class MainWindow(QMainWindow):
657
625
  # -- shutdown --------------------------------------------------------
658
626
 
659
627
  def closeEvent(self, event) -> None: # noqa: N802 - Qt's spelling
660
- """Join the worker thread.
628
+ """Stop the solve in flight and wait for the worker to finish.
661
629
 
662
- Without this Qt reports "QThread: Destroyed while thread is still
663
- running" and aborts intermittently, most visibly in the offscreen CI
664
- runs, where windows are created and destroyed in quick succession.
630
+ A solve still running when the window goes would deliver into widgets
631
+ that no longer exist, most visibly in the offscreen CI runs, where
632
+ windows are created and destroyed in quick succession.
665
633
  """
666
634
  recent.save_layout(self, "efficiency")
667
635
  self._redraw_timer.stop() # a redraw firing into a closing window
668
- self._thread.quit()
669
- self._thread.wait(5000)
636
+ self._runner.cancel()
637
+ self._runner.wait(5000)
670
638
  super().closeEvent(event)