lavavu 1.8.62__cp311-cp311-macosx_10_9_x86_64.whl → 1.9.5__cp311-cp311-macosx_10_9_x86_64.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.
Files changed (39) hide show
  1. lavavu/LavaVuPython.py +2 -1
  2. lavavu/_LavaVuPython.cpython-311-darwin.so +0 -0
  3. lavavu/aserver.py +5 -3
  4. lavavu/control.py +39 -7
  5. lavavu/convert.py +2 -2
  6. lavavu/dict.json +2 -2
  7. lavavu/html/control.js +9 -4
  8. lavavu/html/drawbox.js +9 -0
  9. lavavu/html/emscripten-template.js +1 -1
  10. lavavu/html/menu.js +1 -0
  11. lavavu/html/webview.html +1 -1
  12. lavavu/lavavu.py +602 -146
  13. lavavu/osmesa/LavaVuPython.py +561 -0
  14. lavavu/osmesa/__init__.py +0 -0
  15. lavavu/shaders/default.frag +0 -6
  16. lavavu/shaders/default.vert +4 -4
  17. lavavu/shaders/fontShader.frag +0 -5
  18. lavavu/shaders/lineShader.frag +0 -4
  19. lavavu/shaders/lineShader.vert +0 -2
  20. lavavu/shaders/pointShader.frag +0 -5
  21. lavavu/shaders/pointShader.vert +0 -4
  22. lavavu/shaders/triShader.frag +0 -17
  23. lavavu/shaders/triShader.vert +0 -4
  24. lavavu/shaders/volumeShader.frag +0 -63
  25. lavavu/tracers.py +180 -110
  26. lavavu/vutils.py +9 -11
  27. lavavu-1.9.5.dist-info/METADATA +323 -0
  28. lavavu-1.9.5.dist-info/RECORD +55 -0
  29. {lavavu-1.8.62.dist-info → lavavu-1.9.5.dist-info}/WHEEL +2 -1
  30. {lavavu-1.8.62.dist-info → lavavu-1.9.5.dist-info}/entry_points.txt +0 -1
  31. lavavu/.dylibs/libjpeg.8.3.2.dylib +0 -0
  32. lavavu/.dylibs/liblzma.5.dylib +0 -0
  33. lavavu/.dylibs/libpng16.16.dylib +0 -0
  34. lavavu/.dylibs/libtiff.6.dylib +0 -0
  35. lavavu/.dylibs/libzstd.1.5.5.dylib +0 -0
  36. lavavu-1.8.62.dist-info/METADATA +0 -33
  37. lavavu-1.8.62.dist-info/RECORD +0 -58
  38. {lavavu-1.8.62.dist-info → lavavu-1.9.5.dist-info/licenses}/LICENSE.md +0 -0
  39. {lavavu-1.8.62.dist-info → lavavu-1.9.5.dist-info}/top_level.txt +0 -0
lavavu/LavaVuPython.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # This file was automatically generated by SWIG (https://www.swig.org).
2
- # Version 4.1.0
2
+ # Version 4.2.0
3
3
  #
4
4
  # Do not make changes to this file unless you know what you are doing - modify
5
5
  # the SWIG interface file instead.
@@ -481,6 +481,7 @@ class LavaVu(object):
481
481
  web = _swig_new_instance_method(_LavaVuPython.LavaVu_web)
482
482
  video = _swig_new_instance_method(_LavaVuPython.LavaVu_video)
483
483
  encodeVideo = _swig_new_instance_method(_LavaVuPython.LavaVu_encodeVideo)
484
+ pauseVideo = _swig_new_instance_method(_LavaVuPython.LavaVu_pauseVideo)
484
485
  defaultModel = _swig_new_instance_method(_LavaVuPython.LavaVu_defaultModel)
485
486
  addColourMap = _swig_new_instance_method(_LavaVuPython.LavaVu_addColourMap)
486
487
  updateColourMap = _swig_new_instance_method(_LavaVuPython.LavaVu_updateColourMap)
Binary file
lavavu/aserver.py CHANGED
@@ -11,6 +11,7 @@ import socket
11
11
  import asyncio
12
12
  import aiohttp
13
13
  from aiohttp import web
14
+ import logging
14
15
 
15
16
  from urllib.parse import unquote
16
17
 
@@ -284,6 +285,10 @@ async def _serve(viewer, sock):
284
285
  try:
285
286
  #Create web application manager
286
287
  app = web.Application()
288
+ #https://github.com/aio-libs/aiohttp/issues/3287
289
+ #app.logger.manager.disable = 100
290
+ app.logger.setLevel(logging.CRITICAL)
291
+
287
292
  #Store viewer
288
293
  app["viewer"] = viewer
289
294
  #Add routes
@@ -348,9 +353,6 @@ if __name__ == '__main__':
348
353
  import asyncio
349
354
  lv = lavavu.Viewer()
350
355
 
351
- import logging
352
- logging.getLogger('aiohttp.server').setLevel(logging.CRITICAL)
353
-
354
356
  lv.browser()
355
357
  lv.app.loop()
356
358
  #lv.interactive()
lavavu/control.py CHANGED
@@ -220,6 +220,13 @@ def _connectcode(target):
220
220
  else:
221
221
  return ""
222
222
 
223
+ def _emscriptencode(menu=False, lighttheme=True):
224
+ """
225
+ Returns WebGL base code for an interactive visualisation window
226
+ """
227
+ jslibs = [[], ['emscripten.js', 'LavaVu.js']]
228
+ return _webglcode('', ['emscripten.css'], jslibs, menu=menu, lighttheme=lighttheme)
229
+
223
230
  def _getcss(files=["styles.css"]):
224
231
  #Load stylesheets to inline tag
225
232
  return _filestohtml(files, tag="style")
@@ -474,8 +481,20 @@ class Window(_Container):
474
481
  self.align = align
475
482
  self.wrapper = wrapper
476
483
  self.fullscreen = fullscreen
477
- if resolution is not None:
478
- 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
479
498
 
480
499
  def html(self):
481
500
  #print(self.viewer["resolution"], self.viewer.output_resolution)
@@ -1670,13 +1689,26 @@ class _ControlFactory(object):
1670
1689
  """
1671
1690
  if not is_notebook():
1672
1691
  return
1673
- #Find matching viewer id, redisplay all that match
1692
+ from IPython.display import display,HTML,Javascript
1693
+ display(Javascript(self.redisplay_call()))
1694
+
1695
+ def redisplay_call(self):
1696
+ """Update the active viewer image if any
1697
+ Applies changes made in python to the viewer and forces a redisplay
1698
+ """
1699
+ #Find matching viewer id, redisplay first match
1700
+ ids = self.active_viewers()
1701
+ return ';'.join('_wi["{0}"].redisplay()'.format(i) for i in ids)
1702
+
1703
+ def active_viewers(self):
1704
+ """Return matching active viewer IDs
1705
+ """
1706
+ #Find matching viewer ids, all that match
1707
+ ids = []
1674
1708
  for idx,obj in enumerate(windows):
1675
1709
  if obj == self._target():
1676
- viewerid = winids[idx]
1677
- from IPython.display import display,HTML,Javascript
1678
- #display(Javascript('_wi["{0}"].redisplay();'.format(viewerid)))
1679
- display(HTML('<script>_wi["{0}"].redisplay();</script>'.format(viewerid)))
1710
+ ids.append(winids[idx])
1711
+ return ids
1680
1712
 
1681
1713
  def update(self):
1682
1714
  """Update the control values from current viewer data
lavavu/convert.py CHANGED
@@ -110,10 +110,10 @@ def points_to_volume_histogram(verts, weights, res=8, normed=True, clamp=None, b
110
110
 
111
111
  #H, edges = numpy.histogramdd(verts, bins=RES)
112
112
  if boundingbox is None:
113
- H, edges = numpy.histogramdd(verts, weights=weights, bins=RES, normed=normed) #density=True for newer numpy
113
+ H, edges = numpy.histogramdd(verts, weights=weights, bins=RES, density=normed) #density=True for newer numpy
114
114
  else:
115
115
  rg = ((vmin[0], vmax[0]), (vmin[1], vmax[1]), (vmin[2], vmax[2])) #provide bounding box as range
116
- H, edges = numpy.histogramdd(verts, weights=weights, bins=RES, range=rg, normed=normed) #density=True for newer numpy
116
+ H, edges = numpy.histogramdd(verts, weights=weights, bins=RES, range=rg, density=normed) #density=True for newer numpy
117
117
 
118
118
  #Reverse ordering X,Y,Z to Z,Y,X for volume data
119
119
  values = H.transpose()
lavavu/dict.json CHANGED
@@ -214,10 +214,10 @@
214
214
  ]
215
215
  },
216
216
  "uniforms": {
217
- "default": [],
217
+ "default": {},
218
218
  "target": "object",
219
219
  "type": "object",
220
- "desc": "Custom shader uniforms for rendering objects, list of uniform names, will be copied from property data",
220
+ "desc": "Custom shader uniforms for rendering objects, dict of uniform names/values, will be copied from property data",
221
221
  "strict": true,
222
222
  "redraw": 0,
223
223
  "control": [
lavavu/html/control.js CHANGED
@@ -86,12 +86,17 @@ function WindowInteractor(id, uid, port) {
86
86
  } else {
87
87
 
88
88
  //Several possible modes to try
89
- //JupyterHub URL
90
- var regex = /\/user\/[a-z0-9-]+\//i;
89
+ //Modern JupyterHub lab URL
90
+ var regex = /\/lab\//;
91
91
  var parsed = regex.exec(loc.href);
92
92
  if (parsed && parsed.length > 0) {
93
- var base = parsed[0];
94
- connect(loc.href.substring(0,parsed.index) + base + "proxy/" + port);
93
+ connect(loc.href.substring(0,parsed.index) + "/proxy/" + port);
94
+ }
95
+ //Old JupyterHub URL
96
+ regex = /\/user\/[a-z0-9-]+\//i;
97
+ parsed = regex.exec(loc.href);
98
+ if (parsed && parsed.length > 0) {
99
+ connect(loc.href.substring(0,parsed.index) + parsed[0] + "proxy/" + port);
95
100
  }
96
101
 
97
102
  if (loc.protocol != 'file:') {
lavavu/html/drawbox.js CHANGED
@@ -190,6 +190,14 @@ function canvasBoxMouseMove(event, mouse) {
190
190
 
191
191
  mouse.element.viewer.draw();
192
192
 
193
+ //Instant updates
194
+ if (mouse.element.viewer.alwaysdraw) {
195
+ if (mouse.element.viewer.rotating)
196
+ mouse.element.viewer.command('' + mouse.element.viewer.getRotationString());
197
+ else
198
+ mouse.element.viewer.command('' + mouse.element.viewer.getTranslationString());
199
+ }
200
+
193
201
  return false;
194
202
  }
195
203
 
@@ -422,6 +430,7 @@ function BoxViewer(canvas) {
422
430
 
423
431
  //Non-persistant settings
424
432
  this.mode = 'Rotate';
433
+ this.alwaysdraw = false;
425
434
  if (!this.gl) return;
426
435
 
427
436
  //Create the renderers
@@ -67,7 +67,7 @@ var Module = {
67
67
  },
68
68
  locateFile: function(path, prefix) {
69
69
  // Source from github by default
70
- if (path.endsWith("LavaVu.wasm") || path.endsWith("LavaVu.data")) return "https://cdn.jsdelivr.net/gh/lavavu/lavavu.github.io@LAVAVU_VERSION/" + path;
70
+ //if (path.endsWith("LavaVu.wasm") || path.endsWith("LavaVu.data")) return "https://cdn.jsdelivr.net/gh/lavavu/lavavu.github.io@LAVAVU_VERSION/" + path;
71
71
  // otherwise, use the default, the prefix (JS file's dir) + the path
72
72
  return prefix + path;
73
73
  },
lavavu/html/menu.js CHANGED
@@ -320,6 +320,7 @@ function createMenu(viewer, onchange, webglmode, global) {
320
320
  gui.add({"Export GLDB" : function() {window.commands.push('export');}}, 'Export GLDB');
321
321
  } else if (viewer.canvas) {
322
322
  //Server render
323
+ gui.add(viewer, "alwaysdraw");
323
324
  var url = viewer.canvas.imgtarget.baseurl;
324
325
  if (url)
325
326
  gui.add({"Popup Viewer" : function() {window.open(url, "LavaVu", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1024,height=768");}}, 'Popup Viewer');
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.62/LavaVu-amalgamated.min.js"></script>
30
+ <script async src="https://cdn.jsdelivr.net/gh/lavavu/lavavu.github.io@1.9.5/LavaVu-amalgamated.min.js"></script>
31
31
  <!--script src="dat.gui.min.js"></script>
32
32
  <script src="OK-min.js"></script>
33
33