-
-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
threejs: access files through features, for simpler configuration
- Loading branch information
Showing
4 changed files
with
59 additions
and
6 deletions.
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import os | ||
|
||
from . import StaticFile | ||
|
||
|
||
class Threejs(StaticFile): | ||
r""" | ||
A :class:`~sage.features.Feature` which describes the presence of | ||
threejs-sage in a few standard locations. | ||
EXAMPLES:: | ||
sage: from sage.features.threejs import Threejs | ||
sage: bool(Threejs().is_present()) # needs threejs | ||
True | ||
""" | ||
|
||
def __init__(self): | ||
r""" | ||
TESTS:: | ||
sage: from sage.features.threejs import Threejs | ||
sage: isinstance(Threejs(), Threejs) | ||
True | ||
""" | ||
from sage.env import SAGE_SHARE, THREEJS_DIR | ||
from sage.repl.rich_output import display_manager | ||
|
||
version = display_manager._required_threejs_version() | ||
|
||
threejs_search_path = THREEJS_DIR or ( | ||
os.path.join(SAGE_SHARE, "jupyter", "nbextension", "threejs-sage"), | ||
os.path.join(SAGE_SHARE, "sagemath", "threejs-sage"), | ||
os.path.join(SAGE_SHARE, "threejs-sage") | ||
) | ||
|
||
StaticFile.__init__( | ||
self, name="threejs", | ||
filename=os.path.join(version, "three.min.js"), | ||
spkg="threejs", | ||
type="standard", | ||
search_path=threejs_search_path, | ||
description="JavaScript library to display 3D graphics") | ||
|
||
|
||
def all_features(): | ||
return [Threejs()] |
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