vispy 0.15.0__cp313-cp313-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/__init__.py +33 -0
- vispy/app/__init__.py +15 -0
- vispy/app/_default_app.py +76 -0
- vispy/app/_detect_eventloop.py +148 -0
- vispy/app/application.py +263 -0
- vispy/app/backends/__init__.py +52 -0
- vispy/app/backends/_egl.py +264 -0
- vispy/app/backends/_glfw.py +513 -0
- vispy/app/backends/_jupyter_rfb.py +278 -0
- vispy/app/backends/_offscreen_util.py +121 -0
- vispy/app/backends/_osmesa.py +235 -0
- vispy/app/backends/_pyglet.py +451 -0
- vispy/app/backends/_pyqt4.py +36 -0
- vispy/app/backends/_pyqt5.py +36 -0
- vispy/app/backends/_pyqt6.py +40 -0
- vispy/app/backends/_pyside.py +37 -0
- vispy/app/backends/_pyside2.py +52 -0
- vispy/app/backends/_pyside6.py +53 -0
- vispy/app/backends/_qt.py +1003 -0
- vispy/app/backends/_sdl2.py +444 -0
- vispy/app/backends/_template.py +244 -0
- vispy/app/backends/_test.py +8 -0
- vispy/app/backends/_tk.py +800 -0
- vispy/app/backends/_wx.py +476 -0
- vispy/app/backends/tests/__init__.py +0 -0
- vispy/app/backends/tests/test_offscreen_util.py +52 -0
- vispy/app/backends/tests/test_rfb.py +77 -0
- vispy/app/base.py +294 -0
- vispy/app/canvas.py +828 -0
- vispy/app/qt.py +92 -0
- vispy/app/tests/__init__.py +0 -0
- vispy/app/tests/qt-designer.ui +58 -0
- vispy/app/tests/test_app.py +442 -0
- vispy/app/tests/test_backends.py +164 -0
- vispy/app/tests/test_canvas.py +122 -0
- vispy/app/tests/test_context.py +92 -0
- vispy/app/tests/test_qt.py +47 -0
- vispy/app/tests/test_simultaneous.py +134 -0
- vispy/app/timer.py +174 -0
- vispy/color/__init__.py +17 -0
- vispy/color/_color_dict.py +193 -0
- vispy/color/color_array.py +447 -0
- vispy/color/color_space.py +181 -0
- vispy/color/colormap.py +1213 -0
- vispy/color/tests/__init__.py +0 -0
- vispy/color/tests/test_color.py +378 -0
- vispy/conftest.py +12 -0
- vispy/ext/__init__.py +0 -0
- vispy/ext/cocoapy.py +1522 -0
- vispy/ext/cubehelix.py +138 -0
- vispy/ext/egl.py +375 -0
- vispy/ext/fontconfig.py +118 -0
- vispy/ext/gdi32plus.py +206 -0
- vispy/ext/osmesa.py +105 -0
- vispy/geometry/__init__.py +23 -0
- vispy/geometry/_triangulation_debugger.py +171 -0
- vispy/geometry/calculations.py +162 -0
- vispy/geometry/curves.py +399 -0
- vispy/geometry/generation.py +643 -0
- vispy/geometry/isocurve.py +175 -0
- vispy/geometry/isosurface.py +465 -0
- vispy/geometry/meshdata.py +700 -0
- vispy/geometry/normals.py +78 -0
- vispy/geometry/parametric.py +56 -0
- vispy/geometry/polygon.py +137 -0
- vispy/geometry/rect.py +210 -0
- vispy/geometry/tests/__init__.py +0 -0
- vispy/geometry/tests/test_calculations.py +23 -0
- vispy/geometry/tests/test_generation.py +56 -0
- vispy/geometry/tests/test_meshdata.py +106 -0
- vispy/geometry/tests/test_triangulation.py +594 -0
- vispy/geometry/torusknot.py +142 -0
- vispy/geometry/triangulation.py +876 -0
- vispy/gloo/__init__.py +56 -0
- vispy/gloo/buffer.py +505 -0
- vispy/gloo/context.py +272 -0
- vispy/gloo/framebuffer.py +257 -0
- vispy/gloo/gl/__init__.py +234 -0
- vispy/gloo/gl/_constants.py +332 -0
- vispy/gloo/gl/_es2.py +986 -0
- vispy/gloo/gl/_gl2.py +1365 -0
- vispy/gloo/gl/_proxy.py +499 -0
- vispy/gloo/gl/_pyopengl2.py +362 -0
- vispy/gloo/gl/dummy.py +24 -0
- vispy/gloo/gl/es2.py +62 -0
- vispy/gloo/gl/gl2.py +98 -0
- vispy/gloo/gl/glplus.py +168 -0
- vispy/gloo/gl/pyopengl2.py +97 -0
- vispy/gloo/gl/tests/__init__.py +0 -0
- vispy/gloo/gl/tests/test_basics.py +282 -0
- vispy/gloo/gl/tests/test_functionality.py +568 -0
- vispy/gloo/gl/tests/test_names.py +246 -0
- vispy/gloo/gl/tests/test_use.py +71 -0
- vispy/gloo/glir.py +1824 -0
- vispy/gloo/globject.py +101 -0
- vispy/gloo/preprocessor.py +67 -0
- vispy/gloo/program.py +543 -0
- vispy/gloo/tests/__init__.py +0 -0
- vispy/gloo/tests/test_buffer.py +558 -0
- vispy/gloo/tests/test_context.py +119 -0
- vispy/gloo/tests/test_framebuffer.py +195 -0
- vispy/gloo/tests/test_glir.py +307 -0
- vispy/gloo/tests/test_globject.py +35 -0
- vispy/gloo/tests/test_program.py +302 -0
- vispy/gloo/tests/test_texture.py +732 -0
- vispy/gloo/tests/test_use_gloo.py +187 -0
- vispy/gloo/tests/test_util.py +60 -0
- vispy/gloo/tests/test_wrappers.py +261 -0
- vispy/gloo/texture.py +1046 -0
- vispy/gloo/util.py +129 -0
- vispy/gloo/wrappers.py +762 -0
- vispy/glsl/__init__.py +42 -0
- vispy/glsl/antialias/antialias.glsl +7 -0
- vispy/glsl/antialias/cap-butt.glsl +31 -0
- vispy/glsl/antialias/cap-round.glsl +29 -0
- vispy/glsl/antialias/cap-square.glsl +30 -0
- vispy/glsl/antialias/cap-triangle-in.glsl +30 -0
- vispy/glsl/antialias/cap-triangle-out.glsl +30 -0
- vispy/glsl/antialias/cap.glsl +67 -0
- vispy/glsl/antialias/caps.glsl +67 -0
- vispy/glsl/antialias/filled.glsl +50 -0
- vispy/glsl/antialias/outline.glsl +40 -0
- vispy/glsl/antialias/stroke.glsl +43 -0
- vispy/glsl/arrowheads/angle.glsl +99 -0
- vispy/glsl/arrowheads/arrowheads.frag +60 -0
- vispy/glsl/arrowheads/arrowheads.glsl +12 -0
- vispy/glsl/arrowheads/arrowheads.vert +83 -0
- vispy/glsl/arrowheads/curved.glsl +48 -0
- vispy/glsl/arrowheads/inhibitor.glsl +26 -0
- vispy/glsl/arrowheads/stealth.glsl +46 -0
- vispy/glsl/arrowheads/triangle.glsl +97 -0
- vispy/glsl/arrowheads/util.glsl +13 -0
- vispy/glsl/arrows/angle-30.glsl +12 -0
- vispy/glsl/arrows/angle-60.glsl +12 -0
- vispy/glsl/arrows/angle-90.glsl +12 -0
- vispy/glsl/arrows/arrow.frag +39 -0
- vispy/glsl/arrows/arrow.vert +49 -0
- vispy/glsl/arrows/arrows.glsl +17 -0
- vispy/glsl/arrows/common.glsl +187 -0
- vispy/glsl/arrows/curved.glsl +63 -0
- vispy/glsl/arrows/stealth.glsl +50 -0
- vispy/glsl/arrows/triangle-30.glsl +12 -0
- vispy/glsl/arrows/triangle-60.glsl +12 -0
- vispy/glsl/arrows/triangle-90.glsl +12 -0
- vispy/glsl/arrows/util.glsl +98 -0
- vispy/glsl/build_spatial_filters.py +660 -0
- vispy/glsl/collections/agg-fast-path.frag +20 -0
- vispy/glsl/collections/agg-fast-path.vert +78 -0
- vispy/glsl/collections/agg-glyph.frag +60 -0
- vispy/glsl/collections/agg-glyph.vert +33 -0
- vispy/glsl/collections/agg-marker.frag +35 -0
- vispy/glsl/collections/agg-marker.vert +48 -0
- vispy/glsl/collections/agg-path.frag +55 -0
- vispy/glsl/collections/agg-path.vert +166 -0
- vispy/glsl/collections/agg-point.frag +21 -0
- vispy/glsl/collections/agg-point.vert +35 -0
- vispy/glsl/collections/agg-segment.frag +32 -0
- vispy/glsl/collections/agg-segment.vert +75 -0
- vispy/glsl/collections/marker.frag +38 -0
- vispy/glsl/collections/marker.vert +48 -0
- vispy/glsl/collections/raw-path.frag +15 -0
- vispy/glsl/collections/raw-path.vert +24 -0
- vispy/glsl/collections/raw-point.frag +14 -0
- vispy/glsl/collections/raw-point.vert +31 -0
- vispy/glsl/collections/raw-segment.frag +18 -0
- vispy/glsl/collections/raw-segment.vert +26 -0
- vispy/glsl/collections/raw-triangle.frag +13 -0
- vispy/glsl/collections/raw-triangle.vert +26 -0
- vispy/glsl/collections/sdf-glyph-ticks.vert +69 -0
- vispy/glsl/collections/sdf-glyph.frag +80 -0
- vispy/glsl/collections/sdf-glyph.vert +59 -0
- vispy/glsl/collections/tick-labels.vert +71 -0
- vispy/glsl/colormaps/autumn.glsl +20 -0
- vispy/glsl/colormaps/blues.glsl +20 -0
- vispy/glsl/colormaps/color-space.glsl +17 -0
- vispy/glsl/colormaps/colormaps.glsl +24 -0
- vispy/glsl/colormaps/cool.glsl +20 -0
- vispy/glsl/colormaps/fire.glsl +21 -0
- vispy/glsl/colormaps/gray.glsl +20 -0
- vispy/glsl/colormaps/greens.glsl +20 -0
- vispy/glsl/colormaps/hot.glsl +22 -0
- vispy/glsl/colormaps/ice.glsl +20 -0
- vispy/glsl/colormaps/icefire.glsl +23 -0
- vispy/glsl/colormaps/parse.py +40 -0
- vispy/glsl/colormaps/reds.glsl +20 -0
- vispy/glsl/colormaps/spring.glsl +20 -0
- vispy/glsl/colormaps/summer.glsl +20 -0
- vispy/glsl/colormaps/user.glsl +22 -0
- vispy/glsl/colormaps/util.glsl +41 -0
- vispy/glsl/colormaps/wheel.glsl +21 -0
- vispy/glsl/colormaps/winter.glsl +20 -0
- vispy/glsl/lines/agg.frag +320 -0
- vispy/glsl/lines/agg.vert +241 -0
- vispy/glsl/markers/arrow.glsl +12 -0
- vispy/glsl/markers/asterisk.glsl +16 -0
- vispy/glsl/markers/chevron.glsl +14 -0
- vispy/glsl/markers/clover.glsl +20 -0
- vispy/glsl/markers/club.glsl +31 -0
- vispy/glsl/markers/cross.glsl +17 -0
- vispy/glsl/markers/diamond.glsl +12 -0
- vispy/glsl/markers/disc.glsl +9 -0
- vispy/glsl/markers/ellipse.glsl +67 -0
- vispy/glsl/markers/hbar.glsl +9 -0
- vispy/glsl/markers/heart.glsl +15 -0
- vispy/glsl/markers/infinity.glsl +15 -0
- vispy/glsl/markers/marker-sdf.frag +74 -0
- vispy/glsl/markers/marker-sdf.vert +41 -0
- vispy/glsl/markers/marker.frag +36 -0
- vispy/glsl/markers/marker.vert +46 -0
- vispy/glsl/markers/markers.glsl +24 -0
- vispy/glsl/markers/pin.glsl +18 -0
- vispy/glsl/markers/ring.glsl +11 -0
- vispy/glsl/markers/spade.glsl +28 -0
- vispy/glsl/markers/square.glsl +10 -0
- vispy/glsl/markers/tag.glsl +11 -0
- vispy/glsl/markers/triangle.glsl +14 -0
- vispy/glsl/markers/vbar.glsl +9 -0
- vispy/glsl/math/circle-through-2-points.glsl +30 -0
- vispy/glsl/math/constants.glsl +48 -0
- vispy/glsl/math/double.glsl +114 -0
- vispy/glsl/math/functions.glsl +20 -0
- vispy/glsl/math/point-to-line-distance.glsl +31 -0
- vispy/glsl/math/point-to-line-projection.glsl +29 -0
- vispy/glsl/math/signed-line-distance.glsl +27 -0
- vispy/glsl/math/signed-segment-distance.glsl +30 -0
- vispy/glsl/misc/regular-grid.frag +244 -0
- vispy/glsl/misc/spatial-filters.frag +1407 -0
- vispy/glsl/misc/viewport-NDC.glsl +20 -0
- vispy/glsl/transforms/azimuthal-equal-area.glsl +32 -0
- vispy/glsl/transforms/azimuthal-equidistant.glsl +38 -0
- vispy/glsl/transforms/hammer.glsl +44 -0
- vispy/glsl/transforms/identity.glsl +6 -0
- vispy/glsl/transforms/identity_forward.glsl +23 -0
- vispy/glsl/transforms/identity_inverse.glsl +23 -0
- vispy/glsl/transforms/linear-scale.glsl +127 -0
- vispy/glsl/transforms/log-scale.glsl +126 -0
- vispy/glsl/transforms/mercator-transverse-forward.glsl +40 -0
- vispy/glsl/transforms/mercator-transverse-inverse.glsl +40 -0
- vispy/glsl/transforms/panzoom.glsl +10 -0
- vispy/glsl/transforms/polar.glsl +41 -0
- vispy/glsl/transforms/position.glsl +44 -0
- vispy/glsl/transforms/power-scale.glsl +139 -0
- vispy/glsl/transforms/projection.glsl +7 -0
- vispy/glsl/transforms/pvm.glsl +13 -0
- vispy/glsl/transforms/rotate.glsl +45 -0
- vispy/glsl/transforms/trackball.glsl +15 -0
- vispy/glsl/transforms/translate.glsl +35 -0
- vispy/glsl/transforms/transverse_mercator.glsl +38 -0
- vispy/glsl/transforms/viewport-clipping.glsl +14 -0
- vispy/glsl/transforms/viewport-transform.glsl +16 -0
- vispy/glsl/transforms/viewport.glsl +50 -0
- vispy/glsl/transforms/x.glsl +24 -0
- vispy/glsl/transforms/y.glsl +19 -0
- vispy/glsl/transforms/z.glsl +14 -0
- vispy/io/__init__.py +20 -0
- vispy/io/_data/spatial-filters.npy +0 -0
- vispy/io/datasets.py +94 -0
- vispy/io/image.py +231 -0
- vispy/io/mesh.py +122 -0
- vispy/io/stl.py +167 -0
- vispy/io/tests/__init__.py +0 -0
- vispy/io/tests/test_image.py +47 -0
- vispy/io/tests/test_io.py +121 -0
- vispy/io/wavefront.py +350 -0
- vispy/plot/__init__.py +36 -0
- vispy/plot/fig.py +58 -0
- vispy/plot/plotwidget.py +522 -0
- vispy/plot/tests/__init__.py +0 -0
- vispy/plot/tests/test_plot.py +46 -0
- vispy/scene/__init__.py +43 -0
- vispy/scene/cameras/__init__.py +27 -0
- vispy/scene/cameras/_base.py +38 -0
- vispy/scene/cameras/arcball.py +105 -0
- vispy/scene/cameras/base_camera.py +551 -0
- vispy/scene/cameras/fly.py +474 -0
- vispy/scene/cameras/magnify.py +163 -0
- vispy/scene/cameras/panzoom.py +311 -0
- vispy/scene/cameras/perspective.py +338 -0
- vispy/scene/cameras/tests/__init__.py +0 -0
- vispy/scene/cameras/tests/test_cameras.py +27 -0
- vispy/scene/cameras/tests/test_link.py +53 -0
- vispy/scene/cameras/tests/test_perspective.py +122 -0
- vispy/scene/cameras/turntable.py +183 -0
- vispy/scene/canvas.py +639 -0
- vispy/scene/events.py +85 -0
- vispy/scene/node.py +644 -0
- vispy/scene/subscene.py +20 -0
- vispy/scene/tests/__init__.py +0 -0
- vispy/scene/tests/test_canvas.py +119 -0
- vispy/scene/tests/test_node.py +142 -0
- vispy/scene/tests/test_visuals.py +141 -0
- vispy/scene/visuals.py +276 -0
- vispy/scene/widgets/__init__.py +18 -0
- vispy/scene/widgets/anchor.py +25 -0
- vispy/scene/widgets/axis.py +88 -0
- vispy/scene/widgets/colorbar.py +176 -0
- vispy/scene/widgets/console.py +351 -0
- vispy/scene/widgets/grid.py +509 -0
- vispy/scene/widgets/label.py +50 -0
- vispy/scene/widgets/tests/__init__.py +0 -0
- vispy/scene/widgets/tests/test_colorbar.py +47 -0
- vispy/scene/widgets/viewbox.py +199 -0
- vispy/scene/widgets/widget.py +478 -0
- vispy/testing/__init__.py +51 -0
- vispy/testing/_runners.py +448 -0
- vispy/testing/_testing.py +416 -0
- vispy/testing/image_tester.py +494 -0
- vispy/testing/rendered_array_tester.py +85 -0
- vispy/testing/tests/__init__.py +0 -0
- vispy/testing/tests/test_testing.py +20 -0
- vispy/util/__init__.py +32 -0
- vispy/util/bunch.py +15 -0
- vispy/util/check_environment.py +57 -0
- vispy/util/config.py +490 -0
- vispy/util/dpi/__init__.py +19 -0
- vispy/util/dpi/_linux.py +69 -0
- vispy/util/dpi/_quartz.py +26 -0
- vispy/util/dpi/_win32.py +34 -0
- vispy/util/dpi/tests/__init__.py +0 -0
- vispy/util/dpi/tests/test_dpi.py +16 -0
- vispy/util/eq.py +41 -0
- vispy/util/event.py +774 -0
- vispy/util/fetching.py +276 -0
- vispy/util/filter.py +44 -0
- vispy/util/fonts/__init__.py +14 -0
- vispy/util/fonts/_freetype.py +73 -0
- vispy/util/fonts/_quartz.py +192 -0
- vispy/util/fonts/_triage.py +36 -0
- vispy/util/fonts/_vispy_fonts.py +20 -0
- vispy/util/fonts/_win32.py +105 -0
- vispy/util/fonts/data/OpenSans-Bold.ttf +0 -0
- vispy/util/fonts/data/OpenSans-BoldItalic.ttf +0 -0
- vispy/util/fonts/data/OpenSans-Italic.ttf +0 -0
- vispy/util/fonts/data/OpenSans-Regular.ttf +0 -0
- vispy/util/fonts/tests/__init__.py +0 -0
- vispy/util/fonts/tests/test_font.py +45 -0
- vispy/util/fourier.py +69 -0
- vispy/util/frozen.py +25 -0
- vispy/util/gallery_scraper.py +268 -0
- vispy/util/keys.py +91 -0
- vispy/util/logs.py +358 -0
- vispy/util/osmesa_gl.py +17 -0
- vispy/util/profiler.py +135 -0
- vispy/util/ptime.py +16 -0
- vispy/util/quaternion.py +229 -0
- vispy/util/svg/__init__.py +18 -0
- vispy/util/svg/base.py +20 -0
- vispy/util/svg/color.py +219 -0
- vispy/util/svg/element.py +51 -0
- vispy/util/svg/geometry.py +478 -0
- vispy/util/svg/group.py +66 -0
- vispy/util/svg/length.py +81 -0
- vispy/util/svg/number.py +25 -0
- vispy/util/svg/path.py +332 -0
- vispy/util/svg/shapes.py +57 -0
- vispy/util/svg/style.py +59 -0
- vispy/util/svg/svg.py +40 -0
- vispy/util/svg/transform.py +223 -0
- vispy/util/svg/transformable.py +28 -0
- vispy/util/svg/viewport.py +73 -0
- vispy/util/tests/__init__.py +0 -0
- vispy/util/tests/test_config.py +58 -0
- vispy/util/tests/test_docstring_parameters.py +123 -0
- vispy/util/tests/test_emitter_group.py +262 -0
- vispy/util/tests/test_event_emitter.py +743 -0
- vispy/util/tests/test_fourier.py +35 -0
- vispy/util/tests/test_gallery_scraper.py +112 -0
- vispy/util/tests/test_import.py +127 -0
- vispy/util/tests/test_key.py +22 -0
- vispy/util/tests/test_logging.py +45 -0
- vispy/util/tests/test_run.py +14 -0
- vispy/util/tests/test_transforms.py +42 -0
- vispy/util/tests/test_vispy.py +48 -0
- vispy/util/transforms.py +201 -0
- vispy/util/wrappers.py +155 -0
- vispy/version.py +21 -0
- vispy/visuals/__init__.py +50 -0
- vispy/visuals/_scalable_textures.py +487 -0
- vispy/visuals/axis.py +678 -0
- vispy/visuals/border.py +208 -0
- vispy/visuals/box.py +79 -0
- vispy/visuals/collections/__init__.py +30 -0
- vispy/visuals/collections/agg_fast_path_collection.py +219 -0
- vispy/visuals/collections/agg_path_collection.py +197 -0
- vispy/visuals/collections/agg_point_collection.py +52 -0
- vispy/visuals/collections/agg_segment_collection.py +142 -0
- vispy/visuals/collections/array_list.py +401 -0
- vispy/visuals/collections/base_collection.py +482 -0
- vispy/visuals/collections/collection.py +253 -0
- vispy/visuals/collections/path_collection.py +23 -0
- vispy/visuals/collections/point_collection.py +19 -0
- vispy/visuals/collections/polygon_collection.py +25 -0
- vispy/visuals/collections/raw_path_collection.py +119 -0
- vispy/visuals/collections/raw_point_collection.py +113 -0
- vispy/visuals/collections/raw_polygon_collection.py +77 -0
- vispy/visuals/collections/raw_segment_collection.py +112 -0
- vispy/visuals/collections/raw_triangle_collection.py +78 -0
- vispy/visuals/collections/segment_collection.py +19 -0
- vispy/visuals/collections/triangle_collection.py +16 -0
- vispy/visuals/collections/util.py +168 -0
- vispy/visuals/colorbar.py +699 -0
- vispy/visuals/cube.py +41 -0
- vispy/visuals/ellipse.py +162 -0
- vispy/visuals/filters/__init__.py +10 -0
- vispy/visuals/filters/base_filter.py +242 -0
- vispy/visuals/filters/clipper.py +60 -0
- vispy/visuals/filters/clipping_planes.py +122 -0
- vispy/visuals/filters/color.py +181 -0
- vispy/visuals/filters/markers.py +28 -0
- vispy/visuals/filters/mesh.py +801 -0
- vispy/visuals/filters/picking.py +60 -0
- vispy/visuals/filters/tests/__init__.py +3 -0
- vispy/visuals/filters/tests/test_primitive_picking_filters.py +70 -0
- vispy/visuals/filters/tests/test_wireframe_filter.py +16 -0
- vispy/visuals/glsl/__init__.py +1 -0
- vispy/visuals/glsl/antialiasing.py +133 -0
- vispy/visuals/glsl/color.py +63 -0
- vispy/visuals/graphs/__init__.py +1 -0
- vispy/visuals/graphs/graph.py +240 -0
- vispy/visuals/graphs/layouts/__init__.py +55 -0
- vispy/visuals/graphs/layouts/circular.py +49 -0
- vispy/visuals/graphs/layouts/force_directed.py +211 -0
- vispy/visuals/graphs/layouts/networkx_layout.py +87 -0
- vispy/visuals/graphs/layouts/random.py +52 -0
- vispy/visuals/graphs/tests/__init__.py +1 -0
- vispy/visuals/graphs/tests/test_layouts.py +139 -0
- vispy/visuals/graphs/tests/test_networkx_layout.py +47 -0
- vispy/visuals/graphs/util.py +120 -0
- vispy/visuals/gridlines.py +161 -0
- vispy/visuals/gridmesh.py +98 -0
- vispy/visuals/histogram.py +58 -0
- vispy/visuals/image.py +701 -0
- vispy/visuals/image_complex.py +130 -0
- vispy/visuals/infinite_line.py +199 -0
- vispy/visuals/instanced_mesh.py +152 -0
- vispy/visuals/isocurve.py +213 -0
- vispy/visuals/isoline.py +241 -0
- vispy/visuals/isosurface.py +113 -0
- vispy/visuals/line/__init__.py +6 -0
- vispy/visuals/line/arrow.py +289 -0
- vispy/visuals/line/dash_atlas.py +90 -0
- vispy/visuals/line/line.py +545 -0
- vispy/visuals/line_plot.py +135 -0
- vispy/visuals/linear_region.py +199 -0
- vispy/visuals/markers.py +819 -0
- vispy/visuals/mesh.py +373 -0
- vispy/visuals/mesh_normals.py +159 -0
- vispy/visuals/plane.py +54 -0
- vispy/visuals/polygon.py +145 -0
- vispy/visuals/rectangle.py +196 -0
- vispy/visuals/regular_polygon.py +56 -0
- vispy/visuals/scrolling_lines.py +197 -0
- vispy/visuals/shaders/__init__.py +17 -0
- vispy/visuals/shaders/compiler.py +206 -0
- vispy/visuals/shaders/expression.py +99 -0
- vispy/visuals/shaders/function.py +788 -0
- vispy/visuals/shaders/multiprogram.py +145 -0
- vispy/visuals/shaders/parsing.py +140 -0
- vispy/visuals/shaders/program.py +161 -0
- vispy/visuals/shaders/shader_object.py +162 -0
- vispy/visuals/shaders/tests/__init__.py +0 -0
- vispy/visuals/shaders/tests/test_function.py +486 -0
- vispy/visuals/shaders/tests/test_multiprogram.py +78 -0
- vispy/visuals/shaders/tests/test_parsing.py +57 -0
- vispy/visuals/shaders/variable.py +272 -0
- vispy/visuals/spectrogram.py +169 -0
- vispy/visuals/sphere.py +80 -0
- vispy/visuals/surface_plot.py +192 -0
- vispy/visuals/tests/__init__.py +0 -0
- vispy/visuals/tests/test_arrows.py +109 -0
- vispy/visuals/tests/test_axis.py +120 -0
- vispy/visuals/tests/test_collections.py +15 -0
- vispy/visuals/tests/test_colorbar.py +179 -0
- vispy/visuals/tests/test_colormap.py +97 -0
- vispy/visuals/tests/test_ellipse.py +122 -0
- vispy/visuals/tests/test_gridlines.py +30 -0
- vispy/visuals/tests/test_histogram.py +24 -0
- vispy/visuals/tests/test_image.py +392 -0
- vispy/visuals/tests/test_image_complex.py +36 -0
- vispy/visuals/tests/test_infinite_line.py +53 -0
- vispy/visuals/tests/test_instanced_mesh.py +50 -0
- vispy/visuals/tests/test_isosurface.py +22 -0
- vispy/visuals/tests/test_linear_region.py +152 -0
- vispy/visuals/tests/test_markers.py +54 -0
- vispy/visuals/tests/test_mesh.py +261 -0
- vispy/visuals/tests/test_mesh_normals.py +218 -0
- vispy/visuals/tests/test_polygon.py +112 -0
- vispy/visuals/tests/test_rectangle.py +163 -0
- vispy/visuals/tests/test_regular_polygon.py +111 -0
- vispy/visuals/tests/test_scalable_textures.py +196 -0
- vispy/visuals/tests/test_sdf.py +73 -0
- vispy/visuals/tests/test_spectrogram.py +42 -0
- vispy/visuals/tests/test_surface_plot.py +57 -0
- vispy/visuals/tests/test_text.py +95 -0
- vispy/visuals/tests/test_volume.py +542 -0
- vispy/visuals/tests/test_windbarb.py +33 -0
- vispy/visuals/text/__init__.py +7 -0
- vispy/visuals/text/_sdf_cpu.cp313-win_amd64.pyd +0 -0
- vispy/visuals/text/_sdf_cpu.pyx +112 -0
- vispy/visuals/text/_sdf_gpu.py +316 -0
- vispy/visuals/text/text.py +675 -0
- vispy/visuals/transforms/__init__.py +34 -0
- vispy/visuals/transforms/_util.py +191 -0
- vispy/visuals/transforms/base_transform.py +233 -0
- vispy/visuals/transforms/chain.py +300 -0
- vispy/visuals/transforms/interactive.py +98 -0
- vispy/visuals/transforms/linear.py +564 -0
- vispy/visuals/transforms/nonlinear.py +398 -0
- vispy/visuals/transforms/tests/__init__.py +0 -0
- vispy/visuals/transforms/tests/test_transforms.py +243 -0
- vispy/visuals/transforms/transform_system.py +339 -0
- vispy/visuals/tube.py +173 -0
- vispy/visuals/visual.py +923 -0
- vispy/visuals/volume.py +1366 -0
- vispy/visuals/windbarb.py +291 -0
- vispy/visuals/xyz_axis.py +34 -0
- vispy-0.15.0.dist-info/METADATA +243 -0
- vispy-0.15.0.dist-info/RECORD +521 -0
- vispy-0.15.0.dist-info/WHEEL +5 -0
- vispy-0.15.0.dist-info/licenses/LICENSE.txt +36 -0
- vispy-0.15.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from ..node import Node
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Anchor(Node):
|
|
5
|
+
"""
|
|
6
|
+
Anchor is a node derives parts of its transform from some other
|
|
7
|
+
coordinate system in the scene.
|
|
8
|
+
|
|
9
|
+
The purpose is to allow children of an Anchor to draw using a position
|
|
10
|
+
(and optionally rotation) specified by one coordinate system, and scaling/
|
|
11
|
+
projection specified by another.
|
|
12
|
+
|
|
13
|
+
For example, text attached to a point in a 3D scene should be drawn in
|
|
14
|
+
a coordinate system with a simple relationship to the screen pixels, but
|
|
15
|
+
should derive its location from a position within the 3D coordinate
|
|
16
|
+
system::
|
|
17
|
+
|
|
18
|
+
root = Box()
|
|
19
|
+
view = ViewBox(parent=box)
|
|
20
|
+
plot = LineVisual(parent=ViewBox)
|
|
21
|
+
anchor = Anchor(parent=root, anchor_to=plot, anchor_pos=(10, 0))
|
|
22
|
+
text = Text(parent=anchor,
|
|
23
|
+
text="Always points to (10,0) relative to line.")
|
|
24
|
+
|
|
25
|
+
"""
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# -----------------------------------------------------------------------------
|
|
3
|
+
# Copyright (c) Vispy Development Team. All Rights Reserved.
|
|
4
|
+
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
|
|
5
|
+
# -----------------------------------------------------------------------------
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
from .widget import Widget
|
|
9
|
+
from ...visuals import AxisVisual
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class AxisWidget(Widget):
|
|
13
|
+
"""Widget containing an axis
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
orientation : str
|
|
18
|
+
Orientation of the axis, 'left' or 'bottom'.
|
|
19
|
+
**kwargs : dict
|
|
20
|
+
Keyword arguments to pass to AxisVisual.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self, orientation='left', **kwargs):
|
|
24
|
+
if 'tick_direction' not in kwargs:
|
|
25
|
+
tickdir = {'left': (-1, 0), 'right': (1, 0), 'bottom': (0, 1),
|
|
26
|
+
'top': (0, -1)}[orientation]
|
|
27
|
+
kwargs['tick_direction'] = tickdir
|
|
28
|
+
self.axis = AxisVisual(**kwargs)
|
|
29
|
+
self.orientation = orientation
|
|
30
|
+
self._linked_view = None
|
|
31
|
+
Widget.__init__(self)
|
|
32
|
+
self.add_subvisual(self.axis)
|
|
33
|
+
|
|
34
|
+
def on_resize(self, event):
|
|
35
|
+
"""Resize event handler
|
|
36
|
+
|
|
37
|
+
Parameters
|
|
38
|
+
----------
|
|
39
|
+
event : instance of Event
|
|
40
|
+
The event.
|
|
41
|
+
"""
|
|
42
|
+
self._update_axis()
|
|
43
|
+
|
|
44
|
+
def _update_axis(self):
|
|
45
|
+
self.axis.pos = self._axis_ends()
|
|
46
|
+
|
|
47
|
+
def _axis_ends(self):
|
|
48
|
+
r = self.rect
|
|
49
|
+
if self.orientation == 'left':
|
|
50
|
+
return np.array([[r.right, r.top], [r.right, r.bottom]])
|
|
51
|
+
elif self.orientation == 'bottom':
|
|
52
|
+
return np.array([[r.left, r.bottom], [r.right, r.bottom]])
|
|
53
|
+
elif self.orientation == 'right':
|
|
54
|
+
return np.array([[r.left, r.top], [r.left, r.bottom]])
|
|
55
|
+
elif self.orientation == 'top':
|
|
56
|
+
return np.array([[r.left, r.top], [r.right, r.top]])
|
|
57
|
+
else:
|
|
58
|
+
raise RuntimeError(
|
|
59
|
+
'Orientation %s not supported.' % self.orientation)
|
|
60
|
+
|
|
61
|
+
def link_view(self, view):
|
|
62
|
+
"""Link this axis to a ViewBox
|
|
63
|
+
|
|
64
|
+
This makes it so that the axis's domain always matches the
|
|
65
|
+
visible range in the ViewBox.
|
|
66
|
+
|
|
67
|
+
Parameters
|
|
68
|
+
----------
|
|
69
|
+
view : instance of ViewBox
|
|
70
|
+
The ViewBox to link.
|
|
71
|
+
"""
|
|
72
|
+
if view is self._linked_view:
|
|
73
|
+
return
|
|
74
|
+
if self._linked_view is not None:
|
|
75
|
+
self._linked_view.scene.transform.changed.disconnect(
|
|
76
|
+
self._view_changed)
|
|
77
|
+
self._linked_view = view
|
|
78
|
+
view.scene.transform.changed.connect(self._view_changed)
|
|
79
|
+
self._view_changed()
|
|
80
|
+
|
|
81
|
+
def _view_changed(self, event=None):
|
|
82
|
+
"""Linked view transform has changed; update ticks."""
|
|
83
|
+
tr = self.node_transform(self._linked_view.scene)
|
|
84
|
+
p1, p2 = tr.map(self._axis_ends())
|
|
85
|
+
if self.orientation in ('left', 'right'):
|
|
86
|
+
self.axis.domain = (p1[1], p2[1])
|
|
87
|
+
else:
|
|
88
|
+
self.axis.domain = (p1[0], p2[0])
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# -----------------------------------------------------------------------------
|
|
3
|
+
# Copyright (c) Vispy Development Team. All Rights Reserved.
|
|
4
|
+
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
|
|
5
|
+
# -----------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
from .widget import Widget
|
|
9
|
+
from ...visuals import ColorBarVisual
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ColorBarWidget(Widget):
|
|
13
|
+
"""Widget containing a ColorBar
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
cmap : str | vispy.color.ColorMap
|
|
18
|
+
Either the name of the ColorMap to be used from the standard
|
|
19
|
+
set of names (refer to `vispy.color.get_colormap`),
|
|
20
|
+
or a custom ColorMap object.
|
|
21
|
+
The ColorMap is used to apply a gradient on the colorbar.
|
|
22
|
+
orientation : {'left', 'right', 'top', 'bottom'}
|
|
23
|
+
The orientation of the colorbar, used for rendering. The
|
|
24
|
+
orientation can be thought of as the position of the label
|
|
25
|
+
relative to the color bar.
|
|
26
|
+
|
|
27
|
+
When the orientation is 'left' or 'right', the colorbar is
|
|
28
|
+
vertically placed. When it is 'top' or 'bottom', the colorbar is
|
|
29
|
+
horizontally placed. The colorbar automatically resizes when its
|
|
30
|
+
container's dimension changes.
|
|
31
|
+
|
|
32
|
+
* 'top': the colorbar is horizontal.
|
|
33
|
+
Color is applied from left to right.
|
|
34
|
+
Minimum corresponds to left and maximum to right.
|
|
35
|
+
Label is to the top of the colorbar
|
|
36
|
+
|
|
37
|
+
* 'bottom': Same as top, except that
|
|
38
|
+
label is to the bottom of the colorbar
|
|
39
|
+
|
|
40
|
+
* 'left': the colorbar is vertical.
|
|
41
|
+
Color is applied from bottom to top.
|
|
42
|
+
Minimum corresponds to bottom and maximum to top.
|
|
43
|
+
Label is to the left of the colorbar
|
|
44
|
+
|
|
45
|
+
* 'right': Same as left, except that the
|
|
46
|
+
label is placed to the right of the colorbar
|
|
47
|
+
label : str
|
|
48
|
+
The label that is to be drawn with the colorbar
|
|
49
|
+
that provides information about the colorbar.
|
|
50
|
+
label_color : str | vispy.color.Color
|
|
51
|
+
The color of labels. This can either be a
|
|
52
|
+
str as the color's name or an actual instace of a vipy.color.Color
|
|
53
|
+
clim : tuple (min, max)
|
|
54
|
+
the minimum and maximum values of the data that
|
|
55
|
+
is given to the colorbar. This is used to draw the scale
|
|
56
|
+
on the side of the colorbar.
|
|
57
|
+
border_width : float (in px)
|
|
58
|
+
The width of the border the colormap should have. This measurement
|
|
59
|
+
is given in pixels
|
|
60
|
+
border_color : str | vispy.color.Color
|
|
61
|
+
The color of the border of the colormap. This can either be a
|
|
62
|
+
str as the color's name or an actual instace of a vipy.color.Color
|
|
63
|
+
padding : tuple (major_axis, minor_axis) [0, 1]
|
|
64
|
+
padding with respect to the major and minor axis
|
|
65
|
+
axis_ratio : float
|
|
66
|
+
ratio of minor axis to major axis
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
def __init__(self, cmap, orientation,
|
|
70
|
+
label="", label_color='black', clim=("", ""),
|
|
71
|
+
border_width=0.0, border_color="black",
|
|
72
|
+
padding=(0.2, 0.2), axis_ratio=0.05, **kwargs):
|
|
73
|
+
|
|
74
|
+
dummy_size = (1, 1)
|
|
75
|
+
self._major_axis_padding = padding[0]
|
|
76
|
+
self._minor_axis_padding = padding[1]
|
|
77
|
+
self._minor_axis_ratio = axis_ratio
|
|
78
|
+
|
|
79
|
+
self._colorbar = ColorBarVisual(size=dummy_size, cmap=cmap,
|
|
80
|
+
orientation=orientation,
|
|
81
|
+
label=label, clim=clim,
|
|
82
|
+
label_color=label_color,
|
|
83
|
+
border_width=border_width,
|
|
84
|
+
border_color=border_color, **kwargs)
|
|
85
|
+
|
|
86
|
+
Widget.__init__(self)
|
|
87
|
+
|
|
88
|
+
self.add_subvisual(self._colorbar)
|
|
89
|
+
self._update_colorbar()
|
|
90
|
+
|
|
91
|
+
def on_resize(self, event):
|
|
92
|
+
"""Resize event handler
|
|
93
|
+
|
|
94
|
+
Parameters
|
|
95
|
+
----------
|
|
96
|
+
event : instance of Event
|
|
97
|
+
The event.
|
|
98
|
+
"""
|
|
99
|
+
self._update_colorbar()
|
|
100
|
+
|
|
101
|
+
def _update_colorbar(self):
|
|
102
|
+
self._colorbar.pos = self.rect.center
|
|
103
|
+
self._colorbar.size = self._calc_size()
|
|
104
|
+
|
|
105
|
+
def _calc_size(self):
|
|
106
|
+
"""Calculate a size"""
|
|
107
|
+
(total_halfx, total_halfy) = (self.rect.right, self.rect.top)
|
|
108
|
+
if self._colorbar.orientation in ["bottom", "top"]:
|
|
109
|
+
(total_major_axis, total_minor_axis) = (total_halfx, total_halfy)
|
|
110
|
+
else:
|
|
111
|
+
(total_major_axis, total_minor_axis) = (total_halfy, total_halfx)
|
|
112
|
+
|
|
113
|
+
major_axis = total_major_axis * (1.0 -
|
|
114
|
+
self._major_axis_padding)
|
|
115
|
+
minor_axis = major_axis * self._minor_axis_ratio
|
|
116
|
+
|
|
117
|
+
# if the minor axis is "leaking" from the padding, then clamp
|
|
118
|
+
minor_axis = np.minimum(minor_axis,
|
|
119
|
+
total_minor_axis *
|
|
120
|
+
(1.0 - self._minor_axis_padding))
|
|
121
|
+
|
|
122
|
+
return (major_axis, minor_axis)
|
|
123
|
+
|
|
124
|
+
@property
|
|
125
|
+
def cmap(self):
|
|
126
|
+
return self._colorbar.cmap
|
|
127
|
+
|
|
128
|
+
@cmap.setter
|
|
129
|
+
def cmap(self, cmap):
|
|
130
|
+
self._colorbar.cmap = cmap
|
|
131
|
+
|
|
132
|
+
@property
|
|
133
|
+
def label(self):
|
|
134
|
+
return self._colorbar.label
|
|
135
|
+
|
|
136
|
+
@label.setter
|
|
137
|
+
def label(self, label):
|
|
138
|
+
self._colorbar.label = label
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def ticks(self):
|
|
142
|
+
return self._colorbar.ticks
|
|
143
|
+
|
|
144
|
+
@ticks.setter
|
|
145
|
+
def ticks(self, ticks):
|
|
146
|
+
self._colorbar.ticks = ticks
|
|
147
|
+
|
|
148
|
+
@property
|
|
149
|
+
def clim(self):
|
|
150
|
+
return self._colorbar.clim
|
|
151
|
+
|
|
152
|
+
@clim.setter
|
|
153
|
+
def clim(self, clim):
|
|
154
|
+
self._colorbar.clim = clim
|
|
155
|
+
|
|
156
|
+
@property
|
|
157
|
+
def border_color(self):
|
|
158
|
+
"""The color of the border around the ColorBar in pixels"""
|
|
159
|
+
return self._colorbar.border_color
|
|
160
|
+
|
|
161
|
+
@border_color.setter
|
|
162
|
+
def border_color(self, border_color):
|
|
163
|
+
self._colorbar.border_color = border_color
|
|
164
|
+
|
|
165
|
+
@property
|
|
166
|
+
def border_width(self):
|
|
167
|
+
"""The width of the border around the ColorBar in pixels"""
|
|
168
|
+
return self._colorbar.border_width
|
|
169
|
+
|
|
170
|
+
@border_width.setter
|
|
171
|
+
def border_width(self, border_width):
|
|
172
|
+
self._colorbar.border_width = border_width
|
|
173
|
+
|
|
174
|
+
@property
|
|
175
|
+
def orientation(self):
|
|
176
|
+
return self._colorbar.orientation
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# -----------------------------------------------------------------------------
|
|
3
|
+
# Copyright (c) Vispy Development Team. All Rights Reserved.
|
|
4
|
+
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
|
|
5
|
+
# -----------------------------------------------------------------------------
|
|
6
|
+
"""Fast and failsafe GL console"""
|
|
7
|
+
|
|
8
|
+
# Code translated from glumpy
|
|
9
|
+
|
|
10
|
+
import numpy as np
|
|
11
|
+
|
|
12
|
+
from .widget import Widget
|
|
13
|
+
from ...visuals import Visual
|
|
14
|
+
from ...gloo import VertexBuffer
|
|
15
|
+
from ...color import Color
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# Translated from
|
|
19
|
+
# http://www.piclist.com/tecHREF/datafile/charset/
|
|
20
|
+
# extractor/charset_extractor.htm
|
|
21
|
+
__font_6x8__ = np.array([
|
|
22
|
+
(0x00, 0x00, 0x00, 0x00, 0x00, 0x00), (0x10, 0xE3, 0x84, 0x10, 0x01, 0x00),
|
|
23
|
+
(0x6D, 0xB4, 0x80, 0x00, 0x00, 0x00), (0x00, 0xA7, 0xCA, 0x29, 0xF2, 0x80),
|
|
24
|
+
(0x20, 0xE4, 0x0C, 0x09, 0xC1, 0x00), (0x65, 0x90, 0x84, 0x21, 0x34, 0xC0),
|
|
25
|
+
(0x21, 0x45, 0x08, 0x55, 0x23, 0x40), (0x30, 0xC2, 0x00, 0x00, 0x00, 0x00),
|
|
26
|
+
(0x10, 0x82, 0x08, 0x20, 0x81, 0x00), (0x20, 0x41, 0x04, 0x10, 0x42, 0x00),
|
|
27
|
+
(0x00, 0xA3, 0x9F, 0x38, 0xA0, 0x00), (0x00, 0x41, 0x1F, 0x10, 0x40, 0x00),
|
|
28
|
+
(0x00, 0x00, 0x00, 0x00, 0xC3, 0x08), (0x00, 0x00, 0x1F, 0x00, 0x00, 0x00),
|
|
29
|
+
(0x00, 0x00, 0x00, 0x00, 0xC3, 0x00), (0x00, 0x10, 0x84, 0x21, 0x00, 0x00),
|
|
30
|
+
(0x39, 0x14, 0xD5, 0x65, 0x13, 0x80), (0x10, 0xC1, 0x04, 0x10, 0x43, 0x80),
|
|
31
|
+
(0x39, 0x10, 0x46, 0x21, 0x07, 0xC0), (0x39, 0x10, 0x4E, 0x05, 0x13, 0x80),
|
|
32
|
+
(0x08, 0x62, 0x92, 0x7C, 0x20, 0x80), (0x7D, 0x04, 0x1E, 0x05, 0x13, 0x80),
|
|
33
|
+
(0x18, 0x84, 0x1E, 0x45, 0x13, 0x80), (0x7C, 0x10, 0x84, 0x20, 0x82, 0x00),
|
|
34
|
+
(0x39, 0x14, 0x4E, 0x45, 0x13, 0x80), (0x39, 0x14, 0x4F, 0x04, 0x23, 0x00),
|
|
35
|
+
(0x00, 0x03, 0x0C, 0x00, 0xC3, 0x00), (0x00, 0x03, 0x0C, 0x00, 0xC3, 0x08),
|
|
36
|
+
(0x08, 0x42, 0x10, 0x20, 0x40, 0x80), (0x00, 0x07, 0xC0, 0x01, 0xF0, 0x00),
|
|
37
|
+
(0x20, 0x40, 0x81, 0x08, 0x42, 0x00), (0x39, 0x10, 0x46, 0x10, 0x01, 0x00),
|
|
38
|
+
(0x39, 0x15, 0xD5, 0x5D, 0x03, 0x80), (0x39, 0x14, 0x51, 0x7D, 0x14, 0x40),
|
|
39
|
+
(0x79, 0x14, 0x5E, 0x45, 0x17, 0x80), (0x39, 0x14, 0x10, 0x41, 0x13, 0x80),
|
|
40
|
+
(0x79, 0x14, 0x51, 0x45, 0x17, 0x80), (0x7D, 0x04, 0x1E, 0x41, 0x07, 0xC0),
|
|
41
|
+
(0x7D, 0x04, 0x1E, 0x41, 0x04, 0x00), (0x39, 0x14, 0x17, 0x45, 0x13, 0xC0),
|
|
42
|
+
(0x45, 0x14, 0x5F, 0x45, 0x14, 0x40), (0x38, 0x41, 0x04, 0x10, 0x43, 0x80),
|
|
43
|
+
(0x04, 0x10, 0x41, 0x45, 0x13, 0x80), (0x45, 0x25, 0x18, 0x51, 0x24, 0x40),
|
|
44
|
+
(0x41, 0x04, 0x10, 0x41, 0x07, 0xC0), (0x45, 0xB5, 0x51, 0x45, 0x14, 0x40),
|
|
45
|
+
(0x45, 0x95, 0x53, 0x45, 0x14, 0x40), (0x39, 0x14, 0x51, 0x45, 0x13, 0x80),
|
|
46
|
+
(0x79, 0x14, 0x5E, 0x41, 0x04, 0x00), (0x39, 0x14, 0x51, 0x55, 0x23, 0x40),
|
|
47
|
+
(0x79, 0x14, 0x5E, 0x49, 0x14, 0x40), (0x39, 0x14, 0x0E, 0x05, 0x13, 0x80),
|
|
48
|
+
(0x7C, 0x41, 0x04, 0x10, 0x41, 0x00), (0x45, 0x14, 0x51, 0x45, 0x13, 0x80),
|
|
49
|
+
(0x45, 0x14, 0x51, 0x44, 0xA1, 0x00), (0x45, 0x15, 0x55, 0x55, 0x52, 0x80),
|
|
50
|
+
(0x45, 0x12, 0x84, 0x29, 0x14, 0x40), (0x45, 0x14, 0x4A, 0x10, 0x41, 0x00),
|
|
51
|
+
(0x78, 0x21, 0x08, 0x41, 0x07, 0x80), (0x38, 0x82, 0x08, 0x20, 0x83, 0x80),
|
|
52
|
+
(0x01, 0x02, 0x04, 0x08, 0x10, 0x00), (0x38, 0x20, 0x82, 0x08, 0x23, 0x80),
|
|
53
|
+
(0x10, 0xA4, 0x40, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x00, 0x00, 0x3F),
|
|
54
|
+
(0x30, 0xC1, 0x00, 0x00, 0x00, 0x00), (0x00, 0x03, 0x81, 0x3D, 0x13, 0xC0),
|
|
55
|
+
(0x41, 0x07, 0x91, 0x45, 0x17, 0x80), (0x00, 0x03, 0x91, 0x41, 0x13, 0x80),
|
|
56
|
+
(0x04, 0x13, 0xD1, 0x45, 0x13, 0xC0), (0x00, 0x03, 0x91, 0x79, 0x03, 0x80),
|
|
57
|
+
(0x18, 0x82, 0x1E, 0x20, 0x82, 0x00), (0x00, 0x03, 0xD1, 0x44, 0xF0, 0x4E),
|
|
58
|
+
(0x41, 0x07, 0x12, 0x49, 0x24, 0x80), (0x10, 0x01, 0x04, 0x10, 0x41, 0x80),
|
|
59
|
+
(0x08, 0x01, 0x82, 0x08, 0x24, 0x8C), (0x41, 0x04, 0x94, 0x61, 0x44, 0x80),
|
|
60
|
+
(0x10, 0x41, 0x04, 0x10, 0x41, 0x80), (0x00, 0x06, 0x95, 0x55, 0x14, 0x40),
|
|
61
|
+
(0x00, 0x07, 0x12, 0x49, 0x24, 0x80), (0x00, 0x03, 0x91, 0x45, 0x13, 0x80),
|
|
62
|
+
(0x00, 0x07, 0x91, 0x45, 0x17, 0x90), (0x00, 0x03, 0xD1, 0x45, 0x13, 0xC1),
|
|
63
|
+
(0x00, 0x05, 0x89, 0x20, 0x87, 0x00), (0x00, 0x03, 0x90, 0x38, 0x13, 0x80),
|
|
64
|
+
(0x00, 0x87, 0x88, 0x20, 0xA1, 0x00), (0x00, 0x04, 0x92, 0x49, 0x62, 0x80),
|
|
65
|
+
(0x00, 0x04, 0x51, 0x44, 0xA1, 0x00), (0x00, 0x04, 0x51, 0x55, 0xF2, 0x80),
|
|
66
|
+
(0x00, 0x04, 0x92, 0x31, 0x24, 0x80), (0x00, 0x04, 0x92, 0x48, 0xE1, 0x18),
|
|
67
|
+
(0x00, 0x07, 0x82, 0x31, 0x07, 0x80), (0x18, 0x82, 0x18, 0x20, 0x81, 0x80),
|
|
68
|
+
(0x10, 0x41, 0x00, 0x10, 0x41, 0x00), (0x30, 0x20, 0x83, 0x08, 0x23, 0x00),
|
|
69
|
+
(0x29, 0x40, 0x00, 0x00, 0x00, 0x00), (0x10, 0xE6, 0xD1, 0x45, 0xF0, 0x00)
|
|
70
|
+
], dtype=np.float32)
|
|
71
|
+
|
|
72
|
+
VERTEX_SHADER = """
|
|
73
|
+
uniform vec2 u_logical_scale;
|
|
74
|
+
uniform float u_physical_scale;
|
|
75
|
+
uniform vec4 u_color;
|
|
76
|
+
uniform vec4 u_origin;
|
|
77
|
+
|
|
78
|
+
attribute vec2 a_position;
|
|
79
|
+
attribute vec3 a_bytes_012;
|
|
80
|
+
attribute vec3 a_bytes_345;
|
|
81
|
+
|
|
82
|
+
varying vec4 v_color;
|
|
83
|
+
varying vec3 v_bytes_012, v_bytes_345;
|
|
84
|
+
|
|
85
|
+
void main (void)
|
|
86
|
+
{
|
|
87
|
+
gl_Position = u_origin + vec4(a_position * u_logical_scale, 0., 0.);
|
|
88
|
+
gl_PointSize = 8.0 * u_physical_scale;
|
|
89
|
+
v_color = u_color;
|
|
90
|
+
v_bytes_012 = a_bytes_012;
|
|
91
|
+
v_bytes_345 = a_bytes_345;
|
|
92
|
+
}
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
FRAGMENT_SHADER = """
|
|
96
|
+
#version 120
|
|
97
|
+
float segment(float edge0, float edge1, float x)
|
|
98
|
+
{
|
|
99
|
+
return step(edge0,x) * (1.0-step(edge1,x));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
varying vec4 v_color;
|
|
103
|
+
varying vec3 v_bytes_012, v_bytes_345;
|
|
104
|
+
|
|
105
|
+
vec4 glyph_color(vec2 uv) {
|
|
106
|
+
if(uv.x > 5.0 || uv.y > 7.0)
|
|
107
|
+
return vec4(0., 0., 0., 0.);
|
|
108
|
+
else {
|
|
109
|
+
float index = floor( (uv.y*6.0+uv.x)/8.0 );
|
|
110
|
+
float offset = floor( mod(uv.y*6.0+uv.x,8.0));
|
|
111
|
+
float byte = segment(0.0,1.0,index) * v_bytes_012.x
|
|
112
|
+
+ segment(1.0,2.0,index) * v_bytes_012.y
|
|
113
|
+
+ segment(2.0,3.0,index) * v_bytes_012.z
|
|
114
|
+
+ segment(3.0,4.0,index) * v_bytes_345.x
|
|
115
|
+
+ segment(4.0,5.0,index) * v_bytes_345.y
|
|
116
|
+
+ segment(5.0,6.0,index) * v_bytes_345.z;
|
|
117
|
+
if( floor(mod(byte / (128.0/pow(2.0,offset)), 2.0)) > 0.0 )
|
|
118
|
+
return v_color;
|
|
119
|
+
else
|
|
120
|
+
return vec4(0., 0., 0., 0.);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
void main(void)
|
|
125
|
+
{
|
|
126
|
+
vec2 loc = gl_PointCoord.xy * 8.0;
|
|
127
|
+
vec2 uv = floor(loc);
|
|
128
|
+
// use multi-sampling to make the text look nicer
|
|
129
|
+
vec2 dxy = 0.25*(abs(dFdx(loc)) + abs(dFdy(loc)));
|
|
130
|
+
vec4 box = floor(vec4(loc-dxy, loc+dxy));
|
|
131
|
+
vec4 color = glyph_color(floor(loc)) +
|
|
132
|
+
0.25 * glyph_color(box.xy) +
|
|
133
|
+
0.25 * glyph_color(box.xw) +
|
|
134
|
+
0.25 * glyph_color(box.zy) +
|
|
135
|
+
0.25 * glyph_color(box.zw);
|
|
136
|
+
gl_FragColor = color / 2.;
|
|
137
|
+
}
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class Console(Widget):
|
|
142
|
+
"""Fast and failsafe text console
|
|
143
|
+
|
|
144
|
+
Parameters
|
|
145
|
+
----------
|
|
146
|
+
text_color : instance of Color
|
|
147
|
+
Color to use.
|
|
148
|
+
font_size : float
|
|
149
|
+
Point size to use.
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
def __init__(self, text_color='black', font_size=12., **kwargs):
|
|
153
|
+
self._visual = ConsoleVisual(text_color, font_size)
|
|
154
|
+
Widget.__init__(self, **kwargs)
|
|
155
|
+
self.add_subvisual(self._visual)
|
|
156
|
+
|
|
157
|
+
def on_resize(self, event):
|
|
158
|
+
"""Resize event handler
|
|
159
|
+
|
|
160
|
+
Parameters
|
|
161
|
+
----------
|
|
162
|
+
event : instance of Event
|
|
163
|
+
The event.
|
|
164
|
+
"""
|
|
165
|
+
self._visual.size = self.size
|
|
166
|
+
|
|
167
|
+
def clear(self):
|
|
168
|
+
"""Clear the console"""
|
|
169
|
+
self._visual.clear()
|
|
170
|
+
|
|
171
|
+
def write(self, text='', wrap=True):
|
|
172
|
+
"""Write text and scroll
|
|
173
|
+
|
|
174
|
+
Parameters
|
|
175
|
+
----------
|
|
176
|
+
text : str
|
|
177
|
+
Text to write. ``''`` can be used for a blank line, as a newline
|
|
178
|
+
is automatically added to the end of each line.
|
|
179
|
+
wrap : str
|
|
180
|
+
If True, long messages will be wrapped to span multiple lines.
|
|
181
|
+
"""
|
|
182
|
+
self._visual.write(text)
|
|
183
|
+
|
|
184
|
+
@property
|
|
185
|
+
def text_color(self):
|
|
186
|
+
"""The color of the text"""
|
|
187
|
+
return self._visual._text_color
|
|
188
|
+
|
|
189
|
+
@text_color.setter
|
|
190
|
+
def text_color(self, color):
|
|
191
|
+
self._visual._text_color = Color(color)
|
|
192
|
+
|
|
193
|
+
@property
|
|
194
|
+
def font_size(self):
|
|
195
|
+
"""The font size (in points) of the text"""
|
|
196
|
+
return self._visual._font_size
|
|
197
|
+
|
|
198
|
+
@font_size.setter
|
|
199
|
+
def font_size(self, font_size):
|
|
200
|
+
self._visual._font_size = float(font_size)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
class ConsoleVisual(Visual):
|
|
204
|
+
def __init__(self, text_color, font_size, **kwargs):
|
|
205
|
+
# Harcoded because of font above and shader program
|
|
206
|
+
self.text_color = text_color
|
|
207
|
+
self.font_size = font_size
|
|
208
|
+
self._char_width = 6
|
|
209
|
+
self._char_height = 10
|
|
210
|
+
self._pending_writes = []
|
|
211
|
+
self._text_lines = []
|
|
212
|
+
self._col = 0
|
|
213
|
+
self._current_sizes = (-1,) * 3
|
|
214
|
+
self._size = (100, 100)
|
|
215
|
+
Visual.__init__(self, VERTEX_SHADER, FRAGMENT_SHADER)
|
|
216
|
+
self._draw_mode = 'points'
|
|
217
|
+
self.set_gl_state(depth_test=False, blend=True,
|
|
218
|
+
blend_func=('src_alpha', 'one_minus_src_alpha'))
|
|
219
|
+
|
|
220
|
+
@property
|
|
221
|
+
def size(self):
|
|
222
|
+
return self._size
|
|
223
|
+
|
|
224
|
+
@size.setter
|
|
225
|
+
def size(self, s):
|
|
226
|
+
self._size = s
|
|
227
|
+
|
|
228
|
+
@property
|
|
229
|
+
def text_color(self):
|
|
230
|
+
"""The color of the text"""
|
|
231
|
+
return self._text_color
|
|
232
|
+
|
|
233
|
+
@text_color.setter
|
|
234
|
+
def text_color(self, color):
|
|
235
|
+
self._text_color = Color(color)
|
|
236
|
+
|
|
237
|
+
@property
|
|
238
|
+
def font_size(self):
|
|
239
|
+
"""The font size (in points) of the text"""
|
|
240
|
+
return self._font_size
|
|
241
|
+
|
|
242
|
+
@font_size.setter
|
|
243
|
+
def font_size(self, font_size):
|
|
244
|
+
self._font_size = float(font_size)
|
|
245
|
+
|
|
246
|
+
def _resize_buffers(self, font_scale):
|
|
247
|
+
"""Resize buffers only if necessary"""
|
|
248
|
+
new_sizes = (font_scale,) + self.size
|
|
249
|
+
if new_sizes == self._current_sizes: # don't need resize
|
|
250
|
+
return
|
|
251
|
+
self._n_rows = int(max(self.size[1] /
|
|
252
|
+
(self._char_height * font_scale), 1))
|
|
253
|
+
self._n_cols = int(max(self.size[0] /
|
|
254
|
+
(self._char_width * font_scale), 1))
|
|
255
|
+
self._bytes_012 = np.zeros((self._n_rows, self._n_cols, 3), np.float32)
|
|
256
|
+
self._bytes_345 = np.zeros((self._n_rows, self._n_cols, 3), np.float32)
|
|
257
|
+
pos = np.empty((self._n_rows, self._n_cols, 2), np.float32)
|
|
258
|
+
C, R = np.meshgrid(np.arange(self._n_cols), np.arange(self._n_rows))
|
|
259
|
+
# We are in left, top orientation
|
|
260
|
+
x_off = 4.
|
|
261
|
+
y_off = 4 - self.size[1] / font_scale
|
|
262
|
+
pos[..., 0] = x_off + self._char_width * C
|
|
263
|
+
pos[..., 1] = y_off + self._char_height * R
|
|
264
|
+
self._position = VertexBuffer(pos)
|
|
265
|
+
|
|
266
|
+
# Restore lines
|
|
267
|
+
for ii, line in enumerate(self._text_lines[:self._n_rows]):
|
|
268
|
+
self._insert_text_buf(line, ii)
|
|
269
|
+
self._current_sizes = new_sizes
|
|
270
|
+
|
|
271
|
+
def _prepare_draw(self, view):
|
|
272
|
+
xform = view.get_transform()
|
|
273
|
+
tr = view.get_transform('document', 'render')
|
|
274
|
+
logical_scale = np.diff(tr.map(([0, 1], [1, 0])), axis=0)[0, :2]
|
|
275
|
+
tr = view.get_transform('document', 'framebuffer')
|
|
276
|
+
log_to_phy = np.mean(np.diff(tr.map(([0, 1], [1, 0])), axis=0)[0, :2])
|
|
277
|
+
n_pix = (self.font_size / 72.) * 92. # num of pixels tall
|
|
278
|
+
# The -2 here is because the char_height has a gap built in
|
|
279
|
+
font_scale = max(n_pix / float((self._char_height-2)), 1)
|
|
280
|
+
self._resize_buffers(font_scale)
|
|
281
|
+
self._do_pending_writes()
|
|
282
|
+
self._program['u_origin'] = xform.map((0, 0, 0, 1))
|
|
283
|
+
self._program['u_logical_scale'] = font_scale * logical_scale
|
|
284
|
+
self._program['u_color'] = self.text_color.rgba
|
|
285
|
+
self._program['u_physical_scale'] = font_scale * log_to_phy
|
|
286
|
+
self._program['a_position'] = self._position
|
|
287
|
+
self._program['a_bytes_012'] = VertexBuffer(self._bytes_012)
|
|
288
|
+
self._program['a_bytes_345'] = VertexBuffer(self._bytes_345)
|
|
289
|
+
|
|
290
|
+
def _prepare_transforms(self, view):
|
|
291
|
+
pass
|
|
292
|
+
|
|
293
|
+
def clear(self):
|
|
294
|
+
"""Clear the console"""
|
|
295
|
+
if hasattr(self, '_bytes_012'):
|
|
296
|
+
self._bytes_012.fill(0)
|
|
297
|
+
self._bytes_345.fill(0)
|
|
298
|
+
self._text_lines = [] * self._n_rows
|
|
299
|
+
self._pending_writes = []
|
|
300
|
+
|
|
301
|
+
def write(self, text='', wrap=True):
|
|
302
|
+
"""Write text and scroll
|
|
303
|
+
|
|
304
|
+
Parameters
|
|
305
|
+
----------
|
|
306
|
+
text : str
|
|
307
|
+
Text to write. ``''`` can be used for a blank line, as a newline
|
|
308
|
+
is automatically added to the end of each line.
|
|
309
|
+
wrap : str
|
|
310
|
+
If True, long messages will be wrapped to span multiple lines.
|
|
311
|
+
"""
|
|
312
|
+
# Clear line
|
|
313
|
+
if not isinstance(text, str):
|
|
314
|
+
raise TypeError('text must be a string')
|
|
315
|
+
# ensure we only have ASCII chars
|
|
316
|
+
text = text.encode('utf-8').decode('ascii', errors='replace')
|
|
317
|
+
self._pending_writes.append((text, wrap))
|
|
318
|
+
self.update()
|
|
319
|
+
|
|
320
|
+
def _do_pending_writes(self):
|
|
321
|
+
"""Do any pending text writes"""
|
|
322
|
+
for text, wrap in self._pending_writes:
|
|
323
|
+
# truncate in case of *really* long messages
|
|
324
|
+
text = text[-self._n_cols*self._n_rows:]
|
|
325
|
+
text = text.split('\n')
|
|
326
|
+
text = [t if len(t) > 0 else '' for t in text]
|
|
327
|
+
nr, nc = self._n_rows, self._n_cols
|
|
328
|
+
for para in text:
|
|
329
|
+
para = para[:nc] if not wrap else para
|
|
330
|
+
lines = [para[ii:(ii+nc)] for ii in range(0, len(para), nc)]
|
|
331
|
+
lines = [''] if len(lines) == 0 else lines
|
|
332
|
+
for line in lines:
|
|
333
|
+
# Update row and scroll if necessary
|
|
334
|
+
self._text_lines.insert(0, line)
|
|
335
|
+
self._text_lines = self._text_lines[:nr]
|
|
336
|
+
self._bytes_012[1:] = self._bytes_012[:-1]
|
|
337
|
+
self._bytes_345[1:] = self._bytes_345[:-1]
|
|
338
|
+
self._insert_text_buf(line, 0)
|
|
339
|
+
self._pending_writes = []
|
|
340
|
+
|
|
341
|
+
def _insert_text_buf(self, line, idx):
|
|
342
|
+
"""Insert text into bytes buffers"""
|
|
343
|
+
self._bytes_012[idx] = 0
|
|
344
|
+
self._bytes_345[idx] = 0
|
|
345
|
+
# Crop text if necessary
|
|
346
|
+
ord_chars = np.array([ord(c) - 32 for c in line[:self._n_cols]])
|
|
347
|
+
ord_chars = np.clip(ord_chars, 0, len(__font_6x8__)-1)
|
|
348
|
+
if len(ord_chars) > 0:
|
|
349
|
+
b = __font_6x8__[ord_chars]
|
|
350
|
+
self._bytes_012[idx, :len(ord_chars)] = b[:, :3]
|
|
351
|
+
self._bytes_345[idx, :len(ord_chars)] = b[:, 3:]
|