vispy 0.14.3__cp312-cp312-win_amd64.whl → 0.15.2__cp312-cp312-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.
Potentially problematic release.
This version of vispy might be problematic. Click here for more details.
- vispy/app/backends/_qt.py +46 -11
- vispy/color/colormap.py +106 -27
- vispy/color/tests/test_color.py +27 -1
- vispy/ext/cocoapy.py +1 -21
- vispy/geometry/meshdata.py +3 -1
- vispy/geometry/tests/test_triangulation.py +88 -0
- vispy/geometry/triangulation.py +11 -13
- vispy/gloo/program.py +2 -2
- vispy/scene/cameras/arcball.py +1 -2
- vispy/scene/cameras/base_camera.py +63 -50
- vispy/scene/cameras/panzoom.py +4 -1
- vispy/scene/cameras/perspective.py +6 -1
- vispy/scene/cameras/turntable.py +11 -1
- vispy/scene/widgets/grid.py +191 -71
- vispy/scene/widgets/widget.py +11 -0
- vispy/version.py +9 -4
- vispy/visuals/_scalable_textures.py +5 -4
- vispy/visuals/filters/mesh.py +6 -1
- vispy/visuals/gridlines.py +61 -5
- vispy/visuals/image.py +19 -7
- vispy/visuals/surface_plot.py +1 -1
- vispy/visuals/tests/test_gridlines.py +30 -0
- vispy/visuals/tests/test_image.py +17 -15
- vispy/visuals/tests/test_scalable_textures.py +16 -0
- vispy/visuals/tests/test_surface_plot.py +8 -3
- vispy/visuals/text/_sdf_cpu.cp312-win_amd64.pyd +0 -0
- {vispy-0.14.3.dist-info → vispy-0.15.2.dist-info}/METADATA +50 -27
- {vispy-0.14.3.dist-info → vispy-0.15.2.dist-info}/RECORD +31 -30
- {vispy-0.14.3.dist-info → vispy-0.15.2.dist-info}/WHEEL +1 -1
- {vispy-0.14.3.dist-info → vispy-0.15.2.dist-info/licenses}/LICENSE.txt +1 -1
- {vispy-0.14.3.dist-info → vispy-0.15.2.dist-info}/top_level.txt +0 -0
vispy/gloo/program.py
CHANGED
|
@@ -362,7 +362,7 @@ class Program(GLObject):
|
|
|
362
362
|
data = TextureCube(data)
|
|
363
363
|
else:
|
|
364
364
|
# This should not happen
|
|
365
|
-
raise RuntimeError('Unknown type %s' % type_)
|
|
365
|
+
raise RuntimeError('Unknown type %s for %s' % (type_, name))
|
|
366
366
|
# Store and send GLIR command
|
|
367
367
|
self._user_variables[name] = data
|
|
368
368
|
self.glir.associate(data.glir)
|
|
@@ -442,7 +442,7 @@ class Program(GLObject):
|
|
|
442
442
|
self._glir.command('ATTRIBUTE', self._id,
|
|
443
443
|
name, type_, value, divisor)
|
|
444
444
|
else:
|
|
445
|
-
raise KeyError('Cannot set data for a %s.' % kind)
|
|
445
|
+
raise KeyError('Cannot set data for a %s (%s).' % (kind, name))
|
|
446
446
|
else:
|
|
447
447
|
# This variable is not defined in the current source code,
|
|
448
448
|
# so we cannot establish whether this is a uniform or
|
vispy/scene/cameras/arcball.py
CHANGED
|
@@ -6,7 +6,6 @@ from __future__ import division
|
|
|
6
6
|
|
|
7
7
|
import numpy as np
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
from ...util import transforms
|
|
11
10
|
from ...util.quaternion import Quaternion
|
|
12
11
|
from ...visuals.transforms import MatrixTransform
|
|
@@ -57,7 +56,7 @@ class ArcballCamera(Base3DRotationCamera):
|
|
|
57
56
|
|
|
58
57
|
def _update_rotation(self, event):
|
|
59
58
|
"""Update rotation parmeters based on mouse movement"""
|
|
60
|
-
p2 = event.
|
|
59
|
+
p2 = event.pos[:2]
|
|
61
60
|
if self._event_value is None:
|
|
62
61
|
self._event_value = p2
|
|
63
62
|
wh = self._viewbox.size
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
|
|
4
4
|
|
|
5
5
|
from __future__ import division
|
|
6
|
+
from contextlib import contextmanager
|
|
6
7
|
|
|
7
8
|
from ...util import keys
|
|
8
9
|
from ..node import Node
|
|
@@ -211,11 +212,14 @@ class BaseCamera(Node):
|
|
|
211
212
|
@center.setter
|
|
212
213
|
def center(self, val):
|
|
213
214
|
if len(val) == 2:
|
|
214
|
-
|
|
215
|
+
center = float(val[0]), float(val[1]), 0.0
|
|
215
216
|
elif len(val) == 3:
|
|
216
|
-
|
|
217
|
+
center = float(val[0]), float(val[1]), float(val[2])
|
|
217
218
|
else:
|
|
218
219
|
raise ValueError('Center must be a 2 or 3 element tuple')
|
|
220
|
+
if center == self._center:
|
|
221
|
+
return
|
|
222
|
+
self._center = center
|
|
219
223
|
self.view_changed()
|
|
220
224
|
|
|
221
225
|
@property
|
|
@@ -233,6 +237,12 @@ class BaseCamera(Node):
|
|
|
233
237
|
self._fov = fov
|
|
234
238
|
self.view_changed()
|
|
235
239
|
|
|
240
|
+
@contextmanager
|
|
241
|
+
def _block_updates(self):
|
|
242
|
+
prev, self._resetting = self._resetting, True
|
|
243
|
+
yield
|
|
244
|
+
self._resetting = prev
|
|
245
|
+
|
|
236
246
|
# Camera methods
|
|
237
247
|
|
|
238
248
|
def set_range(self, x=None, y=None, z=None, margin=0.05):
|
|
@@ -276,31 +286,30 @@ class BaseCamera(Node):
|
|
|
276
286
|
return
|
|
277
287
|
|
|
278
288
|
# There is a viewbox, we're going to set the range for real
|
|
279
|
-
self.
|
|
289
|
+
with self._block_updates():
|
|
280
290
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
291
|
+
# Get bounds from viewbox if not given
|
|
292
|
+
if all([(b is None) for b in bounds]):
|
|
293
|
+
bounds = self._viewbox.get_scene_bounds()
|
|
294
|
+
else:
|
|
295
|
+
for i in range(3):
|
|
296
|
+
if bounds[i] is None:
|
|
297
|
+
bounds[i] = self._viewbox.get_scene_bounds(i)
|
|
298
|
+
|
|
299
|
+
# Calculate ranges and margins
|
|
300
|
+
ranges = [b[1] - b[0] for b in bounds]
|
|
301
|
+
margins = [(r*margin or 0.1) for r in ranges]
|
|
302
|
+
# Assign limits for this camera
|
|
303
|
+
bounds_margins = [(b[0]-m, b[1]+m) for b, m in zip(bounds, margins)]
|
|
304
|
+
self._xlim, self._ylim, self._zlim = bounds_margins
|
|
305
|
+
# Store center location
|
|
306
|
+
if (not init) or (self._center is None):
|
|
307
|
+
self._center = [(b[0] + r / 2) for b, r in zip(bounds, ranges)]
|
|
308
|
+
|
|
309
|
+
# Let specific camera handle it
|
|
310
|
+
self._set_range(init)
|
|
301
311
|
|
|
302
312
|
# Finish
|
|
303
|
-
self._resetting = False
|
|
304
313
|
self.view_changed()
|
|
305
314
|
|
|
306
315
|
def _set_range(self, init):
|
|
@@ -357,32 +366,34 @@ class BaseCamera(Node):
|
|
|
357
366
|
state = state or {}
|
|
358
367
|
state.update(kwargs)
|
|
359
368
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
369
|
+
with self._block_updates():
|
|
370
|
+
# In first pass, process tuple keys which select subproperties. This
|
|
371
|
+
# is an undocumented feature used for selective linking of camera state.
|
|
372
|
+
#
|
|
373
|
+
# Subproperties are handled by first copying old value of the root
|
|
374
|
+
# property, then setting the subproperty on this copy, and finally
|
|
375
|
+
# assigning the copied object back to the camera property. There needs
|
|
376
|
+
# to be an assignment of the root property so setters are called and
|
|
377
|
+
# update is triggered.
|
|
378
|
+
for key in list(state.keys()):
|
|
379
|
+
if isinstance(key, tuple):
|
|
380
|
+
key1 = key[0]
|
|
381
|
+
if key1 not in state:
|
|
382
|
+
root_prop = getattr(self, key1)
|
|
383
|
+
# We make copies by passing the old object to the type's
|
|
384
|
+
# constructor. This needs to be supported as is the case in
|
|
385
|
+
# e.g. the geometry.Rect class.
|
|
386
|
+
state[key1] = root_prop.__class__(root_prop)
|
|
387
|
+
nested_setattr(state[key1], key[1:], state[key])
|
|
388
|
+
|
|
389
|
+
# In second pass, assign the new root properties.
|
|
390
|
+
for key, val in state.items():
|
|
391
|
+
if isinstance(key, tuple):
|
|
392
|
+
continue
|
|
393
|
+
if key not in self._state_props:
|
|
394
|
+
raise KeyError('Not a valid camera state property %r' % key)
|
|
395
|
+
setattr(self, key, val)
|
|
396
|
+
self.view_changed()
|
|
386
397
|
|
|
387
398
|
def link(self, camera, props=None, axis=None):
|
|
388
399
|
"""Link this camera with another camera of the same type
|
|
@@ -508,6 +519,8 @@ class BaseCamera(Node):
|
|
|
508
519
|
|
|
509
520
|
def _set_scene_transform(self, tr):
|
|
510
521
|
"""Called by subclasses to configure the viewbox scene transform."""
|
|
522
|
+
if self._resetting:
|
|
523
|
+
return
|
|
511
524
|
# todo: check whether transform has changed, connect to
|
|
512
525
|
# transform.changed event
|
|
513
526
|
pre_tr = self.pre_transform
|
vispy/scene/cameras/panzoom.py
CHANGED
|
@@ -164,7 +164,7 @@ class PanZoomCamera(BaseCamera):
|
|
|
164
164
|
def center(self, center):
|
|
165
165
|
if not (isinstance(center, (tuple, list)) and len(center) in (2, 3)):
|
|
166
166
|
raise ValueError('center must be a 2 or 3 element tuple')
|
|
167
|
-
rect = Rect(self.rect) or Rect(*DEFAULT_RECT_TUPLE)
|
|
167
|
+
rect = Rect(self.rect) or Rect(*DEFAULT_RECT_TUPLE) # make a copy of self.rect
|
|
168
168
|
rect.center = center[:2]
|
|
169
169
|
self.rect = rect
|
|
170
170
|
|
|
@@ -246,6 +246,9 @@ class PanZoomCamera(BaseCamera):
|
|
|
246
246
|
event.handled = False
|
|
247
247
|
|
|
248
248
|
def _update_transform(self):
|
|
249
|
+
if self._resetting: # base camera linking operation
|
|
250
|
+
return
|
|
251
|
+
|
|
249
252
|
rect = self.rect
|
|
250
253
|
self._real_rect = Rect(rect)
|
|
251
254
|
vbr = self._viewbox.rect.flipped(x=self.flip[0], y=(not self.flip[1]))
|
|
@@ -80,7 +80,10 @@ class PerspectiveCamera(BaseCamera):
|
|
|
80
80
|
|
|
81
81
|
@scale_factor.setter
|
|
82
82
|
def scale_factor(self, value):
|
|
83
|
-
|
|
83
|
+
value = abs(float(value))
|
|
84
|
+
if value == self._scale_factor:
|
|
85
|
+
return
|
|
86
|
+
self._scale_factor = value
|
|
84
87
|
self.view_changed()
|
|
85
88
|
|
|
86
89
|
@property
|
|
@@ -137,6 +140,8 @@ class PerspectiveCamera(BaseCamera):
|
|
|
137
140
|
# Do we have a viewbox
|
|
138
141
|
if self._viewbox is None:
|
|
139
142
|
return
|
|
143
|
+
if self._resetting: # base camera linking operation
|
|
144
|
+
return
|
|
140
145
|
|
|
141
146
|
# Calculate viewing range for x and y
|
|
142
147
|
fx = fy = self._scale_factor
|
vispy/scene/cameras/turntable.py
CHANGED
|
@@ -73,6 +73,9 @@ class TurntableCamera(Base3DRotationCamera):
|
|
|
73
73
|
super(TurntableCamera, self).__init__(fov=fov, **kwargs)
|
|
74
74
|
|
|
75
75
|
# Set camera attributes
|
|
76
|
+
self._azimuth = azimuth
|
|
77
|
+
self._elevation = elevation
|
|
78
|
+
self._roll = roll
|
|
76
79
|
self.azimuth = azimuth
|
|
77
80
|
self.elevation = elevation
|
|
78
81
|
self.roll = roll
|
|
@@ -90,7 +93,10 @@ class TurntableCamera(Base3DRotationCamera):
|
|
|
90
93
|
@elevation.setter
|
|
91
94
|
def elevation(self, elev):
|
|
92
95
|
elev = float(elev)
|
|
93
|
-
|
|
96
|
+
elev = min(90, max(-90, elev))
|
|
97
|
+
if elev == self._elevation:
|
|
98
|
+
return
|
|
99
|
+
self._elevation = elev
|
|
94
100
|
self.view_changed()
|
|
95
101
|
|
|
96
102
|
@property
|
|
@@ -108,6 +114,8 @@ class TurntableCamera(Base3DRotationCamera):
|
|
|
108
114
|
azim += 360
|
|
109
115
|
while azim > 180:
|
|
110
116
|
azim -= 360
|
|
117
|
+
if azim == self._azimuth:
|
|
118
|
+
return
|
|
111
119
|
self._azimuth = azim
|
|
112
120
|
self.view_changed()
|
|
113
121
|
|
|
@@ -123,6 +131,8 @@ class TurntableCamera(Base3DRotationCamera):
|
|
|
123
131
|
roll += 360
|
|
124
132
|
while roll > 180:
|
|
125
133
|
roll -= 360
|
|
134
|
+
if roll == self._roll:
|
|
135
|
+
return
|
|
126
136
|
self._roll = roll
|
|
127
137
|
self.view_changed()
|
|
128
138
|
|