diff --git a/README.md b/README.md index aecb636c..302b830f 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ CAD program, and create G-Code for Isolation routing. - fixed version check - added custom mouse cursors for some tools in Gerber Editor - Gerber Editor: added multiple modes to lay a Region: 45-degrees, reverse 45-degrees, 90-degrees, reverse 90-degrees and free-angle. Added also key shortcuts 'T' and 'R' to cycle forward, respectively in reverse through the modes. +- Excellon Editor: fixed issue not remembering last tool after adding a new tool +- added custom mouse cursors for Excellon and Geometry Editors in some of their tools 16.04.2019 diff --git a/flatcamEditors/FlatCAMExcEditor.py b/flatcamEditors/FlatCAMExcEditor.py index c75ea1a2..25d44fc9 100644 --- a/flatcamEditors/FlatCAMExcEditor.py +++ b/flatcamEditors/FlatCAMExcEditor.py @@ -47,6 +47,13 @@ class FCDrillAdd(FCShapeTool): self.draw_app.select_tool("select") return + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero_drill.png')) + QtGui.QGuiApplication.setOverrideCursor(self.cursor) + geo = self.utility_geometry(data=(self.draw_app.snap_x, self.draw_app.snap_y)) if isinstance(geo, DrawToolShape) and geo.geo is not None: @@ -82,6 +89,11 @@ class FCDrillAdd(FCShapeTool): def make(self): + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + # add the point to drills if the diameter is a key in the dict, if not, create it add the drill location # to the value, as a list of itself if self.selected_dia in self.draw_app.points_edit: @@ -137,6 +149,13 @@ class FCDrillArray(FCShapeTool): self.draw_app.app.inform.emit(_("[WARNING_NOTCL] To add an Drill Array first select a tool in Tool Table")) return + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero_drill_array.png')) + QtGui.QGuiApplication.setOverrideCursor(self.cursor) + geo = self.utility_geometry(data=(self.draw_app.snap_x, self.draw_app.snap_y), static=True) if isinstance(geo, DrawToolShape) and geo.geo is not None: @@ -252,6 +271,11 @@ class FCDrillArray(FCShapeTool): self.geometry = [] geo = None + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + # add the point to drills if the diameter is a key in the dict, if not, create it add the drill location # to the value, as a list of itself if self.selected_dia not in self.draw_app.points_edit: @@ -537,6 +561,11 @@ class FCDrillSelect(DrawTool): DrawTool.__init__(self, exc_editor_app) self.name = 'drill_select' + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + self.exc_editor_app = exc_editor_app self.storage = self.exc_editor_app.storage_dict # self.selected = self.exc_editor_app.selected @@ -1433,6 +1462,7 @@ class FlatCAMExcEditor(QtCore.QObject): for key in sorted(self.tool2tooldia): if self.tool2tooldia[key] == tool_dia: row_to_be_selected = int(key) - 1 + self.last_tool_selected = int(key) break self.tools_table_exc.selectRow(row_to_be_selected) diff --git a/flatcamEditors/FlatCAMGeoEditor.py b/flatcamEditors/FlatCAMGeoEditor.py index 5067abf3..4af68b11 100644 --- a/flatcamEditors/FlatCAMGeoEditor.py +++ b/flatcamEditors/FlatCAMGeoEditor.py @@ -1932,6 +1932,13 @@ class FCCircle(FCShapeTool): DrawTool.__init__(self, draw_app) self.name = 'circle' + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero_circle.png')) + QtGui.QGuiApplication.setOverrideCursor(self.cursor) + self.start_msg = _("Click on CENTER ...") self.steps_per_circ = self.draw_app.app.defaults["geometry_circle_steps"] @@ -1958,6 +1965,11 @@ class FCCircle(FCShapeTool): return None def make(self): + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + p1 = self.points[0] p2 = self.points[1] radius = distance(p1, p2) @@ -2173,6 +2185,13 @@ class FCRectangle(FCShapeTool): DrawTool.__init__(self, draw_app) self.name = 'rectangle' + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero.png')) + QtGui.QGuiApplication.setOverrideCursor(self.cursor) + self.start_msg = _("Click on 1st corner ...") def click(self, point): @@ -2196,6 +2215,11 @@ class FCRectangle(FCShapeTool): return None def make(self): + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + p1 = self.points[0] p2 = self.points[1] # self.geometry = LinearRing([p1, (p2[0], p1[1]), p2, (p1[0], p2[1])]) @@ -2213,6 +2237,13 @@ class FCPolygon(FCShapeTool): DrawTool.__init__(self, draw_app) self.name = 'polygon' + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero.png')) + QtGui.QGuiApplication.setOverrideCursor(self.cursor) + self.start_msg = _("Click on 1st point ...") def click(self, point): @@ -2239,6 +2270,11 @@ class FCPolygon(FCShapeTool): return None def make(self): + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + # self.geometry = LinearRing(self.points) self.geometry = DrawToolShape(Polygon(self.points)) self.draw_app.in_action = False @@ -2260,11 +2296,25 @@ class FCPath(FCPolygon): """ Resulting type: LineString """ + def __init__(self, draw_app): + FCPolygon.__init__(self, draw_app) + + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero_path.png')) + QtGui.QGuiApplication.setOverrideCursor(self.cursor) def make(self): self.geometry = DrawToolShape(LineString(self.points)) self.name = 'path' + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + self.draw_app.in_action = False self.complete = True self.draw_app.app.inform.emit(_("[success] Done. Path completed.")) @@ -2293,6 +2343,11 @@ class FCSelect(DrawTool): DrawTool.__init__(self, draw_app) self.name = 'select' + try: + QtGui.QGuiApplication.restoreOverrideCursor() + except: + pass + self.storage = self.draw_app.storage # self.shape_buffer = self.draw_app.shape_buffer # self.selected = self.draw_app.selected diff --git a/share/aero_array.png b/share/aero_array.png index e8a4a4f4..655351ad 100644 Binary files a/share/aero_array.png and b/share/aero_array.png differ diff --git a/share/aero_drill.png b/share/aero_drill.png new file mode 100644 index 00000000..f37fdf43 Binary files /dev/null and b/share/aero_drill.png differ diff --git a/share/aero_drill_array.png b/share/aero_drill_array.png new file mode 100644 index 00000000..7136f86d Binary files /dev/null and b/share/aero_drill_array.png differ