- replaced the testing if instance of FlatCAMObj with testing the obj.kind attribute

- removed the import of the whole FlatCAMApp file only for the usage of GracefulException
- remove the import of FlatCAMApp and used alternate ways
- optimized the imports in some files
- moved the Bookmarksmanager and ToolDB classes into their own files
- solved some bugs that were not so visible in the Editors and HPGL parser
This commit is contained in:
Marius Stanciu
2020-04-27 10:03:22 +03:00
committed by Marius
parent 61020e3624
commit 3ec666edbb
28 changed files with 3452 additions and 3389 deletions

View File

@@ -2876,7 +2876,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# Open Excellon file
if key == QtCore.Qt.Key_E:
self.app.on_fileopenexcellon()
self.app.on_fileopenexcellon(signal=None)
# Open Gerber file
if key == QtCore.Qt.Key_G:
@@ -2884,7 +2884,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
if 'editor' in widget_name.lower():
self.app.goto_text_line()
else:
self.app.on_fileopengerber()
self.app.on_fileopengerber(signal=None)
# Distance Tool
if key == QtCore.Qt.Key_M:

View File

@@ -16,8 +16,6 @@ from descartes.patch import PolygonPatch
from shapely.geometry import Polygon, LineString, LinearRing
import FlatCAMApp
from copy import deepcopy
import logging
@@ -496,7 +494,7 @@ class PlotCanvasLegacy(QtCore.QObject):
:param event:
:return:
"""
FlatCAMApp.App.log.debug('on_key_down(): ' + str(event.key))
log.debug('on_key_down(): ' + str(event.key))
self.key = event.key
def on_key_up(self, event):
@@ -531,7 +529,7 @@ class PlotCanvasLegacy(QtCore.QObject):
try:
self.figure.clf()
except KeyError:
FlatCAMApp.App.log.warning("KeyError in MPL figure.clf()")
log.warning("KeyError in MPL figure.clf()")
# Re-build
self.figure.add_axes(self.axes)
@@ -582,7 +580,7 @@ class PlotCanvasLegacy(QtCore.QObject):
try:
r = width / height
except ZeroDivisionError:
FlatCAMApp.App.log.error("Height is %f" % height)
log.error("Height is %f" % height)
return
canvas_w, canvas_h = self.canvas.get_width_height()
canvas_r = float(canvas_w) / canvas_h
@@ -1190,10 +1188,10 @@ class ShapeCollectionLegacy:
linewidth=local_shapes[element]['linewidth'])
self.axes.add_patch(patch)
except AssertionError:
FlatCAMApp.App.log.warning("A geometry component was not a polygon:")
FlatCAMApp.App.log.warning(str(element))
log.warning("A geometry component was not a polygon:")
log.warning(str(element))
except Exception as e:
FlatCAMApp.App.log.debug(
log.debug(
"PlotCanvasLegacy.ShepeCollectionLegacy.redraw() gerber 'solid' --> %s" % str(e))
else:
try: