From ccfca31c4ef88d02101cc6eb663ac7dabd04eae6 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 30 Aug 2021 02:27:06 +0300 Subject: [PATCH] - removed patch to fix scaling on HIDPI displays since now the fix is implemented in VisPy v0.8.1 - modified a patch for VisPy Infinite Line Visual that set the line width, in order to make it compliant with newer versions of OpenGL --- CHANGELOG.md | 2 ++ appGUI/VisPyPatches.py | 32 ++++---------------------------- requirements.txt | 2 +- 3 files changed, 7 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a60fc2a..34705a45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ CHANGELOG for FlatCAM beta - fixed the reconnection of the mouse events when canceling setting the origin - disabled the selection of a Graphic Engine until matplotlib will have support for PyQt6 framework +- removed patch to fix scaling on HIDPI displays since now the fix is implemented in VisPy v0.8.1 +- modified a patch for VisPy Infinite Line Visual that set the line width, in order to make it compliant with newer versions of OpenGL 29.08.2021 diff --git a/appGUI/VisPyPatches.py b/appGUI/VisPyPatches.py index e5e5766e..cb17b9d8 100644 --- a/appGUI/VisPyPatches.py +++ b/appGUI/VisPyPatches.py @@ -61,19 +61,11 @@ def apply_patches(): """This method is called immediately before each draw. The *view* argument indicates which view is about to be drawn. """ - GL = None - from vispy.app._default_app import default_app - if default_app is not None and \ - default_app.backend_name != 'ipynb_webgl': - try: - import OpenGL.GL as GL - except Exception: # can be other than ImportError sometimes - pass - - if GL: - GL.glDisable(GL.GL_LINE_SMOOTH) - GL.glLineWidth(1.5) + 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) @@ -140,19 +132,3 @@ def apply_patches(): return NotImplementedError Ticker._get_tick_frac_labels = _get_tick_frac_labels - - def _resizeGL(self, w, h): - if self._vispy_canvas is None: - return - if hasattr(self, 'devicePixelRatio'): - # We take into account devicePixelRatio, which is non-unity on - # e.g HiDPI displays. - # self.devicePixelRatio() is a float and should have been in Qt5 according to the documentation - ratio = self.devicePixelRatio() - w = int(w * ratio) - h = int(h * ratio) - self._vispy_set_physical_size(w, h) - self._vispy_canvas.events.resize(size=(self.width(), self.height()), - physical_size=(w, h)) - - CanvasBackendDesktop.resizeGL = _resizeGL diff --git a/requirements.txt b/requirements.txt index e63696d7..ca7196b4 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.0 +vispy>=0.8.1 rasterio foronoi>=1.0.3 networkx \ No newline at end of file