lavavu 1.8.81__cp311-cp311-win_amd64.whl → 1.8.84__cp311-cp311-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/control.py CHANGED
@@ -481,8 +481,20 @@ class Window(_Container):
481
481
  self.align = align
482
482
  self.wrapper = wrapper
483
483
  self.fullscreen = fullscreen
484
- if resolution is not None:
485
- viewer.output_resolution = resolution
484
+ if resolution is None:
485
+ #Default to largest of 640x480 or output res / 2
486
+ resolution = [0,0]
487
+ resolution[0] = max(viewer.output_resolution[0]//2, 640)
488
+ resolution[1] = int(resolution[0] * viewer.output_resolution[1]/viewer.output_resolution[0])
489
+ elif isinstance(resolution, int):
490
+ #Passed interger - interpert as width
491
+ resolution = [resolution,0]
492
+
493
+ if resolution[1] == 0:
494
+ #Width only, set height based on output aspect ratio
495
+ resolution[1] = int(resolution[0] * viewer.output_resolution[1]/viewer.output_resolution[0])
496
+
497
+ viewer.output_resolution = resolution
486
498
 
487
499
  def html(self):
488
500
  #print(self.viewer["resolution"], self.viewer.output_resolution)
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.8.81/LavaVu-amalgamated.min.js"></script>
30
+ <script async src="https://cdn.jsdelivr.net/gh/lavavu/lavavu.github.io@1.8.84/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
@@ -4194,7 +4194,7 @@ class Viewer(dict):
4194
4194
 
4195
4195
  try:
4196
4196
  fn = self.app.video(filename, fps, resolution[0], resolution[1], start, end, quality, **kwargs)
4197
- player(fn)
4197
+ player(fn, **kwargs)
4198
4198
  except (Exception) as e:
4199
4199
  print("Video output error: " + str(e))
4200
4200
  pass
@@ -4357,8 +4357,10 @@ class Viewer(dict):
4357
4357
 
4358
4358
  Parameters
4359
4359
  ----------
4360
- resolution : tuple(int,int)
4361
- Frame size in pixels: width, height. Defaults to the viewer default output resolution, usually (640,480)
4360
+ resolution : int, tuple(int,int)
4361
+ Frame size in pixels: width, height.
4362
+ Defaults to half the viewer default output resolution with a minimum width of 640 pixels
4363
+ If a single integer is passed, will use as the width while maintaining output aspect ratio
4362
4364
  menu : boolean
4363
4365
  Adds a menu to the top right allowing control of vis parameters, defaults to on
4364
4366
  """
@@ -4402,7 +4404,7 @@ class Viewer(dict):
4402
4404
  vdat = {}
4403
4405
  if len(self.state["views"]) and self.state["views"][0]:
4404
4406
  def copyview(dst, src):
4405
- for key in ["translate", "rotate", "xyzrotate", "fov"]:
4407
+ for key in ["translate", "rotate", "xyzrotate", "fov", "focus"]:
4406
4408
  if key in src:
4407
4409
  dst[key] = copy.copy(src[key])
4408
4410
  #Round down arrays to max 3 decimal places
@@ -4426,7 +4428,6 @@ class Viewer(dict):
4426
4428
  #Return
4427
4429
  return vdat
4428
4430
 
4429
-
4430
4431
  def getview(self):
4431
4432
  """
4432
4433
  Get current view settings
@@ -5232,7 +5233,7 @@ class DrawData(object):
5232
5233
  renderlist = [geomnames[value] for value in geomtypes if value == self.data.type]
5233
5234
  return ' '.join(['DrawData("' + r + '")' for r in renderlist]) + ' ==> ' + str(self.available)
5234
5235
 
5235
- def player(filename, width=None, height=None, params=""):
5236
+ def player(filename, params="controls autoplay loop", **kwargs):
5236
5237
  """
5237
5238
  Shows a video inline within an ipython notebook.
5238
5239
  If IPython is not running, just returns
@@ -5241,43 +5242,62 @@ def player(filename, width=None, height=None, params=""):
5241
5242
  ----------
5242
5243
  filename : str
5243
5244
  Path and name of the file to play
5244
- width : int
5245
- Fixed width of player window, otherwise will use video resolution
5246
- height : int
5247
- Fixed height of player window, otherwise will use video resolution
5248
5245
  params : str
5249
- Any other parameters to add to the <video> tag, eg: "autoplay"
5246
+ Additional html attributes for the video control, see:
5247
+ https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video
5248
+ **kwargs :
5249
+ width=W,height=H will set fixed size of player window
5250
+ See further player arguments at
5251
+ https://ipython.readthedocs.io/en/latest/api/generated/IPython.display.html#IPython.display.Video
5250
5252
  """
5251
5253
 
5252
5254
  if is_notebook():
5253
- from IPython.display import display,HTML,Video
5254
- extra_params = params
5255
- if width and height:
5256
- extra_params += ' width=' + str(width) + ' height=' + str(height)
5255
+ from IPython.display import display,HTML,Video,Javascript
5256
+ import uuid
5257
+ vid = 'video_' + str(uuid.uuid4())[:8]
5257
5258
 
5259
+ '''
5258
5260
  def get_fn(filename):
5259
5261
  import os
5262
+ #This is unreliable, path incorrect on NCI
5260
5263
  nbpath = os.getenv('JPY_SESSION_NAME')
5261
5264
  if nbpath is not None:
5262
5265
  import os.path
5263
- relpath = os.path.relpath(os.getcwd(), start=nbpath)
5266
+ relpath = os.path.relpath(os.getcwd(), start=os.path.dirname(nbpath))
5264
5267
  return relpath + '/' + filename
5265
5268
  return filename
5269
+ ''';
5266
5270
 
5267
5271
  import uuid
5268
5272
  uid = uuid.uuid1()
5269
- filename_rel = get_fn(filename)
5270
5273
 
5271
- display(Video(filename, width=width, height=height))
5272
- #display(HTML(f"""
5273
- #<video controls loop {extra_params}>
5274
- # <source src="{filename_rel}">
5275
- #Sorry, your browser doesn't support embedded videos
5276
- #</video><br>
5277
- #"""))
5274
+ #Embed player
5275
+ display(Video(url=os.path.relpath(filename), html_attributes=f"id='{vid}' " + params, **kwargs))
5278
5276
 
5279
5277
  #Add download link
5280
- display(HTML('<a href="{fn}" download>Download Video</a>'.format(fn=filename)))
5278
+ display(HTML(f'<a id="link_{vid}" href="{filename}" download>Download Video</a>'))
5279
+
5280
+ # Fallback - replace url on gadi and similar jupyterhub installs with
5281
+ # fixed working directory that doesn't match notebook dir
5282
+ # check the video tag url and remove subpath on 404 error
5283
+ display(Javascript(f"""
5284
+ let el = document.getElementById('{vid}');
5285
+ let url = el.src;
5286
+ fetch(url, {{method: 'HEAD'}}).then(response=>{{
5287
+ if(response.status == 404) {{
5288
+ console.log("Bad video url: " + url);
5289
+ let toppath = "/files/home/"
5290
+ let baseurl = url.substring(0, url.indexOf(toppath)+toppath.length);
5291
+ let endurl = url.substring(url.indexOf("{filename}"));
5292
+ let fixed = baseurl + endurl;
5293
+ console.log("Replaced video url: " + fixed);
5294
+ el.src = fixed;
5295
+ //Also fix download link
5296
+ document.getElementById('link_{vid}').href = fixed;
5297
+ }}
5298
+ }});
5299
+ """))
5300
+
5281
5301
 
5282
5302
  #Class for managing video animation recording
5283
5303
  class Video(object):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lavavu
3
- Version: 1.8.81
3
+ Version: 1.8.84
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
@@ -221,7 +221,7 @@ Requires-Dist: jupyter-server-proxy
221
221
  [![Build Status](https://github.com/lavavu/LavaVu/workflows/Test/badge.svg)](https://github.com/lavavu/LavaVu/actions?query=workflow:Test)
222
222
  [![Deploy Status](https://github.com/lavavu/LavaVu/workflows/Deploy/badge.svg?branch=1.7.3)](https://github.com/lavavu/LavaVu/actions?query=workflow:Deploy)
223
223
  [![DOI](https://zenodo.org/badge/45163055.svg)](https://zenodo.org/badge/latestdoi/45163055)
224
- [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/lavavu/LavaVu/1.8.81)
224
+ [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/lavavu/LavaVu/1.8.84)
225
225
 
226
226
  A scientific visualisation tool with a python interface for fast and flexible visual analysis.
227
227
 
@@ -1,5 +1,5 @@
1
1
  lavavu/LavaVuPython.py,sha256=uTyBhkTp-Gcg468mS7EXZWxUU4TVtQ0R6D169CnMUZ0,33768
2
- lavavu/_LavaVuPython.cp311-win_amd64.pyd,sha256=C7cRvVO0_tHkppdpXU2kOPGI4SbVxYwLhQzwzJ0Wm50,3117056
2
+ lavavu/_LavaVuPython.cp311-win_amd64.pyd,sha256=i5HC28hEeSCps5R6McB9Rx_8lIMQO2e6jukYxZ4aUqk,3117056
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
@@ -9,12 +9,12 @@ lavavu/avdevice-58.dll,sha256=VgLrv5NWSD4u-hlKHkTE5ciLMUNTxlZljLavR9AlTkQ,276019
9
9
  lavavu/avfilter-7.dll,sha256=cKwN6yDGzmf6XB5HXM1QVV4fc_HfhjAd3dBvV5YVdbk,10957312
10
10
  lavavu/avformat-58.dll,sha256=PB5bD4mq62vBBY8tdagrGaYD2AQjaz3Lgc6wpp0UIr0,11094016
11
11
  lavavu/avutil-56.dll,sha256=VsAhkveudbox9BBMuLEjnJ6yzoyJDoy2SzgPnMgMug0,866304
12
- lavavu/control.py,sha256=QyNNJCeM6MeQhy4lhhb3JGnIUctCKo9JshleVTRUsTI,67547
12
+ lavavu/control.py,sha256=AyCg1zJQcKbd_FwtfAn_KiJctEVQ-YRwPPFn6jlopAI,68152
13
13
  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=QpGCMRv_vGp4nhuAGcNlp-hSAEhIlVOWHefHQnkmxpA,213163
17
+ lavavu/lavavu.py,sha256=GBV1gn62IBa1Kd9eRDFwYkh0fiuvU9fRogNxICerEe8,214242
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
@@ -46,7 +46,7 @@ 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=yuf0wYlgUPjPPFIGJ-lSWmcWZXT-L8q79dmzsh3Dugs,1565
49
+ lavavu/html/webview.html,sha256=9F-wQhoSXW_u1kP0eN_VeDy_tYpJDZrZ5hYJ20LRmtY,1565
50
50
  lavavu/shaders/default.frag,sha256=AlGMo01JdaOsXx6Gq7s1WADi2b-vyX9XMSB91AcJvuA,278
51
51
  lavavu/shaders/default.vert,sha256=SKC2BkE2axNjJL2j5QYjU2bj6mMXs8Wq02XgMTiOeFo,334
52
52
  lavavu/shaders/fontShader.frag,sha256=0GGFFg6S4v0p_1gDTIATDmc19jrCl7xIgH9PpxcXEcE,469
@@ -59,9 +59,9 @@ lavavu/shaders/triShader.frag,sha256=eVGp_ttGMVgKnDYRwByvx_PN80EYiSz61jeuAD8JJvw
59
59
  lavavu/shaders/triShader.vert,sha256=tzgJjqbhKDgVngUJvMVL1ehYvwxAMFLQ-WtKEYU3in0,1175
60
60
  lavavu/shaders/volumeShader.frag,sha256=PLTei6fN_uLxPD35LHbBQVe_S7TanxdBqcW5khslQMI,16583
61
61
  lavavu/shaders/volumeShader.vert,sha256=CroiEfEIe7pP66w14KwmKxfbTuKN6EuXYbZJvt_bfHk,83
62
- lavavu-1.8.81.dist-info/LICENSE.md,sha256=zHOh_qOPkfR76vdrTRP7J-BqPieAIWVDTl2ZP0SN6lQ,8782
63
- lavavu-1.8.81.dist-info/METADATA,sha256=N1pOU4ckJdaHiRwR4fil9Hh7-B7j7hx0vTNFnoivjGw,18555
64
- lavavu-1.8.81.dist-info/WHEEL,sha256=WutsMqxRjo8PALJe8NWxuOYrO2lUIIHDIxhZ8tjc8BY,101
65
- lavavu-1.8.81.dist-info/entry_points.txt,sha256=LC2qXR6EMe45Cb7zGAF99R9HFrAECP6Qkp_YuG6HZB0,44
66
- lavavu-1.8.81.dist-info/top_level.txt,sha256=JptS0k1nlBumjLs_0hITr3_XUJhxqvKBXD2jGho3E3A,7
67
- lavavu-1.8.81.dist-info/RECORD,,
62
+ lavavu-1.8.84.dist-info/LICENSE.md,sha256=zHOh_qOPkfR76vdrTRP7J-BqPieAIWVDTl2ZP0SN6lQ,8782
63
+ lavavu-1.8.84.dist-info/METADATA,sha256=AJGc4e_tLRCUz0jmFTyFKolg_MZ5cRdN3AuepnWh0_Y,18555
64
+ lavavu-1.8.84.dist-info/WHEEL,sha256=WutsMqxRjo8PALJe8NWxuOYrO2lUIIHDIxhZ8tjc8BY,101
65
+ lavavu-1.8.84.dist-info/entry_points.txt,sha256=LC2qXR6EMe45Cb7zGAF99R9HFrAECP6Qkp_YuG6HZB0,44
66
+ lavavu-1.8.84.dist-info/top_level.txt,sha256=JptS0k1nlBumjLs_0hITr3_XUJhxqvKBXD2jGho3E3A,7
67
+ lavavu-1.8.84.dist-info/RECORD,,