gratinglab 0.3.9__tar.gz → 0.3.10__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 (231) hide show
  1. {gratinglab-0.3.9/src/gratinglab.egg-info → gratinglab-0.3.10}/PKG-INFO +3 -3
  2. {gratinglab-0.3.9 → gratinglab-0.3.10}/pyproject.toml +2 -2
  3. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/__init__.py +2 -2
  4. gratinglab-0.3.10/src/gratinglab/gui/qt/theory_viewer.py +93 -0
  5. gratinglab-0.3.10/src/gratinglab/gui/richtext.py +64 -0
  6. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/qt/wiki_view.py +41 -19
  7. {gratinglab-0.3.9 → gratinglab-0.3.10/src/gratinglab.egg-info}/PKG-INFO +3 -3
  8. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab.egg-info/SOURCES.txt +0 -1
  9. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab.egg-info/requires.txt +2 -2
  10. gratinglab-0.3.10/tests/test_gui_mathtext.py +40 -0
  11. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_qt.py +2 -1
  12. gratinglab-0.3.10/tests/test_gui_richtext.py +146 -0
  13. gratinglab-0.3.9/src/gratinglab/gui/mathtext.py +0 -292
  14. gratinglab-0.3.9/src/gratinglab/gui/qt/theory_viewer.py +0 -225
  15. gratinglab-0.3.9/src/gratinglab/gui/richtext.py +0 -518
  16. gratinglab-0.3.9/tests/test_gui_mathtext.py +0 -216
  17. gratinglab-0.3.9/tests/test_gui_richtext.py +0 -474
  18. {gratinglab-0.3.9 → gratinglab-0.3.10}/LICENSE +0 -0
  19. {gratinglab-0.3.9 → gratinglab-0.3.10}/MANIFEST.in +0 -0
  20. {gratinglab-0.3.9 → gratinglab-0.3.10}/README.md +0 -0
  21. {gratinglab-0.3.9 → gratinglab-0.3.10}/docs/conventions.md +0 -0
  22. {gratinglab-0.3.9 → gratinglab-0.3.10}/docs/theory/cmethod.md +0 -0
  23. {gratinglab-0.3.9 → gratinglab-0.3.10}/docs/theory/integral.md +0 -0
  24. {gratinglab-0.3.9 → gratinglab-0.3.10}/docs/theory/metrology.md +0 -0
  25. {gratinglab-0.3.9 → gratinglab-0.3.10}/docs/theory/rcwa.md +0 -0
  26. {gratinglab-0.3.9 → gratinglab-0.3.10}/docs/theory/scalar.md +0 -0
  27. {gratinglab-0.3.9 → gratinglab-0.3.10}/setup.cfg +0 -0
  28. {gratinglab-0.3.9 → gratinglab-0.3.10}/setup.py +0 -0
  29. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/checks.py +0 -0
  30. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/compare.py +0 -0
  31. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/convergence.py +0 -0
  32. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/geometry.py +0 -0
  33. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/__init__.py +0 -0
  34. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/app.py +0 -0
  35. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/cmethod_options.py +0 -0
  36. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/comparison.py +0 -0
  37. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/diagram.py +0 -0
  38. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/diagram3d.py +0 -0
  39. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/docs.py +0 -0
  40. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/efficiency_plot.py +0 -0
  41. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/failures.py +0 -0
  42. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/icon.py +0 -0
  43. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/integral_options.py +0 -0
  44. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/launcher.py +0 -0
  45. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/orders.py +0 -0
  46. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/provenance.py +0 -0
  47. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/__init__.py +0 -0
  48. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/cmethod_tab.py +0 -0
  49. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/compare_tab.py +0 -0
  50. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/geometry_panel.py +0 -0
  51. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/geometry_tab.py +0 -0
  52. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/help_menu.py +0 -0
  53. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/integral_tab.py +0 -0
  54. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/launcher.py +0 -0
  55. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/main_window.py +0 -0
  56. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/profile_plot_panel.py +0 -0
  57. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/provenance_panel.py +0 -0
  58. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/rcwa_tab.py +0 -0
  59. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/recent.py +0 -0
  60. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/scalar_tab.py +0 -0
  61. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/scene3d_panel.py +0 -0
  62. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/setup_tab.py +0 -0
  63. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/sizing.py +0 -0
  64. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/theming.py +0 -0
  65. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/qt/worker.py +0 -0
  66. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/rcwa_options.py +0 -0
  67. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/scalar_options.py +0 -0
  68. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/state.py +0 -0
  69. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/gui/theme.py +0 -0
  70. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/illumination.py +0 -0
  71. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/io/__init__.py +0 -0
  72. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/io/boundary.py +0 -0
  73. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/io/efficiency_table.py +0 -0
  74. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/io/ggp.py +0 -0
  75. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/io/txl.py +0 -0
  76. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/materials/__init__.py +0 -0
  77. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/materials/data/SOURCES.md +0 -0
  78. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/materials/fresnel.py +0 -0
  79. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/materials/optical.py +0 -0
  80. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/materials/refractiveindex.py +0 -0
  81. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/materials/typical.py +0 -0
  82. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/measured.py +0 -0
  83. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/__init__.py +0 -0
  84. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/_analyzer_summary.py +0 -0
  85. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/analyzer.py +0 -0
  86. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/boundary/__init__.py +0 -0
  87. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/boundary/average.py +0 -0
  88. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/boundary/cross_section.py +0 -0
  89. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/boundary/pipeline.py +0 -0
  90. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/boundary/swaths.py +0 -0
  91. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/cli.py +0 -0
  92. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/config.py +0 -0
  93. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/core/__init__.py +0 -0
  94. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/core/analysis.py +0 -0
  95. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/core/image_flatten.py +0 -0
  96. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/core/orientation.py +0 -0
  97. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/core/processing.py +0 -0
  98. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/core/region_mask.py +0 -0
  99. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/core/scars.py +0 -0
  100. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/core/tip.py +0 -0
  101. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/data/__init__.py +0 -0
  102. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/data/aggregation.py +0 -0
  103. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/__init__.py +0 -0
  104. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/icon.py +0 -0
  105. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/qt/__init__.py +0 -0
  106. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/qt/app.py +0 -0
  107. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/qt/boundary_view.py +0 -0
  108. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/qt/canvas.py +0 -0
  109. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/qt/efficiency_dialog.py +0 -0
  110. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/qt/import_view.py +0 -0
  111. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/qt/layout.py +0 -0
  112. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/qt/main_window.py +0 -0
  113. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/qt/swath_dialog.py +0 -0
  114. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/qt/worker.py +0 -0
  115. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/gui/state.py +0 -0
  116. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/io/__init__.py +0 -0
  117. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/io/file_io.py +0 -0
  118. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/io/ibw.py +0 -0
  119. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/io/metrics.py +0 -0
  120. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/io/sem.py +0 -0
  121. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/io/spm.py +0 -0
  122. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/settings.py +0 -0
  123. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/stats/__init__.py +0 -0
  124. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/stats/analysis.py +0 -0
  125. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/stats/icc.py +0 -0
  126. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/visualization/__init__.py +0 -0
  127. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/visualization/diagnostics.py +0 -0
  128. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/visualization/profiles.py +0 -0
  129. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/visualization/statistics.py +0 -0
  130. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/wiki/__init__.py +0 -0
  131. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/wiki/facet-fitting.md +0 -0
  132. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/wiki/file-formats.md +0 -0
  133. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/wiki/flattening.md +0 -0
  134. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/wiki/groove-orientation.md +0 -0
  135. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/wiki/icc-correction.md +0 -0
  136. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/wiki/overview.md +0 -0
  137. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/wiki/reading-outputs.md +0 -0
  138. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/wiki/row-groups.md +0 -0
  139. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/wiki/scars-and-masking.md +0 -0
  140. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/wiki/swath-statistics.md +0 -0
  141. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/wiki/tip-correction.md +0 -0
  142. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/metrology/workflows.py +0 -0
  143. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/problem.py +0 -0
  144. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/profiles/__init__.py +0 -0
  145. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/profiles/_base.py +0 -0
  146. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/profiles/_polyline.py +0 -0
  147. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/profiles/_shapes.py +0 -0
  148. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/profiles/_trapezoid.py +0 -0
  149. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/profiles/_types.py +0 -0
  150. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/resolution.py +0 -0
  151. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/result.py +0 -0
  152. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/__init__.py +0 -0
  153. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/_conditioning.py +0 -0
  154. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/_execution.py +0 -0
  155. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/_scalar_groove.py +0 -0
  156. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/base.py +0 -0
  157. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/cmethod/__init__.py +0 -0
  158. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/cmethod/_core.py +0 -0
  159. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/cmethod/_series.py +0 -0
  160. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/integral/__init__.py +0 -0
  161. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/integral/_boundary.py +0 -0
  162. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/integral/_core.py +0 -0
  163. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/integral/_finite.py +0 -0
  164. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/integral/_greens.py +0 -0
  165. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/integral/_kernels.py +0 -0
  166. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/integral/_nystrom.py +0 -0
  167. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/rcwa/__init__.py +0 -0
  168. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/rcwa/_core.py +0 -0
  169. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/rcwa/_stack.py +0 -0
  170. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab/solvers/scalar.py +0 -0
  171. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab.egg-info/dependency_links.txt +0 -0
  172. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab.egg-info/entry_points.txt +0 -0
  173. {gratinglab-0.3.9 → gratinglab-0.3.10}/src/gratinglab.egg-info/top_level.txt +0 -0
  174. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_changelog.py +0 -0
  175. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_checks.py +0 -0
  176. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_cmethod.py +0 -0
  177. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_compare.py +0 -0
  178. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_conditioning.py +0 -0
  179. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_convergence.py +0 -0
  180. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_cross_method.py +0 -0
  181. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_efficiency_table.py +0 -0
  182. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_four_way.py +0 -0
  183. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_fresnel.py +0 -0
  184. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_geometry.py +0 -0
  185. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_ggp.py +0 -0
  186. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_cmethod_options.py +0 -0
  187. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_cmethod_tab.py +0 -0
  188. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_compare_tab.py +0 -0
  189. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_diagram.py +0 -0
  190. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_diagram3d.py +0 -0
  191. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_docs.py +0 -0
  192. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_help_menu.py +0 -0
  193. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_integral_options.py +0 -0
  194. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_launcher.py +0 -0
  195. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_orders.py +0 -0
  196. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_polish.py +0 -0
  197. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_provenance.py +0 -0
  198. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_provenance_panel.py +0 -0
  199. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_rcwa_options.py +0 -0
  200. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_scalar_options.py +0 -0
  201. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_state.py +0 -0
  202. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_gui_theme.py +0 -0
  203. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_illumination.py +0 -0
  204. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_integral_core.py +0 -0
  205. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_integral_corpus.py +0 -0
  206. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_integral_finite.py +0 -0
  207. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_integral_graded.py +0 -0
  208. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_integral_greens.py +0 -0
  209. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_integral_kernels.py +0 -0
  210. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_integral_measured_polygon.py +0 -0
  211. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_integral_operators.py +0 -0
  212. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_integral_solver.py +0 -0
  213. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_io_boundary.py +0 -0
  214. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_littrow.py +0 -0
  215. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_materials.py +0 -0
  216. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_measured.py +0 -0
  217. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_perturbation.py +0 -0
  218. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_profiles.py +0 -0
  219. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_rayleigh_anomaly.py +0 -0
  220. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_rcwa.py +0 -0
  221. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_rcwa_benchmarks.py +0 -0
  222. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_refractiveindex.py +0 -0
  223. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_resolution.py +0 -0
  224. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_result.py +0 -0
  225. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_scalar.py +0 -0
  226. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_solver_conformance.py +0 -0
  227. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_solver_execution.py +0 -0
  228. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_solver_progress.py +0 -0
  229. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_trapezoidal_solvers.py +0 -0
  230. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_txl.py +0 -0
  231. {gratinglab-0.3.9 → gratinglab-0.3.10}/tests/test_typical.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gratinglab
3
- Version: 0.3.9
3
+ Version: 0.3.10
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.3.0
24
+ Requires-Dist: endstation>=0.4.0
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.3.0; extra == "gui"
36
+ Requires-Dist: endstation[qt]>=0.4.0; 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.3.0",
57
+ "endstation>=0.4.0",
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.3.0",
104
+ "endstation[qt]>=0.4.0",
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.9"
25
+ __version__ = "0.3.10"
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
@@ -32,7 +32,7 @@ __version__ = "0.3.9"
32
32
  #: the `## <version>` heading, so the release commit that forgets to move it
33
33
  #: fails at the point where it is cheapest to fix, the same arrangement as
34
34
  #: the version's own section.
35
- __version_date__ = "2026-11-13"
35
+ __version_date__ = "2026-11-14"
36
36
 
37
37
  __all__ = [
38
38
  "Illumination",
@@ -0,0 +1,93 @@
1
+ """The read-only window for one theory or reference page.
2
+
3
+ The pane and the rendering are endstation's (:mod:`endstation.qt.reading`):
4
+ a ``QTextBrowser`` laid out for reading, with the page's equations sized to
5
+ its font. This module adds what is gratinglab's: the approximate-method banner
6
+ (:func:`gratinglab.gui.richtext.banner`), links between Help pages opening in
7
+ windows of their own, and a re-render when the theme changes.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ from endstation.qt.reading import ReadingBrowser, text_color
13
+ from endstation.qt.reading import render_into as _render_into
14
+ from PySide6.QtCore import Qt, QUrl
15
+ from PySide6.QtGui import QDesktopServices
16
+ from PySide6.QtWidgets import QTextBrowser, QVBoxLayout, QWidget
17
+
18
+ from .. import richtext
19
+ from ..docs import resolve_link
20
+
21
+ __all__ = ["ReadingBrowser", "TheoryViewer", "render_into"]
22
+
23
+
24
+ def render_into(
25
+ browser: QTextBrowser, page, *, device_pixel_ratio: float, text_color: str
26
+ ) -> None:
27
+ """Render a page into a browser, banner and images included.
28
+
29
+ Shared by :class:`TheoryViewer` and :class:`~.setup_tab.SetupTab`.
30
+ """
31
+ _render_into(
32
+ browser,
33
+ page.text,
34
+ device_pixel_ratio=device_pixel_ratio,
35
+ text_color=text_color,
36
+ before=richtext.banner(page),
37
+ )
38
+
39
+
40
+ class TheoryViewer(QWidget):
41
+ """One page, typeset."""
42
+
43
+ def __init__(self, page, parent: QWidget | None = None) -> None:
44
+ # A window in its own right rather than a modal dialog: reading the
45
+ # theory while adjusting the grating is the point.
46
+ super().__init__(parent)
47
+ self.setWindowFlag(Qt.WindowType.Window)
48
+ self.setWindowTitle(page.title)
49
+ self.resize(860, 720)
50
+
51
+ self._browser = ReadingBrowser()
52
+ self._browser.setOpenExternalLinks(False)
53
+ # QTextBrowser would load a relative link as a file in this window and
54
+ # show raw markdown, so links are followed here instead.
55
+ self._browser.setOpenLinks(False)
56
+ self._browser.anchorClicked.connect(self._follow)
57
+ #: The last page a link opened, held so its window is not collected.
58
+ self.opened: TheoryViewer | None = None
59
+
60
+ layout = QVBoxLayout(self)
61
+ layout.setContentsMargins(0, 0, 0, 0)
62
+ layout.addWidget(self._browser)
63
+
64
+ self.set_page(page)
65
+ from . import theming
66
+
67
+ # Equations are images rasterised in the text colour, so a theme
68
+ # change re-renders the page rather than only repainting it.
69
+ theming.subscribe(self._on_theme)
70
+
71
+ def _follow(self, url: QUrl) -> None:
72
+ """Open a linked Help page in a window of its own, beside this one,
73
+ the way the Help menu opens them; anything else goes to the browser."""
74
+ target = resolve_link(self._page, url.toString())
75
+ if isinstance(target, str):
76
+ QDesktopServices.openUrl(QUrl(target))
77
+ elif target is not None:
78
+ self.opened = TheoryViewer(target, parent=self.parentWidget())
79
+ self.opened.show()
80
+
81
+ def _on_theme(self, _theme) -> None:
82
+ # A bound method so Qt disconnects it with the window (see SetupTab).
83
+ self.set_page(self._page)
84
+
85
+ def set_page(self, page) -> None:
86
+ """Render a page into the browser, images and all."""
87
+ self._page = page
88
+ render_into(
89
+ self._browser,
90
+ page,
91
+ device_pixel_ratio=self.devicePixelRatioF(),
92
+ text_color=text_color(self),
93
+ )
@@ -0,0 +1,64 @@
1
+ """What gratinglab adds to endstation's rendering of a Help page.
2
+
3
+ The markdown and the equations are rendered by :mod:`endstation.docs.markdown`,
4
+ which began as this module. Two things stay here because they are about
5
+ gratinglab's pages rather than markdown: the banner above the page of a
6
+ solver that approximates, and the escaping a page title needs to become a
7
+ menu entry.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ from typing import TYPE_CHECKING
13
+
14
+ from endstation.docs.markdown import RichPage, render_markdown
15
+
16
+ if TYPE_CHECKING: # pragma: no cover - imports for type checkers only
17
+ from .docs import TheoryPage
18
+
19
+ __all__ = ["BANNER_COLOR", "banner", "menu_label", "to_html"]
20
+
21
+ #: Colour of the approximate-method banner. The same as endstation's colour
22
+ #: for an equation that failed to render, and kept as its own constant: the
23
+ #: two facts are unrelated, and a test that cannot tell them apart could one
24
+ #: day pass for the wrong reason.
25
+ BANNER_COLOR = "#a5370d"
26
+
27
+
28
+ def banner(page: "TheoryPage") -> str:
29
+ """The HTML placed above the page, empty for a rigorous solver.
30
+
31
+ A solver whose ``Capabilities.rigorous`` is False says so at the top, so a
32
+ reader learns about the approximation before section 7 rather than in it.
33
+ """
34
+ if page.rigorous:
35
+ return ""
36
+ return (
37
+ f'<p style="color:{BANNER_COLOR}"><b>'
38
+ "⚠ Approximate method: see Limits below."
39
+ "</b></p>"
40
+ )
41
+
42
+
43
+ def to_html(page: "TheoryPage", **kwargs) -> RichPage:
44
+ """A page rendered by :func:`endstation.docs.markdown.render_markdown`,
45
+ banner included. ``kwargs`` go to ``render_markdown``."""
46
+ rendered = render_markdown(page.text, **kwargs)
47
+ notice = banner(page)
48
+ if not notice:
49
+ return rendered
50
+ return RichPage(
51
+ html=notice + "\n" + rendered.html,
52
+ images=rendered.images,
53
+ unrendered=rendered.unrendered,
54
+ )
55
+
56
+
57
+ def menu_label(title: str, suffix: str = "") -> str:
58
+ """A menu entry's text, with Qt's mnemonic character neutralised.
59
+
60
+ Qt reads ``&`` in an action's text as "underline the next character", so
61
+ the page titled "Grating Geometry & Conventions" would appear as "Grating
62
+ Geometry Conventions" with a stray underline. Doubling it escapes it.
63
+ """
64
+ return (title + suffix).replace("&", "&&")
@@ -6,25 +6,32 @@ ordering, and this module only displays what it is given, so the pages stay
6
6
  testable without a window and a command-line ``--explain`` could print the
7
7
  same text.
8
8
 
9
- Markdown is rendered by Qt itself (`QTextBrowser.setMarkdown`), which handles
10
- headings, tables, lists, code spans and emphasis, covering everything these
11
- pages use. gratinglab carries a LaTeX rasteriser for its theory pages because
12
- diffraction algebra needs typesetting; the formulas here are one-liners and
13
- read well as text, so that machinery would not justify the ~670 lines it would
14
- add here.
9
+ A page is shown in endstation's reading pane (`endstation.qt.reading`), the
10
+ same pane and renderer as the Help menu's theory pages, so the two read alike:
11
+ a reading font, a column of readable width, and tables with room around them.
15
12
  """
16
13
  from __future__ import annotations
17
14
 
18
15
  from . import * # noqa: F401,F403 - sets QT_API before matplotlib's shim loads
19
16
 
20
- from PySide6.QtWidgets import (
21
- QHBoxLayout, QListWidget, QListWidgetItem, QTextBrowser, QWidget,
22
- )
17
+ from endstation.qt.reading import ReadingBrowser, render_into, text_color
18
+ from PySide6.QtWidgets import QHBoxLayout, QListWidget, QListWidgetItem, QWidget
19
+
20
+ from gratinglab.gui.qt import theming
23
21
 
24
22
  from ...wiki import pages
25
23
 
26
24
  __all__ = ["WikiView"]
27
25
 
26
+ #: Shown when the pages are missing, so an installed copy without its package
27
+ #: data says so rather than presenting an empty panel.
28
+ NO_PAGES = (
29
+ "# No wiki pages found\n\n"
30
+ "The markdown files that ship with `gratinglab.metrology.wiki` could not "
31
+ "be located. In an installed copy this means the package data "
32
+ "was not included."
33
+ )
34
+
28
35
 
29
36
  class WikiView(QWidget):
30
37
  """How the analysis works, in prose."""
@@ -42,7 +49,7 @@ class WikiView(QWidget):
42
49
  self._contents.addItem(item)
43
50
  self._contents.currentRowChanged.connect(self._show_row)
44
51
 
45
- self._browser = QTextBrowser()
52
+ self._browser = ReadingBrowser()
46
53
  # These pages cross-reference each other by title in prose rather than by
47
54
  # link, so there is nothing for a click to resolve. Opening links would
48
55
  # only ever blank the view.
@@ -58,14 +65,11 @@ class WikiView(QWidget):
58
65
  if self._pages:
59
66
  self._contents.setCurrentRow(0)
60
67
  else:
61
- # A checkout missing its package data should say so rather than
62
- # presenting an empty panel that looks like a rendering bug.
63
- self._browser.setMarkdown(
64
- "# No wiki pages found\n\n"
65
- "The markdown files that ship with `gratinglab.metrology.wiki` could not "
66
- "be located. In an installed copy this means the package data "
67
- "was not included."
68
- )
68
+ self._render(NO_PAGES)
69
+
70
+ # Any equation is an image in the text colour, so a theme change
71
+ # re-renders the page rather than only repainting it.
72
+ theming.subscribe(self._on_theme)
69
73
 
70
74
  # ── State, for tests and callers ─────────────────────────────────────────
71
75
 
@@ -95,7 +99,25 @@ class WikiView(QWidget):
95
99
 
96
100
  # ── Internals ────────────────────────────────────────────────────────────
97
101
 
102
+ def _render(self, markdown: str) -> None:
103
+ render_into(
104
+ self._browser,
105
+ markdown,
106
+ device_pixel_ratio=self.devicePixelRatioF(),
107
+ text_color=text_color(self),
108
+ )
109
+
98
110
  def _show_row(self, row: int) -> None:
99
111
  if 0 <= row < len(self._pages):
100
- self._browser.setMarkdown(self._pages[row].markdown)
112
+ self._render(self._pages[row].markdown)
101
113
  self._browser.verticalScrollBar().setValue(0)
114
+
115
+ def _on_theme(self, _theme) -> None:
116
+ # A bound method, so Qt disconnects it when the view is destroyed.
117
+ # The reader keeps their place: only the colours changed.
118
+ row = self._contents.currentRow()
119
+ if 0 <= row < len(self._pages):
120
+ scroll = self._browser.verticalScrollBar()
121
+ position = scroll.value()
122
+ self._render(self._pages[row].markdown)
123
+ scroll.setValue(position)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gratinglab
3
- Version: 0.3.9
3
+ Version: 0.3.10
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.3.0
24
+ Requires-Dist: endstation>=0.4.0
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.3.0; extra == "gui"
36
+ Requires-Dist: endstation[qt]>=0.4.0; extra == "gui"
37
37
  Provides-Extra: metrology
38
38
  Requires-Dist: matplotlib>=3.9; extra == "metrology"
39
39
  Provides-Extra: refractiveindex
@@ -37,7 +37,6 @@ src/gratinglab/gui/failures.py
37
37
  src/gratinglab/gui/icon.py
38
38
  src/gratinglab/gui/integral_options.py
39
39
  src/gratinglab/gui/launcher.py
40
- src/gratinglab/gui/mathtext.py
41
40
  src/gratinglab/gui/orders.py
42
41
  src/gratinglab/gui/provenance.py
43
42
  src/gratinglab/gui/rcwa_options.py
@@ -1,7 +1,7 @@
1
1
  numpy>=1.26
2
2
  scipy>=1.11
3
3
  pydantic>=2.6
4
- endstation>=0.3.0
4
+ endstation>=0.4.0
5
5
  threadpoolctl>=3.1
6
6
 
7
7
  [dev]
@@ -13,7 +13,7 @@ ruff>=0.17
13
13
 
14
14
  [gui]
15
15
  matplotlib>=3.8
16
- endstation[qt]>=0.3.0
16
+ endstation[qt]>=0.4.0
17
17
 
18
18
  [gui:python_version < "3.12"]
19
19
  PySide6-Essentials!=6.12.0,>=6.7
@@ -0,0 +1,40 @@
1
+ """Every equation in gratinglab's pages renders.
2
+
3
+ The renderer is endstation's (``endstation.docs.mathtext``) and is tested
4
+ there. What is tested here is the pages: the spans are parsed out of the real
5
+ files, so an edit that adds a macro mathtext cannot draw fails here rather
6
+ than showing up as raw source in the app.
7
+ """
8
+
9
+ import pytest
10
+ from endstation.docs.mathtext import render_math_png, split_segments
11
+
12
+ from gratinglab.gui.docs import find_theory_root, general_pages, theory_pages
13
+
14
+ THEORY_ROOT = find_theory_root()
15
+ requires_theory_docs = pytest.mark.skipif(
16
+ THEORY_ROOT is None, reason="docs/theory not found from this checkout"
17
+ )
18
+
19
+
20
+ def _failures(text):
21
+ spans = [s.content for s in split_segments(text) if s.kind == "math"]
22
+ return spans, [s for s in spans if render_math_png(s) is None]
23
+
24
+
25
+ @requires_theory_docs
26
+ def test_every_math_span_in_scalar_md_renders():
27
+ spans, failures = _failures((THEORY_ROOT / "scalar.md").read_text(encoding="utf-8"))
28
+ assert len(spans) > 10, "sanity check: did the file load correctly?"
29
+ assert not failures, f"{len(failures)} span(s) failed to render: {failures}"
30
+
31
+
32
+ @requires_theory_docs
33
+ @pytest.mark.parametrize(
34
+ "page",
35
+ [p for p in (*theory_pages(), *general_pages()) if p.available],
36
+ ids=lambda p: p.name,
37
+ )
38
+ def test_every_math_span_in_every_help_page_renders(page):
39
+ _, failures = _failures(page.text)
40
+ assert not failures, f"{page.name}: {len(failures)} span(s) failed: {failures}"
@@ -1999,12 +1999,13 @@ class TestTheoryViewer:
1999
1999
  def test_the_equations_are_registered_as_images(self, qtbot, win):
2000
2000
  """The `Text.dump()` image count this replaces, expressed against the
2001
2001
  document's own resources."""
2002
+ from endstation.docs.markdown import MATH_URL_PREFIX
2002
2003
  from PySide6.QtCore import QUrl
2003
2004
  from PySide6.QtGui import QTextDocument
2004
2005
 
2005
2006
  document = self._open(qtbot, win)._browser.document()
2006
2007
  loaded = document.resource(
2007
- QTextDocument.ResourceType.ImageResource, QUrl("gratinglab-math:0")
2008
+ QTextDocument.ResourceType.ImageResource, QUrl(f"{MATH_URL_PREFIX}0")
2008
2009
  )
2009
2010
  assert not loaded.isNull()
2010
2011
 
@@ -0,0 +1,146 @@
1
+ """gratinglab's Help pages as rich text.
2
+
3
+ The markdown renderer is endstation's and is tested there. These run it on the
4
+ real pages, so an edit to ``scalar.md`` that breaks rendering fails here
5
+ rather than being found by eye, and they test the two things gratinglab adds:
6
+ the approximate-method banner and menu labels.
7
+
8
+ Headless: no Qt, no display.
9
+ """
10
+
11
+ import ast
12
+ import inspect
13
+ import re
14
+ import struct
15
+ import zlib
16
+
17
+ import pytest
18
+ from endstation.docs.markdown import render_markdown
19
+ from endstation.docs.mathtext import split_segments
20
+
21
+ from gratinglab.gui import richtext
22
+ from gratinglab.gui.docs import TheoryPage, general_pages, theory_pages
23
+ from gratinglab.gui.richtext import menu_label, to_html
24
+
25
+
26
+ def fake_render(latex, *, dpi, color, **_):
27
+ """A 4x3 PNG, so a page renders without matplotlib."""
28
+ def chunk(kind, payload):
29
+ body = kind + payload
30
+ return struct.pack(">I", len(payload)) + body + struct.pack(">I", zlib.crc32(body))
31
+
32
+ ihdr = struct.pack(">IIBBBBB", 4, 3, 8, 0, 0, 0, 0)
33
+ return b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", ihdr) + chunk(b"IEND", b"")
34
+
35
+
36
+ @pytest.fixture(scope="module")
37
+ def scalar_page():
38
+ return next(p for p in theory_pages() if p.name == "scalar")
39
+
40
+
41
+ @pytest.fixture(scope="module")
42
+ def conventions_page():
43
+ return next(p for p in general_pages() if p.name == "conventions")
44
+
45
+
46
+ @pytest.fixture(scope="module")
47
+ def scalar_html(scalar_page):
48
+ return to_html(scalar_page, render=fake_render).html
49
+
50
+
51
+ @pytest.fixture(scope="module")
52
+ def conventions_html(conventions_page):
53
+ return to_html(conventions_page, render=fake_render).html
54
+
55
+
56
+ class TestTheRealPages:
57
+ """The pages are mostly tables, with equations in the cells."""
58
+
59
+ def test_the_tension_table_is_a_table(self, scalar_html):
60
+ assert "<table" in scalar_html and scalar_html.count("<tr>") > 10
61
+ assert "<th>" in scalar_html
62
+
63
+ def test_math_renders_inside_table_cells(self, scalar_html):
64
+ """The tension table's column headings are equations."""
65
+ cells = re.findall(r"<t[hd]>.*?</t[hd]>", scalar_html, re.S)
66
+ assert len([c for c in cells if "<img " in c]) > 3
67
+
68
+ def test_lists_rules_quotes_and_the_title(self, scalar_html, conventions_html):
69
+ assert "<ul>" in conventions_html and "<hr>" in conventions_html
70
+ assert "<blockquote>" in scalar_html
71
+ assert "<h1>Conventions</h1>" in conventions_html
72
+
73
+ def test_no_raw_delimiters_latex_or_placeholders_reach_the_output(
74
+ self, scalar_html, conventions_html
75
+ ):
76
+ for html in (scalar_html, conventions_html):
77
+ assert "$" not in html and "\x00" not in html
78
+ assert "\\Phi_m" not in scalar_html and "\\alpha" not in scalar_html
79
+
80
+ def test_an_ampersand_in_prose_is_escaped(self, conventions_html):
81
+ """conventions.md cites 'Heilmann ... & McEntaffer'."""
82
+ assert "&amp;" in conventions_html
83
+
84
+ def test_a_code_span_inside_a_link_survives(self, scalar_html):
85
+ """scalar.md's first line is [`scalar.py`](../../src/...)."""
86
+ assert "<code>solvers/scalar.py</code></a>" in scalar_html
87
+
88
+ def test_every_equation_becomes_a_referenced_image(self, scalar_page):
89
+ rendered = to_html(scalar_page, render=fake_render)
90
+ expected = sum(1 for s in split_segments(scalar_page.text) if s.kind == "math")
91
+ assert len(rendered.images) == expected > 50
92
+ for image in rendered.images:
93
+ assert f'src="{image.key}"' in rendered.html
94
+
95
+ def test_every_equation_actually_rasterises(self, scalar_page):
96
+ """The real renderer: an unsupported macro added later degrades
97
+ visibly, and this is what notices."""
98
+ assert render_markdown(scalar_page.text).unrendered == ()
99
+
100
+ def test_the_metrology_steps_are_a_numbered_list(self):
101
+ page = next(p for p in general_pages() if p.name == "metrology")
102
+ html = to_html(page, render=fake_render).html
103
+ assert "<ol><li><b>Endpoint flattening.</b>" in html
104
+ assert "<p>1. " not in html
105
+
106
+
107
+ class TestBanner:
108
+ def test_a_non_rigorous_solver_is_announced(self, scalar_page):
109
+ assert not scalar_page.rigorous # the case this test needs
110
+ assert "Approximate method" in to_html(scalar_page, render=fake_render).html
111
+
112
+ def test_a_rigorous_one_is_not(self):
113
+ page = TheoryPage(name="integral", title="Integral", available=True, path=None,
114
+ text="## Theory\n\nExact.", rigorous=True)
115
+ assert richtext.banner(page) == ""
116
+ assert "Approximate method" not in to_html(page, render=fake_render).html
117
+
118
+ def test_a_page_that_does_not_exist_yet_still_renders(self):
119
+ page = TheoryPage(name="future", title="Future Method", available=False,
120
+ path=None, rigorous=True,
121
+ text="No theory page has been written yet for 'future'.")
122
+ assert "No theory page has been written yet" in to_html(page).html
123
+
124
+
125
+ class TestMenuLabel:
126
+ def test_an_ampersand_is_escaped_for_qt(self):
127
+ assert menu_label("Grating Geometry & Conventions") == "Grating Geometry && Conventions"
128
+
129
+ def test_the_real_page_title_needs_it(self):
130
+ assert any("&" in p.title for p in general_pages()), "escaping test went vacuous"
131
+
132
+ def test_a_suffix_is_appended_before_escaping(self):
133
+ assert menu_label("A & B", " Theory") == "A && B Theory"
134
+
135
+ def test_a_title_without_an_ampersand_is_untouched(self):
136
+ assert menu_label("Scalar (Kirchhoff)", " Theory") == "Scalar (Kirchhoff) Theory"
137
+
138
+
139
+ def test_richtext_imports_no_toolkit():
140
+ imported = set()
141
+ for node in ast.walk(ast.parse(inspect.getsource(richtext))):
142
+ if isinstance(node, ast.Import):
143
+ imported.update(a.name.split(".")[0] for a in node.names)
144
+ elif isinstance(node, ast.ImportFrom) and node.module:
145
+ imported.add(node.module.split(".")[0])
146
+ assert not {"tkinter", "PySide6", "PyQt6"} & imported