Path: Fixed translation stuff - issue #2443
This commit is contained in:
parent
0e8974a370
commit
7ff4e28599
|
@ -30,31 +30,31 @@
|
|||
<file>icons/Path-Inspect.svg</file>
|
||||
<file>icons/Path-ToolChange.svg</file>
|
||||
<file>icons/Path-SimpleCopy.svg</file>
|
||||
<file>translations/Path_de.qm</file>
|
||||
<file>translations/Path_af.qm</file>
|
||||
<file>translations/Path_zh-CN.qm</file>
|
||||
<file>translations/Path_zh-TW.qm</file>
|
||||
<file>translations/Path_hr.qm</file>
|
||||
<file>translations/Path_cs.qm</file>
|
||||
<file>translations/Path_nl.qm</file>
|
||||
<file>translations/Path_fi.qm</file>
|
||||
<file>translations/Path_fr.qm</file>
|
||||
<file>translations/Path_hu.qm</file>
|
||||
<file>translations/Path_ja.qm</file>
|
||||
<file>translations/Path_no.qm</file>
|
||||
<file>translations/Path_pl.qm</file>
|
||||
<file>translations/Path_pt-PT.qm</file>
|
||||
<file>translations/Path_ro.qm</file>
|
||||
<file>translations/Path_ru.qm</file>
|
||||
<file>translations/Path_sr.qm</file>
|
||||
<file>translations/Path_es-ES.qm</file>
|
||||
<file>translations/Path_sv-SE.qm</file>
|
||||
<file>translations/Path_uk.qm</file>
|
||||
<file>translations/Path_it.qm</file>
|
||||
<file>translations/Path_pt-BR.qm</file>
|
||||
<file>translations/Path_el.qm</file>
|
||||
<file>translations/Path_sk.qm</file>
|
||||
<file>translations/Path_tr.qm</file>
|
||||
<file>translations/Path_sl.qm</file>
|
||||
<file>translations/Path_de.qm</file>
|
||||
<file>translations/Path_af.qm</file>
|
||||
<file>translations/Path_zh-CN.qm</file>
|
||||
<file>translations/Path_zh-TW.qm</file>
|
||||
<file>translations/Path_hr.qm</file>
|
||||
<file>translations/Path_cs.qm</file>
|
||||
<file>translations/Path_nl.qm</file>
|
||||
<file>translations/Path_fi.qm</file>
|
||||
<file>translations/Path_fr.qm</file>
|
||||
<file>translations/Path_hu.qm</file>
|
||||
<file>translations/Path_ja.qm</file>
|
||||
<file>translations/Path_no.qm</file>
|
||||
<file>translations/Path_pl.qm</file>
|
||||
<file>translations/Path_pt-PT.qm</file>
|
||||
<file>translations/Path_ro.qm</file>
|
||||
<file>translations/Path_ru.qm</file>
|
||||
<file>translations/Path_sr.qm</file>
|
||||
<file>translations/Path_es-ES.qm</file>
|
||||
<file>translations/Path_sv-SE.qm</file>
|
||||
<file>translations/Path_uk.qm</file>
|
||||
<file>translations/Path_it.qm</file>
|
||||
<file>translations/Path_pt-BR.qm</file>
|
||||
<file>translations/Path_el.qm</file>
|
||||
<file>translations/Path_sk.qm</file>
|
||||
<file>translations/Path_tr.qm</file>
|
||||
<file>translations/Path_sl.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -61,6 +61,9 @@ class PathWorkbench ( Workbench ):
|
|||
# load the builtin modules
|
||||
import Path
|
||||
import PathGui
|
||||
from PySide import QtGui
|
||||
FreeCADGui.addLanguagePath(":/translations")
|
||||
FreeCADGui.addIconPath(":/icons")
|
||||
# load python modules
|
||||
from PathScripts import PathProfile
|
||||
from PathScripts import PathPocket
|
||||
|
@ -98,16 +101,19 @@ class PathWorkbench ( Workbench ):
|
|||
|
||||
|
||||
# Add commands to menu and toolbar
|
||||
def QT_TRANSLATE_NOOP(scope, text): return text
|
||||
self.appendToolbar(QT_TRANSLATE_NOOP("PathWorkbench","Commands for setting up Project"),projcmdlist)
|
||||
self.appendToolbar(QT_TRANSLATE_NOOP("PathWorkbench","Partial Commands"),prepcmdlist)
|
||||
self.appendToolbar(QT_TRANSLATE_NOOP("PathWorkbench","Operations"),opcmdlist)
|
||||
self.appendToolbar(QT_TRANSLATE_NOOP("PathWorkbench","Commands for grouping,copying, and organizing operations"),modcmdlist)
|
||||
def QT_TRANSLATE_NOOP(scope, text):
|
||||
return text
|
||||
def translate(context,text):
|
||||
return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8).encode("utf8")
|
||||
self.appendToolbar(translate("Path","Project Setup"),projcmdlist)
|
||||
self.appendToolbar(translate("Path","Partial Commands"),prepcmdlist)
|
||||
self.appendToolbar(translate("Path","New Operations"),opcmdlist)
|
||||
self.appendToolbar(translate("Path","Path Modification"),modcmdlist)
|
||||
|
||||
self.appendMenu([QT_TRANSLATE_NOOP("PathWorkbench","Path"),QT_TRANSLATE_NOOP("Path","Project Setup")],projcmdlist)
|
||||
self.appendMenu([QT_TRANSLATE_NOOP("PathWorkbench","Path"),QT_TRANSLATE_NOOP("Path","Partial Commands")],prepcmdlist)
|
||||
self.appendMenu([QT_TRANSLATE_NOOP("PathWorkbench","Path"),QT_TRANSLATE_NOOP("Path","New Operations")],opcmdlist)
|
||||
self.appendMenu([QT_TRANSLATE_NOOP("PathWorkbench","Path"),QT_TRANSLATE_NOOP("Path","Path Modification")],modcmdlist)
|
||||
self.appendMenu([translate("Path","Path"),translate("Path","Project Setup")],projcmdlist)
|
||||
self.appendMenu([translate("Path","Path"),translate("Path","Partial Commands")],prepcmdlist)
|
||||
self.appendMenu([translate("Path","Path"),translate("Path","New Operations")],opcmdlist)
|
||||
self.appendMenu([translate("Path","Path"),translate("Path","Path Modification")],modcmdlist)
|
||||
|
||||
# Add preferences pages
|
||||
import os
|
||||
|
@ -119,6 +125,8 @@ class PathWorkbench ( Workbench ):
|
|||
return "Gui::PythonWorkbench"
|
||||
|
||||
def Activated(self):
|
||||
# update the translation engine
|
||||
FreeCADGui.updateLocale()
|
||||
Msg("Path workbench activated\n")
|
||||
|
||||
def Deactivated(self):
|
||||
|
|
|
@ -103,8 +103,8 @@ class CommandPathArray:
|
|||
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Array',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathArray","Array"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathArray","Creates an array from a selected path")}
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Array","Array"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Array","Creates an array from a selected path")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
@ -114,10 +114,10 @@ class CommandPathArray:
|
|||
# check that the selection contains exactly what we want
|
||||
selection = FreeCADGui.Selection.getSelection()
|
||||
if len(selection) != 1:
|
||||
FreeCAD.Console.PrintError(translate("PathArray","Please select exactly one path object\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_Array","Please select exactly one path object\n"))
|
||||
return
|
||||
if not(selection[0].isDerivedFrom("Path::Feature")):
|
||||
FreeCAD.Console.PrintError(translate("PathArray","Please select exactly one path object\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_Array","Please select exactly one path object\n"))
|
||||
return
|
||||
|
||||
# if everything is ok, execute and register the transaction in the undo/redo stack
|
||||
|
|
|
@ -105,15 +105,15 @@ class _ViewProviderComment:
|
|||
class CommandPathComment:
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Comment',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathComment","Comment"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Comment","Comment"),
|
||||
'Accel': "P, C",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathComment","Add a Comment to your CNC program")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Comment","Add a Comment to your CNC program")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathComment","Create a Comment in your CNC program"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_Comment","Create a Comment in your CNC program"))
|
||||
FreeCADGui.addModule("PathScripts.PathComment")
|
||||
snippet = '''
|
||||
import Path
|
||||
|
|
|
@ -92,16 +92,16 @@ class CommandCompoundExtended:
|
|||
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Compound',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathCompoundExtended","Compound"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_CompoundExtended","Compound"),
|
||||
'Accel': "P, C",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathCompoundExtended","Creates a Path Compound object")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_CompoundExtended","Creates a Path Compound object")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathCompoundExtended","Create Compound"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_CompoundExtended","Create Compound"))
|
||||
FreeCADGui.addModule("PathScripts.PathCompoundExtended")
|
||||
snippet = '''
|
||||
import Path
|
||||
|
|
|
@ -80,16 +80,16 @@ class CommandPathCopy:
|
|||
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Copy',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathCopy","Copy"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Copy","Copy"),
|
||||
'Accel': "P, Y",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathCopy","Creates a linked copy of another path")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Copy","Creates a linked copy of another path")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathCopy","Create Copy"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_Copy","Create Copy"))
|
||||
FreeCADGui.addModule("PathScripts.PathCopy")
|
||||
|
||||
consolecode = '''
|
||||
|
|
|
@ -95,9 +95,9 @@ class CommandPathDressup:
|
|||
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Dressup',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathDressup","Dress-up"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Dressup","Dress-up"),
|
||||
'Accel': "P, S",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathDressup","Creates a Path Dess-up object from a selected path")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Dressup","Creates a Path Dess-up object from a selected path")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
@ -107,17 +107,17 @@ class CommandPathDressup:
|
|||
# check that the selection contains exactly what we want
|
||||
selection = FreeCADGui.Selection.getSelection()
|
||||
if len(selection) != 1:
|
||||
FreeCAD.Console.PrintError(translate("PathDressup","Please select one path object\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_Dressup","Please select one path object\n"))
|
||||
return
|
||||
if not selection[0].isDerivedFrom("Path::Feature"):
|
||||
FreeCAD.Console.PrintError(translate("PathDressup","The selected object is not a path\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_Dressup","The selected object is not a path\n"))
|
||||
return
|
||||
if selection[0].isDerivedFrom("Path::FeatureCompoundPython"):
|
||||
FreeCAD.Console.PrintError(translate("PathDressup", "Please select a Path object"))
|
||||
FreeCAD.Console.PrintError(translate("Path_Dressup", "Please select a Path object"))
|
||||
return
|
||||
|
||||
# everything ok!
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathDressup","Create Dress-up"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_Dressup","Create Dress-up"))
|
||||
FreeCADGui.addModule("PathScripts.PathDressup")
|
||||
FreeCADGui.addModule("PathScripts.PathUtils")
|
||||
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Dressup")')
|
||||
|
|
|
@ -146,9 +146,9 @@ class CommandPathDrilling:
|
|||
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Drilling',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathDrilling","Drilling"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Drilling","Drilling"),
|
||||
'Accel': "P, D",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathDrilling","Creates a Path Drilling object")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Drilling","Creates a Path Drilling object")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
@ -164,7 +164,7 @@ class CommandPathDrilling:
|
|||
if not selection:
|
||||
return
|
||||
# if everything is ok, execute and register the transaction in the undo/redo stack
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathDrilling","Create Drilling"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_Drilling","Create Drilling"))
|
||||
FreeCADGui.addModule("PathScripts.PathDrilling")
|
||||
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Drilling")
|
||||
|
|
|
@ -139,8 +139,8 @@ class CommandPathFacePocket:
|
|||
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-FacePocket',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathFacePocket","Face Pocket"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathFacePocket","Creates a pocket inside a loop of edges or a face")}
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_FacePocket","Face Pocket"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_FacePocket","Creates a pocket inside a loop of edges or a face")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
@ -150,22 +150,22 @@ class CommandPathFacePocket:
|
|||
# check that the selection contains exactly what we want
|
||||
selection = FreeCADGui.Selection.getSelectionEx()
|
||||
if len(selection) != 1:
|
||||
FreeCAD.Console.PrintError(translate("PathFacePocket","Please select an edges loop from one object, or a single face\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_FacePocket","Please select an edges loop from one object, or a single face\n"))
|
||||
return
|
||||
if len(selection[0].SubObjects) == 0:
|
||||
FreeCAD.Console.PrintError(translate("PathFacePocket","Please select an edges loop from one object, or a single face\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_FacePocket","Please select an edges loop from one object, or a single face\n"))
|
||||
return
|
||||
for s in selection[0].SubObjects:
|
||||
if s.ShapeType != "Edge":
|
||||
if (s.ShapeType != "Face") or (len(selection[0].SubObjects) != 1):
|
||||
FreeCAD.Console.PrintError(translate("PathFacePocket","Please select only edges or a single face\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_FacePocket","Please select only edges or a single face\n"))
|
||||
return
|
||||
if selection[0].SubObjects[0].ShapeType == "Edge":
|
||||
try:
|
||||
import Part
|
||||
w = Part.Wire(selection[0].SubObjects)
|
||||
except:
|
||||
FreeCAD.Console.PrintError(translate("PathFacePocket","The selected edges don't form a loop\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_FacePocket","The selected edges don't form a loop\n"))
|
||||
return
|
||||
|
||||
# if everything is ok, execute and register the transaction in the undo/redo stack
|
||||
|
|
|
@ -111,8 +111,8 @@ class CommandPathFaceProfile:
|
|||
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-FaceProfile',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathFaceProfile","Face Profile"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathFaceProfile","Creates a profile object around a selected face")}
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_FaceProfile","Face Profile"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_FaceProfile","Creates a profile object around a selected face")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
@ -122,13 +122,13 @@ class CommandPathFaceProfile:
|
|||
# check that the selection contains exactly what we want
|
||||
selection = FreeCADGui.Selection.getSelectionEx()
|
||||
if len(selection) != 1:
|
||||
FreeCAD.Console.PrintError(translate("PathFaceProfile","Please select one face or wire\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_FaceProfile","Please select one face or wire\n"))
|
||||
return
|
||||
if len(selection[0].SubObjects) != 1:
|
||||
FreeCAD.Console.PrintError(translate("PathFaceProfile","Please select only one face or wire\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_FaceProfile","Please select only one face or wire\n"))
|
||||
return
|
||||
if not selection[0].SubObjects[0].ShapeType in ["Face","Wire"]:
|
||||
FreeCAD.Console.PrintError(translate("PathFaceProfile","Please select only a face or a wire\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_FaceProfile","Please select only a face or a wire\n"))
|
||||
return
|
||||
|
||||
# if everything is ok, execute and register the transaction in the undo/redo stack
|
||||
|
|
|
@ -116,15 +116,15 @@ class _ViewProviderFixture:
|
|||
class CommandPathFixture:
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Datums',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathFixture","Fixture"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Fixture","Fixture"),
|
||||
'Accel': "P, F",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathFixture","Creates a Fixture Offset object")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Fixture","Creates a Fixture Offset object")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathFixture","Create a Fixture Offset"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_Fixture","Create a Fixture Offset"))
|
||||
FreeCADGui.addModule("PathScripts.PathFixture")
|
||||
snippet = '''
|
||||
import Path
|
||||
|
|
|
@ -101,9 +101,9 @@ class CommandPathHop:
|
|||
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Hop',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathHop","Hop"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Hop","Hop"),
|
||||
'Accel': "P, H",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathHop","Creates a Path Hop object")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Hop","Creates a Path Hop object")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
@ -113,13 +113,13 @@ class CommandPathHop:
|
|||
# check that the selection contains exactly what we want
|
||||
selection = FreeCADGui.Selection.getSelection()
|
||||
if len(selection) != 1:
|
||||
FreeCAD.Console.PrintError(translate("PathHop","Please select one path object\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_Hop","Please select one path object\n"))
|
||||
return
|
||||
if not selection[0].isDerivedFrom("Path::Feature"):
|
||||
FreeCAD.Console.PrintError(translate("PathHop","The selected object is not a path\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_Hop","The selected object is not a path\n"))
|
||||
return
|
||||
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathHop","Create Hop"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Pat_hHop","Create Hop"))
|
||||
FreeCADGui.addModule("PathScripts.PathHop")
|
||||
FreeCADGui.addModule("PathScripts.PathUtils")
|
||||
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Hop")')
|
||||
|
|
|
@ -175,10 +175,10 @@ class CommandPathInspect:
|
|||
# check that the selection contains exactly what we want
|
||||
selection = FreeCADGui.Selection.getSelection()
|
||||
if len(selection) != 1:
|
||||
FreeCAD.Console.PrintError(translate("PathInspect","Please select exactly one path object\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_Inspect","Please select exactly one path object\n"))
|
||||
return
|
||||
if not(selection[0].isDerivedFrom("Path::Feature")):
|
||||
FreeCAD.Console.PrintError(translate("PathInspect","Please select exactly one path object\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_Inspect","Please select exactly one path object\n"))
|
||||
return
|
||||
|
||||
# if everything is ok, execute
|
||||
|
|
|
@ -173,15 +173,15 @@ class _ViewProviderKurve:
|
|||
class CommandPathKurve:
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Kurve',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathProfile","Profile"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Kurve","Profile"),
|
||||
'Accel': "P, P",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathProfile","Creates a Path Profile object from selected edges, using libarea for offset algorithm")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Kurve","Creates a Path Profile object from selected edges, using libarea for offset algorithm")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathKurve","Create a Profile operation using libarea"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_Kurve","Create a Profile operation using libarea"))
|
||||
FreeCADGui.addModule("PathScripts.PathKurve")
|
||||
snippet = '''
|
||||
import Path
|
||||
|
|
|
@ -126,9 +126,9 @@ class _ViewProviderLoadTool:
|
|||
class CommandPathLoadTool:
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-LoadTool',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathLoadTool","Tool Number to Load"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_LoadTool","Tool Number to Load"),
|
||||
'Accel': "P, T",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathLoadTool","Tool Number to Load")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_LoadTool","Tool Number to Load")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
|
|
@ -111,15 +111,15 @@ class _ViewProviderPlane:
|
|||
class CommandPathPlane:
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Plane',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathPlane","Selection Plane"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Plane","Selection Plane"),
|
||||
'Accel': "P, P",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathPlane","Create a Selection Plane object")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Plane","Create a Selection Plane object")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathPlane","Create a Selection Plane object"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_Plane","Create a Selection Plane object"))
|
||||
FreeCADGui.addModule("PathScripts.PathPlane")
|
||||
snippet = '''
|
||||
import Path
|
||||
|
|
|
@ -262,9 +262,9 @@ class CommandPathPocket:
|
|||
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Pocket',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathPocket","Pocket"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Pocket","Pocket"),
|
||||
'Accel': "P, O",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathPocket","Creates a Path Pocket object from a loop of edges or a face")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Pocket","Creates a Path Pocket object from a loop of edges or a face")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
@ -274,26 +274,26 @@ class CommandPathPocket:
|
|||
# check that the selection contains exactly what we want
|
||||
selection = FreeCADGui.Selection.getSelectionEx()
|
||||
if len(selection) != 1:
|
||||
FreeCAD.Console.PrintError(translate("PathPocket","Please select an edges loop from one object, or a single face\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_Pocket","Please select an edges loop from one object, or a single face\n"))
|
||||
return
|
||||
if len(selection[0].SubObjects) == 0:
|
||||
FreeCAD.Console.PrintError(translate("PathPocket","Please select an edges loop from one object, or a single face\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_Pocket","Please select an edges loop from one object, or a single face\n"))
|
||||
return
|
||||
for s in selection[0].SubObjects:
|
||||
if s.ShapeType != "Edge":
|
||||
if (s.ShapeType != "Face") or (len(selection[0].SubObjects) != 1):
|
||||
FreeCAD.Console.PrintError(translate("PathPocket","Please select only edges or a single face\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_Pocket","Please select only edges or a single face\n"))
|
||||
return
|
||||
if selection[0].SubObjects[0].ShapeType == "Edge":
|
||||
try:
|
||||
import Part
|
||||
w = Part.Wire(selection[0].SubObjects)
|
||||
except:
|
||||
FreeCAD.Console.PrintError(translate("PathPocket","The selected edges don't form a loop\n"))
|
||||
FreeCAD.Console.PrintError(translate("Path_Pocket","The selected edges don't form a loop\n"))
|
||||
return
|
||||
|
||||
# if everything is ok, execute and register the transaction in the undo/redo stack
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathPocket","Create Pocket"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_Pocket","Create Pocket"))
|
||||
FreeCADGui.addModule("PathScripts.PathPocket")
|
||||
FreeCADGui.doCommand('prjexists = False')
|
||||
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Pocket")')
|
||||
|
|
|
@ -42,15 +42,15 @@ except AttributeError:
|
|||
class CommandPathPost:
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Post',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathPost","Post Process"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Post","Post Process"),
|
||||
'Accel': "P, P",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathPost","Post Process the selected Project")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Post","Post Process the selected Project")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathPost","Post Process the Selected path(s)"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_Post","Post Process the Selected path(s)"))
|
||||
FreeCADGui.addModule("PathScripts.PathPost")
|
||||
#select the PathProject that you want to post output from
|
||||
obj = FreeCADGui.Selection.getSelection()
|
||||
|
|
|
@ -199,9 +199,9 @@ class ViewProviderProfile:
|
|||
class CommandPathProfile:
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Profile',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathProfile","Profile"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Profile","Profile"),
|
||||
'Accel': "P, P",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathProfile","Creates a Path Profile object from selected faces")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Profile","Creates a Path Profile object from selected faces")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
@ -216,7 +216,7 @@ class CommandPathProfile:
|
|||
return
|
||||
|
||||
# if everything is ok, execute and register the transaction in the undo/redo stack
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathProfile","Create Profile"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_Profile","Create Profile"))
|
||||
FreeCADGui.addModule("PathScripts.PathProfile")
|
||||
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Profile")
|
||||
|
|
|
@ -119,9 +119,9 @@ class CommandProject:
|
|||
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Project',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathProject","Project"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Project","Project"),
|
||||
'Accel': "P, P",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathProject","Creates a Path Project object")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Project","Creates a Path Project object")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
@ -132,7 +132,7 @@ class CommandProject:
|
|||
for obj in sel:
|
||||
if obj.isDerivedFrom("Path::Feature"):
|
||||
incl.append(obj)
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathProject","Create Project"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_Project","Create Project"))
|
||||
CommandProject.Create(incl)
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
|
|
@ -110,15 +110,15 @@ class _ViewProviderStop:
|
|||
class CommandPathStop:
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-Stop',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathStop","Stop"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Stop","Stop"),
|
||||
'Accel': "P, C",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathStop","Add Optional or Mandatory Stop to the program")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Stop","Add Optional or Mandatory Stop to the program")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathStop","Add Optional or Mandatory Stop to the program"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_Stop","Add Optional or Mandatory Stop to the program"))
|
||||
FreeCADGui.addModule("PathScripts.PathStop")
|
||||
snippet = '''
|
||||
import Path
|
||||
|
|
|
@ -123,15 +123,15 @@ class _ViewProviderTLO:
|
|||
class CommandPathToolLenOffset:
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-LengthOffset',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathToolLenOffset","Tool Length Offset"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_ToolLenOffset","Tool Length Offset"),
|
||||
'Accel': "P, T",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathToolLenOffset","Create a Tool Length Offset object")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_ToolLenOffset","Create a Tool Length Offset object")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathPlane","Create a Selection Plane object"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_ToolLenOffset","Create a Selection Plane object"))
|
||||
FreeCADGui.addModule("PathScripts.PathToolLenOffset")
|
||||
snippet = '''
|
||||
import Path
|
||||
|
|
|
@ -37,15 +37,15 @@ except AttributeError:
|
|||
class CommandPathToolTableEdit:
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Path-ToolTable',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathToolTableEdit","EditToolTable"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_ToolTableEdit","EditToolTable"),
|
||||
'Accel': "P, T",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathToolTableEdit","Edits a Tool Table in a selected Project")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_ToolTableEdit","Edits a Tool Table in a selected Project")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathToolTableEdit","Edits a Tool Table in a selected Project"))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_ToolTableEdit","Edits a Tool Table in a selected Project"))
|
||||
FreeCADGui.doCommand("from PathScripts import TooltableEditor")
|
||||
FreeCADGui.doCommand("from PathScripts import PathUtils")
|
||||
FreeCADGui.doCommand('machine = PathUtils.findMachine()')
|
||||
|
|
Loading…
Reference in New Issue
Block a user