-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/viewer-widget #8
Conversation
docs/_static/compas.css
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static icons and css clean up. the config.py
is also updated based on Tom's template.
src/compas_viewer/viewer.py
Outdated
# ========================================================================== | ||
# Messages | ||
# ========================================================================== | ||
def _about(self) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming this _about
because the name about
is occupied by the about: str
from the config file.
I was careful about the _
for private functions and attributes. most of them I produced are private, so they are all with the _
prefix
temp.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this random file was accidentally uploaded last time. remove now
src/compas_viewer/viewer.py
Outdated
config: Optional[ViewerConfigData] = None, | ||
) -> None: | ||
# custom or default config | ||
config = config or Viewer.from_default().data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the use from_default
like this doesn't make sense to me.
"from" functions are supposed to be alternative constructors.
they can be used as an alternative to the normal constructor, not inside of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. let me write as config = config or ViewerConfig.from_default().data
which makes more sense.
src/compas_viewer/viewer.py
Outdated
ICONS = Path(Path(__file__).parent, "_static", "icons") | ||
|
||
|
||
class Viewer(ViewerConfig): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does the viewer extend the viewer configuration?
should the configuration not be an attribute of the viewer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should find a better name for ViewerConfig
since I understand making the viewer
inherited from its config doesn't make sense.. but the idea is:
inheritance tree: compas.Data -> compas_viewer.Config -> compas_viewer.ViewerConfig -> compas_viewer.View
so the needed config is safely checked before initialising the Viewer
, and we don't have to assign every config attribute into the Viewer
. The Viewer
naturally has the attributes like width
at the beginning.
In the past we the View was inherited from the Qt like class View(QtWidgets.QOpenGLWidget):
, which is a bit indirect for other operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
things like an OpenGL view should not be based on the data framework
src/compas_viewer/viewer.py
Outdated
# ========================================================================== | ||
# Messages | ||
# ========================================================================== | ||
def _about(self) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add blank line and remove the underscore (since this seems to be a public method: it is used in one of the examples)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes you are right. but
naming this _about because the name about is occupied by the about: str from the config file.
any suggestion on solving this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it cannot be that the config file is in this namespace since the viewer should not inherit from config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this can now just be "about"
pytest locally sucssful but in the github action: tests/test_placeholder.py . [ 50%]
Fatal Python error: Aborted
Current thread 0x00007f48d8437b80 (most recent call first):
File "/home/runner/work/compas_viewer/compas_viewer/src/compas_viewer/viewer.py", line 105 in _init
File "/home/runner/work/compas_viewer/compas_viewer/src/compas_viewer/viewer.py", line 89 in __init__
File "/home/runner/work/compas_viewer/compas_viewer/tests/test_viewer.py", line 12 in test_default_config
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/python.py", line 194 in pytest_pyfunc_call
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_callers.py", line 77 in _multicall
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_manager.py", line 115 in _hookexec
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_hooks.py", line 493 in __call__
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/python.py", line 1[792](https://github.com/compas-dev/compas_viewer/actions/runs/7239911557/job/19722325003?pr=8#step:2:807) in runtest
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/runner.py", line 169 in pytest_runtest_call
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_callers.py", line 77 in _multicall
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_manager.py", line 115 in _hookexec
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_hooks.py", line 493 in __call__
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/runner.py", line 262 in <lambda>
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/runner.py", line 341 in from_call
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/runner.py", line 261 in call_runtest_hook
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/runner.py", line 222 in call_and_report
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/runner.py", line 133 in runtestprotocol
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/runner.py", line 114 in pytest_runtest_protocol
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_callers.py", line 77 in _multicall
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_manager.py", line 115 in _hookexec
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_hooks.py", line 493 in __call__
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/main.py", line 350 in pytest_runtestloop
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_callers.py", line 77 in _multicall
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_manager.py", line 115 in _hookexec
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_hooks.py", line 493 in __call__
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/main.py", line 325 in _main
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/main.py", line 271 in wrap_session
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/main.py", line 318 in pytest_cmdline_main
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_callers.py", line 77 in _multicall
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_manager.py", line 115 in _hookexec
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pluggy/_hooks.py", line 493 in __call__
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/config/__init__.py", line 169 in main
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/config/__init__.py", line 192 in console_main
File "/opt/hostedtoolcache/Python/3.8.18/x64/bin/pytest", line 8 in <module>
tests/test_viewer.py
Error: Process completed with exit code 250. any suggestion? should I write less test files but doc examples to exam... ? |
for me the test works locally, but the user has to close the viewer window to stop the test so i don't know how this would work in a workflow. i don't think this is needed right now... |
also, i would still use an environment with a conda-based setup for this repo, especially to make it cross-platform. for me the following environment works well and doesn't take much time to resolve... (you may need to tweak it for windows) name: viewer-dev
channels:
- conda-forge
dependencies:
- python=3.9
- pip
- freetype-py
- textdistance
- pyside2
- pyopengl
- qtpy
- pip:
- -r requirements-dev.txt and compas 2 is needed as well of course... |
that is because pytest intelligently test examples: 057 Examples
058 -------
059 >>> from compas_viewer import Viewer
060 >>> viewer = Viewer()
061 >>> viewer.show()
I remove the example for now |
you can add |
but if it worked with the pip install until now, just leave it, we can have a look at this later... |
src/compas_viewer/viewer.py
Outdated
Examples | ||
------- | ||
>>> from compas_viewer import Viewer | ||
>>> viewer = Viewer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to skip this as well, because it sets a lot of stuff in motion that is otherwise never properly stopped...
comment summary: This PR is ready to be merged if we are happy with these three questions: |
src/compas_viewer/viewer.py
Outdated
# ========================================================================== | ||
# Messages | ||
# ========================================================================== | ||
def _about(self) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this can now just be "about"
What type of change is this?
Viewer
buildup with the widgets:sphinx-compas2-theme
compatibility.Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.CHANGELOG.md
file in theUnreleased
section under the most fitting heading (e.g.Added
,Changed
,Removed
).invoke test
).invoke lint
).compas.datastructures.Mesh
.