From af699ab7e2dbfff1cb30bdb54353da71f3714da0 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Sat, 3 Jun 2017 12:12:27 -0700 Subject: [PATCH] Replaced default context argument with explicit call for pylupdate to pick up the strings and contexts. --- src/Mod/Path/PathScripts/PathArray.py | 6 ++--- src/Mod/Path/PathScripts/PathComment.py | 4 ++-- .../Path/PathScripts/PathCompoundExtended.py | 5 ++-- src/Mod/Path/PathScripts/PathContour.py | 4 ++-- src/Mod/Path/PathScripts/PathCopy.py | 8 +++---- src/Mod/Path/PathScripts/PathCustom.py | 2 +- src/Mod/Path/PathScripts/PathDressup.py | 10 ++++---- .../Path/PathScripts/PathDressupDogbone.py | 2 +- .../Path/PathScripts/PathDressupDragknife.py | 10 ++++---- .../PathScripts/PathDressupHoldingTags.py | 20 ++++++++-------- src/Mod/Path/PathScripts/PathDrilling.py | 4 ++-- src/Mod/Path/PathScripts/PathEngrave.py | 2 +- src/Mod/Path/PathScripts/PathFacePocket.py | 10 ++++---- src/Mod/Path/PathScripts/PathFaceProfile.py | 8 +++---- src/Mod/Path/PathScripts/PathFixture.py | 4 ++-- src/Mod/Path/PathScripts/PathFromShape.py | 8 +++---- src/Mod/Path/PathScripts/PathHelix.py | 18 ++------------ src/Mod/Path/PathScripts/PathHop.py | 8 +++---- src/Mod/Path/PathScripts/PathInspect.py | 8 +++---- src/Mod/Path/PathScripts/PathJob.py | 10 ++++---- src/Mod/Path/PathScripts/PathLoadTool.py | 4 ++-- src/Mod/Path/PathScripts/PathMillFace.py | 2 +- src/Mod/Path/PathScripts/PathPlane.py | 4 ++-- src/Mod/Path/PathScripts/PathPost.py | 4 ++-- .../PathScripts/PathPreferencesPathDressup.py | 4 ++-- src/Mod/Path/PathScripts/PathSanity.py | 24 +++++++++---------- src/Mod/Path/PathScripts/PathSimpleCopy.py | 8 +++---- src/Mod/Path/PathScripts/PathStock.py | 4 ++-- src/Mod/Path/PathScripts/PathStop.py | 4 ++-- src/Mod/Path/PathScripts/PathSurface.py | 20 ++++++++-------- src/Mod/Path/PathScripts/PathToolLenOffset.py | 4 ++-- .../PathScripts/PathToolLibraryManager.py | 2 +- 32 files changed, 110 insertions(+), 125 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathArray.py b/src/Mod/Path/PathScripts/PathArray.py index 3779858fbe..4819da34f6 100644 --- a/src/Mod/Path/PathScripts/PathArray.py +++ b/src/Mod/Path/PathScripts/PathArray.py @@ -30,7 +30,7 @@ from PySide import QtCore, QtGui """Path Array object and FreeCAD command""" # Qt tanslation handling -def translate(text, context = "Path_Array", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) class ObjectArray: @@ -116,11 +116,11 @@ class CommandPathArray: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: FreeCAD.Console.PrintError( - translate("Please select exactly one path object\n")) + translate("Path_Array", "Please select exactly one path object\n")) return if not(selection[0].isDerivedFrom("Path::Feature")): FreeCAD.Console.PrintError( - translate("Please select exactly one path object\n")) + translate("Path_Array", "Please select exactly one path object\n")) return # if everything is ok, execute and register the transaction in the diff --git a/src/Mod/Path/PathScripts/PathComment.py b/src/Mod/Path/PathScripts/PathComment.py index 1b8490cf0f..83d2ec358e 100644 --- a/src/Mod/Path/PathScripts/PathComment.py +++ b/src/Mod/Path/PathScripts/PathComment.py @@ -29,7 +29,7 @@ import Path from PySide import QtCore, QtGui # Qt tanslation handling -def translate(text, context = "Path_Comment", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) class Comment: @@ -111,7 +111,7 @@ class CommandPathComment: def Activated(self): FreeCAD.ActiveDocument.openTransaction( - translate("Create a Comment in your CNC program")) + translate("Path_Comment", "Create a Comment in your CNC program")) FreeCADGui.addModule("PathScripts.PathComment") snippet = ''' import Path diff --git a/src/Mod/Path/PathScripts/PathCompoundExtended.py b/src/Mod/Path/PathScripts/PathCompoundExtended.py index df14679d12..1bb124bd53 100644 --- a/src/Mod/Path/PathScripts/PathCompoundExtended.py +++ b/src/Mod/Path/PathScripts/PathCompoundExtended.py @@ -30,7 +30,7 @@ from PySide import QtCore, QtGui """Path Compound Extended object and FreeCAD command""" # Qt tanslation handling -def translate(text, context = "Path_CompoundExtended", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) class ObjectCompoundExtended: @@ -106,8 +106,7 @@ class CommandCompoundExtended: def Activated(self): - FreeCAD.ActiveDocument.openTransaction( - translate("Create Compound")) + FreeCAD.ActiveDocument.openTransaction(translate("Path_CompoundExtended", "Create Compound")) FreeCADGui.addModule("PathScripts.PathCompoundExtended") snippet = ''' import Path diff --git a/src/Mod/Path/PathScripts/PathContour.py b/src/Mod/Path/PathScripts/PathContour.py index 7a498c7e7f..2a3b64a1cd 100644 --- a/src/Mod/Path/PathScripts/PathContour.py +++ b/src/Mod/Path/PathScripts/PathContour.py @@ -43,7 +43,7 @@ if FreeCAD.GuiUp: from PySide import QtGui # Qt tanslation handling -def translate(text, context = "Path", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) __title__ = "Path Contour Operation" @@ -310,7 +310,7 @@ class CommandPathContour: ztop = 10.0 zbottom = 0.0 - FreeCAD.ActiveDocument.openTransaction(translate("Create a Contour")) + FreeCAD.ActiveDocument.openTransaction(translate("Path", "Create a Contour")) FreeCADGui.addModule("PathScripts.PathContour") FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "Contour")') FreeCADGui.doCommand('PathScripts.PathContour.ObjectContour(obj)') diff --git a/src/Mod/Path/PathScripts/PathCopy.py b/src/Mod/Path/PathScripts/PathCopy.py index 303b2477c5..2678c7135f 100644 --- a/src/Mod/Path/PathScripts/PathCopy.py +++ b/src/Mod/Path/PathScripts/PathCopy.py @@ -29,7 +29,7 @@ from PySide import QtCore, QtGui """Path Copy object and FreeCAD command""" # Qt tanslation handling -def translate(text, context = "Path_Copy", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -88,7 +88,7 @@ class CommandPathCopy: def Activated(self): FreeCAD.ActiveDocument.openTransaction( - translate("Create Copy")) + translate("Path_Copy", "Create Copy")) FreeCADGui.addModule("PathScripts.PathCopy") consolecode = ''' @@ -101,11 +101,11 @@ selection = FreeCADGui.Selection.getSelection() proj = selection[0].InList[0] #get the group that the selectied object is inside if len(selection) != 1: - FreeCAD.Console.PrintError(translate("Please select one path object\\n")) + FreeCAD.Console.PrintError(translate("Path_Copy", "Please select one path object\\n")) selGood = False if not selection[0].isDerivedFrom("Path::Feature"): - FreeCAD.Console.PrintError(translate("The selected object is not a path\\n")) + FreeCAD.Console.PrintError(translate("Path_Copy", "The selected object is not a path\\n")) selGood = False if selGood: diff --git a/src/Mod/Path/PathScripts/PathCustom.py b/src/Mod/Path/PathScripts/PathCustom.py index 31f6e7f4b7..f66ca4f20a 100644 --- a/src/Mod/Path/PathScripts/PathCustom.py +++ b/src/Mod/Path/PathScripts/PathCustom.py @@ -29,7 +29,7 @@ from PySide import QtCore, QtGui """Path Custom object and FreeCAD command""" # Qt tanslation handling -def translate(text, context = "Path_Custom", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) diff --git a/src/Mod/Path/PathScripts/PathDressup.py b/src/Mod/Path/PathScripts/PathDressup.py index fd0520c90e..ca670b71f2 100644 --- a/src/Mod/Path/PathScripts/PathDressup.py +++ b/src/Mod/Path/PathScripts/PathDressup.py @@ -31,7 +31,7 @@ from PySide import QtCore, QtGui """Path Dressup object and FreeCAD command""" # Qt tanslation handling -def translate(text, context = "Path_Dressup", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) class ObjectDressup: @@ -117,17 +117,17 @@ class CommandPathDressup: # check that the selection contains exactly what we want selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: - FreeCAD.Console.PrintError(translate("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("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("Please select a Path object")) + FreeCAD.Console.PrintError(translate("Path_Dressup", "Please select a Path object")) return # everything ok! - FreeCAD.ActiveDocument.openTransaction(translate("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")') diff --git a/src/Mod/Path/PathScripts/PathDressupDogbone.py b/src/Mod/Path/PathScripts/PathDressupDogbone.py index 28a54c7147..1cc3068f40 100644 --- a/src/Mod/Path/PathScripts/PathDressupDogbone.py +++ b/src/Mod/Path/PathScripts/PathDressupDogbone.py @@ -40,7 +40,7 @@ LOG_MODULE = 'PathDressupDogbone' #PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE) # Qt tanslation handling -def translate(text, context = "PathDressup_Dogbone", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) movecommands = ['G0', 'G00', 'G1', 'G01', 'G2', 'G02', 'G3', 'G03'] diff --git a/src/Mod/Path/PathScripts/PathDressupDragknife.py b/src/Mod/Path/PathScripts/PathDressupDragknife.py index 0613e18ffb..85b73b5eb6 100644 --- a/src/Mod/Path/PathScripts/PathDressupDragknife.py +++ b/src/Mod/Path/PathScripts/PathDressupDragknife.py @@ -35,7 +35,7 @@ import PathScripts.PathUtils as P """Dragknife Dressup object and FreeCAD command""" # Qt tanslation handling -def translate(text, context = "PathDressup_DragKnife", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) movecommands = ['G1', 'G01', 'G2', 'G02', 'G3', 'G03'] @@ -482,19 +482,19 @@ class CommandDressupDragknife: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: FreeCAD.Console.PrintError( - translate("Please select one path object\n")) + translate("PathDressup_DragKnife", "Please select one path object\n")) return if not selection[0].isDerivedFrom("Path::Feature"): FreeCAD.Console.PrintError( - translate("The selected object is not a path\n")) + translate("PathDressup_DragKnife", "The selected object is not a path\n")) return if selection[0].isDerivedFrom("Path::FeatureCompoundPython"): FreeCAD.Console.PrintError( - translate("Please select a Path object")) + translate("PathDressup_DragKnife", "Please select a Path object")) return # everything ok! - FreeCAD.ActiveDocument.openTransaction(translate("Create Dress-up")) + FreeCAD.ActiveDocument.openTransaction(translate("PathDressup_DragKnife", "Create Dress-up")) FreeCADGui.addModule("PathScripts.PathDressupDragknife") FreeCADGui.addModule("PathScripts.PathUtils") FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","DragknifeDressup")') diff --git a/src/Mod/Path/PathScripts/PathDressupHoldingTags.py b/src/Mod/Path/PathScripts/PathDressupHoldingTags.py index acf4ff8fea..8aa1f82b88 100644 --- a/src/Mod/Path/PathScripts/PathDressupHoldingTags.py +++ b/src/Mod/Path/PathScripts/PathDressupHoldingTags.py @@ -40,7 +40,7 @@ from PySide import QtCore """Holding Tags Dressup object and FreeCAD command""" # Qt tanslation handling -def translate(text, context = "PathDressup_HoldingTags", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -136,7 +136,7 @@ class HoldingTagsPreferences: def __init__(self): self.form = FreeCADGui.PySideUic.loadUi(":/preferences/PathDressupHoldingTags.ui") - self.label = translate('Holding Tags') + self.label = translate("PathDressup_HoldingTags", 'Holding Tags') def loadSettings(self): self.form.ifWidth.setText(FreeCAD.Units.Quantity(self.defaultWidth(0), FreeCAD.Units.Length).UserString) @@ -939,7 +939,7 @@ class ObjectDressup: try: pathData = PathData(obj) except ValueError: - PathLog.error(translate("Cannot insert holding tags for this path - please select a Profile path\n")) + PathLog.error(translate("PathDressup_HoldingTags", "Cannot insert holding tags for this path - please select a Profile path\n")) return None self.toolRadius = 5 @@ -954,7 +954,7 @@ class ObjectDressup: # self.toolRadius = tool.Diameter / 2 toolLoad = obj.ToolController if toolLoad is None or toolLoad.ToolNumber == 0: - PathLog.error(translate("No Tool Controller is selected. We need a tool to build a Path\n")) + PathLog.error(translate("PathDressup_HoldingTags", "No Tool Controller is selected. We need a tool to build a Path\n")) #return else: # self.vertFeed = toolLoad.VertFeed.Value @@ -963,7 +963,7 @@ class ObjectDressup: # self.horizRapid = toolLoad.HorizRapid.Value tool = toolLoad.Proxy.getTool(toolLoad) if not tool or tool.Diameter == 0: - PathLog.error(translate("No Tool found or diameter is zero. We need a tool to build a Path.\n")) + PathLog.error(translate("PathDressup_HoldingTags", "No Tool found or diameter is zero. We need a tool to build a Path.\n")) return else: self.toolRadius = tool.Diameter/2 @@ -1027,7 +1027,7 @@ class TaskPanel: self.formPoint.hide() self.jvo = PathUtils.findParentJob(obj).ViewObject if jvoVisibility is None: - FreeCAD.ActiveDocument.openTransaction(translate("Edit HoldingTags Dress-up")) + FreeCAD.ActiveDocument.openTransaction(translate("PathDressup_HoldingTags", "Edit HoldingTags Dress-up")) self.jvoVisible = self.jvo.isVisible() if self.jvoVisible: self.jvo.hide() @@ -1442,18 +1442,18 @@ class CommandPathDressupHoldingTags: # check that the selection contains exactly what we want selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: - PathLog.error(translate("Please select one path object\n")) + PathLog.error(translate("PathDressup_HoldingTags", "Please select one path object\n")) return baseObject = selection[0] if not baseObject.isDerivedFrom("Path::Feature"): - PathLog.error(translate("The selected object is not a path\n")) + PathLog.error(translate("PathDressup_HoldingTags", "The selected object is not a path\n")) return if baseObject.isDerivedFrom("Path::FeatureCompoundPython"): - PathLog.error(translate("Please select a Profile object")) + PathLog.error(translate("PathDressup_HoldingTags", "Please select a Profile object")) return # everything ok! - FreeCAD.ActiveDocument.openTransaction(translate("Create HoldingTags Dress-up")) + FreeCAD.ActiveDocument.openTransaction(translate("PathDressup_HoldingTags", "Create HoldingTags Dress-up")) FreeCADGui.addModule("PathScripts.PathDressupHoldingTags") FreeCADGui.addModule("PathScripts.PathUtils") FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "HoldingTagsDressup")') diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index 1c8d36bd6b..9648b23862 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -48,7 +48,7 @@ if FreeCAD.GuiUp: """Path Drilling object and FreeCAD command""" # Qt tanslation handling -def translate(text, context = "Path_Drilling", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -320,7 +320,7 @@ class CommandPathDrilling: def Activated(self): # if everything is ok, execute and register the transaction in the undo/redo stack - FreeCAD.ActiveDocument.openTransaction(translate("Create Drilling")) + FreeCAD.ActiveDocument.openTransaction(translate("Path_Drilling", "Create Drilling")) FreeCADGui.addModule("PathScripts.PathDrilling") FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "Drilling")') FreeCADGui.doCommand('PathScripts.PathDrilling.ObjectDrilling(obj)') diff --git a/src/Mod/Path/PathScripts/PathEngrave.py b/src/Mod/Path/PathScripts/PathEngrave.py index 483b2e34c0..d0d3fac146 100644 --- a/src/Mod/Path/PathScripts/PathEngrave.py +++ b/src/Mod/Path/PathScripts/PathEngrave.py @@ -40,7 +40,7 @@ PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE) # PathLog.trackModule('PathEngrave') # Qt tanslation handling -def translate(text, context = "Path_Engrave", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) class ObjectPathEngrave: diff --git a/src/Mod/Path/PathScripts/PathFacePocket.py b/src/Mod/Path/PathScripts/PathFacePocket.py index 4d303a6c8b..f813c2d069 100644 --- a/src/Mod/Path/PathScripts/PathFacePocket.py +++ b/src/Mod/Path/PathScripts/PathFacePocket.py @@ -29,7 +29,7 @@ from PySide import QtCore, QtGui """Path Pocket object and FreeCAD command""" # Qt tanslation handling -def translate(text, context = "Path_FacePocket", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -156,22 +156,22 @@ class CommandPathFacePocket: # check that the selection contains exactly what we want selection = FreeCADGui.Selection.getSelectionEx() if len(selection) != 1: - FreeCAD.Console.PrintError(translate("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("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("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("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 diff --git a/src/Mod/Path/PathScripts/PathFaceProfile.py b/src/Mod/Path/PathScripts/PathFaceProfile.py index 3cf226cf20..afb3def343 100644 --- a/src/Mod/Path/PathScripts/PathFaceProfile.py +++ b/src/Mod/Path/PathScripts/PathFaceProfile.py @@ -29,7 +29,7 @@ from PySide import QtCore, QtGui """Path Profile object and FreeCAD command""" # Qt tanslation handling -def translate(text, context = "Path_FaceProfile", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -123,13 +123,13 @@ class CommandPathFaceProfile: # check that the selection contains exactly what we want selection = FreeCADGui.Selection.getSelectionEx() if len(selection) != 1: - FreeCAD.Console.PrintError(translate("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("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("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 diff --git a/src/Mod/Path/PathScripts/PathFixture.py b/src/Mod/Path/PathScripts/PathFixture.py index d22cdb7fb2..aecad15dd2 100644 --- a/src/Mod/Path/PathScripts/PathFixture.py +++ b/src/Mod/Path/PathScripts/PathFixture.py @@ -28,7 +28,7 @@ import Path from PySide import QtCore, QtGui # Qt tanslation handling -def translate(text, context = "Path_Fixture", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) class Fixture: @@ -123,7 +123,7 @@ class CommandPathFixture: return False def Activated(self): - FreeCAD.ActiveDocument.openTransaction(translate("Create a Fixture Offset")) + FreeCAD.ActiveDocument.openTransaction(translate("Path_Fixture", "Create a Fixture Offset")) FreeCADGui.addModule("PathScripts.PathFixture") snippet = ''' import Path diff --git a/src/Mod/Path/PathScripts/PathFromShape.py b/src/Mod/Path/PathScripts/PathFromShape.py index e4e72925ab..2e4f1fad98 100644 --- a/src/Mod/Path/PathScripts/PathFromShape.py +++ b/src/Mod/Path/PathScripts/PathFromShape.py @@ -27,7 +27,7 @@ import FreeCADGui from PySide import QtCore, QtGui # Qt tanslation handling -def translate(text, context = "Path_FromShape", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) # TODO make the shape parametric @@ -84,15 +84,15 @@ class CommandFromShape: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: FreeCAD.Console.PrintError( - translate("Please select exactly one Part-based object\n")) + translate("Path_FromShape", "Please select exactly one Part-based object\n")) return if not(selection[0].isDerivedFrom("Part::Feature")): FreeCAD.Console.PrintError( - translate("Please select exactly one Part-based object\n")) + translate("Path_FromShape", "Please select exactly one Part-based object\n")) return FreeCAD.ActiveDocument.openTransaction( - translate("Create path from shape")) + translate("Path_FromShape", "Create path from shape")) FreeCADGui.addModule("PathScripts.PathUtils") FreeCADGui.doCommand( "obj = FreeCAD.activeDocument().addObject('Path::FeatureShape','PathShape')") diff --git a/src/Mod/Path/PathScripts/PathHelix.py b/src/Mod/Path/PathScripts/PathHelix.py index fec64f78f9..3716521e7e 100644 --- a/src/Mod/Path/PathScripts/PathHelix.py +++ b/src/Mod/Path/PathScripts/PathHelix.py @@ -34,22 +34,8 @@ if FreeCAD.GuiUp: """Helix Drill object and FreeCAD command""" -if FreeCAD.GuiUp: - try: - _encoding = QtGui.QApplication.UnicodeUTF8 - - def translate(context, text, disambig=None): - return QtGui.QApplication.translate(context, text, disambig, - _encoding) - - except AttributeError: - - def translate(context, text, disambig=None): - return QtGui.QApplication.translate(context, text, disambig) -else: - def translate(context, text, disambig=None): - return text - +def translate(context, text, disambig=None): + return QtCore.QCoreApplication.translate(context, text, disambig) def z_cylinder(cyl): """ Test if cylinder is aligned to z-Axis""" diff --git a/src/Mod/Path/PathScripts/PathHop.py b/src/Mod/Path/PathScripts/PathHop.py index 04211ed645..3c9dec0b9f 100644 --- a/src/Mod/Path/PathScripts/PathHop.py +++ b/src/Mod/Path/PathScripts/PathHop.py @@ -30,7 +30,7 @@ from PySide import QtCore, QtGui """Path Hop object and FreeCAD command""" # Qt tanslation handling -def translate(text, context = "Path_Hop", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) class ObjectHop: @@ -110,15 +110,15 @@ class CommandPathHop: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: FreeCAD.Console.PrintError( - translate("Please select one path object\n")) + translate("Path_Hop", "Please select one path object\n")) return if not selection[0].isDerivedFrom("Path::Feature"): FreeCAD.Console.PrintError( - translate("The selected object is not a path\n")) + translate("Path_Hop", "The selected object is not a path\n")) return FreeCAD.ActiveDocument.openTransaction( - translate("Create Hop")) + translate("Path_Hop", "Create Hop")) FreeCADGui.addModule("PathScripts.PathHop") FreeCADGui.addModule("PathScripts.PathUtils") FreeCADGui.doCommand( diff --git a/src/Mod/Path/PathScripts/PathInspect.py b/src/Mod/Path/PathScripts/PathInspect.py index 95f2172aa2..2b5727c81e 100644 --- a/src/Mod/Path/PathScripts/PathInspect.py +++ b/src/Mod/Path/PathScripts/PathInspect.py @@ -28,7 +28,7 @@ import FreeCADGui import Path # Qt tanslation handling -def translate(text, context = "Path_Inspect", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) # class OldHighlighter(QtGui.QSyntaxHighlighter): @@ -132,7 +132,7 @@ class GCodeEditorDialog(QtGui.QDialog): # Note lab = QtGui.QLabel() - lab.setText(translate("Note: Pressing OK will commit any change you make above to the object, but if the object is parametric, these changes will be overridden on recompute.")) + lab.setText(translate("Path_Inspect", "Note: Pressing OK will commit any change you make above to the object, but if the object is parametric, these changes will be overridden on recompute.")) lab.setWordWrap(True) layout.addWidget(lab) @@ -230,11 +230,11 @@ class CommandPathInspect: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: FreeCAD.Console.PrintError( - translate("Please select exactly one path object\n")) + translate("Path_Inspect", "Please select exactly one path object\n")) return if not(selection[0].isDerivedFrom("Path::Feature")): FreeCAD.Console.PrintError( - translate("Please select exactly one path object\n")) + translate("Path_Inspect", "Please select exactly one path object\n")) return # if everything is ok, execute diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index f5c6bbc64b..1f84f559ed 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -46,7 +46,7 @@ if FreeCAD.GuiUp: """Path Job object and FreeCAD command""" # Qt tanslation handling -def translate(text, context = "Path_Job", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) class ObjectPathJob: @@ -176,7 +176,7 @@ class CommandJob: @staticmethod def Create(): - FreeCAD.ActiveDocument.openTransaction(translate("Create Job")) + FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Create Job")) FreeCADGui.addModule('PathScripts.PathUtils') FreeCADGui.addModule('PathScripts.PathLoadTool') snippet = ''' @@ -193,7 +193,7 @@ obj.ViewObject.startEditing() class TaskPanel: def __init__(self, obj, deleteOnReject): - FreeCAD.ActiveDocument.openTransaction(translate("Edit Job")) + FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Edit Job")) self.obj = obj self.deleteOnReject = deleteOnReject self.form = FreeCADGui.PySideUic.loadUi(":/panels/JobEdit.ui") @@ -227,7 +227,7 @@ class TaskPanel: FreeCADGui.Control.closeDialog() FreeCAD.ActiveDocument.abortTransaction() if self.deleteOnReject: - FreeCAD.ActiveDocument.openTransaction(translate("Uncreate Job")) + FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Uncreate Job")) for child in self.obj.Group: FreeCAD.ActiveDocument.removeObject(child.Name) FreeCAD.ActiveDocument.removeObject(self.obj.Name) @@ -309,7 +309,7 @@ class TaskPanel: pass def setFile(self): - filename = QtGui.QFileDialog.getSaveFileName(self.form, translate("Select Output File"), None, translate("All Files (*.*)")) + filename = QtGui.QFileDialog.getSaveFileName(self.form, translate("Path_Job", "Select Output File"), None, translate("Path_Job", "All Files (*.*)")) if filename and filename[0]: self.obj.PostProcessorOutputFile = str(filename[0]) self.setFields() diff --git a/src/Mod/Path/PathScripts/PathLoadTool.py b/src/Mod/Path/PathScripts/PathLoadTool.py index 0ac08aa11f..5b780738c5 100644 --- a/src/Mod/Path/PathScripts/PathLoadTool.py +++ b/src/Mod/Path/PathScripts/PathLoadTool.py @@ -38,7 +38,7 @@ PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE) #PathLog.trackModule('PathLoadTool') # Qt tanslation handling -def translate(text, context = "Path_LoadTool", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -178,7 +178,7 @@ class CommandPathLoadTool: PathLog.track() self.Create() -# FreeCAD.ActiveDocument.openTransaction(translate("Create Tool Controller Object")) +# FreeCAD.ActiveDocument.openTransaction(translate("Path_LoadTool", "Create Tool Controller Object")) # obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "TC") # PathScripts.PathLoadTool.LoadTool(obj) diff --git a/src/Mod/Path/PathScripts/PathMillFace.py b/src/Mod/Path/PathScripts/PathMillFace.py index 98a2a17f8c..82ec975a2b 100644 --- a/src/Mod/Path/PathScripts/PathMillFace.py +++ b/src/Mod/Path/PathScripts/PathMillFace.py @@ -274,7 +274,7 @@ class ObjectFace: commandlist.extend(self._buildPathArea(obj, env).Commands) except Exception as e: print(e) - FreeCAD.Console.PrintWarning(translate("PathMillFace", "The selected settings did not produce a valid path.\n")) + FreeCAD.Console.PrintWarning(translate("Path_MillFace", "The selected settings did not produce a valid path.\n")) if obj.Active: path = Path.Path(commandlist) diff --git a/src/Mod/Path/PathScripts/PathPlane.py b/src/Mod/Path/PathScripts/PathPlane.py index 36fa4ef60d..c7ebb179ce 100644 --- a/src/Mod/Path/PathScripts/PathPlane.py +++ b/src/Mod/Path/PathScripts/PathPlane.py @@ -29,7 +29,7 @@ import Path from PySide import QtCore, QtGui # Qt tanslation handling -def translate(text, context = "Path_Plane", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -120,7 +120,7 @@ class CommandPathPlane: def Activated(self): FreeCAD.ActiveDocument.openTransaction( - translate("Create a Selection Plane object")) + translate("Path_Plane", "Create a Selection Plane object")) FreeCADGui.addModule("PathScripts.PathPlane") snippet = ''' import Path diff --git a/src/Mod/Path/PathScripts/PathPost.py b/src/Mod/Path/PathScripts/PathPost.py index 4c64611f70..7baee76357 100644 --- a/src/Mod/Path/PathScripts/PathPost.py +++ b/src/Mod/Path/PathScripts/PathPost.py @@ -44,7 +44,7 @@ PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE) PathLog.trackModule(LOG_MODULE) # Qt tanslation handling -def translate(text, context = "Path_Post", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) class DlgSelectPostProcessor: @@ -196,7 +196,7 @@ class CommandPathPost: def Activated(self): PathLog.track() FreeCAD.ActiveDocument.openTransaction( - translate("Post Process the Selected path(s)")) + translate("Path_Post", "Post Process the Selected path(s)")) FreeCADGui.addModule("PathScripts.PathPost") # Attempt to figure out what the user wants to post-process diff --git a/src/Mod/Path/PathScripts/PathPreferencesPathDressup.py b/src/Mod/Path/PathScripts/PathPreferencesPathDressup.py index 56b6306f6e..7f87cdfac2 100644 --- a/src/Mod/Path/PathScripts/PathPreferencesPathDressup.py +++ b/src/Mod/Path/PathScripts/PathPreferencesPathDressup.py @@ -28,7 +28,7 @@ from PySide import QtCore, QtGui from PathScripts.PathPreferences import PathPreferences # Qt tanslation handling -def translate(text, context = "Path_PreferencesPathDressup", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) _dressups = [] @@ -39,7 +39,7 @@ def RegisterDressup(dressup): class DressupPreferencesPage: def __init__(self, parent=None): self.form = QtGui.QToolBox() - self.form.setWindowTitle(translate('Dressups')) + self.form.setWindowTitle(translate("Path_PreferencesPathDressup", 'Dressups')) pages = [] for dressup in _dressups: page = dressup.preferencesPage() diff --git a/src/Mod/Path/PathScripts/PathSanity.py b/src/Mod/Path/PathScripts/PathSanity.py index 1c9b84c33c..1263653362 100644 --- a/src/Mod/Path/PathScripts/PathSanity.py +++ b/src/Mod/Path/PathScripts/PathSanity.py @@ -32,7 +32,7 @@ import FreeCADGui import PathScripts.PathUtils as PU # Qt tanslation handling -def translate(text, context = "Path_Sanity", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -41,31 +41,31 @@ def review(obj): toolcontrolcount = 0 if len(obj.Tooltable.Tools) == 0: - FreeCAD.Console.PrintWarning(translate("Machine: " + str(obj.Label) + " has no tools defined in the tool table\n")) + FreeCAD.Console.PrintWarning(translate("Path_Sanity", "Machine: " + str(obj.Label) + " has no tools defined in the tool table\n")) if obj.X_Max == obj.X_Min or obj.Y_Max == obj.Y_Min: - FreeCAD.Console.PrintWarning(translate("It appears the machine limits haven't been set. Not able to check path extents.\n")) + FreeCAD.Console.PrintWarning(translate("Path_Sanity", "It appears the machine limits haven't been set. Not able to check path extents.\n")) for item in obj.Group: print("Checking: " + item.Label) if item.Name[:2] == "TC": toolcontrolcount += 1 if item.ToolNumber == 0: - FreeCAD.Console.PrintWarning(translate("Tool Controller: " + str(item.Label) + " is using ID 0 which the undefined default. Please set a real tool.\n")) + FreeCAD.Console.PrintWarning(translate("Path_Sanity", "Tool Controller: " + str(item.Label) + " is using ID 0 which the undefined default. Please set a real tool.\n")) else: tool = PU.getTool(item, item.ToolNumber) if tool is None: - FreeCAD.Console.PrintError(translate("Tool Controller: " + str(item.Label) + " is using tool: " + str(item.ToolNumber) + " which is invalid\n")) + FreeCAD.Console.PrintError(translate("Path_Sanity", "Tool Controller: " + str(item.Label) + " is using tool: " + str(item.ToolNumber) + " which is invalid\n")) elif tool.Diameter == 0: - FreeCAD.Console.PrintError(translate("Tool Controller: " + str(item.Label) + " is using tool: " + str(item.ToolNumber) + " which has a zero diameter\n")) + FreeCAD.Console.PrintError(translate("Path_Sanity", "Tool Controller: " + str(item.Label) + " is using tool: " + str(item.ToolNumber) + " which has a zero diameter\n")) if item.HorizFeed == 0: - FreeCAD.Console.PrintWarning(translate("Tool Controller: " + str(item.Label) + " has a 0 value for the Horizontal feed rate\n")) + FreeCAD.Console.PrintWarning(translate("Path_Sanity", "Tool Controller: " + str(item.Label) + " has a 0 value for the Horizontal feed rate\n")) if item.VertFeed == 0: - FreeCAD.Console.PrintWarning(translate("Tool Controller: " + str(item.Label) + " has a 0 value for the Vertical feed rate\n")) + FreeCAD.Console.PrintWarning(translate("Path_Sanity", "Tool Controller: " + str(item.Label) + " has a 0 value for the Vertical feed rate\n")) if item.SpindleSpeed == 0: - FreeCAD.Console.PrintWarning(translate("Tool Controller: " + str(item.Label) + " has a 0 value for the spindle speed\n")) + FreeCAD.Console.PrintWarning(translate("Path_Sanity", "Tool Controller: " + str(item.Label) + " has a 0 value for the spindle speed\n")) if toolcontrolcount == 0: - FreeCAD.Console.PrintWarning(translate("A Tool Controller was not found. Default values are used which is dangerous. Please add a Tool Controller.\n")) + FreeCAD.Console.PrintWarning(translate("Path_Sanity", "A Tool Controller was not found. Default values are used which is dangerous. Please add a Tool Controller.\n")) class CommandPathSanity: @@ -86,10 +86,10 @@ class CommandPathSanity: # check that the selection contains exactly what we want selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: - FreeCAD.Console.PrintError(translate("Please select a path Project to check\n")) + FreeCAD.Console.PrintError(translate("Path_Sanity", "Please select a path Project to check\n")) return if not(selection[0].TypeId == "Path::FeatureCompoundPython"): - FreeCAD.Console.PrintError(translate("Please select a path project to check\n")) + FreeCAD.Console.PrintError(translate("Path_Sanity", "Please select a path project to check\n")) return # if everything is ok, execute diff --git a/src/Mod/Path/PathScripts/PathSimpleCopy.py b/src/Mod/Path/PathScripts/PathSimpleCopy.py index 701bc0c818..8b9aabf980 100644 --- a/src/Mod/Path/PathScripts/PathSimpleCopy.py +++ b/src/Mod/Path/PathScripts/PathSimpleCopy.py @@ -28,7 +28,7 @@ from PySide import QtCore, QtGui """Path SimpleCopy command""" # Qt tanslation handling -def translate(text, context = "Path_SimpleCopy", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) class CommandPathSimpleCopy: @@ -51,15 +51,15 @@ class CommandPathSimpleCopy: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: FreeCAD.Console.PrintError( - translate("Please select exactly one path object\n")) + translate("Path_SimpleCopy", "Please select exactly one path object\n")) return if not(selection[0].isDerivedFrom("Path::Feature")): FreeCAD.Console.PrintError( - translate("Please select exactly one path object\n")) + translate("Path_SimpleCopy", "Please select exactly one path object\n")) return FreeCAD.ActiveDocument.openTransaction( - translate("Simple Copy")) + translate("Path_SimpleCopy", "Simple Copy")) FreeCADGui.addModule("PathScripts.PathUtils") FreeCADGui.doCommand( 'obj = FreeCAD.ActiveDocument.addObject("Path::Feature","' + selection[0].Name + '_copy")') diff --git a/src/Mod/Path/PathScripts/PathStock.py b/src/Mod/Path/PathScripts/PathStock.py index c8301e112c..27a7b495c1 100644 --- a/src/Mod/Path/PathScripts/PathStock.py +++ b/src/Mod/Path/PathScripts/PathStock.py @@ -29,7 +29,7 @@ from PySide import QtCore, QtGui import Part # Qt tanslation handling -def translate(text, context = "Path_Stock", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -100,7 +100,7 @@ class CommandPathStock: return FreeCAD.ActiveDocument is not None def Activated(self): - FreeCAD.ActiveDocument.openTransaction(translate("Creates a 3D object to represent raw stock to mill the part out of")) + FreeCAD.ActiveDocument.openTransaction(translate("Path_Stock", "Creates a 3D object to represent raw stock to mill the part out of")) FreeCADGui.addModule("PathScripts.PathStock") snippet = ''' import FreeCADGui diff --git a/src/Mod/Path/PathScripts/PathStop.py b/src/Mod/Path/PathScripts/PathStop.py index 72132f7f01..d2365ee4f4 100644 --- a/src/Mod/Path/PathScripts/PathStop.py +++ b/src/Mod/Path/PathScripts/PathStop.py @@ -28,7 +28,7 @@ import Path from PySide import QtCore, QtGui # Qt tanslation handling -def translate(text, context = "Path_Stop", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) class Stop: @@ -116,7 +116,7 @@ class CommandPathStop: def Activated(self): FreeCAD.ActiveDocument.openTransaction( - translate("Add Optional or Mandatory Stop to the program")) + translate("Path_Stop", "Add Optional or Mandatory Stop to the program")) FreeCADGui.addModule("PathScripts.PathStop") snippet = ''' import Path diff --git a/src/Mod/Path/PathScripts/PathSurface.py b/src/Mod/Path/PathScripts/PathSurface.py index d1b174944a..e2a5d7e498 100644 --- a/src/Mod/Path/PathScripts/PathSurface.py +++ b/src/Mod/Path/PathScripts/PathSurface.py @@ -49,7 +49,7 @@ __url__ = "http://www.freecadweb.org" """Path surface object and FreeCAD command""" # Qt tanslation handling -def translate(text, context = "Path_Surface", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) class ObjectSurface: @@ -259,7 +259,7 @@ class ObjectSurface: def execute(self, obj): import MeshPart FreeCAD.Console.PrintWarning( - translate("Hold on. This might take a minute.\n")) + translate("Path_Surface", "Hold on. This might take a minute.\n")) output = "" if obj.Comment != "": output += '(' + str(obj.Comment)+')\n' @@ -297,8 +297,8 @@ class ObjectSurface: try: import ocl except: - FreeCAD.Console.PrintError(translate( - "This operation requires OpenCamLib to be installed.\n")) + FreeCAD.Console.PrintError( + translate("Path_Surface", "This operation requires OpenCamLib to be installed.\n")) return if mesh.TypeId.startswith('Mesh'): @@ -397,7 +397,7 @@ class CommandPathSurfacing: zbottom = 0 FreeCAD.ActiveDocument.openTransaction( - translate("Create Surface")) + translate("Path_Surface", "Create Surface")) FreeCADGui.addModule("PathScripts.PathSurface") FreeCADGui.doCommand( 'obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Surface")') @@ -508,13 +508,13 @@ class TaskPanel: # check that the selection contains exactly what we want selection = FreeCADGui.Selection.getSelectionEx() if len(selection) != 1: - FreeCAD.Console.PrintError(translate( - "Please select a single solid object from the project tree\n")) + FreeCAD.Console.PrintError( + translate("Path_Surface", "Please select a single solid object from the project tree\n")) return if not len(selection[0].SubObjects) == 0: - FreeCAD.Console.PrintError(translate( - "Please select a single solid object from the project tree\n")) + FreeCAD.Console.PrintError( + translate("Path_Surface", "Please select a single solid object from the project tree\n")) return sel = selection[0].Object @@ -531,7 +531,7 @@ class TaskPanel: else: FreeCAD.Console.PrintError( - translate("Cannot work with this object\n")) + translate("Path_Surface", "Cannot work with this object\n")) return self.obj.Proxy.addsurfacebase(self.obj, sel) diff --git a/src/Mod/Path/PathScripts/PathToolLenOffset.py b/src/Mod/Path/PathScripts/PathToolLenOffset.py index 17f6261e72..0f7ea6d090 100644 --- a/src/Mod/Path/PathScripts/PathToolLenOffset.py +++ b/src/Mod/Path/PathScripts/PathToolLenOffset.py @@ -29,7 +29,7 @@ from PathScripts import PathUtils from PySide import QtCore, QtGui # Qt tanslation handling -def translate(text, context = "Path_ToolLenOffset", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -133,7 +133,7 @@ class CommandPathToolLenOffset: def Activated(self): FreeCAD.ActiveDocument.openTransaction( - translate("Create a Selection Plane object")) + translate("Path_ToolLenOffset", "Create a Selection Plane object")) FreeCADGui.addModule("PathScripts.PathToolLenOffset") snippet = ''' import Path diff --git a/src/Mod/Path/PathScripts/PathToolLibraryManager.py b/src/Mod/Path/PathScripts/PathToolLibraryManager.py index 14267f0527..5044e6f1a6 100644 --- a/src/Mod/Path/PathScripts/PathToolLibraryManager.py +++ b/src/Mod/Path/PathScripts/PathToolLibraryManager.py @@ -38,7 +38,7 @@ LOG_MODULE = 'PathToolLibraryManager' PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE) #PathLog.trackModule('PathToolLibraryManager') -def translate(text, context = "Path_ToolLibraryManager", disambig=None): +def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) # Tooltable XML readers