- Gerber Editor: added ability to change on the fly the aperture after one of the tools: Add Pad or Add Pad Array is activated

- Gerber Editor: if a tool is cancelled via key shortcut ESCAPE, the selection is now deleted and any other action require a new selection
This commit is contained in:
Marius Stanciu
2019-04-13 13:28:47 +03:00
parent 2c8bac7402
commit 2dc98fb6d6
3 changed files with 62 additions and 1 deletions

View File

@@ -12,6 +12,8 @@ CAD program, and create G-Code for Isolation routing.
13.04.2019 13.04.2019
- updating the German translation - updating the German translation
- Gerber Editor: added ability to change on the fly the aperture after one of the tools: Add Pad or Add Pad Array is activated
- Gerber Editor: if a tool is cancelled via key shortcut ESCAPE, the selection is now deleted and any other action require a new selection
12.04.2019 12.04.2019

View File

@@ -75,6 +75,21 @@ class FCPad(FCShapeTool):
return None return None
def util_shape(self, point): def util_shape(self, point):
# updating values here allows us to change the aperture on the fly, after the Tool has been started
self.storage_obj = self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['solid_geometry']
self.radius = float(self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['size']) / 2
self.steps_per_circ = self.draw_app.app.defaults["geometry_circle_steps"]
# if those cause KeyError exception it means that the aperture type is not 'R'. Only 'R' type has those keys
try:
self.half_width = float(self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['width']) / 2
except KeyError:
pass
try:
self.half_height = float(self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['height']) / 2
except KeyError:
pass
if point[0] is None and point[1] is None: if point[0] is None and point[1] is None:
point_x = self.draw_app.x point_x = self.draw_app.x
point_y = self.draw_app.y point_y = self.draw_app.y
@@ -160,6 +175,11 @@ class FCPad(FCShapeTool):
self.complete = True self.complete = True
self.draw_app.app.inform.emit(_("[success] Done. Adding Pad completed.")) self.draw_app.app.inform.emit(_("[success] Done. Adding Pad completed."))
def clean_up(self):
self.draw_app.selected = []
self.draw_app.apertures_table.clearSelection()
self.draw_app.plot_all()
class FCPadArray(FCShapeTool): class FCPadArray(FCShapeTool):
""" """
@@ -312,6 +332,21 @@ class FCPadArray(FCShapeTool):
return DrawToolUtilityShape(LineString(temp_points)) return DrawToolUtilityShape(LineString(temp_points))
def util_shape(self, point): def util_shape(self, point):
# updating values here allows us to change the aperture on the fly, after the Tool has been started
self.storage_obj = self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['solid_geometry']
self.radius = float(self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['size']) / 2
self.steps_per_circ = self.draw_app.app.defaults["geometry_circle_steps"]
# if those cause KeyError exception it means that the aperture type is not 'R'. Only 'R' type has those keys
try:
self.half_width = float(self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['width']) / 2
except KeyError:
pass
try:
self.half_height = float(self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['height']) / 2
except KeyError:
pass
if point[0] is None and point[1] is None: if point[0] is None and point[1] is None:
point_x = self.draw_app.x point_x = self.draw_app.x
point_y = self.draw_app.y point_y = self.draw_app.y
@@ -435,6 +470,11 @@ class FCPadArray(FCShapeTool):
self.draw_app.array_frame.hide() self.draw_app.array_frame.hide()
return return
def clean_up(self):
self.draw_app.selected = []
self.draw_app.apertures_table.clearSelection()
self.draw_app.plot_all()
class FCRegion(FCShapeTool): class FCRegion(FCShapeTool):
""" """
@@ -481,6 +521,11 @@ class FCRegion(FCShapeTool):
self.complete = True self.complete = True
self.draw_app.app.inform.emit(_("[success] Done. Region completed.")) self.draw_app.app.inform.emit(_("[success] Done. Region completed."))
def clean_up(self):
self.draw_app.selected = []
self.draw_app.apertures_table.clearSelection()
self.draw_app.plot_all()
def on_key(self, key): def on_key(self, key):
if key == 'backspace': if key == 'backspace':
if len(self.points) > 0: if len(self.points) > 0:
@@ -501,6 +546,11 @@ class FCTrack(FCRegion):
self.complete = True self.complete = True
self.draw_app.app.inform.emit(_("[success] Done. Path completed.")) self.draw_app.app.inform.emit(_("[success] Done. Path completed."))
def clean_up(self):
self.draw_app.selected = []
self.draw_app.apertures_table.clearSelection()
self.draw_app.plot_all()
def utility_geometry(self, data=None): def utility_geometry(self, data=None):
if len(self.points) > 0: if len(self.points) > 0:
temp_points = [x for x in self.points] temp_points = [x for x in self.points]
@@ -659,6 +709,11 @@ class FCApertureMove(FCShapeTool):
self.draw_app.build_ui() self.draw_app.build_ui()
self.draw_app.app.inform.emit(_("[success] Done. Apertures Move completed.")) self.draw_app.app.inform.emit(_("[success] Done. Apertures Move completed."))
def clean_up(self):
self.draw_app.selected = []
self.draw_app.apertures_table.clearSelection()
self.draw_app.plot_all()
def utility_geometry(self, data=None): def utility_geometry(self, data=None):
""" """
Temporary geometry on screen while using this tool. Temporary geometry on screen while using this tool.
@@ -784,6 +839,9 @@ class FCApertureSelect(DrawTool):
return "" return ""
def clean_up(self):
self.draw_app.plot_all()
class FCTransform(FCShapeTool): class FCTransform(FCShapeTool):
def __init__(self, draw_app): def __init__(self, draw_app):

View File

@@ -2538,7 +2538,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.app.grb_editor.delete_utility_geometry() self.app.grb_editor.delete_utility_geometry()
self.app.grb_editor.plot_all() # self.app.grb_editor.plot_all()
self.app.grb_editor.active_tool.clean_up()
self.app.grb_editor.select_tool('select') self.app.grb_editor.select_tool('select')
return return