unit-cell-gui 0.2.0__tar.gz → 0.2.2__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 (29) hide show
  1. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/CHANGELOG.md +45 -0
  2. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/CITATION.cff +2 -2
  3. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/MANIFEST.in +1 -0
  4. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/PKG-INFO +177 -151
  5. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/README.md +27 -1
  6. unit_cell_gui-0.2.2/RELEASE_NOTES_0.2.2.md +42 -0
  7. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/THIRD_PARTY_NOTICES.txt +1 -1
  8. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/pyproject.toml +1 -1
  9. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/setup.cfg +4 -4
  10. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui/__init__.py +9 -1
  11. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui/opengl_viewer.py +438 -190
  12. unit_cell_gui-0.2.2/src/unit_cell_gui/qt_config.py +47 -0
  13. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui.egg-info/PKG-INFO +177 -151
  14. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui.egg-info/SOURCES.txt +4 -1
  15. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/tests/test_unit_cell_gui.py +32 -1
  16. unit_cell_gui-0.2.2/tests/test_visibility_cache.py +275 -0
  17. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/LICENSE +0 -0
  18. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui/gl_geometry.py +0 -0
  19. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui/hatching.py +0 -0
  20. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui/models.py +0 -0
  21. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui/py.typed +0 -0
  22. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui/render_geometry.py +0 -0
  23. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui/view_helpers.py +0 -0
  24. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui/viewer.py +0 -0
  25. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui.egg-info/dependency_links.txt +0 -0
  26. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui.egg-info/requires.txt +0 -0
  27. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/src/unit_cell_gui.egg-info/top_level.txt +0 -0
  28. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/tests/test_gl_geometry.py +0 -0
  29. {unit_cell_gui-0.2.0 → unit_cell_gui-0.2.2}/tests/test_render_geometry.py +0 -0
@@ -1,5 +1,50 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.2 - 2026-10-01
4
+
5
+ ### Fixed
6
+
7
+ - Individual polyhedron visibility changes now filter resident face, edge and
8
+ atom/face-intersection ranges at draw time, instead of rebuilding their
9
+ geometry and re-uploading the complete buffers.
10
+ - Apply the same visibility selection to opaque and transparent faces, edges,
11
+ hatching and intersection contours, including multiple polyhedra sharing a
12
+ site key.
13
+
14
+ ### Performance
15
+
16
+ - Cache engraving hatching separately for each polyhedron. Reuse GPU buffers
17
+ when the view and effective division count are unchanged; rebuild only the
18
+ affected polyhedra when visible depth extrema alter the density.
19
+ - Preserve the original hatching algorithms and density/GRIP normalization
20
+ over visible polyhedra. Keep at most four CPU density variants per polyhedron
21
+ for the current view; discard them when the view or scene changes.
22
+ - Vectorize finite-face clipping of sphere/face section segments while keeping
23
+ the original 160-sample circles and boundary tolerance.
24
+ - Defer intersection and hatching preparation until their layers are visible.
25
+ - Release per-polyhedron hatching GPU resources on scene replacement/clearing
26
+ and context cleanup; recreate them when needed.
27
+
28
+ ### Compatibility
29
+
30
+ - Keep all public scene models, display options, style overrides, viewer aliases
31
+ and orientation/interaction signals unchanged. Hosts using the existing
32
+ 0.2.x API do not need integration changes.
33
+
34
+ ## 0.2.1 - 2026-09-15
35
+
36
+ ### Fixed
37
+
38
+ - Configure one global OpenGL 3.3 surface format and enable shared OpenGL
39
+ contexts before `QApplication` construction. This prevents stale top-level
40
+ composition after moving or maximising a host window on mixed-DPI screens.
41
+ - Release GPU resources when Qt destroys a viewer context and rebuild every
42
+ buffer and shader when a new context is initialised.
43
+ - Reduce stair-stepping with 8-sample multisampling and pixel-coverage
44
+ antialiasing for polyhedron edges, hatching, bonds and atom contours.
45
+ - Double the period of the dashed unit-cell box while preserving the 2:1
46
+ dash-to-gap ratio.
47
+
3
48
  ## 0.2.0 - 2026-09-14
4
49
 
5
50
  ### Changed
@@ -8,7 +8,7 @@ authors:
8
8
  repository-code: https://github.com/ofussr/unit-cell-gui
9
9
  url: https://github.com/ofussr/unit-cell-gui
10
10
  orcid: https://orcid.org/0000-0002-5571-8525
11
- version: 0.2.0
12
- date-released: 2026-09-14
11
+ version: 0.2.2
12
+ date-released: 2026-10-01
13
13
  doi: 10.5281/zenodo.22714946
14
14
  license: MIT
@@ -2,5 +2,6 @@ include CHANGELOG.md
2
2
  include CITATION.cff
3
3
  include LICENSE
4
4
  include README.md
5
+ include RELEASE_NOTES_0.2.2.md
5
6
  include THIRD_PARTY_NOTICES.txt
6
7
  recursive-include tests *.py
@@ -1,151 +1,177 @@
1
- Metadata-Version: 2.4
2
- Name: unit-cell-gui
3
- Version: 0.2.0
4
- Summary: PySide6 widget for rendering caller-supplied unit-cell scenes
5
- Author-email: Mikhail Mirushchenko <miruschenko98@gmail.com>
6
- License-Expression: MIT
7
- Classifier: Development Status :: 3 - Alpha
8
- Classifier: Environment :: X11 Applications :: Qt
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3 :: Only
11
- Requires-Python: >=3.10
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
- Requires-Dist: numpy>=1.24
15
- Requires-Dist: PySide6-Essentials<7,>=6.8
16
- Requires-Dist: PyOpenGL<4,>=3.1.7
17
- Dynamic: license-file
18
-
19
- # unit-cell-gui
20
-
21
- `unit-cell-gui` is a reusable PySide6 widget that draws complete unit-cell
22
- scenes supplied by another program. It does not read CIF files, expand
23
- symmetry, resolve atomic positions, infer bonds, construct polyhedra or
24
- calculate diffraction.
25
-
26
- The caller supplies ready Cartesian coordinates and presentation data:
27
-
28
- - atoms and their styled occupancy components;
29
- - bond indices;
30
- - unit-cell vertices and edges;
31
- - three basis vectors;
32
- - optional polyhedron vertices, polygon faces and centres.
33
-
34
- The package owns only display behaviour: camera projection, OpenGL depth buffering,
35
- left-button rotation, right-button panning, wheel zoom, occupancy sectors,
36
- colour and black-and-white drawing, and polyhedron hatching. Quadrilateral
37
- hatching uses one intact polygon with `2x + 1` full parallel strokes. Hatch
38
- directions on farther faces are refolded through real shared edges.
39
-
40
- <table>
41
- <tr>
42
- <td align="center" width="50%">
43
- <img src="https://raw.githubusercontent.com/ofussr/unit-cell-gui/main/docs/images/color-view.png" alt="Color view" width="100%">
44
- <br>
45
- <sub>Color view</sub>
46
- </td>
47
- <td align="center" width="50%">
48
- <img src="https://raw.githubusercontent.com/ofussr/unit-cell-gui/main/docs/images/hatched-view.png" alt="Hatched view" width="100%">
49
- <br>
50
- <sub>Hatched view</sub>
51
- </td>
52
- </tr>
53
- </table>
54
-
55
- ## Installation
56
-
57
- ```bash
58
- python -m pip install unit-cell-gui
59
- ```
60
-
61
- Python 3.10 or newer, NumPy, PySide6 Essentials and PyOpenGL are required. The renderer requests an OpenGL 3.3 core-profile context.
62
-
63
- ## Basic use
64
-
65
- ```python
66
- import numpy as np
67
- from PySide6.QtWidgets import QApplication
68
- from unit_cell_gui import Atom, AtomComponent, DisplayOptions, Scene, UnitCellViewer
69
-
70
- silicon = AtomComponent(
71
- key="Si:Si1", label="Si1", element="Si",
72
- occupancy=1.0, colour="#f0c8a0", radius=0.30,
73
- )
74
- scene = Scene(
75
- atoms=(Atom("Si:Si1", "Si1", (silicon,)),),
76
- atom_centers=np.array([[0.0, 0.0, 0.0]]),
77
- bonds=np.empty((0, 2), dtype=int),
78
- cell_vertices=np.array([
79
- [x, y, z]
80
- for x in (-1.0, 1.0)
81
- for y in (-1.0, 1.0)
82
- for z in (-1.0, 1.0)
83
- ]),
84
- cell_edges=np.array([
85
- [0, 1], [0, 2], [0, 4], [1, 3], [1, 5], [2, 3],
86
- [2, 6], [3, 7], [4, 5], [4, 6], [5, 7], [6, 7],
87
- ]),
88
- basis_vectors=np.eye(3),
89
- base_radius=2.0,
90
- )
91
-
92
- app = QApplication([])
93
- viewer = UnitCellViewer()
94
- viewer.set_scene(scene)
95
- viewer.set_display_options(DisplayOptions(show_polyhedra=False))
96
- viewer.show()
97
- app.exec()
98
- ```
99
-
100
- `Scene` copies its arrays and makes them read-only. Later changes in the caller
101
- therefore cannot alter an already submitted scene.
102
-
103
- ## Orientation synchronization
104
-
105
- `orientation` is a 3 by 3 world-to-camera matrix. For column vectors the
106
- camera coordinate is `orientation @ world`; the renderer's row arrays use the
107
- equivalent `world @ orientation.T`.
108
-
109
- Programmatic changes are silent by default:
110
-
111
- ```python
112
- viewer.set_orientation(matrix, emit=False)
113
- ```
114
-
115
- Interactive rotation emits the complete new matrix through
116
- `orientation_changed`. Connect that signal to a pole figure or another view,
117
- then send changes from the other view back with silent `set_orientation` calls.
118
- This supports bidirectional synchronization without a signal loop.
119
-
120
- ```python
121
- viewer.orientation_changed.connect(update_other_view)
122
- other_view.orientation_changed.connect(
123
- lambda matrix: viewer.set_orientation(matrix, emit=False)
124
- )
125
- ```
126
-
127
- Set `rotation_enabled=False` when an application temporarily forbids left-button
128
- rotation. Panning and zoom remain available. Polyhedra are hidden by default
129
- and must be enabled with `show_polyhedra=True`.
130
-
131
- Per-position colours, visibility and opaque-polyhedron selections are replaced
132
- atomically with `viewer.set_style_overrides(StyleOverrides(...))`. The widget
133
- copies these mappings, so the host can keep its own independent UI state.
134
-
135
-
136
- ## Renderer compatibility
137
-
138
- `UnitCellViewer` and the legacy alias `CrystalCanvas` now use the OpenGL
139
- renderer internally. Existing construction, scene submission, display-option,
140
- style-override, orientation-synchronization and interaction calls remain the
141
- same. `OpenGLUnitCellViewer` remains available as an explicit name and refers
142
- to the same renderer class.
143
-
144
-
145
- ## How to cite
146
-
147
- If you use `unit-cell-gui` in academic work, please cite the Zenodo record:
148
-
149
- [![DOI](https://zenodo.org/badge/1366573933.svg)](https://zenodo.org/badge/latestdoi/1366573933)
150
-
151
- You can also use the metadata provided in [`CITATION.cff`](CITATION.cff).
1
+ Metadata-Version: 2.4
2
+ Name: unit-cell-gui
3
+ Version: 0.2.2
4
+ Summary: PySide6 widget for rendering caller-supplied unit-cell scenes
5
+ Author-email: Mikhail Mirushchenko <miruschenko98@gmail.com>
6
+ License-Expression: MIT
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Environment :: X11 Applications :: Qt
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: numpy>=1.24
15
+ Requires-Dist: PySide6-Essentials<7,>=6.8
16
+ Requires-Dist: PyOpenGL<4,>=3.1.7
17
+ Dynamic: license-file
18
+
19
+ # unit-cell-gui
20
+
21
+ `unit-cell-gui` is a reusable PySide6 widget that draws complete unit-cell
22
+ scenes supplied by another program. It does not read CIF files, expand
23
+ symmetry, resolve atomic positions, infer bonds, construct polyhedra or
24
+ calculate diffraction.
25
+
26
+ The caller supplies ready Cartesian coordinates and presentation data:
27
+
28
+ - atoms and their styled occupancy components;
29
+ - bond indices;
30
+ - unit-cell vertices and edges;
31
+ - three basis vectors;
32
+ - optional polyhedron vertices, polygon faces and centres.
33
+
34
+ The package owns only display behaviour: camera projection, OpenGL depth buffering,
35
+ left-button rotation, right-button panning, wheel zoom, occupancy sectors,
36
+ colour and black-and-white drawing, and polyhedron hatching. Quadrilateral
37
+ hatching uses one intact polygon with `2x + 1` full parallel strokes. Hatch
38
+ directions on farther faces are refolded through real shared edges.
39
+
40
+ <table>
41
+ <tr>
42
+ <td align="center" width="50%">
43
+ <img src="https://raw.githubusercontent.com/ofussr/unit-cell-gui/main/docs/images/color-view.png" alt="Color view" width="100%">
44
+ <br>
45
+ <sub>Color view</sub>
46
+ </td>
47
+ <td align="center" width="50%">
48
+ <img src="https://raw.githubusercontent.com/ofussr/unit-cell-gui/main/docs/images/hatched-view.png" alt="Hatched view" width="100%">
49
+ <br>
50
+ <sub>Hatched view</sub>
51
+ </td>
52
+ </tr>
53
+ </table>
54
+
55
+ ## Installation
56
+
57
+ ```bash
58
+ python -m pip install unit-cell-gui
59
+ ```
60
+
61
+ Python 3.10 or newer, NumPy, PySide6 Essentials and PyOpenGL are required. The renderer requests an OpenGL 3.3 core-profile context.
62
+
63
+ Import `UnitCellViewer` or `CrystalCanvas` before constructing `QApplication`.
64
+ This lets the package establish one shared OpenGL format for every viewer and
65
+ keeps top-level Qt composition stable across screen and DPI changes. The basic
66
+ example below already uses this order.
67
+
68
+ ## Basic use
69
+
70
+ ```python
71
+ import numpy as np
72
+ from PySide6.QtWidgets import QApplication
73
+ from unit_cell_gui import Atom, AtomComponent, DisplayOptions, Scene, UnitCellViewer
74
+
75
+ silicon = AtomComponent(
76
+ key="Si:Si1", label="Si1", element="Si",
77
+ occupancy=1.0, colour="#f0c8a0", radius=0.30,
78
+ )
79
+ scene = Scene(
80
+ atoms=(Atom("Si:Si1", "Si1", (silicon,)),),
81
+ atom_centers=np.array([[0.0, 0.0, 0.0]]),
82
+ bonds=np.empty((0, 2), dtype=int),
83
+ cell_vertices=np.array([
84
+ [x, y, z]
85
+ for x in (-1.0, 1.0)
86
+ for y in (-1.0, 1.0)
87
+ for z in (-1.0, 1.0)
88
+ ]),
89
+ cell_edges=np.array([
90
+ [0, 1], [0, 2], [0, 4], [1, 3], [1, 5], [2, 3],
91
+ [2, 6], [3, 7], [4, 5], [4, 6], [5, 7], [6, 7],
92
+ ]),
93
+ basis_vectors=np.eye(3),
94
+ base_radius=2.0,
95
+ )
96
+
97
+ app = QApplication([])
98
+ viewer = UnitCellViewer()
99
+ viewer.set_scene(scene)
100
+ viewer.set_display_options(DisplayOptions(show_polyhedra=False))
101
+ viewer.show()
102
+ app.exec()
103
+ ```
104
+
105
+ `Scene` copies its arrays and makes them read-only. Later changes in the caller
106
+ therefore cannot alter an already submitted scene.
107
+
108
+ ## Orientation synchronization
109
+
110
+ `orientation` is a 3 by 3 world-to-camera matrix. For column vectors the
111
+ camera coordinate is `orientation @ world`; the renderer's row arrays use the
112
+ equivalent `world @ orientation.T`.
113
+
114
+ Programmatic changes are silent by default:
115
+
116
+ ```python
117
+ viewer.set_orientation(matrix, emit=False)
118
+ ```
119
+
120
+ Interactive rotation emits the complete new matrix through
121
+ `orientation_changed`. Connect that signal to a pole figure or another view,
122
+ then send changes from the other view back with silent `set_orientation` calls.
123
+ This supports bidirectional synchronization without a signal loop.
124
+
125
+ ```python
126
+ viewer.orientation_changed.connect(update_other_view)
127
+ other_view.orientation_changed.connect(
128
+ lambda matrix: viewer.set_orientation(matrix, emit=False)
129
+ )
130
+ ```
131
+
132
+ Set `rotation_enabled=False` when an application temporarily forbids left-button
133
+ rotation. Panning and zoom remain available. Polyhedra are hidden by default
134
+ and must be enabled with `show_polyhedra=True`.
135
+
136
+ Per-position colours, visibility and opaque-polyhedron selections are replaced
137
+ atomically with `viewer.set_style_overrides(StyleOverrides(...))`. The widget
138
+ copies these mappings, so the host can keep its own independent UI state.
139
+
140
+ ## Visibility and rendering caches
141
+
142
+ Both global and per-site polyhedron visibility filter already prepared geometry
143
+ at draw time. Faces, edges and atom/face intersection contours remain in GPU
144
+ buffers when a site is hidden or shown. This avoids rebuilding the full
145
+ polyhedron layer for each individual visibility change.
146
+
147
+ Engraving hatching is cached per polyhedron. Its density still follows the
148
+ depth range of the visible polyhedra: hiding the nearest or farthest object can
149
+ change other objects' effective division counts. Only affected hatch buffers
150
+ are updated. Rotation, zoom, panning and window-size changes keep the original
151
+ view-dependent hatching behaviour. CPU density variants are bounded and are
152
+ discarded when the view or scene changes.
153
+
154
+ Intersection contours and hatching are prepared when their layers are first
155
+ needed. The initial preparation still has a cost; subsequent site visibility
156
+ changes reuse the prepared data.
157
+
158
+
159
+ ## Renderer compatibility
160
+
161
+ `UnitCellViewer` and the legacy alias `CrystalCanvas` now use the OpenGL
162
+ renderer internally. Existing construction, scene submission, display-option,
163
+ style-override, orientation-synchronization and interaction calls remain the
164
+ same. `OpenGLUnitCellViewer` remains available as an explicit name and refers
165
+ to the same renderer class.
166
+
167
+ ## Used in
168
+
169
+ `unit-cell-gui` is used as the crystal-structure viewer in [XRD Combine](https://github.com/ofussr/XRD-Combine), where it is integrated with CIF processing, diffraction tools, and synchronized crystallographic views.
170
+
171
+ ## How to cite
172
+
173
+ If you use `unit-cell-gui` in academic work, please cite the Zenodo record:
174
+
175
+ [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.22714946-blue.svg)](https://doi.org/10.5281/zenodo.22714946)
176
+
177
+ You can also use the metadata provided in [`CITATION.cff`](CITATION.cff).
@@ -42,6 +42,11 @@ python -m pip install unit-cell-gui
42
42
 
43
43
  Python 3.10 or newer, NumPy, PySide6 Essentials and PyOpenGL are required. The renderer requests an OpenGL 3.3 core-profile context.
44
44
 
45
+ Import `UnitCellViewer` or `CrystalCanvas` before constructing `QApplication`.
46
+ This lets the package establish one shared OpenGL format for every viewer and
47
+ keeps top-level Qt composition stable across screen and DPI changes. The basic
48
+ example below already uses this order.
49
+
45
50
  ## Basic use
46
51
 
47
52
  ```python
@@ -114,6 +119,24 @@ Per-position colours, visibility and opaque-polyhedron selections are replaced
114
119
  atomically with `viewer.set_style_overrides(StyleOverrides(...))`. The widget
115
120
  copies these mappings, so the host can keep its own independent UI state.
116
121
 
122
+ ## Visibility and rendering caches
123
+
124
+ Both global and per-site polyhedron visibility filter already prepared geometry
125
+ at draw time. Faces, edges and atom/face intersection contours remain in GPU
126
+ buffers when a site is hidden or shown. This avoids rebuilding the full
127
+ polyhedron layer for each individual visibility change.
128
+
129
+ Engraving hatching is cached per polyhedron. Its density still follows the
130
+ depth range of the visible polyhedra: hiding the nearest or farthest object can
131
+ change other objects' effective division counts. Only affected hatch buffers
132
+ are updated. Rotation, zoom, panning and window-size changes keep the original
133
+ view-dependent hatching behaviour. CPU density variants are bounded and are
134
+ discarded when the view or scene changes.
135
+
136
+ Intersection contours and hatching are prepared when their layers are first
137
+ needed. The initial preparation still has a cost; subsequent site visibility
138
+ changes reuse the prepared data.
139
+
117
140
 
118
141
  ## Renderer compatibility
119
142
 
@@ -123,11 +146,14 @@ style-override, orientation-synchronization and interaction calls remain the
123
146
  same. `OpenGLUnitCellViewer` remains available as an explicit name and refers
124
147
  to the same renderer class.
125
148
 
149
+ ## Used in
150
+
151
+ `unit-cell-gui` is used as the crystal-structure viewer in [XRD Combine](https://github.com/ofussr/XRD-Combine), where it is integrated with CIF processing, diffraction tools, and synchronized crystallographic views.
126
152
 
127
153
  ## How to cite
128
154
 
129
155
  If you use `unit-cell-gui` in academic work, please cite the Zenodo record:
130
156
 
131
- [![DOI](https://zenodo.org/badge/1366573933.svg)](https://zenodo.org/badge/latestdoi/1366573933)
157
+ [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.22714946-blue.svg)](https://doi.org/10.5281/zenodo.22714946)
132
158
 
133
159
  You can also use the metadata provided in [`CITATION.cff`](CITATION.cff).
@@ -0,0 +1,42 @@
1
+ # unit-cell-gui 0.2.2
2
+
3
+ This maintenance release fixes pauses when hiding or showing individual
4
+ polyhedra through `StyleOverrides.polyhedron_site_visibility`.
5
+
6
+ ## Faster individual visibility changes
7
+
8
+ - Keep polyhedron faces, edges and atom/face intersection contours in GPU
9
+ buffers and select visible site ranges during drawing.
10
+ - Cache engraving hatching per polyhedron and reuse unchanged GPU buffers.
11
+ When hiding a depth-extreme polyhedron changes other polyhedra's density,
12
+ update only the affected hatch geometry.
13
+ - Preserve the original visible-depth normalization, density and GRIP controls,
14
+ shared-edge hatch directions and intact quadrilateral faces.
15
+
16
+ ## Initial preparation and resource handling
17
+
18
+ - Vectorize sphere/face section clipping without reducing the original
19
+ 160-sample resolution or changing boundary tolerance.
20
+ - Prepare intersection contours and hatching only when their layers are needed.
21
+ - Bound CPU hatching variants for the current view and release per-polyhedron
22
+ GPU buffers when a scene is replaced, cleared or its context is cleaned up.
23
+
24
+ ## Compatibility
25
+
26
+ The public API is unchanged: `UnitCellViewer`, `CrystalCanvas`,
27
+ `OpenGLUnitCellViewer`, scene models, display options, style overrides,
28
+ orientation synchronization and interaction signals remain compatible with
29
+ 0.2.1. No host-application changes are required for this visibility fix.
30
+
31
+ ## Validation
32
+
33
+ - 41 tests passed with a real OpenGL context, including visibility, clipping,
34
+ hatching, resource cleanup and context-rebuild checks.
35
+ - 15 framebuffer comparisons against 0.2.1 were pixel-identical, covering
36
+ colour and engraving views, transparent and opaque polyhedra, individual and
37
+ global visibility, rotation, atom scaling, external atoms and quadrilateral
38
+ hatching.
39
+ - In one synthetic nine-octahedron scene on Mesa software OpenGL, median
40
+ individual-toggle time decreased from approximately 544 ms to 15 ms.
41
+ This is a local benchmark, not a timing guarantee for other structures or
42
+ hardware.
@@ -62,7 +62,7 @@ Notes
62
62
  -----
63
63
 
64
64
  The version ranges above describe the direct runtime dependencies declared by
65
- unit-cell-gui 0.2.0. Transitive dependencies may vary depending on the
65
+ unit-cell-gui 0.2.1. Transitive dependencies may vary depending on the
66
66
  platform and the versions selected by the Python package installer.
67
67
 
68
68
  This file does not replace the license files supplied by third-party packages.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "unit-cell-gui"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  description = "PySide6 widget for rendering caller-supplied unit-cell scenes"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,4 +1,4 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -8,10 +8,16 @@ from .hatching import (
8
8
  quadrilateral_hatch_line_count,
9
9
  )
10
10
  from .models import Atom, AtomComponent, DisplayOptions, Polyhedron, Scene, StyleOverrides
11
- __version__ = "0.2.0"
11
+ __version__ = "0.2.2"
12
12
 
13
13
 
14
14
  def __getattr__(name):
15
+ if name in {"configure_qt_opengl", "preferred_surface_format"}:
16
+ from .qt_config import configure_qt_opengl, preferred_surface_format
17
+ return {
18
+ "configure_qt_opengl": configure_qt_opengl,
19
+ "preferred_surface_format": preferred_surface_format,
20
+ }[name]
15
21
  if name in {"CrystalCanvas", "UnitCellViewer", "OpenGLUnitCellViewer", "screen_drag_orientation"}:
16
22
  from .viewer import CrystalCanvas, UnitCellViewer, screen_drag_orientation
17
23
  if name == "OpenGLUnitCellViewer":
@@ -34,10 +40,12 @@ __all__ = [
34
40
  "Scene",
35
41
  "StyleOverrides",
36
42
  "UnitCellViewer",
43
+ "configure_qt_opengl",
37
44
  "face_hatch_segments",
38
45
  "hatch_division_count",
39
46
  "occupancy_fractions",
40
47
  "propagated_hatch_directions",
41
48
  "quadrilateral_hatch_line_count",
49
+ "preferred_surface_format",
42
50
  "screen_drag_orientation",
43
51
  ]