- 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

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

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)

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
share/aero_drill.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
share/aero_drill_array.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB