- fixed imports in all TclCommands

This commit is contained in:
Marius Stanciu 2019-10-25 02:10:52 +03:00 committed by Marius
parent 7181d55368
commit d0e5b6c83a
57 changed files with 206 additions and 90 deletions

View File

@ -14,13 +14,14 @@ CAD program, and create G-Code for Isolation routing.
- QRCode Tool: added ability to add negative QRCodes (perhaps they can be isolated on copper?); added a clear area surrounding the QRCode in case it is dropped on a copper pour (region); fixed the Gerber export
- QRCode Tool: all parameters are hard-coded for now
- small update
- fixed imports in all TclCommands
24.10.2019
- added some placeholder texts in the TextBoxes.
- working on QRCode Tool; added the utility geometry and intial functional layout
- working on QRCode Tool; added the utility geometry and initial functional layout
- working on QRCode Tool; finished adding the QRCode geometry to the selected Gerber object and also finished adding the 'follow' geometry needed when exporting the Gerber object as a Gerber file in addition to the 'solid' geometry in the obj.apertures
- working on QRCode Tool; finished offseting the geometry both in apertures and in solid_geometry; updated the source_file of the source object
- working on QRCode Tool; finished offsetting the geometry both in apertures and in solid_geometry; updated the source_file of the source object
23.10.2019

View File

@ -1,4 +1,4 @@
from ObjectCollection import *
import collections
from tclCommands.TclCommand import TclCommand
@ -56,7 +56,7 @@ class TclCommandAddCircle(TclCommand):
try:
obj = self.app.collection.get_by_name(str(obj_name))
except:
except Exception as e:
return "Could not retrieve object: %s" % obj_name
if obj is None:
return "Object not found: %s" % obj_name

View File

@ -1,4 +1,4 @@
from ObjectCollection import *
from camlib import Geometry
from tclCommands.TclCommand import *

View File

@ -1,4 +1,5 @@
from ObjectCollection import *
from camlib import Geometry
import collections
from tclCommands.TclCommand import TclCommandSignaled

View File

@ -1,4 +1,4 @@
from ObjectCollection import *
import collections
from tclCommands.TclCommand import TclCommandSignaled
@ -58,7 +58,7 @@ class TclCommandAddRectangle(TclCommandSignaled):
try:
obj = self.app.collection.get_by_name(str(obj_name))
except:
except Exception as e:
return "Could not retrieve object: %s" % obj_name
if obj is None:
return "Object not found: %s" % obj_name

View File

@ -1,5 +1,9 @@
from ObjectCollection import *
import collections
from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMGeometry, FlatCAMGerber, FlatCAMExcellon
from shapely.geometry import Point
import shapely.affinity as affinity
class TclCommandAlignDrill(TclCommandSignaled):

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
import collections
from tclCommands.TclCommand import TclCommandSignaled
from shapely.geometry import Point
class TclCommandAlignDrillGrid(TclCommandSignaled):
"""

View File

@ -1,5 +1,9 @@
from ObjectCollection import *
import collections
from tclCommands.TclCommand import TclCommand
from FlatCAMObj import FlatCAMGeometry, FlatCAMGerber
from shapely.ops import cascaded_union
import gettext
import FlatCAMTranslation as fcTranslate
import builtins

View File

@ -1,7 +1,6 @@
from tclCommands.TclCommand import TclCommand
from ObjectCollection import *
from camlib import get_bounds
import collections
import logging
import gettext
import FlatCAMTranslation as fcTranslate
@ -11,6 +10,7 @@ fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
log = logging.getLogger('base')
class TclCommandBounds(TclCommand):
"""

View File

@ -6,7 +6,7 @@
# ##########################################################
from tclCommands.TclCommand import TclCommand
from ObjectCollection import *
import collections
class TclCommandClearShell(TclCommand):

View File

@ -1,5 +1,8 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMGeometry
import collections
from copy import deepcopy
class TclCommandCncjob(TclCommandSignaled):

View File

@ -1,6 +1,8 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
import logging
import gettext
import FlatCAMTranslation as fcTranslate
import builtins
@ -9,6 +11,8 @@ fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
log = logging.getLogger('base')
class TclCommandCopperClear(TclCommand):
"""

View File

@ -1,8 +1,13 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
import logging
from shapely.ops import cascaded_union
from shapely.geometry import LineString
log = logging.getLogger('base')
class TclCommandCutout(TclCommand):
"""

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandDelete(TclCommand):
"""

View File

@ -1,5 +1,8 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMExcellon
import collections
import math
class TclCommandDrillcncjob(TclCommandSignaled):
@ -114,7 +117,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
try:
if 'drilled_dias' in args and args['drilled_dias'] != 'all':
diameters = [x.strip() for x in args['drilled_dias'].split(",") if x!= '']
diameters = [x.strip() for x in args['drilled_dias'].split(",") if x != '']
nr_diameters = len(diameters)
req_tools = set()

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from camlib import CNCjob
import collections
class TclCommandExportGcode(TclCommandSignaled):

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandExportSVG(TclCommand):
"""
@ -47,6 +48,4 @@ class TclCommandExportSVG(TclCommand):
:return:
"""
name = args['name']
self.app.export_svg(**args)

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from camlib import Geometry
import collections
class TclCommandExteriors(TclCommandSignaled):

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMGerber
import collections
class TclCommandFollow(TclCommandSignaled):

View File

@ -1,9 +1,14 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMGerber, FlatCAMGeometry
import logging
import collections
from copy import deepcopy
from shapely.ops import cascaded_union
from shapely.geometry import Polygon, LineString, LinearRing
log = logging.getLogger('base')
class TclCommandGeoCutout(TclCommandSignaled):
"""

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandGeoUnion(TclCommand):
"""
@ -50,7 +51,7 @@ class TclCommandGeoUnion(TclCommand):
obj_name = args['name']
try:
obj = self.collection.get_by_name(str(obj_name))
obj = self.app.collection.get_by_name(str(obj_name))
except:
return "Could not retrieve object: %s" % obj_name
if obj is None:

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandGetNames(TclCommand):
"""

View File

@ -5,9 +5,10 @@
# MIT Licence #
# ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandGetSys(TclCommand):
"""
@ -54,4 +55,3 @@ class TclCommandGetSys(TclCommand):
if name in self.app.defaults:
return self.app.defaults[name]

View File

@ -1,6 +1,8 @@
from camlib import *
from tclCommands.TclCommand import TclCommandSignaled
import collections
from camlib import Geometry
class TclCommandImportSvg(TclCommandSignaled):
"""
@ -78,4 +80,3 @@ class TclCommandImportSvg(TclCommandSignaled):
# GUI feedback
self.app.inform.emit("Opened: " + filename)

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from camlib import Geometry
import collections
class TclCommandInteriors(TclCommandSignaled):

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMGerber
import collections
class TclCommandIsolate(TclCommandSignaled):
"""
@ -69,10 +70,10 @@ class TclCommandIsolate(TclCommandSignaled):
if 'outname' not in args:
args['outname'] = name + "_iso"
if 'timeout' in args:
timeout = args['timeout']
else:
timeout = 10000
# if 'timeout' in args:
# timeout = args['timeout']
# else:
# timeout = 10000
if 'follow' not in args:
args['follow'] = None

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from FlatCAMObj import FlatCAMExcellon
import collections
class TclCommandJoinExcellon(TclCommand):

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from FlatCAMObj import FlatCAMGeometry
import collections
class TclCommandJoinGeometry(TclCommand):

View File

@ -5,9 +5,11 @@
# MIT Licence #
# ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMExcellon
import math
import collections
class TclCommandMillDrills(TclCommandSignaled):
"""
@ -72,7 +74,7 @@ class TclCommandMillDrills(TclCommandSignaled):
try:
obj = self.app.collection.get_by_name(str(name))
except:
except Exception as e:
obj = None
self.raise_tcl_error("Could not retrieve object: %s" % name)

View File

@ -5,8 +5,11 @@
# MIT Licence #
# ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMExcellon
import collections
import math
class TclCommandMillSlots(TclCommandSignaled):

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMExcellon, FlatCAMGeometry, FlatCAMGerber
import collections
class TclCommandMirror(TclCommandSignaled):
@ -55,7 +57,7 @@ class TclCommandMirror(TclCommandSignaled):
# Get source object.
try:
obj = self.app.collection.get_by_name(str(name))
except:
except Exception as e:
return "Could not retrieve object: %s" % name
if obj is None:
@ -76,7 +78,7 @@ class TclCommandMirror(TclCommandSignaled):
if 'box' in args:
try:
box = self.app.collection.get_by_name(args['box'])
except:
except Exception as e:
return "Could not retrieve object box: %s" % args['box']
if box is None:

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandNew(TclCommand):
"""

View File

@ -5,9 +5,10 @@
# MIT Licence #
# ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandNewExcellon(TclCommandSignaled):
"""

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandNewGeometry(TclCommandSignaled):
"""

View File

@ -5,9 +5,10 @@
# MIT Licence #
# ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandNewGerber(TclCommandSignaled):
"""
@ -56,7 +57,7 @@ class TclCommandNewGerber(TclCommandSignaled):
else:
name = 'new_grb'
def initialize(grb_obj, self):
def initialize(grb_obj, app_obj):
grb_obj.multitool = False
grb_obj.source_file = []
grb_obj.multigeo = False

View File

@ -1,5 +1,10 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from FlatCAMObj import FlatCAMGeometry, FlatCAMGerber
from shapely.ops import cascaded_union
import collections
import gettext
import FlatCAMTranslation as fcTranslate
import builtins

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandOffset(TclCommand):
"""

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandOpenExcellon(TclCommandSignaled):
"""

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandOpenGCode(TclCommandSignaled):
"""

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from camlib import Geometry, ParseError
import collections
class TclCommandOpenGerber(TclCommandSignaled):

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandOpenProject(TclCommandSignaled):
"""

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandOptions(TclCommandSignaled):
"""

View File

@ -1,6 +1,8 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
import logging
import gettext
import FlatCAMTranslation as fcTranslate
import builtins
@ -9,6 +11,8 @@ fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
log = logging.getLogger('base')
class TclCommandPaint(TclCommand):
"""

View File

@ -1,7 +1,13 @@
from ObjectCollection import *
from copy import copy,deepcopy
from tclCommands.TclCommand import TclCommand
from FlatCAMObj import FlatCAMGeometry, FlatCAMExcellon
import shapely.affinity as affinity
import logging
from copy import deepcopy
import collections
log = logging.getLogger('base')
class TclCommandPanelize(TclCommand):
@ -64,7 +70,7 @@ class TclCommandPanelize(TclCommand):
# Get source object.
try:
obj = self.app.collection.get_by_name(str(name))
except:
except Exception as e:
return "Could not retrieve object: %s" % name
if obj is None:
@ -74,7 +80,7 @@ class TclCommandPanelize(TclCommand):
boxname = args['box']
try:
box = self.app.collection.get_by_name(boxname)
except:
except Exception as e:
return "Could not retrieve object: %s" % name
else:
box = obj
@ -185,8 +191,9 @@ class TclCommandPanelize(TclCommand):
if option is not 'name':
try:
obj_fin.options[option] = obj.options[option]
except:
log.warning("Failed to copy option.", option)
except Exception as e:
log.warning("Failed to copy option: %s" % str(option))
log.debug("TclCommandPanelize.execute().panelize2() --> %s" % str(e))
for row in range(rows):
currentx = 0.0
@ -277,9 +284,9 @@ class TclCommandPanelize(TclCommand):
try:
panelize_2()
self.app.inform.emit("[success] Panel created successfully.")
except Exception as e:
except Exception as ee:
proc.done()
log.debug(str(e))
log.debug(str(ee))
return
proc.done()

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandPlotAll(TclCommand):
"""

View File

@ -5,9 +5,10 @@
# MIT Licence #
# ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandPlotObjects(TclCommand):
"""

View File

@ -5,9 +5,10 @@
# MIT Licence #
# ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandQuit(TclCommand):
"""
@ -51,4 +52,3 @@ class TclCommandQuit(TclCommand):
"""
self.app.quit_application()

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandSaveProject(TclCommandSignaled):
"""

View File

@ -1,6 +1,18 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
import logging
import gettext
import FlatCAMTranslation as fcTranslate
import builtins
fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
log = logging.getLogger('base')
class TclCommandScale(TclCommand):
"""

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandSetActive(TclCommand):
"""

View File

@ -6,10 +6,12 @@
# ##########################################################
from tclCommands.TclCommand import TclCommand
from ObjectCollection import *
import collections
from camlib import get_bounds
import logging
import gettext
import FlatCAMTranslation as fcTranslate
import builtins
@ -18,6 +20,8 @@ fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
log = logging.getLogger('base')
class TclCommandSetOrigin(TclCommand):
"""

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandSetSys(TclCommand):
"""

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandSkew(TclCommand):
"""

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandSubtractPoly(TclCommandSignaled):
"""
@ -50,11 +51,13 @@ class TclCommandSubtractPoly(TclCommandSignaled):
if len(unnamed_args) % 2 != 0:
return "Incomplete coordinate."
points = [[float(unnamed_args[2 * i]), float(unnamed_args[2 * i + 1])] for i in range(len(unnamed_args) / 2)]
points = [
[float(unnamed_args[2 * i]), float(unnamed_args[2 * i + 1])] for i in range(int(len(unnamed_args) / 2))
]
try:
obj = self.app.collection.get_by_name(str(obj_name))
except:
except Exception as e:
return "Could not retrieve object: %s" % obj_name
if obj is None:
return "Object not found: %s" % obj_name

View File

@ -1,6 +1,15 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
import collections
import gettext
import FlatCAMTranslation as fcTranslate
import builtins
fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
class TclCommandSubtractRectangle(TclCommandSignaled):
"""
@ -61,7 +70,7 @@ class TclCommandSubtractRectangle(TclCommandSignaled):
try:
obj = self.app.collection.get_by_name(str(obj_name))
except:
except Exception as e:
return "Could not retrieve object: %s" % obj_name
if obj is None:
return "Object not found: %s" % obj_name

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
import collections
class TclCommandVersion(TclCommand):
"""
@ -44,4 +45,3 @@ class TclCommandVersion(TclCommand):
"""
self.app.version_check()

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandWriteGCode(TclCommandSignaled):
"""
@ -89,7 +90,7 @@ class TclCommandWriteGCode(TclCommandSignaled):
try:
obj = self.app.collection.get_by_name(str(obj_name))
except:
except Exception as e:
if muted == 0:
return "Could not retrieve object: %s" % obj_name
else: