- overwritten the Beta_8.995 branch with the Gerber_Editor_Upgrade branch

This commit is contained in:
Marius Stanciu
2023-05-24 18:07:05 +03:00
parent c23d0c4ed6
commit 63071a9bae
214 changed files with 22249 additions and 6251 deletions

View File

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

View File

@@ -1,6 +1,6 @@
from tclCommands.TclCommand import *
from copy import deepcopy
from shapely.geometry import Point
from shapely import Point
class TclCommandAddDrill(TclCommandSignaled):

View File

@@ -1,6 +1,6 @@
from tclCommands.TclCommand import *
from copy import deepcopy
from shapely.geometry import Point
from shapely import Point
class TclCommandAddSlot(TclCommandSignaled):

View File

@@ -1,7 +1,7 @@
import collections
from tclCommands.TclCommand import TclCommandSignaled
from shapely.geometry import Point
from shapely import Point
import shapely.affinity as affinity
from copy import deepcopy

View File

@@ -1,7 +1,7 @@
import collections
from tclCommands.TclCommand import TclCommandSignaled
from shapely.geometry import Point
from shapely import Point
from copy import deepcopy

View File

@@ -5,7 +5,7 @@ from tclCommands.TclCommand import TclCommand
import collections
from copy import deepcopy
from shapely.geometry import box
from shapely import box
from shapely.ops import linemerge
from camlib import flatten_shapely_geometry

View File

@@ -19,7 +19,7 @@ class TclCommandExportDXF(TclCommand):
export_dxf path/my_geometry filename
"""
# List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
# List of all command aliases, to be able to use old names for backward compatibility (add_poly, add_polygon)
aliases = ['export_dxf', 'edxf']
description = '%s %s' % ("--", "Export a Geometry object as a DXF File.")
@@ -35,7 +35,7 @@ class TclCommandExportDXF(TclCommand):
])
# array of mandatory options for current Tcl command: required = ['name','outname']
required = ['obj_name']
required = ['name']
# structured help for current command, args needs to be ordered
help = {

View File

@@ -27,7 +27,7 @@ class TclCommandExportGerber(TclCommand):
])
# array of mandatory options for current Tcl command: required = ['name','outname']
required = ['obj_name']
required = ['name']
# structured help for current command, args needs to be ordered
help = {

View File

@@ -11,7 +11,7 @@ class TclCommandExportSVG(TclCommand):
export_svg my_geometry filename
"""
# List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
# List of all command aliases, to be able to use old names for backward compatibility (add_poly, add_polygon)
aliases = ['export_svg']
description = '%s %s' % ("--", "Export a Geometry object as a SVG File.")

View File

@@ -4,7 +4,7 @@ import logging
import collections
from copy import deepcopy
from shapely.ops import unary_union
from shapely.geometry import Polygon, LineString, LinearRing, MultiPolygon, MultiLineString
from shapely import Polygon, LineString, LinearRing, MultiPolygon, MultiLineString
import gettext
import appTranslation as fcTranslate

View File

@@ -1,7 +1,7 @@
from tclCommands.TclCommand import TclCommand
import shapely.affinity as affinity
from shapely.geometry import MultiPolygon, MultiLineString
from shapely import MultiPolygon, MultiLineString
import logging
from copy import deepcopy

View File

@@ -29,7 +29,7 @@ class TclCommandSetPath(TclCommand):
"""
# List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
# List of all command aliases, to be able to use old names for backward compatibility (add_poly, add_polygon)
aliases = ['set_path']
description = '%s %s' % ("--", "Set the folder path to the specified path.")
@@ -41,6 +41,7 @@ class TclCommandSetPath(TclCommand):
# Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
option_types = collections.OrderedDict([
('create', str),
])
# array of mandatory options for current Tcl command: required = {'name','outname'}
@@ -53,6 +54,7 @@ class TclCommandSetPath(TclCommand):
'args': collections.OrderedDict([
('path', 'A folder path to where the user is supposed to have the file that he will work with.\n'
'WARNING: No spaces allowed. Use quotes around the path if it contains spaces.'),
('create', 'If set to True, if the folder does not exist it will create it.'),
]),
'examples': ['set_path D:\\Project_storage_path']
}
@@ -81,6 +83,20 @@ class TclCommandSetPath(TclCommand):
"is a path to file and not a directory as expected.")
self.app.inform_shell.emit(msg)
return "Failed. The Tcl command set_path was used but it was not a directory."
if 'create' in args:
option = args['create'].capitalize()
try:
eval_option = eval(option)
except NameError:
eval_option = False
if eval_option:
self.app.inform_shell.emit("Path not found, let's create it.")
os.mkdir(path)
else:
return "Failed. The Tcl command set_path has options but could not be recognized: -create %s." % \
str(args['create'])
else:
msg = '[ERROR] %s: %s, %s' % (
"The provided path", str(path), "do not exist. Check for typos.")