From 644e72dc8fd0a98a6ecdade4dfc6a1f9627348bf Mon Sep 17 00:00:00 2001 From: Zac Zhang Date: Sat, 16 Dec 2023 16:51:24 +0100 Subject: [PATCH] Fix rst line `=`, change VIEW_ANGLES to VIEW_PORTS --- docs/examples/control/example_camera_config.rst | 6 +++--- docs/tutorials/tutorial_configuration.rst | 4 ++-- docs/tutorials/tutorial_software_concepts.rst | 4 ++-- src/compas_view2/app/controller.py | 8 ++++---- src/compas_view2/scene/camera.py | 14 +++++++------- src/compas_view2/views/view.py | 4 ++-- src/compas_view2/views/view120.py | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/examples/control/example_camera_config.rst b/docs/examples/control/example_camera_config.rst index c4390e309..257a5d05d 100644 --- a/docs/examples/control/example_camera_config.rst +++ b/docs/examples/control/example_camera_config.rst @@ -7,7 +7,7 @@ Camera Config :nosignatures: Default Camera Config -==================== +====================== By default, the camera is configed 45 dregees perspective: @@ -18,12 +18,12 @@ By default, the camera is configed 45 dregees perspective: Custom Camera Config -==================== +====================== You can customize the camera configreation by passing the dictionary to the viewer: fov, near, fac, position, target, scale. .. note:: - The `position` is not editable and would be ingored from the config file in `TOP`, `FRONT`, `RIGHT`modes. + The `position` is not editable and would be ingored from the config file in `TOP`, `FRONT`, `RIGHT` modes. .. figure:: /_images/example_camera_config_2.jpg :figclass: figure diff --git a/docs/tutorials/tutorial_configuration.rst b/docs/tutorials/tutorial_configuration.rst index e36433f00..0fca4f3e3 100644 --- a/docs/tutorials/tutorial_configuration.rst +++ b/docs/tutorials/tutorial_configuration.rst @@ -65,7 +65,7 @@ This is a quick way to customize your viewer. It is suitable for task-specific c Configuration Structure -====================== +======================================== The default configuration file can be downloaded here: :download:`Link `, or can be printed by the following code: @@ -78,7 +78,7 @@ or can be printed by the following code: It it the template for creating your own settings, keyboard preferences, etc. Supported Keys -=============== +=================== In the `controller -> keys`, you can add you preferred keys. Currently, :mod:`compas_view2` supports below keys: .. figure:: /_images/keyboard.png diff --git a/docs/tutorials/tutorial_software_concepts.rst b/docs/tutorials/tutorial_software_concepts.rst index a05e91adc..8e8c89000 100644 --- a/docs/tutorials/tutorial_software_concepts.rst +++ b/docs/tutorials/tutorial_software_concepts.rst @@ -25,7 +25,7 @@ to help you better the design concepts behind it. Software Architecture -=================== +====================== .. figure:: /_images/software_concept.png :figclass: figure @@ -39,7 +39,7 @@ UI Components :class: figure-img img-fluid Configuration Structure -===================== +=========================== .. figure:: /_images/config_structure.png :figclass: figure :class: figure-img img-fluid diff --git a/src/compas_view2/app/controller.py b/src/compas_view2/app/controller.py index 722b2267f..52d59ae02 100644 --- a/src/compas_view2/app/controller.py +++ b/src/compas_view2/app/controller.py @@ -431,7 +431,7 @@ def view_front(self): None """ - self.app.view.current = self.app.view.VIEW_ANGLES["FRONT"] + self.app.view.current = self.app.view.VIEW_PORTS["FRONT"] self.app.view.camera.reset_position() self.app.view.update_projection() self.app.view.update() @@ -444,7 +444,7 @@ def view_right(self): None """ - self.app.view.current = self.app.view.VIEW_ANGLES["RIGHT"] + self.app.view.current = self.app.view.VIEW_PORTS["RIGHT"] self.app.view.camera.reset_position() self.app.view.update_projection() self.app.view.update() @@ -457,7 +457,7 @@ def view_top(self): None """ - self.app.view.current = self.app.view.VIEW_ANGLES["TOP"] + self.app.view.current = self.app.view.VIEW_PORTS["TOP"] self.app.view.camera.reset_position() self.app.view.update_projection() self.app.view.update() @@ -470,7 +470,7 @@ def view_perspective(self): None """ - self.app.view.current = self.app.view.VIEW_ANGLES["PERSPECTIVE"] + self.app.view.current = self.app.view.VIEW_PORTS["PERSPECTIVE"] self.app.view.camera.reset_position() self.app.view.update_projection() self.app.view.update() diff --git a/src/compas_view2/scene/camera.py b/src/compas_view2/scene/camera.py index 0d2378fef..8f1bab672 100644 --- a/src/compas_view2/scene/camera.py +++ b/src/compas_view2/scene/camera.py @@ -238,13 +238,13 @@ def _on_target_update(self, target): def reset_position(self): """Reset the position of the camera based current view type.""" self.target.set(0, 0, 0) - if self.view.current == self.view.VIEW_ANGLES["PERSPECTIVE"]: + if self.view.current == self.view.VIEW_PORTS["PERSPECTIVE"]: self.rotation.set(pi / 4, 0, -pi / 4) - if self.view.current == self.view.VIEW_ANGLES["TOP"]: + if self.view.current == self.view.VIEW_PORTS["TOP"]: self.rotation.set(0, 0, 0) - if self.view.current == self.view.VIEW_ANGLES["FRONT"]: + if self.view.current == self.view.VIEW_PORTS["FRONT"]: self.rotation.set(pi / 2, 0, 0) - if self.view.current == self.view.VIEW_ANGLES["RIGHT"]: + if self.view.current == self.view.VIEW_PORTS["RIGHT"]: self.rotation.set(pi / 2, 0, pi / 2) def rotate(self, dx, dy): @@ -263,10 +263,10 @@ def rotate(self, dx, dy): Notes ----- - Camera rotations are only available if the current view is a perspective view (``camera.view.current == camera.view.VIEW_ANGLES["PERSPECTIVE"]``). + Camera rotations are only available if the current view is a perspective view (``camera.view.current == camera.view.VIEW_PORTS["PERSPECTIVE"]``). """ - if self.view.current == self.view.VIEW_ANGLES["PERSPECTIVE"]: + if self.view.current == self.view.VIEW_PORTS["PERSPECTIVE"]: self.rotation += [-self.rotation_delta * dy, 0, -self.rotation_delta * dx] def pan(self, dx, dy): @@ -326,7 +326,7 @@ def projection(self, width, height): """ aspect = width / height - if self.view.current == self.view.VIEW_ANGLES["PERSPECTIVE"]: + if self.view.current == self.view.VIEW_PORTS["PERSPECTIVE"]: P = perspective(self.fov, aspect, self.near * self.scale, self.far * self.scale) else: left = -self.distance diff --git a/src/compas_view2/views/view.py b/src/compas_view2/views/view.py index ca7fa7d9e..aca9ce64b 100644 --- a/src/compas_view2/views/view.py +++ b/src/compas_view2/views/view.py @@ -19,13 +19,13 @@ class View(QtWidgets.QOpenGLWidget): The view configuration. """ - VIEW_ANGLES = {"FRONT": 1, "RIGHT": 2, "TOP": 3, "PERSPECTIVE": 4} + VIEW_PORTS = {"FRONT": 1, "RIGHT": 2, "TOP": 3, "PERSPECTIVE": 4} def __init__(self, app, view_config): super().__init__() self.setFocusPolicy(QtCore.Qt.StrongFocus) self._opacity = 1.0 - self._current = self.VIEW_ANGLES[view_config["view_port"]] + self._current = self.VIEW_PORTS[view_config["view_port"]] self.shader_model = None self.app = app self.color = view_config["background_color"] diff --git a/src/compas_view2/views/view120.py b/src/compas_view2/views/view120.py index 9ade0564d..38c09cfe2 100644 --- a/src/compas_view2/views/view120.py +++ b/src/compas_view2/views/view120.py @@ -119,7 +119,7 @@ def sort_objects_from_viewworld(self, viewworld): def paint(self): viewworld = self.camera.viewworld() - if self.current != self.VIEW_ANGLES["PERSPECTIVE"]: + if self.current != self.VIEW_PORTS["PERSPECTIVE"]: self.update_projection() # Draw instance maps