2019-01-03 19:25:08 +00:00
|
|
|
import pkgutil
|
|
|
|
import sys
|
|
|
|
|
|
|
|
# allowed command modules (please append them alphabetically ordered)
|
|
|
|
import tclCommands.TclCommandAddCircle
|
|
|
|
import tclCommands.TclCommandAddPolygon
|
|
|
|
import tclCommands.TclCommandAddPolyline
|
|
|
|
import tclCommands.TclCommandAddRectangle
|
|
|
|
import tclCommands.TclCommandAlignDrill
|
|
|
|
import tclCommands.TclCommandAlignDrillGrid
|
2019-08-24 18:25:25 +00:00
|
|
|
import tclCommands.TclCommandBbox
|
2019-09-23 01:07:24 +00:00
|
|
|
import tclCommands.TclCommandBounds
|
2019-01-03 19:25:08 +00:00
|
|
|
import tclCommands.TclCommandClearShell
|
|
|
|
import tclCommands.TclCommandCncjob
|
2019-08-25 01:45:16 +00:00
|
|
|
import tclCommands.TclCommandCopperClear
|
2019-01-03 19:25:08 +00:00
|
|
|
import tclCommands.TclCommandCutout
|
|
|
|
import tclCommands.TclCommandDelete
|
|
|
|
import tclCommands.TclCommandDrillcncjob
|
2019-12-02 18:54:18 +00:00
|
|
|
import tclCommands.TclCommandExportDXF
|
|
|
|
import tclCommands.TclCommandExportExcellon
|
|
|
|
import tclCommands.TclCommandExportGerber
|
2019-01-03 19:25:08 +00:00
|
|
|
import tclCommands.TclCommandExportGcode
|
|
|
|
import tclCommands.TclCommandExportSVG
|
|
|
|
import tclCommands.TclCommandExteriors
|
|
|
|
import tclCommands.TclCommandGeoCutout
|
|
|
|
import tclCommands.TclCommandGeoUnion
|
|
|
|
import tclCommands.TclCommandGetNames
|
2020-04-28 11:37:34 +00:00
|
|
|
import tclCommands.TclCommandGetPath
|
2019-01-03 19:25:08 +00:00
|
|
|
import tclCommands.TclCommandGetSys
|
2020-04-22 23:07:55 +00:00
|
|
|
import tclCommands.TclCommandHelp
|
2019-01-03 19:25:08 +00:00
|
|
|
import tclCommands.TclCommandInteriors
|
|
|
|
import tclCommands.TclCommandIsolate
|
|
|
|
import tclCommands.TclCommandFollow
|
|
|
|
import tclCommands.TclCommandJoinExcellon
|
|
|
|
import tclCommands.TclCommandJoinGeometry
|
|
|
|
import tclCommands.TclCommandListSys
|
2019-09-11 14:34:01 +00:00
|
|
|
import tclCommands.TclCommandMillDrills
|
|
|
|
import tclCommands.TclCommandMillSlots
|
2019-01-03 19:25:08 +00:00
|
|
|
import tclCommands.TclCommandMirror
|
|
|
|
import tclCommands.TclCommandNew
|
2019-08-24 18:25:25 +00:00
|
|
|
import tclCommands.TclCommandNregions
|
2019-09-15 23:57:46 +00:00
|
|
|
import tclCommands.TclCommandNewExcellon
|
2019-01-03 19:25:08 +00:00
|
|
|
import tclCommands.TclCommandNewGeometry
|
2019-09-15 23:57:46 +00:00
|
|
|
import tclCommands.TclCommandNewGerber
|
2019-01-03 19:25:08 +00:00
|
|
|
import tclCommands.TclCommandOffset
|
2020-04-28 11:37:34 +00:00
|
|
|
import tclCommands.TclCommandOpenDXF
|
2019-01-03 19:25:08 +00:00
|
|
|
import tclCommands.TclCommandOpenExcellon
|
|
|
|
import tclCommands.TclCommandOpenGCode
|
|
|
|
import tclCommands.TclCommandOpenGerber
|
|
|
|
import tclCommands.TclCommandOpenProject
|
2020-04-28 11:37:34 +00:00
|
|
|
import tclCommands.TclCommandOpenSVG
|
2019-01-03 19:25:08 +00:00
|
|
|
import tclCommands.TclCommandOptions
|
|
|
|
import tclCommands.TclCommandPaint
|
|
|
|
import tclCommands.TclCommandPanelize
|
2019-09-15 21:47:15 +00:00
|
|
|
import tclCommands.TclCommandPlotAll
|
|
|
|
import tclCommands.TclCommandPlotObjects
|
2019-09-19 01:04:18 +00:00
|
|
|
import tclCommands.TclCommandQuit
|
2019-01-03 19:25:08 +00:00
|
|
|
import tclCommands.TclCommandSaveProject
|
|
|
|
import tclCommands.TclCommandSaveSys
|
|
|
|
import tclCommands.TclCommandScale
|
|
|
|
import tclCommands.TclCommandSetActive
|
2019-09-23 00:35:32 +00:00
|
|
|
import tclCommands.TclCommandSetOrigin
|
2020-04-28 11:37:34 +00:00
|
|
|
import tclCommands.TclCommandSetPath
|
2019-01-03 19:25:08 +00:00
|
|
|
import tclCommands.TclCommandSetSys
|
|
|
|
import tclCommands.TclCommandSkew
|
|
|
|
import tclCommands.TclCommandSubtractPoly
|
|
|
|
import tclCommands.TclCommandSubtractRectangle
|
|
|
|
import tclCommands.TclCommandVersion
|
|
|
|
import tclCommands.TclCommandWriteGCode
|
|
|
|
|
|
|
|
|
|
|
|
__all__ = []
|
|
|
|
|
|
|
|
for loader, name, is_pkg in pkgutil.walk_packages(__path__):
|
|
|
|
module = loader.find_module(name).load_module(name)
|
|
|
|
__all__.append(name)
|
|
|
|
|
|
|
|
|
|
|
|
def register_all_commands(app, commands):
|
|
|
|
"""
|
|
|
|
Static method which registers all known commands.
|
|
|
|
|
|
|
|
Command should be for now in directory tclCommands and module should start with TCLCommand
|
|
|
|
Class have to follow same name as module.
|
|
|
|
|
|
|
|
we need import all modules in top section:
|
|
|
|
import tclCommands.TclCommandExteriors
|
|
|
|
at this stage we can include only wanted commands with this, auto loading may be implemented in future
|
|
|
|
I have no enough knowledge about python's anatomy. Would be nice to include all classes which are descendant etc.
|
|
|
|
|
|
|
|
:param app: FlatCAMApp
|
|
|
|
:param commands: List of commands being updated
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
|
|
|
|
tcl_modules = {k: v for k, v in list(sys.modules.items()) if k.startswith('tclCommands.TclCommand')}
|
|
|
|
|
|
|
|
for key, mod in list(tcl_modules.items()):
|
|
|
|
if key != 'tclCommands.TclCommand':
|
|
|
|
class_name = key.split('.')[1]
|
|
|
|
class_type = getattr(mod, class_name)
|
|
|
|
command_instance = class_type(app)
|
|
|
|
|
|
|
|
for alias in command_instance.aliases:
|
2020-04-13 16:15:20 +00:00
|
|
|
try:
|
|
|
|
description = command_instance.description
|
|
|
|
except AttributeError:
|
|
|
|
description = ''
|
2019-01-03 19:25:08 +00:00
|
|
|
commands[alias] = {
|
|
|
|
'fcn': command_instance.execute_wrapper,
|
2020-04-13 16:15:20 +00:00
|
|
|
'help': command_instance.get_decorated_help(),
|
|
|
|
'description': description
|
2019-01-03 19:25:08 +00:00
|
|
|
}
|