From 3ce40c8cdf0e59b1619cad783dea6721add8f146 Mon Sep 17 00:00:00 2001 From: Kushal Kolar Date: Sun, 9 Mar 2025 21:38:27 -0400 Subject: [PATCH 1/4] Update docs-deploy.yml --- .github/workflows/docs-deploy.yml | 36 +++++++++---------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index f854ed70d..d773a60fc 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -68,18 +68,18 @@ jobs: if: ${{ github.ref == 'refs/heads/main' }} # any push to main goes to fastplotlib.org/ver/dev run: echo "DOCS_VERSION_DIR=dev" >> "$GITHUB_ENV" - - # upload docs via FTP - - name: Deploy docs - uses: SamKirkland/FTP-Deploy-Action@v4.3.5 + + # upload docs via SCP + - name: copy file via ssh key + uses: appleboy/scp-action@v0.1.7 with: - server: ${{ secrets.DOCS_SERVER }} + host: ${{ secrets.DOCS_SERVER }} username: ${{ secrets.DOCS_USERNAME }} - password: ${{ secrets.DOCS_PASSWORD }} - # built docs - local-dir: docs/build/html/ - # output subdir based on the previous if statements - server-dir: ./ver/${{ env.DOCS_VERSION_DIR }}/ + port: ${{ secrets.DOCS_PORT }} + key: ${{ secrets.DOCS_KEY }} + passphrase: ${{ secrets.DOCS_PASS }} + source: "docs/build/html/*" + target: /home/${{ secrets.DOCS_USERNAME }}/public_html/ver/${{ env.DOCS_VERSION_DIR }}/ # comment on PR to provide link to built docs - name: Add PR link in comment @@ -88,19 +88,3 @@ jobs: with: message: | 📚 Docs preview built and uploaded! https://www.fastplotlib.org/ver/${{ env.DOCS_VERSION_DIR }} - - # also deploy to root if this is a new release - # i.e., fastplotlib.org/ points to docs for the latest release - - name: Deploy docs - if: ${{ github.ref_type == 'tag' }} - uses: SamKirkland/FTP-Deploy-Action@v4.3.5 - with: - server: ${{ secrets.DOCS_SERVER }} - username: ${{ secrets.DOCS_USERNAME }} - password: ${{ secrets.DOCS_PASSWORD }} - log-level: verbose - timeout: 60000 - local-dir: docs/build/html/ - server-dir: ./ # deploy to the root dir - exclude: | # don't delete the /ver/ dir - **/ver/** From 3fc9c483187fc920bba22815665760177d4d629f Mon Sep 17 00:00:00 2001 From: Kushal Kolar Date: Sun, 9 Mar 2025 22:26:10 -0400 Subject: [PATCH 2/4] Update _axes.py --- fastplotlib/graphics/_axes.py | 114 ++-------------------------------- 1 file changed, 6 insertions(+), 108 deletions(-) diff --git a/fastplotlib/graphics/_axes.py b/fastplotlib/graphics/_axes.py index 4938b1a97..10774fc2a 100644 --- a/fastplotlib/graphics/_axes.py +++ b/fastplotlib/graphics/_axes.py @@ -141,108 +141,6 @@ def yz(self) -> Grid: return self._yz -class Ruler(pygfx.Ruler): - def __init__(self, **kwargs): - super().__init__(**kwargs) - self.tick_text_mapper = None - self.font_size = 14 - - def _update_sub_objects(self, ticks, tick_auto_step): - """Update the sub-objects to show the given ticks.""" - assert isinstance(ticks, dict) - - tick_size = 5 - min_n_slots = 8 # todo: can be (much) higher when we use a single text object! - - # Load config - start_pos = self._start_pos - end_pos = self._end_pos - start_value = self._start_value - end_value = self.end_value - - # Derive some more variables - length = end_value - start_value - vec = end_pos - start_pos - if length: - vec /= length - - # Get array to store positions - n_slots = self.points.geometry.positions.nitems - n_positions = len(ticks) + 2 - if n_positions <= n_slots <= max(min_n_slots, 2 * n_positions): - # Re-use existing buffers - positions = self.points.geometry.positions.data - sizes = self.points.geometry.sizes.data - self.points.geometry.positions.update_range() - self.points.geometry.sizes.update_range() - else: - # Allocate new buffers - new_n_slots = max(min_n_slots, int(n_positions * 1.2)) - positions = np.zeros((new_n_slots, 3), np.float32) - sizes = np.zeros((new_n_slots,), np.float32) - self.points.geometry.positions = pygfx.Buffer(positions) - self.points.geometry.sizes = pygfx.Buffer(sizes) - # Allocate text objects - while len(self._text_object_pool) < new_n_slots: - ob = pygfx.Text( - pygfx.TextGeometry("", screen_space=True, font_size=self.font_size), - pygfx.TextMaterial(aa=False), - ) - self._text_object_pool.append(ob) - self._text_object_pool[new_n_slots:] = [] - # Reset children - self.clear() - self.add(self._line, self._points, *self._text_object_pool) - - def define_text(pos, text): - if self.tick_text_mapper is not None and text != "": - text = self.tick_text_mapper(text) - - ob = self._text_object_pool[index] - ob.geometry.anchor = self._text_anchor - ob.geometry.anchor_offset = self._text_anchor_offset - ob.geometry.set_text(text) - ob.local.position = pos - - # Apply start point - index = 0 - positions[0] = start_pos - if self._ticks_at_end_points: - sizes[0] = tick_size - define_text(start_pos, f"{self._start_value:0.4g}") - else: - sizes[0] = 0 - define_text(start_pos, f"") - - # Collect ticks - index += 1 - for value, text in ticks.items(): - pos = start_pos + vec * (value - start_value) - positions[index] = pos - sizes[index] = tick_size - define_text(pos, text) - index += 1 - - # Handle end point, and nullify remaining slots - positions[index:] = end_pos - sizes[index:] = 0 - for ob in self._text_object_pool[index:]: - ob.geometry.set_text("") - - # Show last tick? - if self._ticks_at_end_points: - sizes[index] = tick_size - define_text(end_pos, f"{end_value:0.4g}") - - # Hide the ticks close to the ends? - if self._ticks_at_end_points and ticks: - tick_values = list(ticks.keys()) - if abs(tick_values[0] - start_value) < 0.5 * tick_auto_step: - self._text_object_pool[1].geometry.set_text("") - if abs(tick_values[-1] - end_value) < 0.5 * tick_auto_step: - self._text_object_pool[index - 1].geometry.set_text("") - - class Axes: def __init__( self, @@ -283,9 +181,9 @@ def __init__( } # create ruler for each dim - self._x = Ruler(**x_kwargs) - self._y = Ruler(**y_kwargs) - self._z = Ruler(**z_kwargs) + self._x = pygfx.Ruler(**x_kwargs) + self._y = pygfx.Ruler(**y_kwargs) + self._z = pygfx.Ruler(**z_kwargs) self._offset = offset @@ -400,17 +298,17 @@ def offset(self, value: np.ndarray): self._offset = value @property - def x(self) -> Ruler: + def x(self) -> pygfx.Ruler: """x axis ruler""" return self._x @property - def y(self) -> Ruler: + def y(self) -> pygfx.Ruler: """y axis ruler""" return self._y @property - def z(self) -> Ruler: + def z(self) -> pygfx.Ruler: """z axis ruler""" return self._z From 84ea217961a6773be0fc1dc9d5ac44719fdc471f Mon Sep 17 00:00:00 2001 From: Kushal Kolar Date: Sun, 9 Mar 2025 22:42:12 -0400 Subject: [PATCH 3/4] Update docs-deploy.yml --- .github/workflows/docs-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index d773a60fc..37b79a8a6 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -79,6 +79,7 @@ jobs: key: ${{ secrets.DOCS_KEY }} passphrase: ${{ secrets.DOCS_PASS }} source: "docs/build/html/*" + strip_components: 3 target: /home/${{ secrets.DOCS_USERNAME }}/public_html/ver/${{ env.DOCS_VERSION_DIR }}/ # comment on PR to provide link to built docs From af621d9cc67a08a199bc51658255c60202f75911 Mon Sep 17 00:00:00 2001 From: Kushal Kolar Date: Sun, 9 Mar 2025 23:28:12 -0400 Subject: [PATCH 4/4] Update docs-deploy.yml --- .github/workflows/docs-deploy.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index 37b79a8a6..a0cb54357 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -70,7 +70,7 @@ jobs: run: echo "DOCS_VERSION_DIR=dev" >> "$GITHUB_ENV" # upload docs via SCP - - name: copy file via ssh key + - name: Deploy docs uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.DOCS_SERVER }} @@ -79,6 +79,7 @@ jobs: key: ${{ secrets.DOCS_KEY }} passphrase: ${{ secrets.DOCS_PASS }} source: "docs/build/html/*" + # without strip_components it creates dirs docs/build/html within /ver on the server strip_components: 3 target: /home/${{ secrets.DOCS_USERNAME }}/public_html/ver/${{ env.DOCS_VERSION_DIR }}/ @@ -89,3 +90,18 @@ jobs: with: message: | 📚 Docs preview built and uploaded! https://www.fastplotlib.org/ver/${{ env.DOCS_VERSION_DIR }} + + # upload docs via SCP + - name: Deploy docs release + if: ${{ github.ref_type == 'tag' }} + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.DOCS_SERVER }} + username: ${{ secrets.DOCS_USERNAME }} + port: ${{ secrets.DOCS_PORT }} + key: ${{ secrets.DOCS_KEY }} + passphrase: ${{ secrets.DOCS_PASS }} + source: "docs/build/html/*" + # without strip_components it creates dirs docs/build/html within /ver on the server + strip_components: 3 + target: /home/${{ secrets.DOCS_USERNAME }}/public_html/ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy