File tree Expand file tree Collapse file tree 3 files changed +15
-20
lines changed Expand file tree Collapse file tree 3 files changed +15
-20
lines changed Original file line number Diff line number Diff line change
1
+ import os
2
+
1
3
import matplotlib .tri as mtri
2
4
import numpy as np
3
5
from matplotlib import animation
@@ -96,4 +98,6 @@ def main(fname="source/_static/logo_docs.mp4"):
96
98
97
99
98
100
if __name__ == "__main__" :
99
- main ()
101
+ fname = "_static/logo_docs.mp4"
102
+ if not os .path .exists (fname ):
103
+ main (fname )
Original file line number Diff line number Diff line change 14
14
import os
15
15
import sys
16
16
17
- from docutils import nodes
18
- from docutils .parsers .rst import Directive
19
-
20
17
package_path = os .path .abspath ("../.." )
21
18
# Insert into sys.path so that we can import adaptive here
22
19
sys .path .insert (0 , package_path )
160
157
html_logo = "_static/logo_docs.png"
161
158
162
159
163
- class RunLogoAnimated (Directive ):
164
- def run (self ):
165
- fname = "_static/logo_docs.mp4"
166
- if not os .path .exists (fname ):
167
- import logo_animated
168
-
169
- print (f"{ fname } does not exist." )
170
- logo_animated .main (fname )
171
- style = "width: 400px; max-width: 100%; margin: 0 auto; display:block;"
172
- opts = f'autoplay loop muted playsinline webkit-playsinline style="{ style } "'
173
- html = f'<video { opts } ><source src="{ fname } " type="video/mp4"></video><br>'
174
- return [nodes .raw (text = html , format = "html" )]
175
-
176
-
177
160
def setup (app ):
178
161
app .add_css_file ("custom.css" ) # For the `live_info` widget
179
- app .add_directive ("animated-logo" , RunLogoAnimated )
Original file line number Diff line number Diff line change 1
- .. animated-logo ::
1
+ .. jupyter-execute :: ../logo_animated.py
2
+ :hide-code:
3
+ :hide-output:
4
+
5
+ .. raw :: html
6
+
7
+ <video autoplay loop muted playsinline webkit-playsinline
8
+ style =" width : 400px ; max-width : 100% ; margin : 0 auto ; display :block ;" >
9
+ <source src =" _static/logo_docs.mp4" type =" video/mp4" >
10
+ </video ><br >
You can’t perform that action at this time.
0 commit comments