-
Notifications
You must be signed in to change notification settings - Fork 182
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
RF: Flatten the window folder to the file #955
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,42 @@ | ||
from typing import TypeAlias | ||
|
||
import pygfx as gfx | ||
from wgpu.gui.auto import WgpuCanvas, run | ||
from wgpu.gui.offscreen import WgpuCanvas as OffscreenWgpuCanvas | ||
|
||
from fury.optpkg import optional_package | ||
|
||
jupyter_pckg_msg = ( | ||
"You do not have jupyter-rfb installed. The jupyter widget will not work for " | ||
"you. Please install or upgrade jupyter-rfb using pip install -U jupyter-rfb" | ||
) | ||
|
||
jupyter_rfb, have_jupyter_rfb, _ = optional_package( | ||
"jupyter-rfb", trip_msg=jupyter_pckg_msg | ||
) | ||
|
||
if have_jupyter_rfb: | ||
from wgpu.gui.jupyter import WgpuCanvas as JupyterWgpuCanvas | ||
|
||
Texture = gfx.Texture | ||
AmbientLight = gfx.AmbientLight | ||
Background = gfx.Background | ||
BackgroundSkyboxMaterial = gfx.BackgroundSkyboxMaterial | ||
Camera = gfx.Camera | ||
Controller = gfx.Controller | ||
|
||
# Classes that needed to be written as types | ||
Camera: TypeAlias = gfx.Camera | ||
Controller: TypeAlias = gfx.Controller | ||
Scene: TypeAlias = gfx.Scene | ||
Viewport: TypeAlias = gfx.Viewport | ||
|
||
DirectionalLight = gfx.DirectionalLight | ||
OrbitController = gfx.OrbitController | ||
PerspectiveCamera = gfx.PerspectiveCamera | ||
GfxScene = gfx.Scene | ||
Viewport = gfx.Viewport | ||
WgpuRenderer = gfx.WgpuRenderer | ||
Renderer = gfx.WgpuRenderer | ||
run = run | ||
Canvas = WgpuCanvas | ||
OffscreenCanvas = OffscreenWgpuCanvas | ||
if have_jupyter_rfb: | ||
JupyterCanvas = JupyterWgpuCanvas | ||
else: | ||
JupyterCanvas = jupyter_rfb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What do you need the TypeAlias here ?
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 gives pre-commit error as these classes are used to either extend the class or used as type in a dataclass.
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.
strange, ok, I look into it later, merging
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.
@skoudoro you can take a look at this. The pre-commit points to this resource when it gives the error. https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases