Basic workflow. No editing
concept dock work most functions working. made linuxcnc export work Fixed some defaults on new install fixed display label in dock
This commit is contained in:
@@ -25,9 +25,10 @@ import FreeCADGui
|
||||
import PySide.QtCore as QtCore
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
|
||||
class CommandToolBitLibraryOpen:
|
||||
|
||||
class CommandToolBitSelectorOpen:
|
||||
'''
|
||||
Command to ToolBitLibrary editor.
|
||||
Command to toggle the ToolBitSelector Dock
|
||||
'''
|
||||
|
||||
def __init__(self):
|
||||
@@ -35,11 +36,40 @@ class CommandToolBitLibraryOpen:
|
||||
|
||||
def GetResources(self):
|
||||
return {'Pixmap': 'Path-ToolTable',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathToolBitLibrary", "Open ToolBit Library editor"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathToolBitLibrary", "ToolBit Dock"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathToolBitLibrary", "Toggle the Toolbit Dock"),
|
||||
'Accel': "P, T"}
|
||||
|
||||
def IsActive(self):
|
||||
return FreeCAD.ActiveDocument is not None
|
||||
|
||||
def Activated(self):
|
||||
import PathScripts.PathToolBitLibraryGui as PathToolBitLibraryGui
|
||||
dock = PathToolBitLibraryGui.ToolBitSelector()
|
||||
|
||||
lastlib = PathPreferences.lastPathToolLibrary()
|
||||
|
||||
if PathPreferences.toolsOpenLastLibrary():
|
||||
dock.open(lastlib)
|
||||
else:
|
||||
dock.open()
|
||||
|
||||
|
||||
class CommandToolBitLibraryOpen:
|
||||
'''
|
||||
Command to open ToolBitLibrary editor.
|
||||
'''
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def GetResources(self):
|
||||
return {'Pixmap': 'Path-ToolTable',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathToolBitLibrary", "ToolBit Library editor"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathToolBitLibrary", "Open an editor to manage ToolBit libraries")}
|
||||
|
||||
def IsActive(self):
|
||||
return True
|
||||
return FreeCAD.ActiveDocument is not None
|
||||
|
||||
def Activated(self):
|
||||
import PathScripts.PathToolBitLibraryGui as PathToolBitLibraryGui
|
||||
@@ -52,55 +82,56 @@ class CommandToolBitLibraryOpen:
|
||||
else:
|
||||
library.open()
|
||||
|
||||
class CommandToolBitLibraryLoad:
|
||||
'''
|
||||
Command used to load an entire ToolBitLibrary (or part of it) from a file into a job.
|
||||
'''
|
||||
# class CommandToolBitLibraryLoad:
|
||||
# '''
|
||||
# Command used to load an entire ToolBitLibrary (or part of it) from a file into a job.
|
||||
# '''
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
# def __init__(self):
|
||||
# pass
|
||||
|
||||
def GetResources(self):
|
||||
return {'Pixmap': 'Path-ToolTable',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathToolBitLibrary", "Load ToolBit Library"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathToolBitLibrary", "Load an entire ToolBit library or part of it into a job")}
|
||||
# def GetResources(self):
|
||||
# return {'Pixmap': 'Path-ToolTable',
|
||||
# 'MenuText': QtCore.QT_TRANSLATE_NOOP("PathToolBitLibrary", "Load ToolBit Library"),
|
||||
# 'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathToolBitLibrary", "Load an entire ToolBit library or part of it into a job")}
|
||||
|
||||
def selectedJob(self):
|
||||
if FreeCAD.ActiveDocument:
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
if sel and sel[0].Object.Name[:3] == 'Job':
|
||||
return sel[0].Object
|
||||
jobs = [o for o in FreeCAD.ActiveDocument.Objects if o.Name[:3] == 'Job']
|
||||
if 1 == len(jobs):
|
||||
return jobs[0]
|
||||
return None
|
||||
# def selectedJob(self):
|
||||
# if FreeCAD.ActiveDocument:
|
||||
# sel = FreeCADGui.Selection.getSelectionEx()
|
||||
# if sel and sel[0].Object.Name[:3] == 'Job':
|
||||
# return sel[0].Object
|
||||
# jobs = [o for o in FreeCAD.ActiveDocument.Objects if o.Name[:3] == 'Job']
|
||||
# if 1 == len(jobs):
|
||||
# return jobs[0]
|
||||
# return None
|
||||
|
||||
def IsActive(self):
|
||||
return not self.selectedJob() is None
|
||||
# def IsActive(self):
|
||||
# return not self.selectedJob() is None
|
||||
|
||||
def Activated(self):
|
||||
job = self.selectedJob()
|
||||
self.Execute(job)
|
||||
# def Activated(self):
|
||||
# job = self.selectedJob()
|
||||
# self.Execute(job)
|
||||
|
||||
@classmethod
|
||||
def Execute(cls, job):
|
||||
import PathScripts.PathToolBitLibraryGui as PathToolBitLibraryGui
|
||||
import PathScripts.PathToolControllerGui as PathToolControllerGui
|
||||
# @classmethod
|
||||
# def Execute(cls, job):
|
||||
# import PathScripts.PathToolBitLibraryGui as PathToolBitLibraryGui
|
||||
# import PathScripts.PathToolControllerGui as PathToolControllerGui
|
||||
|
||||
library = PathToolBitLibraryGui.ToolBitLibrary()
|
||||
# library = PathToolBitLibraryGui.ToolBitLibrary()
|
||||
|
||||
if 1 == library.open() and job:
|
||||
for nr, tool in library.selectedOrAllTools():
|
||||
tc = PathToolControllerGui.Create("TC: {}".format(tool.Label), tool, nr)
|
||||
job.Proxy.addToolController(tc)
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return True
|
||||
return False
|
||||
# if 1 == library.open() and job:
|
||||
# for nr, tool in library.selectedOrAllTools():
|
||||
# tc = PathToolControllerGui.Create("TC: {}".format(tool.Label), tool, nr)
|
||||
# job.Proxy.addToolController(tc)
|
||||
# FreeCAD.ActiveDocument.recompute()
|
||||
# return True
|
||||
# return False
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
FreeCADGui.addCommand('Path_ToolBitLibraryOpen', CommandToolBitLibraryOpen())
|
||||
FreeCADGui.addCommand('Path_ToolBitLibraryLoad', CommandToolBitLibraryLoad())
|
||||
FreeCADGui.addCommand('Path_ToolBitDock', CommandToolBitSelectorOpen())
|
||||
|
||||
CommandList = ['Path_ToolBitLibraryOpen', 'Path_ToolBitLibraryLoad']
|
||||
BarList = ['Path_ToolBitDock']
|
||||
MenuList = ['Path_ToolBitLibraryOpen', 'Path_ToolBitDock']
|
||||
|
||||
FreeCAD.Console.PrintLog("Loading PathToolBitLibraryCmd... done\n")
|
||||
|
||||
Reference in New Issue
Block a user