- more refactoring in the app Editors
This commit is contained in:
@@ -10,7 +10,7 @@ from PyQt5.QtCore import Qt, QSettings
|
||||
|
||||
from camlib import distance, arc, FlatCAMRTreeStorage
|
||||
from appGUI.GUIElements import FCEntry, FCComboBox, FCTable, FCDoubleSpinner, RadioSet, FCSpinner
|
||||
from appEditors.appGeoEditor import FCShapeTool, DrawTool, DrawToolShape, DrawToolUtilityShape, appGeoEditor
|
||||
from appEditors.AppGeoEditor import FCShapeTool, DrawTool, DrawToolShape, DrawToolUtilityShape, AppGeoEditor
|
||||
from appParsers.ParseExcellon import Excellon
|
||||
|
||||
from shapely.geometry import LineString, LinearRing, MultiLineString, Polygon, MultiPolygon, Point
|
||||
@@ -935,7 +935,7 @@ class FCDrillResize(FCShapeTool):
|
||||
return
|
||||
|
||||
if new_dia not in self.draw_app.olddia_newdia:
|
||||
self.destination_storage = appGeoEditor.make_storage()
|
||||
self.destination_storage = AppGeoEditor.make_storage()
|
||||
self.draw_app.storage_dict[new_dia] = self.destination_storage
|
||||
|
||||
# self.olddia_newdia dict keeps the evidence on current tools diameters as keys and gets updated on values
|
||||
@@ -1347,7 +1347,7 @@ class FCDrillSelect(DrawTool):
|
||||
self.sel_tools = set()
|
||||
|
||||
# here we store all shapes that were selected so we can search for the nearest to our click location
|
||||
self.sel_storage = FlatCAMExcEditor.make_storage()
|
||||
self.sel_storage = AppExcEditor.make_storage()
|
||||
|
||||
self.exc_editor_app.resize_frame.hide()
|
||||
self.exc_editor_app.array_frame.hide()
|
||||
@@ -1452,7 +1452,7 @@ class FCDrillSelect(DrawTool):
|
||||
self.exc_editor_app.tools_table_exc.cellPressed.connect(self.exc_editor_app.on_row_selected)
|
||||
|
||||
# delete whatever is in selection storage, there is no longer need for those shapes
|
||||
self.sel_storage = FlatCAMExcEditor.make_storage()
|
||||
self.sel_storage = AppExcEditor.make_storage()
|
||||
|
||||
return ""
|
||||
|
||||
@@ -1467,13 +1467,13 @@ class FCDrillSelect(DrawTool):
|
||||
# # if there is no shape under our click then deselect all shapes
|
||||
# if not over_shape_list:
|
||||
# self.exc_editor_app.selected = []
|
||||
# FlatCAMExcEditor.draw_shape_idx = -1
|
||||
# AppExcEditor.draw_shape_idx = -1
|
||||
# self.exc_editor_app.tools_table_exc.clearSelection()
|
||||
# else:
|
||||
# # if there are shapes under our click then advance through the list of them, one at the time in a
|
||||
# # circular way
|
||||
# FlatCAMExcEditor.draw_shape_idx = (FlatCAMExcEditor.draw_shape_idx + 1) % len(over_shape_list)
|
||||
# obj_to_add = over_shape_list[int(FlatCAMExcEditor.draw_shape_idx)]
|
||||
# AppExcEditor.draw_shape_idx = (AppExcEditor.draw_shape_idx + 1) % len(over_shape_list)
|
||||
# obj_to_add = over_shape_list[int(AppExcEditor.draw_shape_idx)]
|
||||
#
|
||||
# if self.exc_editor_app.app.defaults["global_mselect_key"] == 'Shift':
|
||||
# if self.exc_editor_app.modifiers == Qt.ShiftModifier:
|
||||
@@ -1510,14 +1510,14 @@ class FCDrillSelect(DrawTool):
|
||||
# raise
|
||||
|
||||
|
||||
class FlatCAMExcEditor(QtCore.QObject):
|
||||
class AppExcEditor(QtCore.QObject):
|
||||
|
||||
draw_shape_idx = -1
|
||||
|
||||
def __init__(self, app):
|
||||
# assert isinstance(app, FlatCAMApp.App), "Expected the app to be a FlatCAMApp.App, got %s" % type(app)
|
||||
|
||||
super(FlatCAMExcEditor, self).__init__()
|
||||
super(AppExcEditor, self).__init__()
|
||||
|
||||
self.app = app
|
||||
self.canvas = self.app.plotcanvas
|
||||
@@ -2560,7 +2560,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
return
|
||||
|
||||
if tool_dia not in self.olddia_newdia:
|
||||
storage_elem = appGeoEditor.make_storage()
|
||||
storage_elem = AppGeoEditor.make_storage()
|
||||
self.storage_dict[tool_dia] = storage_elem
|
||||
|
||||
# self.olddia_newdia dict keeps the evidence on current tools diameters as keys and gets updated on values
|
||||
@@ -2590,7 +2590,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
try:
|
||||
self.tools_table_exc.selectRow(row_to_be_selected)
|
||||
except TypeError as e:
|
||||
log.debug("FlatCAMExcEditor.on_tool_add() --> %s" % str(e))
|
||||
log.debug("AppExcEditor.on_tool_add() --> %s" % str(e))
|
||||
|
||||
def on_tool_delete(self, dia=None):
|
||||
self.is_modified = True
|
||||
@@ -2615,7 +2615,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
for deleted_tool_dia in deleted_tool_dia_list:
|
||||
|
||||
# delete the storage used for that tool
|
||||
storage_elem = appGeoEditor.make_storage()
|
||||
storage_elem = AppGeoEditor.make_storage()
|
||||
self.storage_dict[deleted_tool_dia] = storage_elem
|
||||
self.storage_dict.pop(deleted_tool_dia, None)
|
||||
|
||||
@@ -2665,7 +2665,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
try:
|
||||
new_dia = float(self.tools_table_exc.currentItem().text())
|
||||
except ValueError as e:
|
||||
log.debug("FlatCAMExcEditor.on_tool_edit() --> %s" % str(e))
|
||||
log.debug("AppExcEditor.on_tool_edit() --> %s" % str(e))
|
||||
return
|
||||
|
||||
row_of_item_changed = self.tools_table_exc.currentRow()
|
||||
@@ -2679,7 +2679,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
# DESTINATION storage
|
||||
# tool diameter is not used so we create a new tool with the desired diameter
|
||||
if new_dia not in self.olddia_newdia:
|
||||
destination_storage = appGeoEditor.make_storage()
|
||||
destination_storage = AppGeoEditor.make_storage()
|
||||
self.storage_dict[new_dia] = destination_storage
|
||||
|
||||
# self.olddia_newdia dict keeps the evidence on current tools diameters as keys and gets updated on values
|
||||
@@ -2910,7 +2910,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
self.mr = self.canvas.graph_event_connect('mouse_release', self.on_exc_click_release)
|
||||
|
||||
# make sure that the shortcuts key and mouse events will no longer be linked to the methods from FlatCAMApp
|
||||
# but those from appGeoEditor
|
||||
# but those from AppGeoEditor
|
||||
if self.app.is_legacy is False:
|
||||
self.app.plotcanvas.graph_event_disconnect('mouse_press', self.app.on_mouse_click_over_plot)
|
||||
self.app.plotcanvas.graph_event_disconnect('mouse_move', self.app.on_mouse_move_over_plot)
|
||||
@@ -3006,7 +3006,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
self.shapes.clear(update=True)
|
||||
self.tool_shape.clear(update=True)
|
||||
|
||||
# self.storage = FlatCAMExcEditor.make_storage()
|
||||
# self.storage = AppExcEditor.make_storage()
|
||||
self.replot()
|
||||
|
||||
def edit_fcexcellon(self, exc_obj):
|
||||
@@ -3052,7 +3052,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
# build the geometry for each tool-diameter, each drill will be represented by a '+' symbol
|
||||
# and then add it to the storage elements (each storage elements is a member of a list
|
||||
for tool_dia in self.points_edit:
|
||||
storage_elem = appGeoEditor.make_storage()
|
||||
storage_elem = AppGeoEditor.make_storage()
|
||||
for point in self.points_edit[tool_dia]:
|
||||
# make a '+' sign, the line length is the tool diameter
|
||||
start_hor_line = ((point.x - (tool_dia / 2)), point.y)
|
||||
@@ -3073,7 +3073,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
shape_geo = line_geo.buffer(buf_value)
|
||||
|
||||
if tool_dia not in self.storage_dict:
|
||||
storage_elem = appGeoEditor.make_storage()
|
||||
storage_elem = AppGeoEditor.make_storage()
|
||||
self.storage_dict[tool_dia] = storage_elem
|
||||
|
||||
if shape_geo is not None:
|
||||
@@ -3614,7 +3614,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
self.app.ui.popMenu.popup(self.app.cursor.pos())
|
||||
|
||||
except Exception as e:
|
||||
log.warning("FlatCAMExcEditor.on_exc_click_release() RMB click --> Error: %s" % str(e))
|
||||
log.warning("AppExcEditor.on_exc_click_release() RMB click --> Error: %s" % str(e))
|
||||
raise
|
||||
|
||||
# if the released mouse button was LMB then test if we had a right-to-left selection or a left-to-right
|
||||
@@ -3632,7 +3632,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
if self.selected:
|
||||
self.replot()
|
||||
except Exception as e:
|
||||
log.warning("FlatCAMExcEditor.on_exc_click_release() LMB click --> Error: %s" % str(e))
|
||||
log.warning("AppExcEditor.on_exc_click_release() LMB click --> Error: %s" % str(e))
|
||||
raise
|
||||
|
||||
def draw_selection_area_handler(self, start, end, sel_type):
|
||||
@@ -2523,12 +2523,12 @@ class FCSelect(DrawTool):
|
||||
# it will not work for 3rd method of click selection
|
||||
if not over_shape_list:
|
||||
self.draw_app.selected = []
|
||||
appGeoEditor.draw_shape_idx = -1
|
||||
AppGeoEditor.draw_shape_idx = -1
|
||||
else:
|
||||
# if there are shapes under our click then advance through the list of them, one at the time in a
|
||||
# circular way
|
||||
appGeoEditor.draw_shape_idx = (appGeoEditor.draw_shape_idx + 1) % len(over_shape_list)
|
||||
obj_to_add = over_shape_list[int(appGeoEditor.draw_shape_idx)]
|
||||
AppGeoEditor.draw_shape_idx = (AppGeoEditor.draw_shape_idx + 1) % len(over_shape_list)
|
||||
obj_to_add = over_shape_list[int(AppGeoEditor.draw_shape_idx)]
|
||||
|
||||
key_modifier = QtWidgets.QApplication.keyboardModifiers()
|
||||
|
||||
@@ -2550,7 +2550,7 @@ class FCSelect(DrawTool):
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.selected.append(obj_to_add)
|
||||
except Exception as e:
|
||||
log.error("[ERROR] appGeoEditor.FCSelect.click_release() -> Something went bad. %s" % str(e))
|
||||
log.error("[ERROR] AppGeoEditor.FCSelect.click_release() -> Something went bad. %s" % str(e))
|
||||
|
||||
# if selection is done on canvas update the Tree in Selected Tab with the selection
|
||||
try:
|
||||
@@ -2788,9 +2788,9 @@ class FCMove(FCShapeTool):
|
||||
else:
|
||||
# if there are shapes under our click then advance through the list of them, one at the time in a
|
||||
# circular way
|
||||
self.draw_app.draw_shape_idx = (appGeoEditor.draw_shape_idx + 1) % len(over_shape_list)
|
||||
self.draw_app.draw_shape_idx = (AppGeoEditor.draw_shape_idx + 1) % len(over_shape_list)
|
||||
try:
|
||||
obj_to_add = over_shape_list[int(appGeoEditor.draw_shape_idx)]
|
||||
obj_to_add = over_shape_list[int(AppGeoEditor.draw_shape_idx)]
|
||||
except IndexError:
|
||||
return
|
||||
|
||||
@@ -3230,7 +3230,7 @@ class FCTransform(FCShapeTool):
|
||||
# ###############################################
|
||||
# ################ Main Application #############
|
||||
# ###############################################
|
||||
class appGeoEditor(QtCore.QObject):
|
||||
class AppGeoEditor(QtCore.QObject):
|
||||
|
||||
# will emit the name of the object that was just selected
|
||||
item_selected = QtCore.pyqtSignal(str)
|
||||
@@ -3243,7 +3243,7 @@ class appGeoEditor(QtCore.QObject):
|
||||
# assert isinstance(app, FlatCAMApp.App), \
|
||||
# "Expected the app to be a FlatCAMApp.App, got %s" % type(app)
|
||||
|
||||
super(appGeoEditor, self).__init__()
|
||||
super(AppGeoEditor, self).__init__()
|
||||
|
||||
self.app = app
|
||||
self.canvas = app.plotcanvas
|
||||
@@ -3316,7 +3316,7 @@ class appGeoEditor(QtCore.QObject):
|
||||
# # ## Data
|
||||
self.active_tool = None
|
||||
|
||||
self.storage = appGeoEditor.make_storage()
|
||||
self.storage = AppGeoEditor.make_storage()
|
||||
self.utility = []
|
||||
|
||||
# VisPy visuals
|
||||
@@ -3415,7 +3415,7 @@ class appGeoEditor(QtCore.QObject):
|
||||
self.options[opt] = float(text_value)
|
||||
except Exception as e:
|
||||
entry.set_value(self.app.defaults[opt])
|
||||
log.debug("appGeoEditor.__init__().entry2option() --> %s" % str(e))
|
||||
log.debug("AppGeoEditor.__init__().entry2option() --> %s" % str(e))
|
||||
return
|
||||
|
||||
def grid_changed(goption, gentry):
|
||||
@@ -3588,7 +3588,7 @@ class appGeoEditor(QtCore.QObject):
|
||||
self.connect_canvas_event_handlers()
|
||||
|
||||
# initialize working objects
|
||||
self.storage = appGeoEditor.make_storage()
|
||||
self.storage = AppGeoEditor.make_storage()
|
||||
self.utility = []
|
||||
self.selected = []
|
||||
|
||||
@@ -3701,7 +3701,7 @@ class appGeoEditor(QtCore.QObject):
|
||||
# for w in sel_tab_widget_list:
|
||||
# w.setEnabled(True)
|
||||
# except Exception as e:
|
||||
# log.debug("appGeoEditor.deactivate() --> %s" % str(e))
|
||||
# log.debug("AppGeoEditor.deactivate() --> %s" % str(e))
|
||||
|
||||
# Show original geometry
|
||||
if self.fcgeometry:
|
||||
@@ -3727,7 +3727,7 @@ class appGeoEditor(QtCore.QObject):
|
||||
|
||||
if self.app.is_legacy is False:
|
||||
# make sure that the shortcuts key and mouse events will no longer be linked to the methods from FlatCAMApp
|
||||
# but those from appGeoEditor
|
||||
# but those from AppGeoEditor
|
||||
self.app.plotcanvas.graph_event_disconnect('mouse_press', self.app.on_mouse_click_over_plot)
|
||||
self.app.plotcanvas.graph_event_disconnect('mouse_move', self.app.on_mouse_move_over_plot)
|
||||
self.app.plotcanvas.graph_event_disconnect('mouse_release', self.app.on_mouse_click_release_over_plot)
|
||||
@@ -3958,7 +3958,7 @@ class appGeoEditor(QtCore.QObject):
|
||||
self.shapes.clear(update=True)
|
||||
self.tool_shape.clear(update=True)
|
||||
|
||||
# self.storage = appGeoEditor.make_storage()
|
||||
# self.storage = AppGeoEditor.make_storage()
|
||||
self.replot()
|
||||
|
||||
def edit_fcgeometry(self, fcgeometry, multigeo_tool=None):
|
||||
@@ -4567,10 +4567,10 @@ class appGeoEditor(QtCore.QObject):
|
||||
elif isinstance(geom, LineString) and geom is not None:
|
||||
geom = LineString(geom.coords[::-1])
|
||||
else:
|
||||
log.debug("appGeoEditor.on_shape_complete() Error --> Unexpected Geometry %s" %
|
||||
log.debug("AppGeoEditor.on_shape_complete() Error --> Unexpected Geometry %s" %
|
||||
type(geom))
|
||||
except Exception as e:
|
||||
log.debug("appGeoEditor.on_shape_complete() Error --> %s" % str(e))
|
||||
log.debug("AppGeoEditor.on_shape_complete() Error --> %s" % str(e))
|
||||
return 'fail'
|
||||
|
||||
shape_list = []
|
||||
@@ -4757,7 +4757,7 @@ class appGeoEditor(QtCore.QObject):
|
||||
try:
|
||||
results = geo_shapes[0].geo
|
||||
except Exception as e:
|
||||
log.debug("appGeoEditor.intersection() --> %s" % str(e))
|
||||
log.debug("AppGeoEditor.intersection() --> %s" % str(e))
|
||||
self.app.inform.emit('[WARNING_NOTCL] %s' %
|
||||
_("A selection of at least 2 geo items is required to do Intersection."))
|
||||
self.select_tool('select')
|
||||
@@ -4792,7 +4792,7 @@ class appGeoEditor(QtCore.QObject):
|
||||
try:
|
||||
intersector = geo_shapes[0].geo
|
||||
except Exception as e:
|
||||
log.debug("appGeoEditor.intersection() --> %s" % str(e))
|
||||
log.debug("AppGeoEditor.intersection() --> %s" % str(e))
|
||||
self.app.inform.emit('[WARNING_NOTCL] %s' %
|
||||
_("A selection of at least 2 geo items is required to do Intersection."))
|
||||
self.select_tool('select')
|
||||
@@ -885,7 +885,7 @@ class FCRegion(FCShapeTool):
|
||||
try:
|
||||
QtGui.QGuiApplication.restoreOverrideCursor()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.FCRegion --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.FCRegion --> %s" % str(e))
|
||||
|
||||
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.draw_app.app.resource_location + '/aero.png'))
|
||||
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
|
||||
@@ -991,7 +991,7 @@ class FCRegion(FCShapeTool):
|
||||
join_style=1)
|
||||
return DrawToolUtilityShape(new_geo_el)
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.FCRegion.utility_geometry() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.FCRegion.utility_geometry() --> %s" % str(e))
|
||||
else:
|
||||
new_geo_el['solid'] = Point(self.temp_points).buffer(self.buf_val,
|
||||
resolution=int(self.steps_per_circle / 4))
|
||||
@@ -1182,7 +1182,7 @@ class FCTrack(FCShapeTool):
|
||||
try:
|
||||
QtGui.QGuiApplication.restoreOverrideCursor()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.FCTrack.__init__() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.FCTrack.__init__() --> %s" % str(e))
|
||||
|
||||
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.draw_app.app.resource_location +
|
||||
'/aero_path%s.png' % self.draw_app.bend_mode))
|
||||
@@ -1329,7 +1329,7 @@ class FCTrack(FCShapeTool):
|
||||
try:
|
||||
QtGui.QGuiApplication.restoreOverrideCursor()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.FCTrack.on_key() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.FCTrack.on_key() --> %s" % str(e))
|
||||
|
||||
if self.draw_app.bend_mode == 1:
|
||||
self.draw_app.bend_mode = 2
|
||||
@@ -1368,7 +1368,7 @@ class FCTrack(FCShapeTool):
|
||||
try:
|
||||
QtGui.QGuiApplication.restoreOverrideCursor()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.FCTrack.on_key() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.FCTrack.on_key() --> %s" % str(e))
|
||||
|
||||
if self.draw_app.bend_mode == 1:
|
||||
self.draw_app.bend_mode = 5
|
||||
@@ -1477,7 +1477,7 @@ class FCDisc(FCShapeTool):
|
||||
try:
|
||||
QtGui.QGuiApplication.restoreOverrideCursor()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.FCDisc --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.FCDisc --> %s" % str(e))
|
||||
|
||||
self.draw_app.current_storage = self.storage_obj
|
||||
|
||||
@@ -1514,7 +1514,7 @@ class FCSemiDisc(FCShapeTool):
|
||||
try:
|
||||
QtGui.QGuiApplication.restoreOverrideCursor()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.FCSemiDisc --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.FCSemiDisc --> %s" % str(e))
|
||||
|
||||
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.draw_app.app.resource_location + '/aero_semidisc.png'))
|
||||
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
|
||||
@@ -2201,7 +2201,7 @@ class FCEraser(FCShapeTool):
|
||||
try:
|
||||
self.draw_app.apertures_table.cellPressed.disconnect()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.FCEraser.click_release() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.FCEraser.click_release() --> %s" % str(e))
|
||||
|
||||
self.draw_app.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
|
||||
for aper in sel_aperture:
|
||||
@@ -2325,7 +2325,7 @@ class FCApertureSelect(DrawTool):
|
||||
try:
|
||||
QtGui.QGuiApplication.restoreOverrideCursor()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.FCApertureSelect --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.FCApertureSelect --> %s" % str(e))
|
||||
|
||||
def set_origin(self, origin):
|
||||
self.origin = origin
|
||||
@@ -2381,7 +2381,7 @@ class FCApertureSelect(DrawTool):
|
||||
try:
|
||||
self.grb_editor_app.apertures_table.cellPressed.disconnect()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.FCApertureSelect.click_release() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.FCApertureSelect.click_release() --> %s" % str(e))
|
||||
|
||||
for shape_s in self.grb_editor_app.selected:
|
||||
for storage in self.grb_editor_app.storage_dict:
|
||||
@@ -2424,7 +2424,7 @@ class FCTransform(FCShapeTool):
|
||||
self.draw_app.plot_all()
|
||||
|
||||
|
||||
class FlatCAMGrbEditor(QtCore.QObject):
|
||||
class AppGerberEditor(QtCore.QObject):
|
||||
|
||||
draw_shape_idx = -1
|
||||
# plot_finished = QtCore.pyqtSignal()
|
||||
@@ -2434,7 +2434,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
# assert isinstance(app, FlatCAMApp.App), \
|
||||
# "Expected the app to be a FlatCAMApp.App, got %s" % type(app)
|
||||
|
||||
super(FlatCAMGrbEditor, self).__init__()
|
||||
super(AppGerberEditor, self).__init__()
|
||||
|
||||
self.app = app
|
||||
self.canvas = self.app.plotcanvas
|
||||
@@ -3369,7 +3369,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
self.apsize_entry.set_value(size_val)
|
||||
|
||||
except Exception as e:
|
||||
log.error("FlatCAMGrbEditor.on_aperture_add() --> the R or O aperture dims has to be in a "
|
||||
log.error("AppGerberEditor.on_aperture_add() --> the R or O aperture dims has to be in a "
|
||||
"tuple format (x,y)\nError: %s" % str(e))
|
||||
self.app.inform.emit('[WARNING_NOTCL] %s' %
|
||||
_("Aperture dimensions value is missing or wrong format. "
|
||||
@@ -3497,7 +3497,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
try:
|
||||
val_edited = int(self.apertures_table.currentItem().text())
|
||||
except ValueError as e:
|
||||
log.debug("FlatCAMGrbEditor.on_tool_edit() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.on_tool_edit() --> %s" % str(e))
|
||||
# self.apertures_table.setCurrentItem(None)
|
||||
# we reactivate the signals after the after the tool editing
|
||||
self.apertures_table.itemChanged.connect(self.on_tool_edit)
|
||||
@@ -3507,7 +3507,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
try:
|
||||
val_edited = float(self.apertures_table.currentItem().text())
|
||||
except ValueError as e:
|
||||
log.debug("FlatCAMGrbEditor.on_tool_edit() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.on_tool_edit() --> %s" % str(e))
|
||||
# self.apertures_table.setCurrentItem(None)
|
||||
# we reactivate the signals after the after the tool editing
|
||||
self.apertures_table.itemChanged.connect(self.on_tool_edit)
|
||||
@@ -3519,7 +3519,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
float(x.strip()) for x in self.apertures_table.currentItem().text().split(",") if x != ''
|
||||
]
|
||||
except ValueError as e:
|
||||
log.debug("FlatCAMGrbEditor.on_tool_edit() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.on_tool_edit() --> %s" % str(e))
|
||||
# we reactivate the signals after the after the tool editing
|
||||
self.apertures_table.itemChanged.connect(self.on_tool_edit)
|
||||
return
|
||||
@@ -3725,7 +3725,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
try:
|
||||
QtGui.QGuiApplication.restoreOverrideCursor()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.deactivate_grb_editor() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.deactivate_grb_editor() --> %s" % str(e))
|
||||
|
||||
self.clear()
|
||||
|
||||
@@ -3778,7 +3778,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
# Canvas events
|
||||
|
||||
# make sure that the shortcuts key and mouse events will no longer be linked to the methods from FlatCAMApp
|
||||
# but those from appGeoEditor
|
||||
# but those from AppGeoEditor
|
||||
|
||||
# first connect to new, then disconnect the old handlers
|
||||
# don't ask why but if there is nothing connected I've seen issues
|
||||
@@ -3980,7 +3980,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
# we activate this after the initial build as we don't need to see the tool been populated
|
||||
self.apertures_table.itemChanged.connect(self.on_tool_edit)
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.edit_fcgerber() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.edit_fcgerber() --> %s" % str(e))
|
||||
|
||||
# apply the conversion factor on the obj.apertures
|
||||
conv_apertures = deepcopy(self.gerber_obj.apertures)
|
||||
@@ -4020,7 +4020,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
# else:
|
||||
# self.storage_dict[aperture_id][k] = self.gerber_obj.apertures[aperture_id][k]
|
||||
# except Exception as e:
|
||||
# log.debug("FlatCAMGrbEditor.edit_fcgerber().job_thread() --> %s" % str(e))
|
||||
# log.debug("AppGerberEditor.edit_fcgerber().job_thread() --> %s" % str(e))
|
||||
#
|
||||
# # Check promises and clear if exists
|
||||
# while True:
|
||||
@@ -4150,7 +4150,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
)
|
||||
except Exception as ee:
|
||||
log.debug(
|
||||
"FlatCAMGrbEditor.edit_fcgerber.worker_job() Adding processes to pool --> %s" % str(ee))
|
||||
"AppGerberEditor.edit_fcgerber.worker_job() Adding processes to pool --> %s" % str(ee))
|
||||
traceback.print_exc()
|
||||
|
||||
output = []
|
||||
@@ -4186,7 +4186,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
else:
|
||||
storage_dict[k] = aperture_dict[k]
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.edit_fcgerber().job_thread() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.edit_fcgerber().job_thread() --> %s" % str(e))
|
||||
|
||||
return [aperture_id, storage_dict]
|
||||
|
||||
@@ -4215,7 +4215,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
try:
|
||||
self.plot_thread.stop()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.update_fcgerber() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.update_fcgerber() --> %s" % str(e))
|
||||
|
||||
if "_edit" in self.edited_obj_name:
|
||||
try:
|
||||
@@ -4598,7 +4598,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
try:
|
||||
QtGui.QGuiApplication.restoreOverrideCursor()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.on_grb_click_release() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.on_grb_click_release() --> %s" % str(e))
|
||||
|
||||
if self.active_tool.complete is False and not isinstance(self.active_tool, FCApertureSelect):
|
||||
self.active_tool.complete = True
|
||||
@@ -4640,7 +4640,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
else:
|
||||
self.select_tool("select")
|
||||
except Exception as e:
|
||||
log.warning("FlatCAMGrbEditor.on_grb_click_release() RMB click --> Error: %s" % str(e))
|
||||
log.warning("AppGerberEditor.on_grb_click_release() RMB click --> Error: %s" % str(e))
|
||||
raise
|
||||
|
||||
# if the released mouse button was LMB then test if we had a right-to-left selection or a left-to-right
|
||||
@@ -4658,7 +4658,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
if self.selected:
|
||||
self.plot_all()
|
||||
except Exception as e:
|
||||
log.warning("FlatCAMGrbEditor.on_grb_click_release() LMB click --> Error: %s" % str(e))
|
||||
log.warning("AppGerberEditor.on_grb_click_release() LMB click --> Error: %s" % str(e))
|
||||
raise
|
||||
|
||||
def draw_selection_area_handler(self, start_pos, end_pos, sel_type):
|
||||
@@ -4694,7 +4694,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
try:
|
||||
self.apertures_table.cellPressed.disconnect()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.draw_selection_Area_handler() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.draw_selection_Area_handler() --> %s" % str(e))
|
||||
# select the aperture code of the selected geometry, in the tool table
|
||||
self.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
|
||||
for aper in sel_aperture:
|
||||
@@ -4901,7 +4901,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
#
|
||||
# # self.plot_thread = threading.Thread(target=lambda: self.check_plot_finished(check_period))
|
||||
# # self.plot_thread.start()
|
||||
# log.debug("FlatCAMGrbEditor --> Delayed Plot started.")
|
||||
# log.debug("AppGerberEditor --> Delayed Plot started.")
|
||||
# self.plot_thread = QtCore.QTimer()
|
||||
# self.plot_thread.setInterval(check_period)
|
||||
# self.plot_finished.connect(self.setup_ui_after_delayed_plot)
|
||||
@@ -4919,7 +4919,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
# if not self.grb_plot_promises:
|
||||
# self.plot_thread.stop()
|
||||
# self.plot_finished.emit()
|
||||
# log.debug("FlatCAMGrbEditor --> delayed_plot finished")
|
||||
# log.debug("AppGerberEditor --> delayed_plot finished")
|
||||
# except Exception as e:
|
||||
# traceback.print_exc()
|
||||
#
|
||||
@@ -4941,7 +4941,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
|
||||
:return: None
|
||||
"""
|
||||
log.debug("FlatCAMGrbEditor.on_zoom_fit()")
|
||||
log.debug("AppGerberEditor.on_zoom_fit()")
|
||||
|
||||
# calculate all the geometry in the edited Gerber object
|
||||
edit_geo = []
|
||||
@@ -5095,7 +5095,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
|
||||
def on_buffer(self):
|
||||
buff_value = 0.01
|
||||
log.debug("FlatCAMGrbEditor.on_buffer()")
|
||||
log.debug("AppGerberEditor.on_buffer()")
|
||||
|
||||
try:
|
||||
buff_value = float(self.buffer_distance_entry.get_value())
|
||||
@@ -5145,7 +5145,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
self.storage_dict[apcode]['geometry'] = []
|
||||
self.storage_dict[apcode]['geometry'] = temp_storage
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.buffer() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.buffer() --> %s" % str(e))
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s\n%s' % (_("Failed."), str(traceback.print_exc())))
|
||||
return
|
||||
|
||||
@@ -5154,7 +5154,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
|
||||
def on_scale(self):
|
||||
scale_factor = 1.0
|
||||
log.debug("FlatCAMGrbEditor.on_scale()")
|
||||
log.debug("AppGerberEditor.on_scale()")
|
||||
|
||||
try:
|
||||
scale_factor = float(self.scale_factor_entry.get_value())
|
||||
@@ -5209,7 +5209,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
self.storage_dict[apcode]['geometry'] = temp_storage
|
||||
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.on_scale() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.on_scale() --> %s" % str(e))
|
||||
|
||||
self.plot_all()
|
||||
self.app.inform.emit('[success] %s' %
|
||||
@@ -5287,7 +5287,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
||||
if tool_name == 'markarea' or tool_name == 'all':
|
||||
self.ma_tool_frame.hide()
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMGrbEditor.hide_tool() --> %s" % str(e))
|
||||
log.debug("AppGerberEditor.hide_tool() --> %s" % str(e))
|
||||
self.app.ui.notebook.setCurrentWidget(self.app.ui.selected_tab)
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class TextEditor(QtWidgets.QWidget):
|
||||
class AppTextEditor(QtWidgets.QWidget):
|
||||
|
||||
def __init__(self, app, text=None, plain_text=None, parent=None):
|
||||
super().__init__(parent=parent)
|
||||
Reference in New Issue
Block a user