- more refactoring in the app Editors

This commit is contained in:
Marius Stanciu 2020-06-08 19:53:31 +03:00 committed by Marius
parent 05df0a61c2
commit 850b80bb41
23 changed files with 4976 additions and 4975 deletions

View File

@ -10,8 +10,9 @@ CHANGELOG for FlatCAM beta
8.06.2020
- minor changes in the way that the tools are installed and connected
- renamed the GeoEditor class/file to appGeoEditor from FlatCAMGeoEditor making it easier to see in the IDE tree structure
- renamed the GeoEditor class/file to AppGeoEditor from FlatCAMGeoEditor making it easier to see in the IDE tree structure
- some refactoring that lead to a working solution when using the Python 3.8 + PyQt 5.15
- more refactoring in the app Editors
7.06.2020
@ -1333,7 +1334,7 @@ RELEASE 8.993
13.11.2019
- trying to improve the performance of View CNC Code command by using QPlainTextEdit; made the mods for it
- when using the Find function in the TextEditor and the result reach the bottom of the document, the next find will be the first in the document (before it defaulted to the beginning of the document)
- when using the Find function in the AppTextEditor and the result reach the bottom of the document, the next find will be the first in the document (before it defaulted to the beginning of the document)
- finished improving the show of text files in FlatCAM (CNC Code, Source files)
- fixed an issue in the FlatCAMObj.GerberObject.convert_units() which needed to be updated after changes elsewhere
@ -1636,7 +1637,7 @@ RELEASE 8.993
- fixed bug in Geometry Editor that did not allow the copy of geometric elements
- created a new class that holds all the Code Editor functionality and integrated as a Editor in FlatCAM, the location is in flatcamEditors folder
- remade all the functions for view_source, scripts and view_code to use the new TextEditor class; now all the Code Editor tabs are being kept alive, before only one could be in an open state
- remade all the functions for view_source, scripts and view_code to use the new AppTextEditor class; now all the Code Editor tabs are being kept alive, before only one could be in an open state
- changed the name of the new object FlatCAMNotes to a more general one DocumentObject
- changed the way a new ScriptObject object is made, the method that is processing the Tcl commands when the Run button is clicked is moved to the FlatCAMObj.ScriptObject() class
- reused the Multiprocessing Pool declared in the App for the ToolRulesCheck() class
@ -2492,7 +2493,7 @@ RELEASE 8.993
4.06.2019
- PEP8 updates in FlatCAMExcEditor.py
- PEP8 updates in AppExcEditor.py
- added the Excellon Editor parameters to the Edit -> Preferences -> Excellon GUI
- fixed a small bug in Excellon Editor
- PEP8 cleanup in FlatCAMGui
@ -2564,7 +2565,7 @@ RELEASE 8.993
- fixed the Circle Steps parameter for both Gerber and Geometry objects not being applied and instead the app internal defaults were used.
- fixed the Tcl command Geocutout issue that gave an error when using the 4 or 8 value for gaps parameter
- made wider the '#' column for Apertures Table for Gerber Object and for Gerber Editor; in this way numbers with 3 digits can be seen
- PEP8 corrections in FlatCAMGrbEditor.py
- PEP8 corrections in AppGerberEditor.py
- added a selection limit parameter for Geometry Editor
- added entries in Edit -> Preferences for the new parameter Selection limit for both the Gerber and Geometry Editors.
- set the buttons in the lower part of the Preferences Window to have a preferred minimum width instead of fixed width
@ -2841,7 +2842,7 @@ RELEASE 8.993
- Gerber Editor: fixed error when adding an aperture with code value lower than the ones that already exists
- when adding an aperture with code '0' (zero) it will automatically be set with size zero and type: 'REG' (from region); here we store all the regions from a Gerber file, the ones without a declared aperture
- Gerber Editor: added support for Gerber polarity change commands (LPD, LPC)
- moved the polarity change processing from FlatCAMGrbEditor() class to camlib.Gerber().parse_lines()
- moved the polarity change processing from AppGerberEditor() class to camlib.Gerber().parse_lines()
- made optional the saving of an edited object. Now the user can cancel the changes to the object.
- replaced the standard buttons in the QMessageBox's used in the app with custom ones that can have text translated
- updated the POT translation file and the MO/PO files for English and Romanian language

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@ from appGUI.preferences.excellon.ExcellonPreferencesUI import ExcellonPreference
from appGUI.preferences.general.GeneralPreferencesUI import GeneralPreferencesUI
from appGUI.preferences.geometry.GeometryPreferencesUI import GeometryPreferencesUI
from appGUI.preferences.gerber.GerberPreferencesUI import GerberPreferencesUI
from appEditors.appGeoEditor import FCShapeTool
from appEditors.AppGeoEditor import FCShapeTool
from matplotlib.backend_bases import KeyEvent as mpl_key_event
import webbrowser

View File

@ -14,7 +14,7 @@ from copy import deepcopy
from io import StringIO
from datetime import datetime
from appEditors.FlatCAMTextEditor import TextEditor
from appEditors.AppTextEditor import AppTextEditor
from appObjects.FlatCAMObj import *
from camlib import CNCjob
@ -556,7 +556,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
else:
self.app.gcode_edited = gco
self.gcode_editor_tab = TextEditor(app=self.app, plain_text=True)
self.gcode_editor_tab = AppTextEditor(app=self.app, plain_text=True)
# add the tab if it was closed
self.app.ui.plot_tab_area.addTab(self.gcode_editor_tab, '%s' % _("Code Editor"))

View File

@ -10,7 +10,7 @@
# File modified by: Marius Stanciu #
# ##########################################################
from appEditors.FlatCAMTextEditor import TextEditor
from appEditors.AppTextEditor import AppTextEditor
from appObjects.FlatCAMObj import *
import gettext
@ -75,7 +75,7 @@ class DocumentObject(FlatCAMObj):
'<span style="color:red;"><b>Advanced</b></span>'
))
self.document_editor_tab = TextEditor(app=self.app)
self.document_editor_tab = AppTextEditor(app=self.app)
stylesheet = """
QTextEdit {selection-background-color:%s;
selection-color:white;

View File

@ -10,7 +10,7 @@
# File modified by: Marius Stanciu #
# ##########################################################
from appEditors.FlatCAMTextEditor import TextEditor
from appEditors.AppTextEditor import AppTextEditor
from appObjects.FlatCAMObj import *
from appGUI.ObjectUI import *
@ -86,7 +86,7 @@ class ScriptObject(FlatCAMObj):
'<span style="color:red;"><b>Advanced</b></span>'
))
self.script_editor_tab = TextEditor(app=self.app, plain_text=True, parent=self.app.ui)
self.script_editor_tab = AppTextEditor(app=self.app, plain_text=True, parent=self.app.ui)
# tab_here = False
# # try to not add too many times a tab that it is already installed

View File

@ -10,7 +10,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui
from appTool import AppTool
from appGUI.GUIElements import FCDoubleSpinner, EvalEntry, FCCheckBox, OptionalInputSection, FCEntry
from appGUI.GUIElements import FCTable, FCComboBox, RadioSet
from appEditors.FlatCAMTextEditor import TextEditor
from appEditors.AppTextEditor import AppTextEditor
from shapely.geometry import Point
from shapely.geometry.base import *
@ -1061,7 +1061,7 @@ class ToolCalibration(AppTool):
gcode += 'M2'
self.gcode_editor_tab = TextEditor(app=self.app, plain_text=True)
self.gcode_editor_tab = AppTextEditor(app=self.app, plain_text=True)
# add the tab if it was closed
self.app.ui.plot_tab_area.addTab(self.gcode_editor_tab, '%s' % _("Gcode Viewer"))

View File

@ -15,7 +15,7 @@ from shapely.geometry import Point, MultiLineString, Polygon
import appTranslation as fcTranslate
from camlib import FlatCAMRTreeStorage
from appEditors.appGeoEditor import DrawToolShape
from appEditors.AppGeoEditor import DrawToolShape
from copy import copy
import math

View File

@ -11,7 +11,7 @@ from appGUI.GUIElements import FCComboBox, FCEntry, FCTable, \
FCInputDialog, FCDoubleSpinner, FCSpinner, FCFileSaveDialog
from app_Main import log
from camlib import distance
from appEditors.FlatCAMTextEditor import TextEditor
from appEditors.AppTextEditor import AppTextEditor
from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.QtCore import Qt
@ -1414,7 +1414,7 @@ class SolderPaste(AppTool):
"""
time_str = "{:%A, %d %B %Y at %H:%M}".format(datetime.now())
self.text_editor_tab = TextEditor(app=self.app)
self.text_editor_tab = AppTextEditor(app=self.app)
# add the tab if it was closed
self.app.ui.plot_tab_area.addTab(self.text_editor_tab, _("SP GCode Editor"))

View File

@ -78,10 +78,10 @@ from appGUI.GUIElements import FCFileSaveDialog, message_dialog, FlatCAMSystemTr
from appPreProcessor import load_preprocessors
# FlatCAM appEditors
from appEditors.appGeoEditor import appGeoEditor
from appEditors.FlatCAMExcEditor import FlatCAMExcEditor
from appEditors.FlatCAMGrbEditor import FlatCAMGrbEditor
from appEditors.FlatCAMTextEditor import TextEditor
from appEditors.AppGeoEditor import AppGeoEditor
from appEditors.AppExcEditor import AppExcEditor
from appEditors.AppGerberEditor import AppGerberEditor
from appEditors.AppTextEditor import AppTextEditor
from appParsers.ParseHPGL2 import HPGL2
# FlatCAM Workers
@ -1552,17 +1552,17 @@ class App(QtCore.QObject):
# watch out for the position of the editors instantiation ... if it is done before a save of the default values
# at the first launch of the App , the editors will not be functional.
try:
self.geo_editor = appGeoEditor(self)
self.geo_editor = AppGeoEditor(self)
except Exception as es:
log.debug("app_Main.__init__() --> Geo Editor Error: %s" % str(es))
try:
self.exc_editor = FlatCAMExcEditor(self)
self.exc_editor = AppExcEditor(self)
except Exception as es:
log.debug("app_Main.__init__() --> Excellon Editor Error: %s" % str(es))
try:
self.grb_editor = FlatCAMGrbEditor(self)
self.grb_editor = AppGerberEditor(self)
except Exception as es:
log.debug("app_Main.__init__() --> Gerber Editor Error: %s" % str(es))
self.log.debug("Finished adding FlatCAM Editor's.")
@ -6593,9 +6593,9 @@ class App(QtCore.QObject):
if self.call_source != 'app':
self.editor2object(cleanup=True)
# ## EDITOR section
self.geo_editor = appGeoEditor(self)
self.exc_editor = FlatCAMExcEditor(self)
self.grb_editor = FlatCAMGrbEditor(self)
self.geo_editor = AppGeoEditor(self)
self.exc_editor = AppExcEditor(self)
self.grb_editor = AppGerberEditor(self)
# Clear pool
self.clear_pool()
@ -7415,7 +7415,7 @@ class App(QtCore.QObject):
# ###############################################################################################################
def init_code_editor(self, name):
self.text_editor_tab = TextEditor(app=self, plain_text=True)
self.text_editor_tab = AppTextEditor(app=self, plain_text=True)
# add the tab if it was closed
self.ui.plot_tab_area.addTab(self.text_editor_tab, '%s' % name)
@ -7466,7 +7466,7 @@ class App(QtCore.QObject):
elif obj.kind == 'cncjob':
flt = "GCode Files .nc (*.NC);;PDF Files .pdf (*.PDF);;All Files (*.*)"
self.source_editor_tab = TextEditor(app=self, plain_text=True)
self.source_editor_tab = AppTextEditor(app=self, plain_text=True)
# add the tab if it was closed
self.ui.plot_tab_area.addTab(self.source_editor_tab, '%s' % _("Source Editor"))
@ -7577,7 +7577,7 @@ class App(QtCore.QObject):
# make sure to move first the cursor at the end so after finding the line the line will be positioned
# at the top of the window
self.ui.plot_tab_area.currentWidget().code_editor.moveCursor(QTextCursor.End)
# get the document() of the TextEditor
# get the document() of the AppTextEditor
doc = self.ui.plot_tab_area.currentWidget().code_editor.document()
# create a Text Cursor based on the searched line
cursor = QTextCursor(doc.findBlockByLineNumber(line))

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff