- 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
This commit is contained in:
Marius Stanciu
2019-04-17 21:30:43 +03:00
parent 7218c2d920
commit b749a47652
6 changed files with 87 additions and 0 deletions

View File

@@ -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)