From 337d4af249745f3a50ed675f42bd0fa44182cce9 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sun, 3 Oct 2021 03:01:22 +0300 Subject: [PATCH] - removed some VisPy patches that now are incorporated in the v 0.9 of VisPy; bumped the VisPy requirement to 0.9.0 --- CHANGELOG.md | 1 + appGUI/PlotCanvas.py | 4 +-- appGUI/VisPyPatches.py | 72 +++++++++++++++++++++--------------------- requirements.txt | 2 +- 4 files changed, 40 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d3c3e12..e135e37e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ CHANGELOG for FlatCAM beta - updated the language strings to the latest version - some changes in the Objects UI +- removed some VisPy patches that now are incorporated in the v 0.9 of VisPy; bumped the VisPy requirement to 0.9.0 2.10.2021 diff --git a/appGUI/PlotCanvas.py b/appGUI/PlotCanvas.py index 4ed37b31..7ca6687a 100644 --- a/appGUI/PlotCanvas.py +++ b/appGUI/PlotCanvas.py @@ -138,9 +138,9 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas): # self.v_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 0.8), vertical=True, # parent=self.view.scene) - self.v_line = InfiniteLine(pos=0, color=axis_color, vertical=True, + self.v_line = InfiniteLine(pos=0, color=axis_color, vertical=True, line_width=1.5, parent=self.view.scene) - self.h_line = InfiniteLine(pos=0, color=axis_color, vertical=False, + self.h_line = InfiniteLine(pos=0, color=axis_color, vertical=False, line_width=1.5, parent=self.view.scene) self.line_parent = None diff --git a/appGUI/VisPyPatches.py b/appGUI/VisPyPatches.py index cb17b9d8..4c0eb6f9 100644 --- a/appGUI/VisPyPatches.py +++ b/appGUI/VisPyPatches.py @@ -15,23 +15,23 @@ import numpy as np def apply_patches(): # Patch MarkersVisual to have crossed lines marker - cross_lines = """ - float cross(vec2 pointcoord, float size) - { - //vbar - float r1 = abs(pointcoord.x - 0.5)*size; - float r2 = abs(pointcoord.y - 0.5)*size - $v_size/2; - float vbar = max(r1,r2); - //hbar - float r3 = abs(pointcoord.y - 0.5)*size; - float r4 = abs(pointcoord.x - 0.5)*size - $v_size/2; - float hbar = max(r3,r4); - return min(vbar, hbar); - } - """ - - markers._marker_dict['++'] = cross_lines - markers.marker_types = tuple(sorted(list(markers._marker_dict.copy().keys()))) + # cross_lines = """ + # float cross(vec2 pointcoord, float size) + # { + # //vbar + # float r1 = abs(pointcoord.x - 0.5)*size; + # float r2 = abs(pointcoord.y - 0.5)*size - $v_size/2; + # float vbar = max(r1,r2); + # //hbar + # float r3 = abs(pointcoord.y - 0.5)*size; + # float r4 = abs(pointcoord.x - 0.5)*size - $v_size/2; + # float hbar = max(r3,r4); + # return min(vbar, hbar); + # } + # """ + # + # markers._marker_dict['++'] = cross_lines + # markers.marker_types = tuple(sorted(list(markers._marker_dict.copy().keys()))) # # Add clear_data method to LineVisual to have possibility of clearing data # def clear_data(self): @@ -57,25 +57,25 @@ def apply_patches(): Grid._update_clipper = _update_clipper # Patch InfiniteLine visual to 1.5px width - def _prepare_draw(self, view=None): - """This method is called immediately before each draw. - The *view* argument indicates which view is about to be drawn. - """ - - self.update_gl_state(line_smooth=False) - px_scale = self.transforms.pixel_scale - width = px_scale * 1.5 - self.update_gl_state(line_width=max(width, 1.0)) - - if self._changed['pos']: - self.pos_buf.set_data(self._pos) - self._changed['pos'] = False - - if self._changed['color']: - self._program.vert['color'] = self._color - self._changed['color'] = False - - InfiniteLineVisual._prepare_draw = _prepare_draw + # def _prepare_draw(self, view=None): + # """This method is called immediately before each draw. + # The *view* argument indicates which view is about to be drawn. + # """ + # + # self.update_gl_state(line_smooth=False) + # px_scale = self.transforms.pixel_scale + # width = px_scale * 1.5 + # self.update_gl_state(line_width=max(width, 1.0)) + # + # if self._changed['pos']: + # self.pos_buf.set_data(self._pos) + # self._changed['pos'] = False + # + # if self._changed['color']: + # self._program.vert['color'] = self._color + # self._changed['color'] = False + # + # InfiniteLineVisual._prepare_draw = _prepare_draw # Patch AxisVisual to have less axis labels def _get_tick_frac_labels(self): diff --git a/requirements.txt b/requirements.txt index ca7196b4..2d5e24b8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,7 +29,7 @@ pyserial>=3.4 pikepdf>=2.0 pywin32>2.0 pyqt6>=6.1.0 -vispy>=0.8.1 +vispy>=0.9.0 rasterio foronoi>=1.0.3 networkx \ No newline at end of file