- 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 8.06.2020
- minor changes in the way that the tools are installed and connected - 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 - 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 7.06.2020
@ -1333,7 +1334,7 @@ RELEASE 8.993
13.11.2019 13.11.2019
- trying to improve the performance of View CNC Code command by using QPlainTextEdit; made the mods for it - 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) - 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 - 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 - 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 - 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 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 - 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 - reused the Multiprocessing Pool declared in the App for the ToolRulesCheck() class
@ -2492,7 +2493,7 @@ RELEASE 8.993
4.06.2019 4.06.2019
- PEP8 updates in FlatCAMExcEditor.py - PEP8 updates in AppExcEditor.py
- added the Excellon Editor parameters to the Edit -> Preferences -> Excellon GUI - added the Excellon Editor parameters to the Edit -> Preferences -> Excellon GUI
- fixed a small bug in Excellon Editor - fixed a small bug in Excellon Editor
- PEP8 cleanup in FlatCAMGui - 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 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 - 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 - 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 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. - 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 - 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 - 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 - 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) - 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. - 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 - 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 - 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 camlib import distance, arc, FlatCAMRTreeStorage
from appGUI.GUIElements import FCEntry, FCComboBox, FCTable, FCDoubleSpinner, RadioSet, FCSpinner 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 appParsers.ParseExcellon import Excellon
from shapely.geometry import LineString, LinearRing, MultiLineString, Polygon, MultiPolygon, Point from shapely.geometry import LineString, LinearRing, MultiLineString, Polygon, MultiPolygon, Point
@ -935,7 +935,7 @@ class FCDrillResize(FCShapeTool):
return return
if new_dia not in self.draw_app.olddia_newdia: 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.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 # 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() self.sel_tools = set()
# here we store all shapes that were selected so we can search for the nearest to our click location # 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.resize_frame.hide()
self.exc_editor_app.array_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) 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 # 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 "" return ""
@ -1467,13 +1467,13 @@ class FCDrillSelect(DrawTool):
# # if there is no shape under our click then deselect all shapes # # if there is no shape under our click then deselect all shapes
# if not over_shape_list: # if not over_shape_list:
# self.exc_editor_app.selected = [] # self.exc_editor_app.selected = []
# FlatCAMExcEditor.draw_shape_idx = -1 # AppExcEditor.draw_shape_idx = -1
# self.exc_editor_app.tools_table_exc.clearSelection() # self.exc_editor_app.tools_table_exc.clearSelection()
# else: # else:
# # if there are shapes under our click then advance through the list of them, one at the time in a # # if there are shapes under our click then advance through the list of them, one at the time in a
# # circular way # # circular way
# FlatCAMExcEditor.draw_shape_idx = (FlatCAMExcEditor.draw_shape_idx + 1) % len(over_shape_list) # AppExcEditor.draw_shape_idx = (AppExcEditor.draw_shape_idx + 1) % len(over_shape_list)
# obj_to_add = over_shape_list[int(FlatCAMExcEditor.draw_shape_idx)] # 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.app.defaults["global_mselect_key"] == 'Shift':
# if self.exc_editor_app.modifiers == Qt.ShiftModifier: # if self.exc_editor_app.modifiers == Qt.ShiftModifier:
@ -1510,14 +1510,14 @@ class FCDrillSelect(DrawTool):
# raise # raise
class FlatCAMExcEditor(QtCore.QObject): class AppExcEditor(QtCore.QObject):
draw_shape_idx = -1 draw_shape_idx = -1
def __init__(self, app): def __init__(self, app):
# assert isinstance(app, FlatCAMApp.App), "Expected the app to be a FlatCAMApp.App, got %s" % type(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.app = app
self.canvas = self.app.plotcanvas self.canvas = self.app.plotcanvas
@ -2560,7 +2560,7 @@ class FlatCAMExcEditor(QtCore.QObject):
return return
if tool_dia not in self.olddia_newdia: 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.storage_dict[tool_dia] = storage_elem
# self.olddia_newdia dict keeps the evidence on current tools diameters as keys and gets updated on values # 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: try:
self.tools_table_exc.selectRow(row_to_be_selected) self.tools_table_exc.selectRow(row_to_be_selected)
except TypeError as e: 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): def on_tool_delete(self, dia=None):
self.is_modified = True self.is_modified = True
@ -2615,7 +2615,7 @@ class FlatCAMExcEditor(QtCore.QObject):
for deleted_tool_dia in deleted_tool_dia_list: for deleted_tool_dia in deleted_tool_dia_list:
# delete the storage used for that tool # 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[deleted_tool_dia] = storage_elem
self.storage_dict.pop(deleted_tool_dia, None) self.storage_dict.pop(deleted_tool_dia, None)
@ -2665,7 +2665,7 @@ class FlatCAMExcEditor(QtCore.QObject):
try: try:
new_dia = float(self.tools_table_exc.currentItem().text()) new_dia = float(self.tools_table_exc.currentItem().text())
except ValueError as e: except ValueError as e:
log.debug("FlatCAMExcEditor.on_tool_edit() --> %s" % str(e)) log.debug("AppExcEditor.on_tool_edit() --> %s" % str(e))
return return
row_of_item_changed = self.tools_table_exc.currentRow() row_of_item_changed = self.tools_table_exc.currentRow()
@ -2679,7 +2679,7 @@ class FlatCAMExcEditor(QtCore.QObject):
# DESTINATION storage # DESTINATION storage
# tool diameter is not used so we create a new tool with the desired diameter # tool diameter is not used so we create a new tool with the desired diameter
if new_dia not in self.olddia_newdia: 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.storage_dict[new_dia] = destination_storage
# self.olddia_newdia dict keeps the evidence on current tools diameters as keys and gets updated on values # 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) 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 # 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: 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_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_move', self.app.on_mouse_move_over_plot)
@ -3006,7 +3006,7 @@ class FlatCAMExcEditor(QtCore.QObject):
self.shapes.clear(update=True) self.shapes.clear(update=True)
self.tool_shape.clear(update=True) self.tool_shape.clear(update=True)
# self.storage = FlatCAMExcEditor.make_storage() # self.storage = AppExcEditor.make_storage()
self.replot() self.replot()
def edit_fcexcellon(self, exc_obj): 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 # 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 # and then add it to the storage elements (each storage elements is a member of a list
for tool_dia in self.points_edit: 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]: for point in self.points_edit[tool_dia]:
# make a '+' sign, the line length is the tool diameter # make a '+' sign, the line length is the tool diameter
start_hor_line = ((point.x - (tool_dia / 2)), point.y) 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) shape_geo = line_geo.buffer(buf_value)
if tool_dia not in self.storage_dict: 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 self.storage_dict[tool_dia] = storage_elem
if shape_geo is not None: if shape_geo is not None:
@ -3614,7 +3614,7 @@ class FlatCAMExcEditor(QtCore.QObject):
self.app.ui.popMenu.popup(self.app.cursor.pos()) self.app.ui.popMenu.popup(self.app.cursor.pos())
except Exception as e: 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 raise
# if the released mouse button was LMB then test if we had a right-to-left selection or a left-to-right # 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: if self.selected:
self.replot() self.replot()
except Exception as e: 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 raise
def draw_selection_area_handler(self, start, end, sel_type): 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 # it will not work for 3rd method of click selection
if not over_shape_list: if not over_shape_list:
self.draw_app.selected = [] self.draw_app.selected = []
appGeoEditor.draw_shape_idx = -1 AppGeoEditor.draw_shape_idx = -1
else: else:
# if there are shapes under our click then advance through the list of them, one at the time in a # if there are shapes under our click then advance through the list of them, one at the time in a
# circular way # circular way
appGeoEditor.draw_shape_idx = (appGeoEditor.draw_shape_idx + 1) % len(over_shape_list) AppGeoEditor.draw_shape_idx = (AppGeoEditor.draw_shape_idx + 1) % len(over_shape_list)
obj_to_add = over_shape_list[int(appGeoEditor.draw_shape_idx)] obj_to_add = over_shape_list[int(AppGeoEditor.draw_shape_idx)]
key_modifier = QtWidgets.QApplication.keyboardModifiers() key_modifier = QtWidgets.QApplication.keyboardModifiers()
@ -2550,7 +2550,7 @@ class FCSelect(DrawTool):
self.draw_app.selected = [] self.draw_app.selected = []
self.draw_app.selected.append(obj_to_add) self.draw_app.selected.append(obj_to_add)
except Exception as e: 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 # if selection is done on canvas update the Tree in Selected Tab with the selection
try: try:
@ -2788,9 +2788,9 @@ class FCMove(FCShapeTool):
else: else:
# if there are shapes under our click then advance through the list of them, one at the time in a # if there are shapes under our click then advance through the list of them, one at the time in a
# circular way # 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: 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: except IndexError:
return return
@ -3230,7 +3230,7 @@ class FCTransform(FCShapeTool):
# ############################################### # ###############################################
# ################ Main Application ############# # ################ Main Application #############
# ############################################### # ###############################################
class appGeoEditor(QtCore.QObject): class AppGeoEditor(QtCore.QObject):
# will emit the name of the object that was just selected # will emit the name of the object that was just selected
item_selected = QtCore.pyqtSignal(str) item_selected = QtCore.pyqtSignal(str)
@ -3243,7 +3243,7 @@ class appGeoEditor(QtCore.QObject):
# assert isinstance(app, FlatCAMApp.App), \ # assert isinstance(app, FlatCAMApp.App), \
# "Expected the app to be a FlatCAMApp.App, got %s" % type(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.app = app
self.canvas = app.plotcanvas self.canvas = app.plotcanvas
@ -3316,7 +3316,7 @@ class appGeoEditor(QtCore.QObject):
# # ## Data # # ## Data
self.active_tool = None self.active_tool = None
self.storage = appGeoEditor.make_storage() self.storage = AppGeoEditor.make_storage()
self.utility = [] self.utility = []
# VisPy visuals # VisPy visuals
@ -3415,7 +3415,7 @@ class appGeoEditor(QtCore.QObject):
self.options[opt] = float(text_value) self.options[opt] = float(text_value)
except Exception as e: except Exception as e:
entry.set_value(self.app.defaults[opt]) entry.set_value(self.app.defaults[opt])
log.debug("appGeoEditor.__init__().entry2option() --> %s" % str(e)) log.debug("AppGeoEditor.__init__().entry2option() --> %s" % str(e))
return return
def grid_changed(goption, gentry): def grid_changed(goption, gentry):
@ -3588,7 +3588,7 @@ class appGeoEditor(QtCore.QObject):
self.connect_canvas_event_handlers() self.connect_canvas_event_handlers()
# initialize working objects # initialize working objects
self.storage = appGeoEditor.make_storage() self.storage = AppGeoEditor.make_storage()
self.utility = [] self.utility = []
self.selected = [] self.selected = []
@ -3701,7 +3701,7 @@ class appGeoEditor(QtCore.QObject):
# for w in sel_tab_widget_list: # for w in sel_tab_widget_list:
# w.setEnabled(True) # w.setEnabled(True)
# except Exception as e: # except Exception as e:
# log.debug("appGeoEditor.deactivate() --> %s" % str(e)) # log.debug("AppGeoEditor.deactivate() --> %s" % str(e))
# Show original geometry # Show original geometry
if self.fcgeometry: if self.fcgeometry:
@ -3727,7 +3727,7 @@ class appGeoEditor(QtCore.QObject):
if self.app.is_legacy is False: 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 # 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_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_move', self.app.on_mouse_move_over_plot)
self.app.plotcanvas.graph_event_disconnect('mouse_release', self.app.on_mouse_click_release_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.shapes.clear(update=True)
self.tool_shape.clear(update=True) self.tool_shape.clear(update=True)
# self.storage = appGeoEditor.make_storage() # self.storage = AppGeoEditor.make_storage()
self.replot() self.replot()
def edit_fcgeometry(self, fcgeometry, multigeo_tool=None): 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: elif isinstance(geom, LineString) and geom is not None:
geom = LineString(geom.coords[::-1]) geom = LineString(geom.coords[::-1])
else: else:
log.debug("appGeoEditor.on_shape_complete() Error --> Unexpected Geometry %s" % log.debug("AppGeoEditor.on_shape_complete() Error --> Unexpected Geometry %s" %
type(geom)) type(geom))
except Exception as e: 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' return 'fail'
shape_list = [] shape_list = []
@ -4757,7 +4757,7 @@ class appGeoEditor(QtCore.QObject):
try: try:
results = geo_shapes[0].geo results = geo_shapes[0].geo
except Exception as e: 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' % self.app.inform.emit('[WARNING_NOTCL] %s' %
_("A selection of at least 2 geo items is required to do Intersection.")) _("A selection of at least 2 geo items is required to do Intersection."))
self.select_tool('select') self.select_tool('select')
@ -4792,7 +4792,7 @@ class appGeoEditor(QtCore.QObject):
try: try:
intersector = geo_shapes[0].geo intersector = geo_shapes[0].geo
except Exception as e: 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' % self.app.inform.emit('[WARNING_NOTCL] %s' %
_("A selection of at least 2 geo items is required to do Intersection.")) _("A selection of at least 2 geo items is required to do Intersection."))
self.select_tool('select') self.select_tool('select')

View File

@ -885,7 +885,7 @@ class FCRegion(FCShapeTool):
try: try:
QtGui.QGuiApplication.restoreOverrideCursor() QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e: 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')) self.cursor = QtGui.QCursor(QtGui.QPixmap(self.draw_app.app.resource_location + '/aero.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor) QtGui.QGuiApplication.setOverrideCursor(self.cursor)
@ -991,7 +991,7 @@ class FCRegion(FCShapeTool):
join_style=1) join_style=1)
return DrawToolUtilityShape(new_geo_el) return DrawToolUtilityShape(new_geo_el)
except Exception as e: except Exception as e:
log.debug("FlatCAMGrbEditor.FCRegion.utility_geometry() --> %s" % str(e)) log.debug("AppGerberEditor.FCRegion.utility_geometry() --> %s" % str(e))
else: else:
new_geo_el['solid'] = Point(self.temp_points).buffer(self.buf_val, new_geo_el['solid'] = Point(self.temp_points).buffer(self.buf_val,
resolution=int(self.steps_per_circle / 4)) resolution=int(self.steps_per_circle / 4))
@ -1182,7 +1182,7 @@ class FCTrack(FCShapeTool):
try: try:
QtGui.QGuiApplication.restoreOverrideCursor() QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e: 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 + self.cursor = QtGui.QCursor(QtGui.QPixmap(self.draw_app.app.resource_location +
'/aero_path%s.png' % self.draw_app.bend_mode)) '/aero_path%s.png' % self.draw_app.bend_mode))
@ -1329,7 +1329,7 @@ class FCTrack(FCShapeTool):
try: try:
QtGui.QGuiApplication.restoreOverrideCursor() QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e: 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: if self.draw_app.bend_mode == 1:
self.draw_app.bend_mode = 2 self.draw_app.bend_mode = 2
@ -1368,7 +1368,7 @@ class FCTrack(FCShapeTool):
try: try:
QtGui.QGuiApplication.restoreOverrideCursor() QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e: 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: if self.draw_app.bend_mode == 1:
self.draw_app.bend_mode = 5 self.draw_app.bend_mode = 5
@ -1477,7 +1477,7 @@ class FCDisc(FCShapeTool):
try: try:
QtGui.QGuiApplication.restoreOverrideCursor() QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e: 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 self.draw_app.current_storage = self.storage_obj
@ -1514,7 +1514,7 @@ class FCSemiDisc(FCShapeTool):
try: try:
QtGui.QGuiApplication.restoreOverrideCursor() QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e: 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')) self.cursor = QtGui.QCursor(QtGui.QPixmap(self.draw_app.app.resource_location + '/aero_semidisc.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor) QtGui.QGuiApplication.setOverrideCursor(self.cursor)
@ -2201,7 +2201,7 @@ class FCEraser(FCShapeTool):
try: try:
self.draw_app.apertures_table.cellPressed.disconnect() self.draw_app.apertures_table.cellPressed.disconnect()
except Exception as e: 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) self.draw_app.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
for aper in sel_aperture: for aper in sel_aperture:
@ -2325,7 +2325,7 @@ class FCApertureSelect(DrawTool):
try: try:
QtGui.QGuiApplication.restoreOverrideCursor() QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e: except Exception as e:
log.debug("FlatCAMGrbEditor.FCApertureSelect --> %s" % str(e)) log.debug("AppGerberEditor.FCApertureSelect --> %s" % str(e))
def set_origin(self, origin): def set_origin(self, origin):
self.origin = origin self.origin = origin
@ -2381,7 +2381,7 @@ class FCApertureSelect(DrawTool):
try: try:
self.grb_editor_app.apertures_table.cellPressed.disconnect() self.grb_editor_app.apertures_table.cellPressed.disconnect()
except Exception as e: 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 shape_s in self.grb_editor_app.selected:
for storage in self.grb_editor_app.storage_dict: for storage in self.grb_editor_app.storage_dict:
@ -2424,7 +2424,7 @@ class FCTransform(FCShapeTool):
self.draw_app.plot_all() self.draw_app.plot_all()
class FlatCAMGrbEditor(QtCore.QObject): class AppGerberEditor(QtCore.QObject):
draw_shape_idx = -1 draw_shape_idx = -1
# plot_finished = QtCore.pyqtSignal() # plot_finished = QtCore.pyqtSignal()
@ -2434,7 +2434,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
# assert isinstance(app, FlatCAMApp.App), \ # assert isinstance(app, FlatCAMApp.App), \
# "Expected the app to be a FlatCAMApp.App, got %s" % type(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.app = app
self.canvas = self.app.plotcanvas self.canvas = self.app.plotcanvas
@ -3369,7 +3369,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
self.apsize_entry.set_value(size_val) self.apsize_entry.set_value(size_val)
except Exception as e: 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)) "tuple format (x,y)\nError: %s" % str(e))
self.app.inform.emit('[WARNING_NOTCL] %s' % self.app.inform.emit('[WARNING_NOTCL] %s' %
_("Aperture dimensions value is missing or wrong format. " _("Aperture dimensions value is missing or wrong format. "
@ -3497,7 +3497,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
try: try:
val_edited = int(self.apertures_table.currentItem().text()) val_edited = int(self.apertures_table.currentItem().text())
except ValueError as e: 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) # self.apertures_table.setCurrentItem(None)
# we reactivate the signals after the after the tool editing # we reactivate the signals after the after the tool editing
self.apertures_table.itemChanged.connect(self.on_tool_edit) self.apertures_table.itemChanged.connect(self.on_tool_edit)
@ -3507,7 +3507,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
try: try:
val_edited = float(self.apertures_table.currentItem().text()) val_edited = float(self.apertures_table.currentItem().text())
except ValueError as e: 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) # self.apertures_table.setCurrentItem(None)
# we reactivate the signals after the after the tool editing # we reactivate the signals after the after the tool editing
self.apertures_table.itemChanged.connect(self.on_tool_edit) 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 != '' float(x.strip()) for x in self.apertures_table.currentItem().text().split(",") if x != ''
] ]
except ValueError as e: 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 # we reactivate the signals after the after the tool editing
self.apertures_table.itemChanged.connect(self.on_tool_edit) self.apertures_table.itemChanged.connect(self.on_tool_edit)
return return
@ -3725,7 +3725,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
try: try:
QtGui.QGuiApplication.restoreOverrideCursor() QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e: except Exception as e:
log.debug("FlatCAMGrbEditor.deactivate_grb_editor() --> %s" % str(e)) log.debug("AppGerberEditor.deactivate_grb_editor() --> %s" % str(e))
self.clear() self.clear()
@ -3778,7 +3778,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
# Canvas events # Canvas events
# make sure that the shortcuts key and mouse events will no longer be linked to the methods from FlatCAMApp # 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 # first connect to new, then disconnect the old handlers
# don't ask why but if there is nothing connected I've seen issues # 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 # 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) self.apertures_table.itemChanged.connect(self.on_tool_edit)
except Exception as e: 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 # apply the conversion factor on the obj.apertures
conv_apertures = deepcopy(self.gerber_obj.apertures) conv_apertures = deepcopy(self.gerber_obj.apertures)
@ -4020,7 +4020,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
# else: # else:
# self.storage_dict[aperture_id][k] = self.gerber_obj.apertures[aperture_id][k] # self.storage_dict[aperture_id][k] = self.gerber_obj.apertures[aperture_id][k]
# except Exception as e: # 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 # # Check promises and clear if exists
# while True: # while True:
@ -4150,7 +4150,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
) )
except Exception as ee: except Exception as ee:
log.debug( 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() traceback.print_exc()
output = [] output = []
@ -4186,7 +4186,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
else: else:
storage_dict[k] = aperture_dict[k] storage_dict[k] = aperture_dict[k]
except Exception as e: 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] return [aperture_id, storage_dict]
@ -4215,7 +4215,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
try: try:
self.plot_thread.stop() self.plot_thread.stop()
except Exception as e: 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: if "_edit" in self.edited_obj_name:
try: try:
@ -4598,7 +4598,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
try: try:
QtGui.QGuiApplication.restoreOverrideCursor() QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e: 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): if self.active_tool.complete is False and not isinstance(self.active_tool, FCApertureSelect):
self.active_tool.complete = True self.active_tool.complete = True
@ -4640,7 +4640,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
else: else:
self.select_tool("select") self.select_tool("select")
except Exception as e: 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 raise
# if the released mouse button was LMB then test if we had a right-to-left selection or a left-to-right # 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: if self.selected:
self.plot_all() self.plot_all()
except Exception as e: 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 raise
def draw_selection_area_handler(self, start_pos, end_pos, sel_type): def draw_selection_area_handler(self, start_pos, end_pos, sel_type):
@ -4694,7 +4694,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
try: try:
self.apertures_table.cellPressed.disconnect() self.apertures_table.cellPressed.disconnect()
except Exception as e: 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 # select the aperture code of the selected geometry, in the tool table
self.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection) self.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
for aper in sel_aperture: 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 = threading.Thread(target=lambda: self.check_plot_finished(check_period))
# # self.plot_thread.start() # # self.plot_thread.start()
# log.debug("FlatCAMGrbEditor --> Delayed Plot started.") # log.debug("AppGerberEditor --> Delayed Plot started.")
# self.plot_thread = QtCore.QTimer() # self.plot_thread = QtCore.QTimer()
# self.plot_thread.setInterval(check_period) # self.plot_thread.setInterval(check_period)
# self.plot_finished.connect(self.setup_ui_after_delayed_plot) # self.plot_finished.connect(self.setup_ui_after_delayed_plot)
@ -4919,7 +4919,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
# if not self.grb_plot_promises: # if not self.grb_plot_promises:
# self.plot_thread.stop() # self.plot_thread.stop()
# self.plot_finished.emit() # self.plot_finished.emit()
# log.debug("FlatCAMGrbEditor --> delayed_plot finished") # log.debug("AppGerberEditor --> delayed_plot finished")
# except Exception as e: # except Exception as e:
# traceback.print_exc() # traceback.print_exc()
# #
@ -4941,7 +4941,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
:return: None :return: None
""" """
log.debug("FlatCAMGrbEditor.on_zoom_fit()") log.debug("AppGerberEditor.on_zoom_fit()")
# calculate all the geometry in the edited Gerber object # calculate all the geometry in the edited Gerber object
edit_geo = [] edit_geo = []
@ -5095,7 +5095,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
def on_buffer(self): def on_buffer(self):
buff_value = 0.01 buff_value = 0.01
log.debug("FlatCAMGrbEditor.on_buffer()") log.debug("AppGerberEditor.on_buffer()")
try: try:
buff_value = float(self.buffer_distance_entry.get_value()) 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'] = []
self.storage_dict[apcode]['geometry'] = temp_storage self.storage_dict[apcode]['geometry'] = temp_storage
except Exception as e: 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()))) self.app.inform.emit('[ERROR_NOTCL] %s\n%s' % (_("Failed."), str(traceback.print_exc())))
return return
@ -5154,7 +5154,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
def on_scale(self): def on_scale(self):
scale_factor = 1.0 scale_factor = 1.0
log.debug("FlatCAMGrbEditor.on_scale()") log.debug("AppGerberEditor.on_scale()")
try: try:
scale_factor = float(self.scale_factor_entry.get_value()) scale_factor = float(self.scale_factor_entry.get_value())
@ -5209,7 +5209,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
self.storage_dict[apcode]['geometry'] = temp_storage self.storage_dict[apcode]['geometry'] = temp_storage
except Exception as e: except Exception as e:
log.debug("FlatCAMGrbEditor.on_scale() --> %s" % str(e)) log.debug("AppGerberEditor.on_scale() --> %s" % str(e))
self.plot_all() self.plot_all()
self.app.inform.emit('[success] %s' % self.app.inform.emit('[success] %s' %
@ -5287,7 +5287,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
if tool_name == 'markarea' or tool_name == 'all': if tool_name == 'markarea' or tool_name == 'all':
self.ma_tool_frame.hide() self.ma_tool_frame.hide()
except Exception as e: 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) self.app.ui.notebook.setCurrentWidget(self.app.ui.selected_tab)

View File

@ -23,7 +23,7 @@ if '_' not in builtins.__dict__:
_ = gettext.gettext _ = gettext.gettext
class TextEditor(QtWidgets.QWidget): class AppTextEditor(QtWidgets.QWidget):
def __init__(self, app, text=None, plain_text=None, parent=None): def __init__(self, app, text=None, plain_text=None, parent=None):
super().__init__(parent=parent) 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.general.GeneralPreferencesUI import GeneralPreferencesUI
from appGUI.preferences.geometry.GeometryPreferencesUI import GeometryPreferencesUI from appGUI.preferences.geometry.GeometryPreferencesUI import GeometryPreferencesUI
from appGUI.preferences.gerber.GerberPreferencesUI import GerberPreferencesUI 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 from matplotlib.backend_bases import KeyEvent as mpl_key_event
import webbrowser import webbrowser

View File

@ -14,7 +14,7 @@ from copy import deepcopy
from io import StringIO from io import StringIO
from datetime import datetime from datetime import datetime
from appEditors.FlatCAMTextEditor import TextEditor from appEditors.AppTextEditor import AppTextEditor
from appObjects.FlatCAMObj import * from appObjects.FlatCAMObj import *
from camlib import CNCjob from camlib import CNCjob
@ -556,7 +556,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
else: else:
self.app.gcode_edited = gco 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 # add the tab if it was closed
self.app.ui.plot_tab_area.addTab(self.gcode_editor_tab, '%s' % _("Code Editor")) 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 # # File modified by: Marius Stanciu #
# ########################################################## # ##########################################################
from appEditors.FlatCAMTextEditor import TextEditor from appEditors.AppTextEditor import AppTextEditor
from appObjects.FlatCAMObj import * from appObjects.FlatCAMObj import *
import gettext import gettext
@ -75,7 +75,7 @@ class DocumentObject(FlatCAMObj):
'<span style="color:red;"><b>Advanced</b></span>' '<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 = """ stylesheet = """
QTextEdit {selection-background-color:%s; QTextEdit {selection-background-color:%s;
selection-color:white; selection-color:white;

View File

@ -10,7 +10,7 @@
# File modified by: Marius Stanciu # # File modified by: Marius Stanciu #
# ########################################################## # ##########################################################
from appEditors.FlatCAMTextEditor import TextEditor from appEditors.AppTextEditor import AppTextEditor
from appObjects.FlatCAMObj import * from appObjects.FlatCAMObj import *
from appGUI.ObjectUI import * from appGUI.ObjectUI import *
@ -86,7 +86,7 @@ class ScriptObject(FlatCAMObj):
'<span style="color:red;"><b>Advanced</b></span>' '<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 # tab_here = False
# # try to not add too many times a tab that it is already installed # # 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 appTool import AppTool
from appGUI.GUIElements import FCDoubleSpinner, EvalEntry, FCCheckBox, OptionalInputSection, FCEntry from appGUI.GUIElements import FCDoubleSpinner, EvalEntry, FCCheckBox, OptionalInputSection, FCEntry
from appGUI.GUIElements import FCTable, FCComboBox, RadioSet 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 import Point
from shapely.geometry.base import * from shapely.geometry.base import *
@ -1061,7 +1061,7 @@ class ToolCalibration(AppTool):
gcode += 'M2' 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 # add the tab if it was closed
self.app.ui.plot_tab_area.addTab(self.gcode_editor_tab, '%s' % _("Gcode Viewer")) 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 import appTranslation as fcTranslate
from camlib import FlatCAMRTreeStorage from camlib import FlatCAMRTreeStorage
from appEditors.appGeoEditor import DrawToolShape from appEditors.AppGeoEditor import DrawToolShape
from copy import copy from copy import copy
import math import math

View File

@ -11,7 +11,7 @@ from appGUI.GUIElements import FCComboBox, FCEntry, FCTable, \
FCInputDialog, FCDoubleSpinner, FCSpinner, FCFileSaveDialog FCInputDialog, FCDoubleSpinner, FCSpinner, FCFileSaveDialog
from app_Main import log from app_Main import log
from camlib import distance from camlib import distance
from appEditors.FlatCAMTextEditor import TextEditor from appEditors.AppTextEditor import AppTextEditor
from PyQt5 import QtGui, QtCore, QtWidgets from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
@ -1414,7 +1414,7 @@ class SolderPaste(AppTool):
""" """
time_str = "{:%A, %d %B %Y at %H:%M}".format(datetime.now()) 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 # add the tab if it was closed
self.app.ui.plot_tab_area.addTab(self.text_editor_tab, _("SP GCode Editor")) 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 from appPreProcessor import load_preprocessors
# FlatCAM appEditors # FlatCAM appEditors
from appEditors.appGeoEditor import appGeoEditor from appEditors.AppGeoEditor import AppGeoEditor
from appEditors.FlatCAMExcEditor import FlatCAMExcEditor from appEditors.AppExcEditor import AppExcEditor
from appEditors.FlatCAMGrbEditor import FlatCAMGrbEditor from appEditors.AppGerberEditor import AppGerberEditor
from appEditors.FlatCAMTextEditor import TextEditor from appEditors.AppTextEditor import AppTextEditor
from appParsers.ParseHPGL2 import HPGL2 from appParsers.ParseHPGL2 import HPGL2
# FlatCAM Workers # 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 # 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. # at the first launch of the App , the editors will not be functional.
try: try:
self.geo_editor = appGeoEditor(self) self.geo_editor = AppGeoEditor(self)
except Exception as es: except Exception as es:
log.debug("app_Main.__init__() --> Geo Editor Error: %s" % str(es)) log.debug("app_Main.__init__() --> Geo Editor Error: %s" % str(es))
try: try:
self.exc_editor = FlatCAMExcEditor(self) self.exc_editor = AppExcEditor(self)
except Exception as es: except Exception as es:
log.debug("app_Main.__init__() --> Excellon Editor Error: %s" % str(es)) log.debug("app_Main.__init__() --> Excellon Editor Error: %s" % str(es))
try: try:
self.grb_editor = FlatCAMGrbEditor(self) self.grb_editor = AppGerberEditor(self)
except Exception as es: except Exception as es:
log.debug("app_Main.__init__() --> Gerber Editor Error: %s" % str(es)) log.debug("app_Main.__init__() --> Gerber Editor Error: %s" % str(es))
self.log.debug("Finished adding FlatCAM Editor's.") self.log.debug("Finished adding FlatCAM Editor's.")
@ -6593,9 +6593,9 @@ class App(QtCore.QObject):
if self.call_source != 'app': if self.call_source != 'app':
self.editor2object(cleanup=True) self.editor2object(cleanup=True)
# ## EDITOR section # ## EDITOR section
self.geo_editor = appGeoEditor(self) self.geo_editor = AppGeoEditor(self)
self.exc_editor = FlatCAMExcEditor(self) self.exc_editor = AppExcEditor(self)
self.grb_editor = FlatCAMGrbEditor(self) self.grb_editor = AppGerberEditor(self)
# Clear pool # Clear pool
self.clear_pool() self.clear_pool()
@ -7415,7 +7415,7 @@ class App(QtCore.QObject):
# ############################################################################################################### # ###############################################################################################################
def init_code_editor(self, name): 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 # add the tab if it was closed
self.ui.plot_tab_area.addTab(self.text_editor_tab, '%s' % name) self.ui.plot_tab_area.addTab(self.text_editor_tab, '%s' % name)
@ -7466,7 +7466,7 @@ class App(QtCore.QObject):
elif obj.kind == 'cncjob': elif obj.kind == 'cncjob':
flt = "GCode Files .nc (*.NC);;PDF Files .pdf (*.PDF);;All Files (*.*)" 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 # add the tab if it was closed
self.ui.plot_tab_area.addTab(self.source_editor_tab, '%s' % _("Source Editor")) 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 # 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 # at the top of the window
self.ui.plot_tab_area.currentWidget().code_editor.moveCursor(QTextCursor.End) 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() doc = self.ui.plot_tab_area.currentWidget().code_editor.document()
# create a Text Cursor based on the searched line # create a Text Cursor based on the searched line
cursor = QTextCursor(doc.findBlockByLineNumber(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