lavavu 1.9.5__cp39-cp39-win_amd64.whl → 1.9.6__cp39-cp39-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
lavavu/html/menu.js CHANGED
@@ -123,7 +123,12 @@ function menu_addctrls(menu, obj, viewer, onchange) {
123
123
  //Check if it has been set on the target object
124
124
  if (prop in obj) {
125
125
  //console.log(prop + " ==> " + JSON.stringify(viewer.dict[prop]));
126
- menu_addctrl(menu, obj, viewer, prop, onchange);
126
+ try {
127
+ //Catch errors and continue gracefully
128
+ menu_addctrl(menu, obj, viewer, prop, onchange);
129
+ } catch(e) {
130
+ console.log("Error adding control to menu: " + e);
131
+ }
127
132
 
128
133
  } else {
129
134
  //Save list of properties without controls
@@ -159,9 +164,9 @@ function menu_addctrls(menu, obj, viewer, onchange) {
159
164
 
160
165
  function menu_addcmaps(menu, obj, viewer, onchange) {
161
166
  //Colourmap editing menu
162
- if (viewer.cgui.prmenu) viewer.cgui.removeFolder(viewer.cgui.prmenu);
163
- if (viewer.cgui.cmenu) viewer.cgui.removeFolder(viewer.cgui.cmenu);
164
- if (viewer.cgui.pomenu) viewer.cgui.removeFolder(viewer.cgui.pomenu);
167
+ if (viewer.cgui.prmenu) viewer.cgui.remove(viewer.cgui.prmenu);
168
+ if (viewer.cgui.cmenu) viewer.cgui.remove(viewer.cgui.cmenu);
169
+ if (viewer.cgui.pomenu) viewer.cgui.remove(viewer.cgui.pomenu);
165
170
  viewer.cgui.prmenu = viewer.cgui.addFolder("Properties");
166
171
  viewer.cgui.cmenu = viewer.cgui.addFolder("Colours");
167
172
  viewer.cgui.pomenu = viewer.cgui.addFolder("Positions");
lavavu/html/webview.html CHANGED
@@ -27,7 +27,7 @@
27
27
 
28
28
  <input id="fileinput" type="file" style="visibility:hidden" onchange="useFileInput(this)" />
29
29
 
30
- <script async src="https://cdn.jsdelivr.net/gh/lavavu/lavavu.github.io@1.9.5/LavaVu-amalgamated.min.js"></script>
30
+ <script async src="https://cdn.jsdelivr.net/gh/lavavu/lavavu.github.io@1.9.6/LavaVu-amalgamated.min.js"></script>
31
31
  <!--script src="dat.gui.min.js"></script>
32
32
  <script src="OK-min.js"></script>
33
33
 
lavavu/lavavu.py CHANGED
@@ -4187,7 +4187,7 @@ class Viewer(dict):
4187
4187
  from IPython.display import display,HTML,Javascript
4188
4188
  display(Javascript(js + code))
4189
4189
 
4190
- def video(self, filename="", resolution=(0,0), fps=30, quality=0, encoder="h264", player=None, options={}, **kwargs):
4190
+ def video(self, filename="", resolution=(0,0), fps=30, quality=2, encoder="h264", embed=False, player=None, options={}, **kwargs):
4191
4191
  """
4192
4192
  Record and show the generated video inline within an ipython notebook.
4193
4193
 
@@ -4214,6 +4214,9 @@ class Viewer(dict):
4214
4214
  If omitted will use default settings, can fine tune settings in kwargs
4215
4215
  encoder : str
4216
4216
  Name of encoder to use, eg: "h264" (default), "mpeg"
4217
+ embed : bool
4218
+ Set to true to embed the video file rather than link to url
4219
+ Not recommended for large videos, default is False
4217
4220
  player : dict
4218
4221
  Args to pass to the player when the video is finished, eg:
4219
4222
  {"width" : 800, "height", 400, "params": "controls autoplay"}
@@ -4228,12 +4231,11 @@ class Viewer(dict):
4228
4231
  recorder : Video(object)
4229
4232
  Context manager object that controls the video recording
4230
4233
  """
4231
- return Video(self, filename, resolution, fps, quality, encoder, player, options, **kwargs)
4234
+ return Video(self, filename, resolution, fps, quality, encoder, embed, player, options, **kwargs)
4232
4235
 
4233
- def video_steps(self, filename="", start=0, end=0, resolution=(0,0), fps=30, quality=2, encoder="h264", player=None, options={}, **kwargs):
4236
+ def video_steps(self, filename="", start=0, end=0, resolution=(0,0), fps=30, quality=2, encoder="h264", embed=False, player=None, options={}, **kwargs):
4237
+ my_func.__doc__
4234
4238
  """
4235
- TODO: Fix to use pyAV
4236
-
4237
4239
  Record a video of the model by looping through all time steps
4238
4240
 
4239
4241
  Shows the generated video inline within an ipython notebook.
@@ -4245,21 +4247,12 @@ class Viewer(dict):
4245
4247
 
4246
4248
  Parameters
4247
4249
  ----------
4248
- filename : str
4249
- Name of the file to save, if not provided a default will be used
4250
4250
  start : int
4251
4251
  First timestep to record, if not specified will use first available
4252
4252
  end : int
4253
4253
  Last timestep to record, if not specified will use last available
4254
- resolution : list or tuple
4255
- Video resolution in pixels [x,y]
4256
- fps : int
4257
- Frames to output per second of video
4258
- quality : int
4259
- Encoding quality, 1=low, 2=medium(default), 3=high, higher quality reduces
4260
- encoding artifacts at cost of larger file size
4261
- **kwargs :
4262
- Any additional keyword args will also be passed as options to the encoder
4254
+
4255
+ All other parameters same as video()
4263
4256
  """
4264
4257
 
4265
4258
  try:
@@ -4267,7 +4260,7 @@ class Viewer(dict):
4267
4260
  if end == 0: end = len(steps)
4268
4261
  steps = steps[start:end]
4269
4262
  from tqdm.notebook import tqdm
4270
- with Video(self, filename, resolution, fps, quality, encoder, player, options, **kwargs):
4263
+ with Video(self, filename, resolution, fps, quality, encoder, embed, player, options, **kwargs):
4271
4264
  for s in tqdm(steps, desc='Rendering loop'):
4272
4265
  self.timestep(s)
4273
4266
  self.render()
@@ -5415,37 +5408,44 @@ def player(filename, params="controls autoplay loop", **kwargs):
5415
5408
 
5416
5409
  if is_notebook():
5417
5410
  from IPython.display import display,HTML,Video,Javascript
5418
- import uuid
5419
- vid = 'video_' + str(uuid.uuid4())[:8]
5420
5411
 
5421
5412
  # Fallback - replace url on gadi and similar jupyterhub installs with
5422
5413
  # fixed working directory that doesn't match notebook dir
5423
5414
  # check the video tag url and remove subpath on 404 error
5424
- display(Javascript(f"""
5425
- function video_error(el) {{
5426
- let url = el.src;
5427
- console.log("Bad video url: " + url);
5428
- let toppath = "/files/home/"
5429
- let baseurl = url.substring(0, url.indexOf(toppath)+toppath.length);
5430
- let endurl = url.substring(url.indexOf("{filename}"));
5431
- let fixed = baseurl + endurl;
5432
- if (url != fixed) {{
5433
- console.log("Replaced video url: " + fixed);
5434
- el.src = fixed;
5415
+ onerror = """{
5416
+ let url = this.src;
5417
+ console.log('Error in video url: ' + url);
5418
+ var urlp = new window.URL(url);
5419
+ let toppath = '/files/home/';
5420
+ let startidx = urlp.pathname.indexOf(toppath);
5421
+ if (startidx < 0) {
5422
+ toppath = '/files/';
5423
+ startidx = urlp.pathname.indexOf(toppath);
5424
+ }
5425
+ if (startidx >= 0) {
5426
+ let filename = urlp.pathname.split('/').pop();
5427
+ let base = urlp.pathname.substring(0, startidx+toppath.length);
5428
+ urlp.pathname = base + filename;
5429
+ if (url != urlp.href) {
5430
+ console.log('Replaced video url: ' + urlp.href);
5431
+ this.src = urlp.href;
5435
5432
  //Also fix download link
5436
- document.getElementById('link_{vid}').href = fixed;
5437
- }} else {{
5438
- console.log("Not replacing video url, no change: " + fixed);
5439
- }}
5440
- }}
5441
- """))
5442
-
5443
- #Embed player
5444
- filename = os.path.relpath(filename)
5445
- display(Video(url=filename, html_attributes=f'id="{vid}" onerror="video_error(this)"' + params, **kwargs))
5433
+ let link = document.getElementById('link_' + this.id);
5434
+ if (link) link.href = urlp.href;
5435
+ }
5436
+ }
5437
+ }"""
5438
+
5439
+ if "embed" in kwargs:
5440
+ #Not needed if embedding
5441
+ onerror = ""
5446
5442
 
5447
- #Add download link
5448
- display(HTML(f'<a id="link_{vid}" href="{filename}" download>Download Video</a>'))
5443
+ #Display player and download link
5444
+ import uuid
5445
+ vid = 'video_' + str(uuid.uuid4())[:8]
5446
+ filename = os.path.relpath(filename)
5447
+ display(Video(filename=filename, html_attributes=f'id="{vid}" onerror="{onerror}" ' + params, **kwargs),
5448
+ HTML(f'<a id="link_{vid}" href="{filename}" download>Download Video</a>'))
5449
5449
 
5450
5450
  #Class for managing video animation recording
5451
5451
  class Video(object):
@@ -5465,7 +5465,7 @@ class Video(object):
5465
5465
  ... lv.rotate('y', 10) # doctest: +SKIP
5466
5466
  ... lv.render() # doctest: +SKIP
5467
5467
  """
5468
- def __init__(self, viewer, filename="output.mp4", resolution=(0,0), framerate=30, quality=2, encoder="h264", player=None, options={}, **kwargs):
5468
+ def __init__(self, viewer, filename="output.mp4", resolution=(0,0), framerate=30, quality=2, encoder="h264", embed=False, player=None, options={}, **kwargs):
5469
5469
  """
5470
5470
  Record and show the generated video inline within an ipython notebook.
5471
5471
 
@@ -5492,6 +5492,9 @@ class Video(object):
5492
5492
  Video resolution in pixels [x,y]
5493
5493
  encoder : str
5494
5494
  Name of encoder to use, eg: "h264" (default), "mpeg"
5495
+ embed : bool
5496
+ Set to true to embed the video file rather than link to url
5497
+ Not recommended for large videos, default is False
5495
5498
  player : dict
5496
5499
  Args to pass to the player when the video is finished, eg:
5497
5500
  {"width" : 800, "height", 400, "params": "controls autoplay"}
@@ -5526,6 +5529,8 @@ class Video(object):
5526
5529
  self.player = {"width": self.resolution[0]//2, "height": self.resolution[1]//2}
5527
5530
  else:
5528
5531
  self.player = {}
5532
+ if embed:
5533
+ self.player["embed"] = True
5529
5534
  self.encoder = encoder
5530
5535
  self.options = options
5531
5536
  #Also include extra args
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lavavu
3
- Version: 1.9.5
3
+ Version: 1.9.6
4
4
  Summary: Python interface to LavaVu OpenGL 3D scientific visualisation utilities
5
5
  Author-email: Owen Kaluza <owen@kaluza.id.au>
6
6
  License: ### Licensing
@@ -224,7 +224,7 @@ Dynamic: license-file
224
224
  [![Build Status](https://github.com/lavavu/LavaVu/workflows/Test/badge.svg)](https://github.com/lavavu/LavaVu/actions?query=workflow:Test)
225
225
  [![Deploy Status](https://github.com/lavavu/LavaVu/workflows/Deploy/badge.svg?branch=1.7.3)](https://github.com/lavavu/LavaVu/actions?query=workflow:Deploy)
226
226
  [![DOI](https://zenodo.org/badge/45163055.svg)](https://zenodo.org/badge/latestdoi/45163055)
227
- [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/lavavu/LavaVu/1.9.5)
227
+ [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/lavavu/LavaVu/1.9.6)
228
228
 
229
229
  A scientific visualisation tool with a python interface for fast and flexible visual analysis.
230
230
 
@@ -1,5 +1,5 @@
1
1
  lavavu/LavaVuPython.py,sha256=uTyBhkTp-Gcg468mS7EXZWxUU4TVtQ0R6D169CnMUZ0,33768
2
- lavavu/_LavaVuPython.cp39-win_amd64.pyd,sha256=QYTIaI5mu4EOhgM5ifIUFhEirvc2r_F4-vKrS7pM1HY,3132416
2
+ lavavu/_LavaVuPython.cp39-win_amd64.pyd,sha256=60pnScil_VDFPugb-kQOGrwa7yq36wYYO0XbYkA8Ydc,3132416
3
3
  lavavu/__init__.py,sha256=ZOkoA9N5M5swxkeLDlrc9NGFQ1PggLWW4GheseTtq8I,206
4
4
  lavavu/__main__.py,sha256=9L7Rfhb_U9Oqkop7MVJ4fi9XUnx4t2vpajOMKNNVunc,247
5
5
  lavavu/amalgamate.py,sha256=goS8OLot2q400zRMMRoksYkaNyBgRJlrpU1UxSKwLmA,601
@@ -14,7 +14,7 @@ lavavu/convert.py,sha256=3F79LHdsi74pvewvDuvnlYR_Zsh5mCc1QI7XZnQSMN8,36404
14
14
  lavavu/dict.json,sha256=1q3o7wF_siDIwmA2Sw1nh8Y1knlfmWJ64EHki21iWRU,55246
15
15
  lavavu/font.bin,sha256=fvi5zkvmq6gh9v3jXedBVuxNJWKmHtbjECzv6eT9wb4,225360
16
16
  lavavu/glfw3.dll,sha256=zI-Qy4RDHQo4mYYgW4QLREz-WZ5l5HCXJzyksyTy0bY,83456
17
- lavavu/lavavu.py,sha256=BMQM-1j14wOnjakh30SECYLoWej8kHkVPyIkLR4yeGY,224466
17
+ lavavu/lavavu.py,sha256=Sh1DAgP8SaYsO7NyKA667WMzoGsS2adAu7Pdp2x4eKQ,224667
18
18
  lavavu/liblzma.dll,sha256=_n95XbzYpeaXq6wB884fmpf8nqs2Ot9gyxUL_CS2TCI,154624
19
19
  lavavu/points.py,sha256=bp5XFMUHShjeRW7XUNgq8uxj3wjk4EE-qnWEJjAn-uM,6062
20
20
  lavavu/postproc-55.dll,sha256=DwfCHwxbuZiEzRcfbh5aa-5Ax3xIsWkxEN0achBvJPU,133120
@@ -41,12 +41,12 @@ lavavu/html/emscripten.css,sha256=xSOf_UBkkq3fPF_8h_YKFLZXUVy8FVOymRgANWQMMLc,19
41
41
  lavavu/html/favicon.ico,sha256=OrIWwvxOSnOCuynrGRUyEIVQng0ZwA9Rrz89S9eiog0,1150
42
42
  lavavu/html/gl-matrix-min.js,sha256=-LGye5bMuwoTva7bswxQeewoEaybX7EnZFTlhjXzrB8,23189
43
43
  lavavu/html/gui.css,sha256=5sfIpoA-fFIVxEBqEK4cKagF1mnOAMnI4dABk9rj-pU,607
44
- lavavu/html/menu.js,sha256=hqmRv_gZsRjGduSOQxpMVVO8M4eEZU1lMiaaX7_bG1s,22111
44
+ lavavu/html/menu.js,sha256=vFw163cTqpbYq6h0UFCVCIArJvYD8_1aj_bQVxo3eoY,22245
45
45
  lavavu/html/server.js,sha256=WXuAnY6aE4h8vYs4U2sl4Xq5RjrkuDi-mIgM-x3Nkj0,7325
46
46
  lavavu/html/stats.min.js,sha256=q9kZjkwmWu8F8HV-4m2EfZRJXQBzyibceJoz-tDgB94,1970
47
47
  lavavu/html/styles.css,sha256=8JE8l7zcc0PV8CfOQpfDyhM226-Sq9eDLXvTCe-wSgw,3041
48
48
  lavavu/html/webview-template.html,sha256=E5w7pd91z0WL3244PQxDKMNZorWzoRT5G7wuBHXJc6Y,1573
49
- lavavu/html/webview.html,sha256=3ETCQYGZ8rpSTfE4rIlGQr4E9jRqCbFaSzZ8HJAYtJo,1564
49
+ lavavu/html/webview.html,sha256=07nQPUnc0F-qN9be9gL30JQMgS9Sg5gvR6NvYm2g8OY,1564
50
50
  lavavu/osmesa/LavaVuPython.py,sha256=uTyBhkTp-Gcg468mS7EXZWxUU4TVtQ0R6D169CnMUZ0,33768
51
51
  lavavu/osmesa/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
52
  lavavu/shaders/default.frag,sha256=SHdqowe24zRNKnffZX7XilwD_I0NhVx9_rR04YJlLTE,194
@@ -61,9 +61,9 @@ lavavu/shaders/triShader.frag,sha256=6VhNYBN5encmiE6jM-Y_titqCteTnL4AcefGprVDqxM
61
61
  lavavu/shaders/triShader.vert,sha256=haljW2eQwyB24QWR1SURspU1z6ndskdZG7mrILfgXzo,1129
62
62
  lavavu/shaders/volumeShader.frag,sha256=6NeP_bgEl0SNOAjMxOWORhU62-TA9KyveDZ93mVtkKE,14594
63
63
  lavavu/shaders/volumeShader.vert,sha256=CroiEfEIe7pP66w14KwmKxfbTuKN6EuXYbZJvt_bfHk,83
64
- lavavu-1.9.5.dist-info/licenses/LICENSE.md,sha256=zHOh_qOPkfR76vdrTRP7J-BqPieAIWVDTl2ZP0SN6lQ,8782
65
- lavavu-1.9.5.dist-info/METADATA,sha256=-TaXvLzsFVh9cmylCSW73maqGMH0QQPzxKIPlhuiFu8,18200
66
- lavavu-1.9.5.dist-info/WHEEL,sha256=3JRrBaG_r4GKEsQxd6dVT34joOu5By0wlyszd6u_ofs,99
67
- lavavu-1.9.5.dist-info/entry_points.txt,sha256=LC2qXR6EMe45Cb7zGAF99R9HFrAECP6Qkp_YuG6HZB0,44
68
- lavavu-1.9.5.dist-info/top_level.txt,sha256=JptS0k1nlBumjLs_0hITr3_XUJhxqvKBXD2jGho3E3A,7
69
- lavavu-1.9.5.dist-info/RECORD,,
64
+ lavavu-1.9.6.dist-info/licenses/LICENSE.md,sha256=zHOh_qOPkfR76vdrTRP7J-BqPieAIWVDTl2ZP0SN6lQ,8782
65
+ lavavu-1.9.6.dist-info/METADATA,sha256=8uElwm8qg73dYqmStSy5z9iZmmva_24pDWbLGy7dwzI,18200
66
+ lavavu-1.9.6.dist-info/WHEEL,sha256=3JRrBaG_r4GKEsQxd6dVT34joOu5By0wlyszd6u_ofs,99
67
+ lavavu-1.9.6.dist-info/entry_points.txt,sha256=LC2qXR6EMe45Cb7zGAF99R9HFrAECP6Qkp_YuG6HZB0,44
68
+ lavavu-1.9.6.dist-info/top_level.txt,sha256=JptS0k1nlBumjLs_0hITr3_XUJhxqvKBXD2jGho3E3A,7
69
+ lavavu-1.9.6.dist-info/RECORD,,
File without changes