Skip to content

Commit 3134fd3

Browse files
authored
Ensure that three.js is downloaded for offline HTML (#87)
1 parent d5d975e commit 3134fd3

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

src/ansys/dynamicreporting/core/utils/report_download_html.py

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def _download_special_files(self):
154154

155155
# Additional files to be mapped to the media directory
156156
images = ["menu_20_gray.png", "menu_20_white.png", "nexus_front_page.png", "nexus_logo.png"]
157-
self._download_static_files(images, "/static/website/images/", "media", "image")
157+
self._download_static_files(images, "/static/website/images/", "media", "nexus images")
158158

159159
# The old Ansys Nexus WebGL viewer
160160
images = [
@@ -169,7 +169,7 @@ def _download_special_files(self):
169169
"open.png",
170170
"Point.cur",
171171
]
172-
self._download_static_files(images, "/static/website/images/", "media", "viewer image")
172+
self._download_static_files(images, "/static/website/images/", "media", "viewer images I")
173173

174174
# The new Ansys Nexus WebGL viewer
175175
images = [
@@ -187,14 +187,16 @@ def _download_special_files(self):
187187
"play.png",
188188
]
189189
self._download_static_files(
190-
images, "/ansys/nexus/images/", "ansys/nexus/images/", "viewer image"
190+
images, "/ansys/nexus/images/", "ansys/nexus/images/", "viewer images II"
191191
)
192192
images = ["js-inflate.js", "js-unzip.js", "jquery.min.js"]
193193
self._download_static_files(
194-
images, "/ansys/nexus/utils/", "ansys/nexus/utils/", "viewer image"
194+
images, "/ansys/nexus/utils/", "ansys/nexus/utils/", "viewer javascript support"
195195
)
196196
images = ["ANSYSViewer_min.js", "viewer-loader.js"]
197-
self._download_static_files(images, "/ansys/nexus/", "ansys/nexus/", "viewer image")
197+
self._download_static_files(
198+
images, "/ansys/nexus/", "ansys/nexus/", "ansys-nexus-viewer js"
199+
)
198200
images = [
199201
"jquery.contextMenu.min.css",
200202
"jquery.contextMenu.min.js",
@@ -204,7 +206,37 @@ def _download_special_files(self):
204206
images,
205207
"/ansys/nexus/novnc/vendor/jQuery-contextMenu/",
206208
"ansys/nexus/novnc/vendor/jQuery-contextMenu",
207-
"viewer image",
209+
"ansys-nexus-viewer vnc js",
210+
)
211+
212+
image = [
213+
"ArcballControls.js",
214+
"DRACOLoader.js",
215+
"GLTFLoader.js",
216+
"OrbitControls.js",
217+
"three.js",
218+
]
219+
self._download_static_files(
220+
image, "/ansys/nexus/threejs/", "ansys/nexus/threejs", "threejs core"
221+
)
222+
223+
image = [
224+
"draco_decoder.js",
225+
"draco_decoder.wasm",
226+
"draco_encoder.js",
227+
"draco_wasm_wrapper.js",
228+
]
229+
self._download_static_files(
230+
image,
231+
"/ansys/nexus/threejs/libs/draco/",
232+
"ansys/nexus/threejs/libs/draco",
233+
"threejs draco",
234+
)
235+
self._download_static_files(
236+
image,
237+
"/ansys/nexus/threejs/libs/draco/gltf/",
238+
"ansys/nexus/threejs/libs/draco/gltf",
239+
"threejs draco gltf",
208240
)
209241

210242
# Fonts
@@ -215,7 +247,7 @@ def _download_special_files(self):
215247
"fa-solid-900.woff",
216248
"fa-solid-900.woff2",
217249
]
218-
self._download_static_files(fonts, "/static/website/webfonts/", "webfonts", "font")
250+
self._download_static_files(fonts, "/static/website/webfonts/", "webfonts", "fonts")
219251

220252
@staticmethod
221253
def _fix_viewer_component_paths(filename, data):
@@ -422,6 +454,7 @@ def _download(self):
422454
self._make_dir([self._directory, "webfonts"])
423455
self._make_dir([self._directory, "ansys", "nexus", "images"])
424456
self._make_dir([self._directory, "ansys", "nexus", "utils"])
457+
self._make_dir([self._directory, "ansys", "nexus", "threejs", "libs", "draco", "gltf"])
425458
self._make_dir([self._directory, "ansys", "nexus", "novnc", "vendor", "jQuery-contextMenu"])
426459

427460
# get the webpage html source

0 commit comments

Comments
 (0)