From 9c8c36adbb51a84987f733a601a4638c8063f9bd Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Fri, 27 Sep 2019 01:15:29 +0300 Subject: [PATCH] - optimized the toggle grid command --- FlatCAMApp.py | 23 +++++++++++++++-------- README.md | 5 +++++ flatcamGUI/FlatCAMGUI.py | 21 +-------------------- 3 files changed, 21 insertions(+), 28 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 52b0d349..fe261376 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -1200,7 +1200,7 @@ class App(QtCore.QObject): 'mil, pho, plc, pls, smb, smt, sol, spb, spt, ssb, sst, stc, sts, top, tsm', # Keyword list "util_autocomplete_keywords": 'Desktop, Documents, FlatConfig, FlatPrj, Marius, My Documents, Paste_1, ' - 'Repetier, Roland_MDX_20, Toolchange_Custom, Toolchange_Probe_MACH3, ' + 'Repetier, Roland_MDX_20, Users, Toolchange_Custom, Toolchange_Probe_MACH3, ' 'Toolchange_manual, Users, all, angle_x, angle_y, axis, auto, axisoffset, ' 'box, center_x, center_y, columns, combine, connect, contour, default, ' 'depthperpass, dia, diatol, dist, drilled_dias, drillz, dwell, dwelltime, ' @@ -2120,7 +2120,7 @@ class App(QtCore.QObject): ] self.default_keywords = ['Desktop', 'Documents', 'FlatConfig', 'FlatPrj', 'Marius', 'My Documents', 'Paste_1', - 'Repetier', 'Roland_MDX_20', 'Toolchange_Custom', 'Toolchange_Probe_MACH3', + 'Repetier', 'Roland_MDX_20', 'Users', 'Toolchange_Custom', 'Toolchange_Probe_MACH3', 'Toolchange_manual', 'Users', 'all', 'angle_x', 'angle_y', 'auto', 'axis', 'axisoffset', 'box', 'center_x', 'center_y', 'columns', 'combine', 'connect', 'contour', 'default', 'depthperpass', 'dia', 'diatol', 'dist', 'drilled_dias', 'drillz', 'dwell', @@ -5639,9 +5639,14 @@ class App(QtCore.QObject): if self.toggle_axis is False: if self.is_legacy is False: - self.plotcanvas.v_line.set_data(color=(0.70, 0.3, 0.3, 1.0)) - self.plotcanvas.h_line.set_data(color=(0.70, 0.3, 0.3, 1.0)) - self.plotcanvas.redraw() + # self.plotcanvas.v_line.set_data(color=(0.70, 0.3, 0.3, 1.0)) + # self.plotcanvas.h_line.set_data(color=(0.70, 0.3, 0.3, 1.0)) + self.plotcanvas.v_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 1.0), vertical=True, + parent=self.plotcanvas.view.scene) + + self.plotcanvas.h_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 1.0), vertical=False, + parent=self.plotcanvas.view.scene) + # self.plotcanvas.redraw() else: self.plotcanvas.axes.axhline(color=(0.70, 0.3, 0.3), linewidth=2) self.plotcanvas.axes.axvline(color=(0.70, 0.3, 0.3), linewidth=2) @@ -5650,9 +5655,11 @@ class App(QtCore.QObject): self.toggle_axis = True else: if self.is_legacy is False: - self.plotcanvas.v_line.set_data(color=(0.0, 0.0, 0.0, 0.0)) - self.plotcanvas.h_line.set_data(color=(0.0, 0.0, 0.0, 0.0)) - self.plotcanvas.redraw() + # self.plotcanvas.v_line.set_data(color=(0.0, 0.0, 0.0, 0.0)) + # self.plotcanvas.h_line.set_data(color=(0.0, 0.0, 0.0, 0.0)) + # self.plotcanvas.redraw() + self.plotcanvas.v_line.parent = None + self.plotcanvas.h_line.parent = None else: self.plotcanvas.axes.lines[:] = [] self.plotcanvas.canvas.draw() diff --git a/README.md b/README.md index be6ca169..3d1b575c 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,11 @@ CAD program, and create G-Code for Isolation routing. ================================================= +27.09.2019 + +- optimized the toggle grid command + + 27.09.2019 - RELEASE FlatCAM 8.97 diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index dd01e608..a1821e5b 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -2353,26 +2353,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): # Toggle axis if key == QtCore.Qt.Key_G: - if self.app.toggle_axis is False: - if self.app.is_legacy is False: - self.app.plotcanvas.v_line.set_data(color=(0.70, 0.3, 0.3, 1.0)) - self.app.plotcanvas.h_line.set_data(color=(0.70, 0.3, 0.3, 1.0)) - self.app.plotcanvas.redraw() - else: - self.app.plotcanvas.axes.axhline(color=(0.70, 0.3, 0.3), linewidth=2) - self.app.plotcanvas.axes.axvline(color=(0.70, 0.3, 0.3), linewidth=2) - self.app.plotcanvas.canvas.draw() - - self.app.toggle_axis = True - else: - if self.app.is_legacy is False: - self.app.plotcanvas.v_line.set_data(color=(0.0, 0.0, 0.0, 0.0)) - self.app.plotcanvas.h_line.set_data(color=(0.0, 0.0, 0.0, 0.0)) - self.app.plotcanvas.redraw() - else: - self.app.plotcanvas.axes.lines[:] = [] - self.app.plotcanvas.canvas.draw() - self.app.toggle_axis = False + self.app.on_toggle_axis() # Open Preferences Window if key == QtCore.Qt.Key_P: