Skip to content

Commit e0a655b

Browse files
committed
smaller pyvista window and default view direction
1 parent abe982a commit e0a655b

2 files changed

Lines changed: 46 additions & 7 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Update Binder tutorials on release
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
jobs:
8+
update-binder-repo:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout binder-tutorials repo
12+
uses: actions/checkout@v4
13+
with:
14+
repository: gemc/binder-tutorials
15+
token: ${{ secrets.BINDER_REPO_PAT }} # PAT with repo write access
16+
path: binder-tutorials
17+
18+
- name: Patch the Dockerfile with the new release tag
19+
run: |
20+
TAG="${{ github.event.release.tag_name }}"
21+
sed -i "s|FROM gemc/gemc:.*|FROM gemc/gemc:${TAG}|" \
22+
binder-tutorials/Dockerfile
23+
echo "Updated Dockerfile to gemc/gemc:${TAG}"
24+
25+
- name: Commit and push
26+
working-directory: binder-tutorials
27+
run: |
28+
git config user.name "gemc-bot"
29+
git config user.email "ungaro@jlab.org"
30+
git add Dockerfile
31+
git commit -m "chore: bump GEMC to ${{ github.event.release.tag_name }}"
32+
git push
33+
34+
- name: Pre-warm Binder cache
35+
run: |
36+
TAG="${{ github.event.release.tag_name }}"
37+
REPO="gemc%2Fbinder-tutorials"
38+
curl -s "https://mybinder.org/build/gh/${REPO}/main" \
39+
--max-time 300 --no-buffer | tail -5
40+
echo "Binder pre-warm triggered for ${TAG}"

api/gconfiguration.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ def get_arguments(argv=None):
7272
action="store_true",
7373
help="Use PyVista BackgroundPlotter (non-blocking GUI, needs pyqt6 pyvistaqt)",
7474
)
75-
parser.add_argument("-pvw", "--width", type=int, default=2400, help="Set plotter width")
76-
parser.add_argument("-pvh", "--height", type=int, default=1600, help="Set plotter height")
75+
parser.add_argument("-pvw", "--width", type=int, default=1200, help="Set plotter width")
76+
parser.add_argument("-pvh", "--height", type=int, default=800, help="Set plotter height")
7777
parser.add_argument("-pvx", "--x", type=int, default=0, help="Set plotter x position")
7878
parser.add_argument("-pvy", "--y", type=int, default=0, help="Set plotter y position")
7979
parser.add_argument("-axes", "--add_axes_at_zero", action="store_true",
@@ -169,7 +169,6 @@ def plotter(self):
169169

170170
self._plotter.add_axes()
171171
self._plotter.set_background("#303048", top="#000020")
172-
self._plotter.camera_position = "iso"
173172

174173
return self._plotter
175174

@@ -320,7 +319,6 @@ def show(self, block: bool = True):
320319
if _in_jupyter:
321320

322321
cpos = self._configure_camera_from_bounds(
323-
margin=-12.8,
324322
distance_scale=3.0,
325323
)
326324
return p.show(
@@ -367,8 +365,9 @@ def _configure_camera_from_bounds(self, margin: float = 0.8, distance_scale: flo
367365
if scene_len <= 0:
368366
scene_len = max(dx, dy, dz, 1.0)
369367

370-
direction = np.array([1.0, 1.0, 1.0])
371-
direction /= np.linalg.norm(direction)
368+
# View from +X toward the geometry center.
369+
# With this view_up, +Z goes left-to-right on screen.
370+
direction = np.array([1.0, 0.0, 0.0])
372371

373372
# Larger distance_scale = more zoomed out
374373
distance = distance_scale * scene_len
@@ -377,7 +376,7 @@ def _configure_camera_from_bounds(self, margin: float = 0.8, distance_scale: flo
377376
cpos = [
378377
tuple(position),
379378
tuple(center),
380-
(0, 0, 1),
379+
(0, -1, 0),
381380
]
382381

383382
p.camera_position = cpos

0 commit comments

Comments
 (0)