Path: Fixed translation stuff - issue #2443

This commit is contained in:
Yorik van Havre 2016-02-09 17:05:57 -02:00
parent 0e8974a370
commit 7ff4e28599
23 changed files with 119 additions and 111 deletions

View File

@ -30,31 +30,31 @@
<file>icons/Path-Inspect.svg</file> <file>icons/Path-Inspect.svg</file>
<file>icons/Path-ToolChange.svg</file> <file>icons/Path-ToolChange.svg</file>
<file>icons/Path-SimpleCopy.svg</file> <file>icons/Path-SimpleCopy.svg</file>
<file>translations/Path_de.qm</file> <file>translations/Path_de.qm</file>
<file>translations/Path_af.qm</file> <file>translations/Path_af.qm</file>
<file>translations/Path_zh-CN.qm</file> <file>translations/Path_zh-CN.qm</file>
<file>translations/Path_zh-TW.qm</file> <file>translations/Path_zh-TW.qm</file>
<file>translations/Path_hr.qm</file> <file>translations/Path_hr.qm</file>
<file>translations/Path_cs.qm</file> <file>translations/Path_cs.qm</file>
<file>translations/Path_nl.qm</file> <file>translations/Path_nl.qm</file>
<file>translations/Path_fi.qm</file> <file>translations/Path_fi.qm</file>
<file>translations/Path_fr.qm</file> <file>translations/Path_fr.qm</file>
<file>translations/Path_hu.qm</file> <file>translations/Path_hu.qm</file>
<file>translations/Path_ja.qm</file> <file>translations/Path_ja.qm</file>
<file>translations/Path_no.qm</file> <file>translations/Path_no.qm</file>
<file>translations/Path_pl.qm</file> <file>translations/Path_pl.qm</file>
<file>translations/Path_pt-PT.qm</file> <file>translations/Path_pt-PT.qm</file>
<file>translations/Path_ro.qm</file> <file>translations/Path_ro.qm</file>
<file>translations/Path_ru.qm</file> <file>translations/Path_ru.qm</file>
<file>translations/Path_sr.qm</file> <file>translations/Path_sr.qm</file>
<file>translations/Path_es-ES.qm</file> <file>translations/Path_es-ES.qm</file>
<file>translations/Path_sv-SE.qm</file> <file>translations/Path_sv-SE.qm</file>
<file>translations/Path_uk.qm</file> <file>translations/Path_uk.qm</file>
<file>translations/Path_it.qm</file> <file>translations/Path_it.qm</file>
<file>translations/Path_pt-BR.qm</file> <file>translations/Path_pt-BR.qm</file>
<file>translations/Path_el.qm</file> <file>translations/Path_el.qm</file>
<file>translations/Path_sk.qm</file> <file>translations/Path_sk.qm</file>
<file>translations/Path_tr.qm</file> <file>translations/Path_tr.qm</file>
<file>translations/Path_sl.qm</file> <file>translations/Path_sl.qm</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -61,6 +61,9 @@ class PathWorkbench ( Workbench ):
# load the builtin modules # load the builtin modules
import Path import Path
import PathGui import PathGui
from PySide import QtGui
FreeCADGui.addLanguagePath(":/translations")
FreeCADGui.addIconPath(":/icons")
# load python modules # load python modules
from PathScripts import PathProfile from PathScripts import PathProfile
from PathScripts import PathPocket from PathScripts import PathPocket
@ -98,16 +101,19 @@ class PathWorkbench ( Workbench ):
# Add commands to menu and toolbar # Add commands to menu and toolbar
def QT_TRANSLATE_NOOP(scope, text): return text def QT_TRANSLATE_NOOP(scope, text):
self.appendToolbar(QT_TRANSLATE_NOOP("PathWorkbench","Commands for setting up Project"),projcmdlist) return text
self.appendToolbar(QT_TRANSLATE_NOOP("PathWorkbench","Partial Commands"),prepcmdlist) def translate(context,text):
self.appendToolbar(QT_TRANSLATE_NOOP("PathWorkbench","Operations"),opcmdlist) return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8).encode("utf8")
self.appendToolbar(QT_TRANSLATE_NOOP("PathWorkbench","Commands for grouping,copying, and organizing operations"),modcmdlist) 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([translate("Path","Path"),translate("Path","Project Setup")],projcmdlist)
self.appendMenu([QT_TRANSLATE_NOOP("PathWorkbench","Path"),QT_TRANSLATE_NOOP("Path","Partial Commands")],prepcmdlist) self.appendMenu([translate("Path","Path"),translate("Path","Partial Commands")],prepcmdlist)
self.appendMenu([QT_TRANSLATE_NOOP("PathWorkbench","Path"),QT_TRANSLATE_NOOP("Path","New Operations")],opcmdlist) self.appendMenu([translate("Path","Path"),translate("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","Path Modification")],modcmdlist)
# Add preferences pages # Add preferences pages
import os import os
@ -119,6 +125,8 @@ class PathWorkbench ( Workbench ):
return "Gui::PythonWorkbench" return "Gui::PythonWorkbench"
def Activated(self): def Activated(self):
# update the translation engine
FreeCADGui.updateLocale()
Msg("Path workbench activated\n") Msg("Path workbench activated\n")
def Deactivated(self): def Deactivated(self):

View File

@ -103,8 +103,8 @@ class CommandPathArray:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Array', return {'Pixmap' : 'Path-Array',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathArray","Array"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Array","Array"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathArray","Creates an array from a selected path")} 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Array","Creates an array from a selected path")}
def IsActive(self): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
@ -114,10 +114,10 @@ class CommandPathArray:
# check that the selection contains exactly what we want # check that the selection contains exactly what we want
selection = FreeCADGui.Selection.getSelection() selection = FreeCADGui.Selection.getSelection()
if len(selection) != 1: 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 return
if not(selection[0].isDerivedFrom("Path::Feature")): 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 return
# if everything is ok, execute and register the transaction in the undo/redo stack # if everything is ok, execute and register the transaction in the undo/redo stack

View File

@ -105,15 +105,15 @@ class _ViewProviderComment:
class CommandPathComment: class CommandPathComment:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Comment', return {'Pixmap' : 'Path-Comment',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathComment","Comment"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Comment","Comment"),
'Accel': "P, C", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
def Activated(self): 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") FreeCADGui.addModule("PathScripts.PathComment")
snippet = ''' snippet = '''
import Path import Path

View File

@ -92,16 +92,16 @@ class CommandCompoundExtended:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Compound', return {'Pixmap' : 'Path-Compound',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathCompoundExtended","Compound"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_CompoundExtended","Compound"),
'Accel': "P, C", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
def Activated(self): def Activated(self):
FreeCAD.ActiveDocument.openTransaction(translate("PathCompoundExtended","Create Compound")) FreeCAD.ActiveDocument.openTransaction(translate("Path_CompoundExtended","Create Compound"))
FreeCADGui.addModule("PathScripts.PathCompoundExtended") FreeCADGui.addModule("PathScripts.PathCompoundExtended")
snippet = ''' snippet = '''
import Path import Path

View File

@ -80,16 +80,16 @@ class CommandPathCopy:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Copy', return {'Pixmap' : 'Path-Copy',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathCopy","Copy"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Copy","Copy"),
'Accel': "P, Y", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
def Activated(self): def Activated(self):
FreeCAD.ActiveDocument.openTransaction(translate("PathCopy","Create Copy")) FreeCAD.ActiveDocument.openTransaction(translate("Path_Copy","Create Copy"))
FreeCADGui.addModule("PathScripts.PathCopy") FreeCADGui.addModule("PathScripts.PathCopy")
consolecode = ''' consolecode = '''

View File

@ -95,9 +95,9 @@ class CommandPathDressup:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Dressup', return {'Pixmap' : 'Path-Dressup',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathDressup","Dress-up"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Dressup","Dress-up"),
'Accel': "P, S", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
@ -107,17 +107,17 @@ class CommandPathDressup:
# check that the selection contains exactly what we want # check that the selection contains exactly what we want
selection = FreeCADGui.Selection.getSelection() selection = FreeCADGui.Selection.getSelection()
if len(selection) != 1: 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 return
if not selection[0].isDerivedFrom("Path::Feature"): 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 return
if selection[0].isDerivedFrom("Path::FeatureCompoundPython"): 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 return
# everything ok! # 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.PathDressup")
FreeCADGui.addModule("PathScripts.PathUtils") FreeCADGui.addModule("PathScripts.PathUtils")
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Dressup")') FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Dressup")')

View File

@ -146,9 +146,9 @@ class CommandPathDrilling:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Drilling', return {'Pixmap' : 'Path-Drilling',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathDrilling","Drilling"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Drilling","Drilling"),
'Accel': "P, D", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
@ -164,7 +164,7 @@ class CommandPathDrilling:
if not selection: if not selection:
return return
# if everything is ok, execute and register the transaction in the undo/redo stack # 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") FreeCADGui.addModule("PathScripts.PathDrilling")
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Drilling") obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Drilling")

View File

@ -139,8 +139,8 @@ class CommandPathFacePocket:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-FacePocket', return {'Pixmap' : 'Path-FacePocket',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathFacePocket","Face Pocket"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_FacePocket","Face Pocket"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathFacePocket","Creates a pocket inside a loop of edges or a face")} 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_FacePocket","Creates a pocket inside a loop of edges or a face")}
def IsActive(self): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
@ -150,22 +150,22 @@ class CommandPathFacePocket:
# check that the selection contains exactly what we want # check that the selection contains exactly what we want
selection = FreeCADGui.Selection.getSelectionEx() selection = FreeCADGui.Selection.getSelectionEx()
if len(selection) != 1: 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 return
if len(selection[0].SubObjects) == 0: 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 return
for s in selection[0].SubObjects: for s in selection[0].SubObjects:
if s.ShapeType != "Edge": if s.ShapeType != "Edge":
if (s.ShapeType != "Face") or (len(selection[0].SubObjects) != 1): 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 return
if selection[0].SubObjects[0].ShapeType == "Edge": if selection[0].SubObjects[0].ShapeType == "Edge":
try: try:
import Part import Part
w = Part.Wire(selection[0].SubObjects) w = Part.Wire(selection[0].SubObjects)
except: 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 return
# if everything is ok, execute and register the transaction in the undo/redo stack # if everything is ok, execute and register the transaction in the undo/redo stack

View File

@ -111,8 +111,8 @@ class CommandPathFaceProfile:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-FaceProfile', return {'Pixmap' : 'Path-FaceProfile',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathFaceProfile","Face Profile"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_FaceProfile","Face Profile"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathFaceProfile","Creates a profile object around a selected face")} 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_FaceProfile","Creates a profile object around a selected face")}
def IsActive(self): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
@ -122,13 +122,13 @@ class CommandPathFaceProfile:
# check that the selection contains exactly what we want # check that the selection contains exactly what we want
selection = FreeCADGui.Selection.getSelectionEx() selection = FreeCADGui.Selection.getSelectionEx()
if len(selection) != 1: 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 return
if len(selection[0].SubObjects) != 1: 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 return
if not selection[0].SubObjects[0].ShapeType in ["Face","Wire"]: 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 return
# if everything is ok, execute and register the transaction in the undo/redo stack # if everything is ok, execute and register the transaction in the undo/redo stack

View File

@ -116,15 +116,15 @@ class _ViewProviderFixture:
class CommandPathFixture: class CommandPathFixture:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Datums', return {'Pixmap' : 'Path-Datums',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathFixture","Fixture"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Fixture","Fixture"),
'Accel': "P, F", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
def Activated(self): 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") FreeCADGui.addModule("PathScripts.PathFixture")
snippet = ''' snippet = '''
import Path import Path

View File

@ -101,9 +101,9 @@ class CommandPathHop:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Hop', return {'Pixmap' : 'Path-Hop',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathHop","Hop"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Hop","Hop"),
'Accel': "P, H", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
@ -113,13 +113,13 @@ class CommandPathHop:
# check that the selection contains exactly what we want # check that the selection contains exactly what we want
selection = FreeCADGui.Selection.getSelection() selection = FreeCADGui.Selection.getSelection()
if len(selection) != 1: 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 return
if not selection[0].isDerivedFrom("Path::Feature"): 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 return
FreeCAD.ActiveDocument.openTransaction(translate("PathHop","Create Hop")) FreeCAD.ActiveDocument.openTransaction(translate("Pat_hHop","Create Hop"))
FreeCADGui.addModule("PathScripts.PathHop") FreeCADGui.addModule("PathScripts.PathHop")
FreeCADGui.addModule("PathScripts.PathUtils") FreeCADGui.addModule("PathScripts.PathUtils")
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Hop")') FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Hop")')

View File

@ -175,10 +175,10 @@ class CommandPathInspect:
# check that the selection contains exactly what we want # check that the selection contains exactly what we want
selection = FreeCADGui.Selection.getSelection() selection = FreeCADGui.Selection.getSelection()
if len(selection) != 1: 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 return
if not(selection[0].isDerivedFrom("Path::Feature")): 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 return
# if everything is ok, execute # if everything is ok, execute

View File

@ -173,15 +173,15 @@ class _ViewProviderKurve:
class CommandPathKurve: class CommandPathKurve:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Kurve', return {'Pixmap' : 'Path-Kurve',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathProfile","Profile"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Kurve","Profile"),
'Accel': "P, P", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
def Activated(self): 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") FreeCADGui.addModule("PathScripts.PathKurve")
snippet = ''' snippet = '''
import Path import Path

View File

@ -126,9 +126,9 @@ class _ViewProviderLoadTool:
class CommandPathLoadTool: class CommandPathLoadTool:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-LoadTool', 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", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None

View File

@ -111,15 +111,15 @@ class _ViewProviderPlane:
class CommandPathPlane: class CommandPathPlane:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Plane', return {'Pixmap' : 'Path-Plane',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathPlane","Selection Plane"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Plane","Selection Plane"),
'Accel': "P, P", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
def Activated(self): 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") FreeCADGui.addModule("PathScripts.PathPlane")
snippet = ''' snippet = '''
import Path import Path

View File

@ -262,9 +262,9 @@ class CommandPathPocket:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Pocket', return {'Pixmap' : 'Path-Pocket',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathPocket","Pocket"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Pocket","Pocket"),
'Accel': "P, O", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
@ -274,26 +274,26 @@ class CommandPathPocket:
# check that the selection contains exactly what we want # check that the selection contains exactly what we want
selection = FreeCADGui.Selection.getSelectionEx() selection = FreeCADGui.Selection.getSelectionEx()
if len(selection) != 1: 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 return
if len(selection[0].SubObjects) == 0: 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 return
for s in selection[0].SubObjects: for s in selection[0].SubObjects:
if s.ShapeType != "Edge": if s.ShapeType != "Edge":
if (s.ShapeType != "Face") or (len(selection[0].SubObjects) != 1): 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 return
if selection[0].SubObjects[0].ShapeType == "Edge": if selection[0].SubObjects[0].ShapeType == "Edge":
try: try:
import Part import Part
w = Part.Wire(selection[0].SubObjects) w = Part.Wire(selection[0].SubObjects)
except: 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 return
# if everything is ok, execute and register the transaction in the undo/redo stack # 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.addModule("PathScripts.PathPocket")
FreeCADGui.doCommand('prjexists = False') FreeCADGui.doCommand('prjexists = False')
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Pocket")') FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Pocket")')

View File

@ -42,15 +42,15 @@ except AttributeError:
class CommandPathPost: class CommandPathPost:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Post', return {'Pixmap' : 'Path-Post',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathPost","Post Process"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Post","Post Process"),
'Accel': "P, P", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
def Activated(self): 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") FreeCADGui.addModule("PathScripts.PathPost")
#select the PathProject that you want to post output from #select the PathProject that you want to post output from
obj = FreeCADGui.Selection.getSelection() obj = FreeCADGui.Selection.getSelection()

View File

@ -199,9 +199,9 @@ class ViewProviderProfile:
class CommandPathProfile: class CommandPathProfile:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Profile', return {'Pixmap' : 'Path-Profile',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathProfile","Profile"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Profile","Profile"),
'Accel': "P, P", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
@ -216,7 +216,7 @@ class CommandPathProfile:
return return
# if everything is ok, execute and register the transaction in the undo/redo stack # 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") FreeCADGui.addModule("PathScripts.PathProfile")
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Profile") obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Profile")

View File

@ -119,9 +119,9 @@ class CommandProject:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Project', return {'Pixmap' : 'Path-Project',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathProject","Project"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Project","Project"),
'Accel': "P, P", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
@ -132,7 +132,7 @@ class CommandProject:
for obj in sel: for obj in sel:
if obj.isDerivedFrom("Path::Feature"): if obj.isDerivedFrom("Path::Feature"):
incl.append(obj) incl.append(obj)
FreeCAD.ActiveDocument.openTransaction(translate("PathProject","Create Project")) FreeCAD.ActiveDocument.openTransaction(translate("Path_Project","Create Project"))
CommandProject.Create(incl) CommandProject.Create(incl)
FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute() FreeCAD.ActiveDocument.recompute()

View File

@ -110,15 +110,15 @@ class _ViewProviderStop:
class CommandPathStop: class CommandPathStop:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-Stop', return {'Pixmap' : 'Path-Stop',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathStop","Stop"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Stop","Stop"),
'Accel': "P, C", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
def Activated(self): 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") FreeCADGui.addModule("PathScripts.PathStop")
snippet = ''' snippet = '''
import Path import Path

View File

@ -123,15 +123,15 @@ class _ViewProviderTLO:
class CommandPathToolLenOffset: class CommandPathToolLenOffset:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-LengthOffset', 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", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
def Activated(self): 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") FreeCADGui.addModule("PathScripts.PathToolLenOffset")
snippet = ''' snippet = '''
import Path import Path

View File

@ -37,15 +37,15 @@ except AttributeError:
class CommandPathToolTableEdit: class CommandPathToolTableEdit:
def GetResources(self): def GetResources(self):
return {'Pixmap' : 'Path-ToolTable', return {'Pixmap' : 'Path-ToolTable',
'MenuText': QtCore.QT_TRANSLATE_NOOP("PathToolTableEdit","EditToolTable"), 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_ToolTableEdit","EditToolTable"),
'Accel': "P, T", '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): def IsActive(self):
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
def Activated(self): 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 TooltableEditor")
FreeCADGui.doCommand("from PathScripts import PathUtils") FreeCADGui.doCommand("from PathScripts import PathUtils")
FreeCADGui.doCommand('machine = PathUtils.findMachine()') FreeCADGui.doCommand('machine = PathUtils.findMachine()')