Parcourir la source

- solved a circular import

Marius Stanciu il y a 5 ans
Parent
commit
9c707e0682

+ 1 - 1
AppEditors/FlatCAMGeoEditor.py

@@ -15,7 +15,7 @@ from PyQt5 import QtGui, QtCore, QtWidgets
 from PyQt5.QtCore import Qt, QSettings
 
 from camlib import distance, arc, three_point_circle, Geometry, FlatCAMRTreeStorage
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import OptionalInputSection, FCCheckBox, FCEntry, FCComboBox, FCTextAreaRich, \
     FCDoubleSpinner, FCButton, FCInputDialog, FCTree
 from AppParsers.ParseFont import *

+ 1 - 1
AppEditors/FlatCAMGrbEditor.py

@@ -20,7 +20,7 @@ import logging
 from camlib import distance, arc, three_point_circle
 from AppGUI.GUIElements import FCEntry, FCComboBox, FCTable, FCDoubleSpinner, FCSpinner, RadioSet, \
     EvalEntry2, FCInputDialog, FCButton, OptionalInputSection, FCCheckBox
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 
 import numpy as np
 from numpy.linalg import norm as numpy_norm

+ 2 - 3
AppParsers/ParseExcellon.py

@@ -6,7 +6,7 @@
 # MIT Licence                                                 #
 # ########################################################## ##
 
-from camlib import Geometry
+from camlib import Geometry, grace
 
 import shapely.affinity as affinity
 from shapely.geometry import Point, LineString
@@ -17,8 +17,7 @@ import logging
 import traceback
 from copy import deepcopy
 
-import AppTranslation as fcTranslate
-from Common import GracefulException as grace
+# import AppTranslation as fcTranslate
 
 import gettext
 import builtins

+ 1 - 2
AppParsers/ParseGerber.py

@@ -1,5 +1,5 @@
 from PyQt5 import QtWidgets
-from camlib import Geometry, arc, arc_angle, ApertureMacro
+from camlib import Geometry, arc, arc_angle, ApertureMacro, grace
 
 import numpy as np
 import re
@@ -15,7 +15,6 @@ from shapely.geometry import box as shply_box, Polygon, LineString, Point, Multi
 
 from lxml import etree as ET
 from AppParsers.ParseSVG import svgparselength, getsvggeo
-from Common import GracefulException as grace
 import AppTranslation as fcTranslate
 
 import gettext

+ 2 - 3
AppParsers/ParseHPGL2.py

@@ -6,7 +6,7 @@
 # MIT Licence                                                #
 # ############################################################
 
-from camlib import arc, three_point_circle
+from camlib import arc, three_point_circle, grace
 
 import numpy as np
 import re
@@ -18,8 +18,7 @@ import sys
 from shapely.ops import unary_union
 from shapely.geometry import LineString, Point
 
-from Common import GracefulException as grace
-import AppTranslation as fcTranslate
+# import AppTranslation as fcTranslate
 import gettext
 import builtins
 

+ 2 - 3
AppTools/AppTool.py → AppTool.py

@@ -27,7 +27,7 @@ class AppTool(QtWidgets.QWidget):
         """
 
         :param app:         The application this tool will run in.
-        :type app:          App.App
+        :type app:          App_Main.App
         :param parent:      Qt Parent
         :return:            AppTool
         """
@@ -284,8 +284,7 @@ class AppTool(QtWidgets.QWidget):
 
     def confirmation_message_int(self, accepted, minval, maxval):
         if accepted is False:
-            self.app.inform.emit('[WARNING_NOTCL] %s: [%d, %d]' %
-                                 (_("Edited value is out of range"), minval, maxval))
+            self.app.inform.emit('[WARNING_NOTCL] %s: [%d, %d]' % (_("Edited value is out of range"), minval, maxval))
         else:
             self.app.inform.emit('[success] %s' % _("Edited value is within limits."))
 

+ 1 - 1
AppTools/ToolAlignObjects.py

@@ -6,7 +6,7 @@
 # ##########################################################
 
 from PyQt5 import QtWidgets, QtCore
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 
 from AppGUI.GUIElements import FCComboBox, RadioSet
 

+ 1 - 1
AppTools/ToolCalculators.py

@@ -6,7 +6,7 @@
 # ##########################################################
 
 from PyQt5 import QtWidgets
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import FCSpinner, FCDoubleSpinner, FCEntry
 import math
 

+ 1 - 1
AppTools/ToolCalibration.py

@@ -7,7 +7,7 @@
 
 from PyQt5 import QtWidgets, QtCore, QtGui
 
-from AppTools.AppTool import AppTool
+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

+ 2 - 2
AppTools/ToolCopperThieving.py

@@ -7,8 +7,8 @@
 
 from PyQt5 import QtWidgets, QtCore
 
-from Common import GracefulException as grace
-from AppTools.AppTool import AppTool
+from camlib import grace
+from AppTool import AppTool
 from AppGUI.GUIElements import FCDoubleSpinner, RadioSet, FCEntry, FCComboBox
 
 import shapely.geometry.base as base

+ 1 - 1
AppTools/ToolCorners.py

@@ -7,7 +7,7 @@
 
 from PyQt5 import QtWidgets, QtCore
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCComboBox, FCButton
 
 from shapely.geometry import MultiPolygon, LineString

+ 1 - 1
AppTools/ToolCutOut.py

@@ -6,7 +6,7 @@
 # ##########################################################
 
 from PyQt5 import QtWidgets, QtGui, QtCore
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import FCDoubleSpinner, FCCheckBox, RadioSet, FCComboBox, OptionalInputSection, FCButton
 
 from shapely.geometry import box, MultiPolygon, Polygon, LineString, LinearRing

+ 1 - 1
AppTools/ToolDblSided.py

@@ -1,7 +1,7 @@
 
 from PyQt5 import QtWidgets, QtCore
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import RadioSet, FCDoubleSpinner, EvalEntry, FCEntry, FCButton, FCComboBox
 
 from numpy import Inf

+ 1 - 1
AppTools/ToolDistance.py

@@ -7,7 +7,7 @@
 
 from PyQt5 import QtWidgets, QtCore
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.VisPyVisuals import *
 from AppGUI.GUIElements import FCEntry, FCButton, FCCheckBox
 

+ 1 - 1
AppTools/ToolDistanceMin.py

@@ -6,7 +6,7 @@
 # ##########################################################
 
 from PyQt5 import QtWidgets, QtCore
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import FCEntry
 
 from shapely.ops import nearest_points

+ 1 - 1
AppTools/ToolExtractDrills.py

@@ -7,7 +7,7 @@
 
 from PyQt5 import QtWidgets, QtCore
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox
 
 from shapely.geometry import Point

+ 1 - 1
AppTools/ToolFiducials.py

@@ -7,7 +7,7 @@
 
 from PyQt5 import QtWidgets, QtCore
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import FCDoubleSpinner, RadioSet, EvalEntry, FCTable, FCComboBox
 
 from shapely.geometry import Point, Polygon, MultiPolygon, LineString

+ 1 - 1
AppTools/ToolFilm.py

@@ -7,7 +7,7 @@
 
 from PyQt5 import QtCore, QtWidgets
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, \
     OptionalHideInputSection, OptionalInputSection, FCComboBox, FCFileSaveDialog
 

+ 1 - 1
AppTools/ToolImage.py

@@ -7,7 +7,7 @@
 
 from PyQt5 import QtGui, QtWidgets
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import RadioSet, FCComboBox, FCSpinner
 
 import gettext

+ 1 - 1
AppTools/ToolInvertGerber.py

@@ -7,7 +7,7 @@
 
 from PyQt5 import QtWidgets, QtCore
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import FCButton, FCDoubleSpinner, RadioSet, FCComboBox
 
 from shapely.geometry import box

+ 1 - 1
AppTools/ToolMove.py

@@ -6,7 +6,7 @@
 # ##########################################################
 
 from PyQt5 import QtWidgets, QtCore
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.VisPyVisuals import *
 
 from copy import copy

+ 2 - 2
AppTools/ToolNCC.py

@@ -7,12 +7,12 @@
 
 from PyQt5 import QtWidgets, QtCore, QtGui
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCInputDialog, FCButton,\
     FCComboBox, OptionalInputSection
 from AppParsers.ParseGerber import Gerber
 
-from Common import GracefulException as grace
+from camlib import grace
 
 from copy import deepcopy
 

+ 2 - 2
AppTools/ToolOptimal.py

@@ -7,9 +7,9 @@
 
 from PyQt5 import QtWidgets, QtCore, QtGui
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import OptionalHideInputSection, FCTextArea, FCEntry, FCSpinner, FCCheckBox, FCComboBox
-from Common import GracefulException as grace
+from camlib import grace
 
 from shapely.geometry import MultiPolygon
 from shapely.ops import nearest_points

+ 3 - 3
AppTools/ToolPDF.py

@@ -7,9 +7,9 @@
 
 from PyQt5 import QtWidgets, QtCore
 
-from AppTools.AppTool import AppTool
-from Common import GracefulException as grace
-from AppParsers.ParsePDF import PdfParser
+from AppTool import AppTool
+
+from AppParsers.ParsePDF import PdfParser, grace
 from shapely.geometry import Point, MultiPolygon
 from shapely.ops import unary_union
 

+ 2 - 3
AppTools/ToolPaint.py

@@ -8,13 +8,12 @@
 from PyQt5 import QtWidgets, QtGui, QtCore
 from PyQt5.QtCore import Qt
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from copy import deepcopy
 # from ObjectCollection import *
 from AppParsers.ParseGerber import Gerber
-from camlib import Geometry, FlatCAMRTreeStorage
+from camlib import Geometry, FlatCAMRTreeStorage, grace
 from AppGUI.GUIElements import FCTable, FCDoubleSpinner, FCCheckBox, FCInputDialog, RadioSet, FCButton, FCComboBox
-from Common import GracefulException as grace
 
 from shapely.geometry import base, Polygon, MultiPolygon, LinearRing, Point
 from shapely.ops import cascaded_union, unary_union, linemerge

+ 3 - 2
AppTools/ToolPanelize.py

@@ -6,10 +6,11 @@
 # ##########################################################
 
 from PyQt5 import QtWidgets, QtGui, QtCore
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 
 from AppGUI.GUIElements import FCSpinner, FCDoubleSpinner, RadioSet, FCCheckBox, OptionalInputSection, FCComboBox
-from Common import GracefulException as grace
+from camlib import grace
+
 from copy import deepcopy
 import numpy as np
 

+ 1 - 1
AppTools/ToolPcbWizard.py

@@ -7,7 +7,7 @@
 
 from PyQt5 import QtWidgets, QtCore
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import RadioSet, FCSpinner, FCButton, FCTable
 
 import re

+ 1 - 1
AppTools/ToolProperties.py

@@ -6,7 +6,7 @@
 # ##########################################################
 
 from PyQt5 import QtGui, QtCore, QtWidgets
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import FCTree
 
 from shapely.geometry import MultiPolygon, Polygon

+ 1 - 1
AppTools/ToolPunchGerber.py

@@ -7,7 +7,7 @@
 
 from PyQt5 import QtCore, QtWidgets
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox
 
 from copy import deepcopy

+ 1 - 1
AppTools/ToolQRCode.py

@@ -8,7 +8,7 @@
 from PyQt5 import QtWidgets, QtCore, QtGui
 from PyQt5.QtCore import Qt
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import RadioSet, FCTextArea, FCSpinner, FCEntry, FCCheckBox, FCComboBox, FCFileSaveDialog
 from AppParsers.ParseSVG import *
 

+ 1 - 1
AppTools/ToolRulesCheck.py

@@ -7,7 +7,7 @@
 
 from PyQt5 import QtWidgets
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import FCDoubleSpinner, FCCheckBox, OptionalInputSection, FCComboBox
 from copy import deepcopy
 

+ 2 - 2
AppTools/ToolSolderPaste.py

@@ -5,11 +5,11 @@
 # MIT Licence                                              #
 # ##########################################################
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from Common import LoudDict
 from AppGUI.GUIElements import FCComboBox, FCEntry, FCTable, \
     FCInputDialog, FCDoubleSpinner, FCSpinner, FCFileSaveDialog
-from App import log
+from App_Main import log
 from camlib import distance
 from AppEditors.FlatCAMTextEditor import TextEditor
 

+ 1 - 1
AppTools/ToolSub.py

@@ -7,7 +7,7 @@
 
 from PyQt5 import QtWidgets, QtCore
 
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import FCCheckBox, FCButton, FCComboBox
 
 from shapely.geometry import Polygon, MultiPolygon, MultiLineString, LineString

+ 1 - 1
AppTools/ToolTransform.py

@@ -6,7 +6,7 @@
 # ##########################################################
 
 from PyQt5 import QtWidgets
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 from AppGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCButton, OptionalInputSection, FCEntry
 
 import gettext

+ 4 - 1
App.py → App_Main.py

@@ -43,7 +43,10 @@ import socket
 # ####################################################################################################################
 
 # Diverse
-from Common import LoudDict, color_variant, ExclusionAreas
+from Common import LoudDict
+from Common import color_variant
+from Common import ExclusionAreas
+
 from Bookmark import BookmarkManager
 from AppDatabase import ToolsDB2
 

+ 1 - 0
CHANGELOG.md

@@ -22,6 +22,7 @@ CHANGELOG for FlatCAM beta
 - moved some of the methods from the App class to the ObjectCollection class
 - moved all the new_object related methods in their own class AppObjects.AppObject
 - more refactoring; solved some issues introduced by the refactoring
+- solved a circular import
 
 17.05.2020
 

+ 1 - 1
Common.py

@@ -15,7 +15,7 @@ from PyQt5 import QtCore
 from shapely.geometry import Polygon, MultiPolygon
 
 from AppGUI.VisPyVisuals import ShapeCollection
-from AppTools.AppTool import AppTool
+from AppTool import AppTool
 
 import numpy as np
 

+ 1 - 1
FlatCAM.py

@@ -3,7 +3,7 @@ import os
 
 from PyQt5 import QtWidgets
 from PyQt5.QtCore import QSettings, Qt
-from App import App
+from App_Main import App
 from AppGUI import VisPyPatches
 
 from multiprocessing import freeze_support

+ 1 - 2
camlib.py

@@ -39,7 +39,6 @@ from shapely.geometry import shape
 from descartes.patch import PolygonPatch
 # ---------------------------------------
 
-import collections
 from collections import Iterable
 
 import rasterio
@@ -48,7 +47,7 @@ import ezdxf
 
 from Common import GracefulException as grace
 
-# TODO: Commented for FlatCAM packaging with cx_freeze
+# Commented for FlatCAM packaging with cx_freeze
 # from scipy.spatial import KDTree, Delaunay
 # from scipy.spatial import Delaunay
 

+ 2 - 2
tclCommands/TclCommand.py

@@ -1,6 +1,6 @@
 import sys
 import re
-import App
+import App_Main
 import abc
 import collections
 from PyQt5 import QtCore
@@ -53,7 +53,7 @@ class TclCommand(object):
         if self.app is None:
             raise TypeError('Expected app to be FlatCAMApp instance.')
 
-        if not isinstance(self.app, App.App):
+        if not isinstance(self.app, App_Main.App):
             raise TypeError('Expected FlatCAMApp, got %s.' % type(app))
 
         self.log = self.app.log