Преглед изворни кода

- optimized the toggle grid command

Marius Stanciu пре 6 година
родитељ
комит
9c8c36adbb
3 измењених фајлова са 21 додато и 28 уклоњено
  1. 15 8
      FlatCAMApp.py
  2. 5 0
      README.md
  3. 1 20
      flatcamGUI/FlatCAMGUI.py

+ 15 - 8
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',
                          'mil, pho, plc, pls, smb, smt, sol, spb, spt, ssb, sst, stc, sts, top, tsm',
             # Keyword list
             # Keyword list
             "util_autocomplete_keywords": 'Desktop, Documents, FlatConfig, FlatPrj, Marius, My Documents, Paste_1, '
             "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, '
                                           'Toolchange_manual, Users, all, angle_x, angle_y, axis, auto, axisoffset, '
                                           'box, center_x, center_y, columns, combine, connect, contour, default, '
                                           'box, center_x, center_y, columns, combine, connect, contour, default, '
                                           'depthperpass, dia, diatol, dist, drilled_dias, drillz, dwell, dwelltime, '
                                           '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',
         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',
                                  'Toolchange_manual', 'Users', 'all', 'angle_x', 'angle_y', 'auto', 'axis', 'axisoffset',
                                  'box', 'center_x', 'center_y', 'columns', 'combine', 'connect', 'contour', 'default',
                                  'box', 'center_x', 'center_y', 'columns', 'combine', 'connect', 'contour', 'default',
                                  'depthperpass', 'dia', 'diatol', 'dist', 'drilled_dias', 'drillz', 'dwell',
                                  'depthperpass', 'dia', 'diatol', 'dist', 'drilled_dias', 'drillz', 'dwell',
@@ -5639,9 +5639,14 @@ class App(QtCore.QObject):
 
 
         if self.toggle_axis is False:
         if self.toggle_axis is False:
             if self.is_legacy 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:
             else:
                 self.plotcanvas.axes.axhline(color=(0.70, 0.3, 0.3), linewidth=2)
                 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)
                 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
             self.toggle_axis = True
         else:
         else:
             if self.is_legacy is False:
             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:
             else:
                 self.plotcanvas.axes.lines[:] = []
                 self.plotcanvas.axes.lines[:] = []
                 self.plotcanvas.canvas.draw()
                 self.plotcanvas.canvas.draw()

+ 5 - 0
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
 27.09.2019
 
 
 - RELEASE FlatCAM 8.97
 - RELEASE FlatCAM 8.97

+ 1 - 20
flatcamGUI/FlatCAMGUI.py

@@ -2353,26 +2353,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
 
 
                 # Toggle axis
                 # Toggle axis
                 if key == QtCore.Qt.Key_G:
                 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
                 # Open Preferences Window
                 if key == QtCore.Qt.Key_P:
                 if key == QtCore.Qt.Key_P: