Skip to content

Commit 9884ad7

Browse files
committed
Merge branch 'develop'
2 parents a7b2a7f + ec0eb44 commit 9884ad7

File tree

4 files changed

+96
-19
lines changed

4 files changed

+96
-19
lines changed

.gitlab-ci.yml

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,38 @@ pre-package:
382382
- pipx install "briefcase==${BRIEFCASE_VERSION}"
383383
- export PATH="${HOME}/.local/bin:${PATH}"
384384
- python3 -m venv env
385+
- ./env/bin/python3 -m pip install -U
386+
pip
387+
setuptools
388+
wheel
389+
# Latest pip versions on Debian 11 bullseye may throw encoding errors in `compileall.py` if not all modules can be
390+
# byte-compiled (for example for PySide6). Therefore, patch the Python installation to use 'UTF-8' as fallback
391+
# encoding.
392+
- |-
393+
if ! awk -F'=' '$1 == "VERSION_CODENAME" && $2 == "bullseye" { exit 1 }' /etc/os-release; then
394+
pushd /usr/lib/python3.9
395+
(
396+
echo "--- compileall.py 2025-03-20 02:07:39.000000000 +0000";
397+
echo "+++ compileall.py.patched 2025-04-29 10:11:00.568493043 +0000";
398+
echo "@@ -252,9 +252,9 @@";
399+
echo " else:";
400+
echo " print('*** ', end='')";
401+
echo " # escape non-printable characters in msg";
402+
echo "- msg = err.msg.encode(sys.stdout.encoding,";
403+
echo "+ msg = err.msg.encode(sys.stdout.encoding if sys.stdout.encoding is not None else 'utf-8',";
404+
echo " errors='backslashreplace')";
405+
echo "- msg = msg.decode(sys.stdout.encoding)";
406+
echo "+ msg = msg.decode(sys.stdout.encoding if sys.stdout.encoding is not None else 'utf-8')";
407+
echo " print(msg)";
408+
echo " except (SyntaxError, UnicodeError, OSError) as e:";
409+
echo " success = False";
410+
) | patch -N
411+
popd
412+
fi
385413
script:
386414
# Install the project in editable mode to force to build all C extenions in-place. Otherwise, they won't be packaged
387415
# by briefcase
388-
- ./env/bin/python3 -m pip install -e .
416+
- ./env/bin/python3 -m pip install --no-deps -e .
389417
- briefcase create linux system
390418
- briefcase build linux system
391419
- briefcase package linux system
@@ -419,6 +447,11 @@ package:ubuntu:24.10:
419447
image: ubuntu:24.10
420448

421449

450+
package:ubuntu:25.04:
451+
extends: .package:debian
452+
image: ubuntu:25.04
453+
454+
422455
.package:rhel:
423456
stage: package
424457
needs: ["pre-package"]
@@ -433,10 +466,14 @@ package:ubuntu:24.10:
433466
- pipx install "briefcase==${BRIEFCASE_VERSION}"
434467
- export PATH="${HOME}/.local/bin:${PATH}"
435468
- python3 -m venv env
469+
- ./env/bin/python3 -m pip install -U
470+
pip
471+
setuptools
472+
wheel
436473
script:
437474
# Install the project in editable mode to force to build all C extenions in-place. Otherwise, they won't be packaged
438475
# by briefcase
439-
- ./env/bin/python3 -m pip install -e .
476+
- ./env/bin/python3 -m pip install --no-deps -e .
440477
- briefcase create linux system
441478
- briefcase build linux system
442479
- briefcase package linux system
@@ -455,6 +492,11 @@ package:fedora:41:
455492
image: fedora:41
456493

457494

495+
package:fedora:42:
496+
extends: .package:rhel
497+
image: fedora:42
498+
499+
458500
package:opensuse:tumbleweed:
459501
stage: package
460502
image: opensuse/tumbleweed
@@ -468,10 +510,14 @@ package:opensuse:tumbleweed:
468510
- pipx install "briefcase==${BRIEFCASE_VERSION}"
469511
- export PATH="${HOME}/.local/bin:${PATH}"
470512
- python3 -m venv env
513+
- ./env/bin/python3 -m pip install -U
514+
pip
515+
setuptools
516+
wheel
471517
script:
472518
# Install the project in editable mode to force to build all C extenions in-place. Otherwise, they won't be packaged
473519
# by briefcase
474-
- ./env/bin/python3 -m pip install -e .
520+
- ./env/bin/python3 -m pip install --no-deps -e .
475521
- briefcase create linux system
476522
- briefcase build linux system
477523
- briefcase package linux system
@@ -500,10 +546,14 @@ package:flatpack:
500546
- pipx install "briefcase==${BRIEFCASE_VERSION}"
501547
- export PATH="${HOME}/.local/bin:${PATH}"
502548
- python3 -m venv env
549+
- ./env/bin/python3 -m pip install -U
550+
pip
551+
setuptools
552+
wheel
503553
script:
504554
# Install the project in editable mode to force to build all C extenions in-place. Otherwise, they won't be packaged
505555
# by briefcase
506-
- ./env/bin/python3 -m pip install -e .
556+
- ./env/bin/python3 -m pip install --no-deps -e .
507557
- briefcase create linux flatpak
508558
- briefcase build linux flatpak
509559
- briefcase package linux flatpak
@@ -575,6 +625,10 @@ package:macos:
575625
- ./create_icns.py pymoldyn/icon.png pymoldyn/icon.icns
576626
- GR_TEMPDIR="$(mktemp -d)"
577627
- python3 -m venv env
628+
- ./env/bin/python3 -m pip install -U
629+
pip
630+
setuptools
631+
wheel
578632
- GR_STABLE_VERSION="$(
579633
git ls-remote --tags "https://github.com/sciapp/gr" |
580634
awk 'match($2, /refs\/tags\/v[0-9]+\.[0-9]+\.[0-9]+$/) { print substr($2, RSTART + length("refs/tags/v")) }' |
@@ -587,7 +641,7 @@ package:macos:
587641
script:
588642
# Install the project in editable mode to force to build all C extenions in-place. Otherwise, they won't be packaged
589643
# by briefcase
590-
- ./env/bin/python3 -m pip install -e .
644+
- ./env/bin/python3 -m pip install --no-deps -e .
591645
- briefcase create
592646
# Force to use the universal GR binaries for x86_64 and arm64
593647
- rsync -a "${GR_TEMPDIR}/gr/" --exclude "Applications"
@@ -620,10 +674,14 @@ package:windows:
620674
-define "icon:auto-resize=16,32,48,64,128,256"
621675
pymoldyn/icon.ico
622676
- vcvars_cmd python -m venv env
677+
- ./env/Scripts/python -m pip install -U
678+
pip
679+
setuptools
680+
wheel
623681
script:
624682
# Install the project in editable mode to force to build all C extenions in-place. Otherwise, they won't be packaged
625683
# by briefcase
626-
- ./env/Scripts/python -m pip install -e .
684+
- ./env/Scripts/python -m pip install --no-deps -e .
627685
- vcvars_cmd python -m briefcase create
628686
- vcvars_cmd python -m briefcase build
629687
- vcvars_cmd python -m briefcase package --adhoc-sign

pymoldyn/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version_info__ = (0, 11, 0)
1+
__version_info__ = (0, 11, 1)
22
__version__ = ".".join(map(str, __version_info__))

pymoldyn/gui/gl_widget.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def __init__(self, parent, main_window):
4848
self.control = parent.control
4949
self.main_window = main_window
5050
self.setDisabled(True)
51+
self.vis.repaint_callback = self.update
5152

5253
@property
5354
def vis(self):

pymoldyn/visualization/visualization.py

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Visualization(object):
2222
Visualize Atoms and Cavities with GR3
2323
"""
2424

25-
def __init__(self):
25+
def __init__(self, repaint_callback=None):
2626
self.max_side_lengths = 1.0
2727
self.mat = np.eye(4)
2828
self.d = self.max_side_lengths * 2
@@ -37,7 +37,12 @@ def __init__(self):
3737
self.width = 0
3838
self.height = 0
3939
self.usecurrentframebuffer = False
40+
if repaint_callback is not None:
41+
self._repaint_callback = repaint_callback
42+
else:
43+
self._repaint_callback = lambda: self.paint(self.width, self.height)
4044
# self.assigned_opengl_context = None
45+
self._export_args = None
4146

4247
self.results = None
4348
self.settings = VisualizationSettings()
@@ -58,7 +63,7 @@ def setresults(self, results):
5863
self.far = 6 * max_side_lengths
5964
self.create_scene()
6065
if self.width != 0 and self.height != 0:
61-
self.paint(self.width, self.height)
66+
self.repaint_callback()
6267
self.settings.visible_domain_indices = None
6368
self.settings.visible_surface_cavity_indices = None
6469
self.settings.visible_center_cavity_indices = None
@@ -270,23 +275,28 @@ def paint(self, width, height, usecurrentframebuffer=None, device_pixel_ratio=1)
270275
self.usecurrentframebuffer = usecurrentframebuffer
271276
if self.usecurrentframebuffer:
272277
gr3.usecurrentframebuffer()
273-
gr3.drawimage(
274-
0,
275-
width * device_pixel_ratio,
276-
0,
277-
height * device_pixel_ratio,
278-
width,
279-
height,
280-
gr3.GR3_Drawable.GR3_DRAWABLE_OPENGL,
281-
)
278+
if self._export_args is not None:
279+
gr3.export(*self._export_args)
280+
self._export_args = None
281+
else:
282+
gr3.drawimage(
283+
0,
284+
width * device_pixel_ratio,
285+
0,
286+
height * device_pixel_ratio,
287+
width,
288+
height,
289+
gr3.GR3_Drawable.GR3_DRAWABLE_OPENGL,
290+
)
282291

283292
def save_screenshot(self, file_name, width=3840, height=2160, first=True, last=True):
284293
"""
285294
Save a screenshot in the given resolution.
286295
``first`` and ``last`` can be used to indicate if the first or last screenshot is taken when
287296
multiple images are saved in a loop for example.
288297
"""
289-
gr3.export(file_name, width, height)
298+
self._export_args = (file_name, width, height)
299+
self.repaint_callback()
290300

291301
def get_object_at_2dposition(self, x, y):
292302
oid = gr3.c_int(0)
@@ -317,6 +327,14 @@ def get_object_at_3dposition(self, x, y, z):
317327
if 0.95 < distances[nearest_atom_index] / atom_radius < 1.05:
318328
return ("atom", nearest_atom_index)
319329

330+
@property
331+
def repaint_callback(self):
332+
return self._repaint_callback
333+
334+
@repaint_callback.setter
335+
def repaint_callback(self, repaint_callback):
336+
self._repaint_callback = repaint_callback
337+
320338

321339
class VisualizationSettings(object):
322340
"""

0 commit comments

Comments
 (0)