- changed the extension of the Tool Database file to FlatDB for easy recognition (in the future double clicking such a file might import the new tools in the FC database)
- modified the ToolDB class and changed some strings - Preferences classes now have access to the App attributes through app.setup_obj_classes() method - moved app.setup_obj_classes() upper in the App.__init__() - added a new Preferences setting allowing to modify the mouse cursor color - remade the GUI in Preferences -> General grouping the settings in a more clear way - made available the Jump To function in Excellon Editor - added a clean_up() method in all the Editor Tools that need it, to be run when aborting using the ESC key
This commit is contained in:
@@ -56,8 +56,7 @@ class FCDrillAdd(FCShapeTool):
|
||||
item = self.draw_app.tools_table_exc.item((self.draw_app.last_tool_selected - 1), 1)
|
||||
self.draw_app.tools_table_exc.setCurrentItem(item)
|
||||
except KeyError:
|
||||
self.draw_app.app.inform.emit('[WARNING_NOTCL] %s' %
|
||||
_("To add a drill first select a tool"))
|
||||
self.draw_app.app.inform.emit('[WARNING_NOTCL] %s' % _("To add a drill first select a tool"))
|
||||
self.draw_app.select_tool("drill_select")
|
||||
return
|
||||
|
||||
@@ -75,6 +74,8 @@ class FCDrillAdd(FCShapeTool):
|
||||
|
||||
self.draw_app.app.inform.emit(_("Click to place ..."))
|
||||
|
||||
self.draw_app.app.jump_signal.connect(lambda x: self.draw_app.update_utility_geometry(data=x))
|
||||
|
||||
# Switch notebook to Selected page
|
||||
self.draw_app.app.ui.notebook.setCurrentWidget(self.draw_app.app.ui.selected_tab)
|
||||
|
||||
@@ -119,8 +120,18 @@ class FCDrillAdd(FCShapeTool):
|
||||
self.geometry = DrawToolShape(self.util_shape(self.points))
|
||||
self.draw_app.in_action = False
|
||||
self.complete = True
|
||||
self.draw_app.app.inform.emit('[success] %s' %
|
||||
_("Done. Drill added."))
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Drill added."))
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCDrillArray(FCShapeTool):
|
||||
@@ -181,6 +192,8 @@ class FCDrillArray(FCShapeTool):
|
||||
|
||||
self.draw_app.app.inform.emit(_("Click on target location ..."))
|
||||
|
||||
self.draw_app.app.jump_signal.connect(lambda x: self.draw_app.update_utility_geometry(data=x))
|
||||
|
||||
# Switch notebook to Selected page
|
||||
self.draw_app.app.ui.notebook.setCurrentWidget(self.draw_app.app.ui.selected_tab)
|
||||
|
||||
@@ -292,7 +305,7 @@ class FCDrillArray(FCShapeTool):
|
||||
|
||||
try:
|
||||
QtGui.QGuiApplication.restoreOverrideCursor()
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# add the point to drills if the diameter is a key in the dict, if not, create it add the drill location
|
||||
@@ -322,6 +335,7 @@ class FCDrillArray(FCShapeTool):
|
||||
if (self.drill_angle * self.drill_array_size) > 360:
|
||||
self.draw_app.app.inform.emit('[WARNING_NOTCL] %s' %
|
||||
_("Too many drills for the selected spacing angle."))
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
return
|
||||
|
||||
radius = distance(self.destination, self.origin)
|
||||
@@ -338,11 +352,21 @@ class FCDrillArray(FCShapeTool):
|
||||
geo = self.util_shape((x, y))
|
||||
self.geometry.append(DrawToolShape(geo))
|
||||
self.complete = True
|
||||
self.draw_app.app.inform.emit('[success] %s' %
|
||||
_("Done. Drill Array added."))
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Drill Array added."))
|
||||
self.draw_app.in_action = False
|
||||
self.draw_app.array_frame.hide()
|
||||
return
|
||||
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCSlot(FCShapeTool):
|
||||
@@ -391,6 +415,8 @@ class FCSlot(FCShapeTool):
|
||||
|
||||
self.draw_app.app.inform.emit(_("Click on target location ..."))
|
||||
|
||||
self.draw_app.app.jump_signal.connect(lambda x: self.draw_app.update_utility_geometry(data=x))
|
||||
|
||||
# Switch notebook to Selected page
|
||||
self.draw_app.app.ui.notebook.setCurrentWidget(self.draw_app.app.ui.selected_tab)
|
||||
|
||||
@@ -531,9 +557,19 @@ class FCSlot(FCShapeTool):
|
||||
|
||||
self.draw_app.in_action = False
|
||||
self.complete = True
|
||||
self.draw_app.app.inform.emit('[success] %s' %
|
||||
_("Done. Adding Slot completed."))
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Adding Slot completed."))
|
||||
self.draw_app.slot_frame.hide()
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCSlotArray(FCShapeTool):
|
||||
@@ -600,6 +636,8 @@ class FCSlotArray(FCShapeTool):
|
||||
|
||||
self.draw_app.app.inform.emit(_("Click on target location ..."))
|
||||
|
||||
self.draw_app.app.jump_signal.connect(lambda x: self.draw_app.update_utility_geometry(data=x))
|
||||
|
||||
# Switch notebook to Selected page
|
||||
self.draw_app.app.ui.notebook.setCurrentWidget(self.draw_app.app.ui.selected_tab)
|
||||
|
||||
@@ -821,6 +859,7 @@ class FCSlotArray(FCShapeTool):
|
||||
if (self.slot_angle * self.slot_array_size) > 360:
|
||||
self.draw_app.app.inform.emit('[WARNING_NOTCL] %s' %
|
||||
_("Too many Slots for the selected spacing angle."))
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
return
|
||||
|
||||
radius = distance(self.destination, self.origin)
|
||||
@@ -842,18 +881,22 @@ class FCSlotArray(FCShapeTool):
|
||||
|
||||
self.geometry.append(DrawToolShape(geo))
|
||||
self.complete = True
|
||||
self.draw_app.app.inform.emit('[success] %s' %
|
||||
_("Done. Slot Array added."))
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Slot Array added."))
|
||||
self.draw_app.in_action = False
|
||||
self.draw_app.slot_frame.hide()
|
||||
self.draw_app.slot_array_frame.hide()
|
||||
return
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.apertures_table.clearSelection()
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCDrillResize(FCShapeTool):
|
||||
def __init__(self, draw_app):
|
||||
@@ -1084,6 +1127,16 @@ class FCDrillResize(FCShapeTool):
|
||||
# MS: always return to the Select Tool
|
||||
self.draw_app.select_tool("drill_select")
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCDrillMove(FCShapeTool):
|
||||
def __init__(self, draw_app):
|
||||
@@ -1112,6 +1165,8 @@ class FCDrillMove(FCShapeTool):
|
||||
dia_on_row = self.draw_app.tools_table_exc.item(row, 1).text()
|
||||
self.selected_dia_list.append(float(dia_on_row))
|
||||
|
||||
self.draw_app.app.jump_signal.connect(lambda x: self.draw_app.update_utility_geometry(data=x))
|
||||
|
||||
# Switch notebook to Selected page
|
||||
self.draw_app.app.ui.notebook.setCurrentWidget(self.draw_app.app.ui.selected_tab)
|
||||
|
||||
@@ -1156,8 +1211,8 @@ class FCDrillMove(FCShapeTool):
|
||||
sel_shapes_to_be_deleted = []
|
||||
|
||||
self.draw_app.build_ui()
|
||||
self.draw_app.app.inform.emit('[success] %s' %
|
||||
_("Done. Drill(s) Move completed."))
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Drill(s) Move completed."))
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def selection_bbox(self):
|
||||
geo_list = []
|
||||
@@ -1212,6 +1267,16 @@ class FCDrillMove(FCShapeTool):
|
||||
ss_el = None
|
||||
return DrawToolUtilityShape(ss_el)
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCDrillCopy(FCDrillMove):
|
||||
def __init__(self, draw_app):
|
||||
@@ -1254,8 +1319,18 @@ class FCDrillCopy(FCDrillMove):
|
||||
sel_shapes_to_be_deleted = []
|
||||
|
||||
self.draw_app.build_ui()
|
||||
self.draw_app.app.inform.emit('[success] %s' %
|
||||
_("Done. Drill(s) copied."))
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Drill(s) copied."))
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCDrillSelect(DrawTool):
|
||||
@@ -2919,6 +2994,11 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
try:
|
||||
self.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
def clear(self):
|
||||
self.active_tool = None
|
||||
# self.shape_buffer = []
|
||||
@@ -3710,12 +3790,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
"%.4f " % (dx, dy))
|
||||
|
||||
# ## Utility geometry (animated)
|
||||
geo = self.active_tool.utility_geometry(data=(x, y))
|
||||
|
||||
if isinstance(geo, DrawToolShape) and geo.geo is not None:
|
||||
# Remove any previous utility shape
|
||||
self.tool_shape.clear(update=True)
|
||||
self.draw_utility_geometry(geo=geo)
|
||||
self.update_utility_geometry(data=(x, y))
|
||||
|
||||
# ## Selection area on canvas section # ##
|
||||
if event_is_dragging == 1 and event.button == 1:
|
||||
@@ -3743,6 +3818,14 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
edge_width=self.app.defaults["global_cursor_width"],
|
||||
size=self.app.defaults["global_cursor_size"])
|
||||
|
||||
def update_utility_geometry(self, data):
|
||||
# ### Utility geometry (animated) ###
|
||||
geo = self.active_tool.utility_geometry(data=data)
|
||||
if isinstance(geo, DrawToolShape) and geo.geo is not None:
|
||||
# Remove any previous utility shape
|
||||
self.tool_shape.clear(update=True)
|
||||
self.draw_utility_geometry(geo=geo)
|
||||
|
||||
def on_canvas_key_release(self, event):
|
||||
self.key = None
|
||||
|
||||
|
||||
@@ -1883,6 +1883,7 @@ class DrawTool(object):
|
||||
# Jump to coords
|
||||
if key == QtCore.Qt.Key_J or key == 'J':
|
||||
self.draw_app.app.on_jump_to()
|
||||
return
|
||||
|
||||
def utility_geometry(self, data=None):
|
||||
return None
|
||||
@@ -1988,6 +1989,15 @@ class FCCircle(FCShapeTool):
|
||||
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Adding Circle completed."))
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCArc(FCShapeTool):
|
||||
def __init__(self, draw_app):
|
||||
@@ -2213,6 +2223,15 @@ class FCArc(FCShapeTool):
|
||||
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Arc completed."))
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCRectangle(FCShapeTool):
|
||||
"""
|
||||
@@ -2271,6 +2290,15 @@ class FCRectangle(FCShapeTool):
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Rectangle completed."))
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCPolygon(FCShapeTool):
|
||||
"""
|
||||
@@ -2345,6 +2373,15 @@ class FCPolygon(FCShapeTool):
|
||||
self.draw_app.draw_utility_geometry(geo=geo)
|
||||
return _("Backtracked one point ...")
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCPath(FCPolygon):
|
||||
"""
|
||||
@@ -2401,6 +2438,15 @@ class FCPath(FCPolygon):
|
||||
self.draw_app.draw_utility_geometry(geo=geo)
|
||||
return _("Backtracked one point ...")
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCSelect(DrawTool):
|
||||
def __init__(self, draw_app):
|
||||
@@ -2533,6 +2579,15 @@ class FCExplode(FCShapeTool):
|
||||
self.draw_app.on_shape_complete()
|
||||
self.draw_app.app.inform.emit('[success] %s...' % _("Done. Polygons exploded into lines."))
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCMove(FCShapeTool):
|
||||
def __init__(self, draw_app):
|
||||
@@ -2555,8 +2610,10 @@ class FCMove(FCShapeTool):
|
||||
if len(self.draw_app.get_selected()) == 0:
|
||||
self.draw_app.app.inform.emit('[WARNING_NOTCL] %s...' %
|
||||
_("MOVE: No shape selected. Select a shape to move"))
|
||||
return
|
||||
else:
|
||||
self.draw_app.app.inform.emit(_(" MOVE: Click on reference point ..."))
|
||||
self.draw_app.app.jump_signal.connect(lambda x: self.draw_app.update_utility_geometry(data=x))
|
||||
|
||||
def set_origin(self, origin):
|
||||
self.draw_app.app.inform.emit(_(" Click on destination point ..."))
|
||||
@@ -2593,8 +2650,8 @@ class FCMove(FCShapeTool):
|
||||
# Delete old
|
||||
self.draw_app.delete_selected()
|
||||
self.complete = True
|
||||
self.draw_app.app.inform.emit('[success] %s' %
|
||||
_("Done. Geometry(s) Move completed."))
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Geometry(s) Move completed."))
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def selection_bbox(self):
|
||||
geo_list = []
|
||||
@@ -2701,6 +2758,15 @@ class FCMove(FCShapeTool):
|
||||
log.error("[ERROR] Something went bad. %s" % str(e))
|
||||
raise
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCCopy(FCMove):
|
||||
def __init__(self, draw_app):
|
||||
@@ -2715,6 +2781,16 @@ class FCCopy(FCMove):
|
||||
for geom in self.draw_app.get_selected()]
|
||||
self.complete = True
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Geometry(s) Copy completed."))
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCText(FCShapeTool):
|
||||
@@ -2732,11 +2808,12 @@ class FCText(FCShapeTool):
|
||||
|
||||
self.app = draw_app.app
|
||||
|
||||
self.draw_app.app.inform.emit(_("Click on 1st corner ..."))
|
||||
self.draw_app.app.inform.emit(_("Click on 1st point ..."))
|
||||
self.origin = (0, 0)
|
||||
|
||||
self.text_gui = TextInputTool(self.app)
|
||||
self.text_gui.run()
|
||||
self.draw_app.app.jump_signal.connect(lambda x: self.draw_app.update_utility_geometry(data=x))
|
||||
|
||||
def click(self, point):
|
||||
# Create new geometry
|
||||
@@ -2754,9 +2831,11 @@ class FCText(FCShapeTool):
|
||||
self.text_gui.text_path = []
|
||||
self.text_gui.hide_tool()
|
||||
self.draw_app.select_tool('select')
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
return
|
||||
else:
|
||||
self.draw_app.app.inform.emit('[WARNING_NOTCL] %s' % _("No text to add."))
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
return
|
||||
|
||||
self.text_gui.text_path = []
|
||||
@@ -2780,6 +2859,15 @@ class FCText(FCShapeTool):
|
||||
except Exception:
|
||||
return
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCBuffer(FCShapeTool):
|
||||
def __init__(self, draw_app):
|
||||
@@ -2909,6 +2997,16 @@ class FCBuffer(FCShapeTool):
|
||||
self.draw_app.select_tool("select")
|
||||
self.buff_tool.hide_tool()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class FCEraser(FCShapeTool):
|
||||
def __init__(self, draw_app):
|
||||
@@ -2931,6 +3029,7 @@ class FCEraser(FCShapeTool):
|
||||
|
||||
# Switch notebook to Selected page
|
||||
self.draw_app.app.ui.notebook.setCurrentWidget(self.draw_app.app.ui.selected_tab)
|
||||
self.draw_app.app.jump_signal.connect(lambda x: self.draw_app.update_utility_geometry(data=x))
|
||||
|
||||
def set_origin(self, origin):
|
||||
self.origin = origin
|
||||
@@ -2982,8 +3081,8 @@ class FCEraser(FCShapeTool):
|
||||
|
||||
self.draw_app.delete_utility_geometry()
|
||||
self.draw_app.plot_all()
|
||||
self.draw_app.app.inform.emit('[success] %s' %
|
||||
_("Done. Eraser tool action completed."))
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Eraser tool action completed."))
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def utility_geometry(self, data=None):
|
||||
"""
|
||||
@@ -3013,9 +3112,14 @@ class FCEraser(FCShapeTool):
|
||||
return DrawToolUtilityShape(geo_list)
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCPaint(FCShapeTool):
|
||||
def __init__(self, draw_app):
|
||||
@@ -3557,6 +3661,11 @@ class FlatCAMGeoEditor(QtCore.QObject):
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
try:
|
||||
self.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
def add_shape(self, shape):
|
||||
"""
|
||||
Adds a shape to the shape storage.
|
||||
|
||||
@@ -240,6 +240,8 @@ class FCPad(FCShapeTool):
|
||||
|
||||
self.draw_app.app.inform.emit(_("Click to place ..."))
|
||||
|
||||
self.draw_app.app.jump_signal.connect(lambda x: self.draw_app.update_utility_geometry(data=x))
|
||||
|
||||
# Switch notebook to Selected page
|
||||
self.draw_app.app.ui.notebook.setCurrentWidget(self.draw_app.app.ui.selected_tab)
|
||||
|
||||
@@ -378,13 +380,17 @@ class FCPad(FCShapeTool):
|
||||
|
||||
self.draw_app.in_action = False
|
||||
self.complete = True
|
||||
self.draw_app.app.inform.emit('[success] %s' %
|
||||
_("Done. Adding Pad completed."))
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Adding Pad completed."))
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.apertures_table.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCPadArray(FCShapeTool):
|
||||
@@ -464,6 +470,8 @@ class FCPadArray(FCShapeTool):
|
||||
|
||||
self.draw_app.app.inform.emit(_("Click on target location ..."))
|
||||
|
||||
self.draw_app.app.jump_signal.connect(lambda x: self.draw_app.update_utility_geometry(data=x))
|
||||
|
||||
# Switch notebook to Selected page
|
||||
self.draw_app.app.ui.notebook.setCurrentWidget(self.draw_app.app.ui.selected_tab)
|
||||
|
||||
@@ -726,12 +734,16 @@ class FCPadArray(FCShapeTool):
|
||||
_("Done. Pad Array added."))
|
||||
self.draw_app.in_action = False
|
||||
self.draw_app.array_frame.hide()
|
||||
return
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.apertures_table.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCPoligonize(FCShapeTool):
|
||||
@@ -1077,6 +1089,10 @@ class FCRegion(FCShapeTool):
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.apertures_table.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
def on_key(self, key):
|
||||
# Jump to coords
|
||||
@@ -1190,6 +1206,10 @@ class FCTrack(FCRegion):
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.apertures_table.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
def click(self, point):
|
||||
self.draw_app.in_action = True
|
||||
@@ -1472,6 +1492,10 @@ class FCDisc(FCShapeTool):
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.apertures_table.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCSemiDisc(FCShapeTool):
|
||||
@@ -1737,6 +1761,10 @@ class FCSemiDisc(FCShapeTool):
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.apertures_table.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class FCScale(FCShapeTool):
|
||||
@@ -1921,6 +1949,8 @@ class FCApertureMove(FCShapeTool):
|
||||
# Switch notebook to Selected page
|
||||
self.draw_app.app.ui.notebook.setCurrentWidget(self.draw_app.app.ui.selected_tab)
|
||||
|
||||
self.draw_app.app.jump_signal.connect(lambda x: self.draw_app.update_utility_geometry(data=x))
|
||||
|
||||
self.sel_limit = self.draw_app.app.defaults["gerber_editor_sel_limit"]
|
||||
self.selection_shape = self.selection_bbox()
|
||||
|
||||
@@ -2021,14 +2051,19 @@ class FCApertureMove(FCShapeTool):
|
||||
|
||||
self.draw_app.plot_all()
|
||||
self.draw_app.build_ui()
|
||||
self.draw_app.app.inform.emit('[success] %s' %
|
||||
_("Done. Apertures Move completed."))
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Apertures Move completed."))
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.apertures_table.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
def utility_geometry(self, data=None):
|
||||
"""
|
||||
Temporary geometry on screen while using this tool.
|
||||
@@ -2098,8 +2133,8 @@ class FCApertureCopy(FCApertureMove):
|
||||
sel_shapes_to_be_deleted = []
|
||||
|
||||
self.draw_app.build_ui()
|
||||
self.draw_app.app.inform.emit('[success] %s' %
|
||||
_("Done. Apertures copied."))
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Apertures copied."))
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
|
||||
class FCEraser(FCShapeTool):
|
||||
@@ -2130,6 +2165,8 @@ class FCEraser(FCShapeTool):
|
||||
# Switch notebook to Selected page
|
||||
self.draw_app.app.ui.notebook.setCurrentWidget(self.draw_app.app.ui.selected_tab)
|
||||
|
||||
self.draw_app.app.jump_signal.connect(lambda x: self.draw_app.update_utility_geometry(data=x))
|
||||
|
||||
self.sel_limit = self.draw_app.app.defaults["gerber_editor_sel_limit"]
|
||||
|
||||
def set_origin(self, origin):
|
||||
@@ -2206,13 +2243,17 @@ class FCEraser(FCShapeTool):
|
||||
|
||||
self.draw_app.delete_utility_geometry()
|
||||
self.draw_app.plot_all()
|
||||
self.draw_app.app.inform.emit('[success] %s' %
|
||||
_("Done. Eraser tool action completed."))
|
||||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Eraser tool action completed."))
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.apertures_table.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
try:
|
||||
self.draw_app.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
def utility_geometry(self, data=None):
|
||||
"""
|
||||
@@ -3760,6 +3801,11 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
try:
|
||||
self.app.jump_signal.disconnect()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
|
||||
def clear(self):
|
||||
self.active_tool = None
|
||||
self.selected = []
|
||||
|
||||
Reference in New Issue
Block a user