diff --git a/src/Mod/Path/InitGui.py b/src/Mod/Path/InitGui.py index 1902e4345c..1e01a6c651 100644 --- a/src/Mod/Path/InitGui.py +++ b/src/Mod/Path/InitGui.py @@ -21,6 +21,28 @@ # * * # ***************************************************************************/ +class PathCommandGroup: + def __init__(self, cmdlist, menu, tooltip = None): + self.cmdlist = cmdlist + self.menu = menu + if tooltip is None: + self.tooltip = menu + else: + self.tooltip = tooltip + + def GetCommands(self): + return tuple(self.cmdlist) + + def GetResources(self): + return { 'MenuText': self.menu, 'ToolTip': self.tooltip } + + def IsActive(self): + if FreeCAD.ActiveDocument is not None: + for o in FreeCAD.ActiveDocument.Objects: + if o.Name[:3] == "Job": + return True + return False + class PathWorkbench (Workbench): "Path workbench" @@ -30,6 +52,8 @@ class PathWorkbench (Workbench): self.__class__.ToolTip = "Path workbench" def Initialize(self): + global PathCommandGroup + # Add preferences pages - before loading PathGui to properly order pages of Path group from PathScripts import PathPreferencesPathJob, PathPreferencesPathDressup FreeCADGui.addPreferencePage(PathPreferencesPathJob.JobPreferencesPage, "Path") @@ -42,7 +66,7 @@ class PathWorkbench (Workbench): import Path import PathScripts import PathGui - from PySide import QtGui + from PySide import QtCore, QtGui FreeCADGui.addLanguagePath(":/translations") FreeCADGui.addIconPath(":/icons") # load python modules @@ -85,75 +109,45 @@ class PathWorkbench (Workbench): prepcmdlist = ["Path_Fixture", "Path_Comment", "Path_Stop", "Path_Custom"] twodopcmdlist = ["Path_Contour", "Path_Profile_Faces", "Path_Profile_Edges", "Path_Pocket_Shape", "Path_Drilling", "Path_MillFace", "Path_Helix"] threedopcmdlist = ["Path_Pocket_3D"] - engravecmdlist = ["Path_Engrave", "Path_Chamfer"] + engravecmdlist = ["Path_Engrave"] modcmdlist = ["Path_OperationCopy", "Path_Array", "Path_SimpleCopy" ] dressupcmdlist = ["Path_DressupAxisMap", "Path_DressupDogbone", "Path_DressupDragKnife", "Path_DressupLeadInOut", "Path_DressupRampEntry", "Path_DressupTag"] extracmdlist = [] #modcmdmore = ["Path_Hop",] #remotecmdlist = ["Path_Remote"] - # Add commands to menu and toolbar - def QT_TRANSLATE_NOOP(scope, text): - return text - - class EngraveCommandGroup: - def GetCommands(self): - return tuple(engravecmdlist) - - def GetResources(self): - return { 'MenuText': QT_TRANSLATE_NOOP("Path", 'Engrave Operations'), - 'ToolTip': QT_TRANSLATE_NOOP("Path", 'Engraving Ops') - } - def isActive(self): - if FreeCAD.ActiveDocument is not None: - for o in FreeCAD.ActiveDocument.Objects: - if o.Name[:3] == "Job": - return True - return False - - class ThreeDCommandGroup: - def GetCommands(self): - return tuple(threedopcmdlist) - - def GetResources(self): - return { 'MenuText': QT_TRANSLATE_NOOP("Path",'3D Operations'), - 'ToolTip': QT_TRANSLATE_NOOP("Path",'3D Operations') - } - def IsActive(self): - if FreeCAD.ActiveDocument is not None: - for o in FreeCAD.ActiveDocument.Objects: - if o.Name[:3] == "Job": - return True - return False - if PathPreferences.experimentalFeaturesEnabled(): projcmdlist.append("Path_Sanity") prepcmdlist.append("Path_Shape") - threedopcmdlist.append("Path_Surface") - FreeCADGui.addCommand('Path_EngraveTools', EngraveCommandGroup()) extracmdlist.extend(["Path_Area", "Path_Area_Workplane"]) - FreeCADGui.addCommand('Path_3dTools', ThreeDCommandGroup()) + + engravecmdlist = sorted(engravecmdlist + ['Path_Chamfer']) + engravecmdgroup = ['Path_EngraveTools'] + FreeCADGui.addCommand('Path_EngraveTools', PathCommandGroup(engravecmdlist, QtCore.QT_TRANSLATE_NOOP("Path", 'Engraving Operations'))) + + threedopcmdlist.append("Path_Surface") threedcmdgroup = ['Path_3dTools'] + FreeCADGui.addCommand('Path_3dTools', PathCommandGroup(threedopcmdlist, QtCore.QT_TRANSLATE_NOOP("Path",'3D Operations'))) else: + engravecmdgroup = engravecmdlist threedcmdgroup = threedopcmdlist - engravecmdgroup = ['Path_EngraveTools'] - self.appendToolbar(QT_TRANSLATE_NOOP("Path", "Project Setup"), projcmdlist) - self.appendToolbar(QT_TRANSLATE_NOOP("Path", "Tool Commands"), toolcmdlist) - self.appendToolbar(QT_TRANSLATE_NOOP("Path", "New Operations"), twodopcmdlist+engravecmdgroup+threedcmdgroup) - self.appendToolbar(QT_TRANSLATE_NOOP("Path", "Path Modification"), modcmdlist) + self.appendToolbar(QtCore.QT_TRANSLATE_NOOP("Path", "Project Setup"), projcmdlist) + self.appendToolbar(QtCore.QT_TRANSLATE_NOOP("Path", "Tool Commands"), toolcmdlist) + self.appendToolbar(QtCore.QT_TRANSLATE_NOOP("Path", "New Operations"), twodopcmdlist+engravecmdgroup+threedcmdgroup) + self.appendToolbar(QtCore.QT_TRANSLATE_NOOP("Path", "Path Modification"), modcmdlist) if extracmdlist: - self.appendToolbar(QT_TRANSLATE_NOOP("Path", "Helpful Tools"), extracmdlist) + self.appendToolbar(QtCore.QT_TRANSLATE_NOOP("Path", "Helpful Tools"), extracmdlist) - self.appendMenu([QT_TRANSLATE_NOOP("Path", "&Path")], projcmdlist +["Path_ExportTemplate", "Separator"] + toolcmdlist +["Separator"] + twodopcmdlist + engravecmdlist +["Separator"] +threedopcmdlist +["Separator"]) - self.appendMenu([QT_TRANSLATE_NOOP("Path", "&Path"), QT_TRANSLATE_NOOP( + self.appendMenu([QtCore.QT_TRANSLATE_NOOP("Path", "&Path")], projcmdlist +["Path_ExportTemplate", "Separator"] + toolcmdlist +["Separator"] + twodopcmdlist + engravecmdlist +["Separator"] +threedopcmdlist +["Separator"]) + self.appendMenu([QtCore.QT_TRANSLATE_NOOP("Path", "&Path"), QtCore.QT_TRANSLATE_NOOP( "Path", "Path Dressup")], dressupcmdlist) - self.appendMenu([QT_TRANSLATE_NOOP("Path", "&Path"), QT_TRANSLATE_NOOP( + self.appendMenu([QtCore.QT_TRANSLATE_NOOP("Path", "&Path"), QtCore.QT_TRANSLATE_NOOP( "Path", "Supplemental Commands")], prepcmdlist) - self.appendMenu([QT_TRANSLATE_NOOP("Path", "&Path"), QT_TRANSLATE_NOOP( + self.appendMenu([QtCore.QT_TRANSLATE_NOOP("Path", "&Path"), QtCore.QT_TRANSLATE_NOOP( "Path", "Path Modification")], modcmdlist) if extracmdlist: - self.appendMenu([QT_TRANSLATE_NOOP("Path", "&Path")], extracmdlist) + self.appendMenu([QtCore.QT_TRANSLATE_NOOP("Path", "&Path")], extracmdlist) self.dressupcmds = dressupcmdlist diff --git a/src/Mod/Path/PathScripts/PathChamferGui.py b/src/Mod/Path/PathScripts/PathChamferGui.py index 52e87c82ae..a05dca063e 100644 --- a/src/Mod/Path/PathScripts/PathChamferGui.py +++ b/src/Mod/Path/PathScripts/PathChamferGui.py @@ -104,7 +104,7 @@ Command = PathOpGui.SetupOperation('Chamfer', TaskPanelOpPage, 'Path-Chamfer', QtCore.QT_TRANSLATE_NOOP("PathChamfer", "Chamfer"), - QtCore.QT_TRANSLATE_NOOP("PathChamfer", "Creates an Engraving Path around a Draft ShapeString")) + QtCore.QT_TRANSLATE_NOOP("PathChamfer", "Creates a Chamfer Path along Edges or around Faces")) FreeCAD.Console.PrintLog("Loading PathChamferGui... done\n")