diff --git a/src/Mod/Path/PathScripts/PathArray.py b/src/Mod/Path/PathScripts/PathArray.py
index fba11db433..3779858fbe 100644
--- a/src/Mod/Path/PathScripts/PathArray.py
+++ b/src/Mod/Path/PathScripts/PathArray.py
@@ -30,14 +30,8 @@ from PySide import QtCore, QtGui
"""Path Array object and FreeCAD command"""
# Qt tanslation handling
-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)
-
+def translate(text, context = "Path_Array", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectArray:
@@ -122,11 +116,11 @@ class CommandPathArray:
selection = FreeCADGui.Selection.getSelection()
if len(selection) != 1:
FreeCAD.Console.PrintError(
- translate("Path_Array", "Please select exactly one path object\n"))
+ translate("Please select exactly one path object\n"))
return
if not(selection[0].isDerivedFrom("Path::Feature")):
FreeCAD.Console.PrintError(
- translate("Path_Array", "Please select exactly one path object\n"))
+ translate("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 37878e8739..1b8490cf0f 100644
--- a/src/Mod/Path/PathScripts/PathComment.py
+++ b/src/Mod/Path/PathScripts/PathComment.py
@@ -29,15 +29,8 @@ import Path
from PySide import QtCore, QtGui
# Qt tanslation handling
-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)
-
+def translate(text, context = "Path_Comment", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class Comment:
@@ -118,7 +111,7 @@ class CommandPathComment:
def Activated(self):
FreeCAD.ActiveDocument.openTransaction(
- translate("Path_Comment", "Create a Comment in your CNC program"))
+ translate("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 f29bbca729..df14679d12 100644
--- a/src/Mod/Path/PathScripts/PathCompoundExtended.py
+++ b/src/Mod/Path/PathScripts/PathCompoundExtended.py
@@ -30,15 +30,8 @@ from PySide import QtCore, QtGui
"""Path Compound Extended object and FreeCAD command"""
# Qt tanslation handling
-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)
-
+def translate(text, context = "Path_CompoundExtended", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectCompoundExtended:
@@ -114,7 +107,7 @@ class CommandCompoundExtended:
def Activated(self):
FreeCAD.ActiveDocument.openTransaction(
- translate("Path_CompoundExtended", "Create Compound"))
+ translate("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 b9c9b5a963..7a498c7e7f 100644
--- a/src/Mod/Path/PathScripts/PathContour.py
+++ b/src/Mod/Path/PathScripts/PathContour.py
@@ -41,18 +41,10 @@ FreeCAD.setLogLevel('Path.Area', 0)
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtGui
- # Qt tanslation handling
- 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(ctxt, txt):
- return txt
+# Qt tanslation handling
+def translate(text, context = "Path", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
__title__ = "Path Contour Operation"
__author__ = "sliptonic (Brad Collette)"
@@ -318,7 +310,7 @@ class CommandPathContour:
ztop = 10.0
zbottom = 0.0
- FreeCAD.ActiveDocument.openTransaction(translate("Path", "Create a Contour"))
+ FreeCAD.ActiveDocument.openTransaction(translate("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 2dd3467721..303b2477c5 100644
--- a/src/Mod/Path/PathScripts/PathCopy.py
+++ b/src/Mod/Path/PathScripts/PathCopy.py
@@ -29,14 +29,8 @@ from PySide import QtCore, QtGui
"""Path Copy object and FreeCAD command"""
# Qt tanslation handling
-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)
+def translate(text, context = "Path_Copy", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectPathCopy:
@@ -94,7 +88,7 @@ class CommandPathCopy:
def Activated(self):
FreeCAD.ActiveDocument.openTransaction(
- translate("Path_Copy", "Create Copy"))
+ translate("Create Copy"))
FreeCADGui.addModule("PathScripts.PathCopy")
consolecode = '''
@@ -107,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("PathCopy","Please select one path object\\n"))
+ FreeCAD.Console.PrintError(translate("Please select one path object\\n"))
selGood = False
if not selection[0].isDerivedFrom("Path::Feature"):
- FreeCAD.Console.PrintError(translate("PathCopy","The selected object is not a path\\n"))
+ FreeCAD.Console.PrintError(translate("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 eeb393fc53..31f6e7f4b7 100644
--- a/src/Mod/Path/PathScripts/PathCustom.py
+++ b/src/Mod/Path/PathScripts/PathCustom.py
@@ -29,14 +29,8 @@ from PySide import QtCore, QtGui
"""Path Custom object and FreeCAD command"""
# Qt tanslation handling
-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)
+def translate(text, context = "Path_Custom", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectCustom:
diff --git a/src/Mod/Path/PathScripts/PathDressup.py b/src/Mod/Path/PathScripts/PathDressup.py
index 82cb1c3042..fd0520c90e 100644
--- a/src/Mod/Path/PathScripts/PathDressup.py
+++ b/src/Mod/Path/PathScripts/PathDressup.py
@@ -31,17 +31,8 @@ from PySide import QtCore, QtGui
"""Path Dressup object and FreeCAD command"""
# Qt tanslation handling
-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)
-
+def translate(text, context = "Path_Dressup", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectDressup:
@@ -126,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("Path_Dressup", "Please select one path object\n"))
+ FreeCAD.Console.PrintError(translate("Please select one path object\n"))
return
if not selection[0].isDerivedFrom("Path::Feature"):
- FreeCAD.Console.PrintError(translate("Path_Dressup", "The selected object is not a path\n"))
+ FreeCAD.Console.PrintError(translate("The selected object is not a path\n"))
return
if selection[0].isDerivedFrom("Path::FeatureCompoundPython"):
- FreeCAD.Console.PrintError(translate("Path_Dressup", "Please select a Path object"))
+ FreeCAD.Console.PrintError(translate("Please select a Path object"))
return
# everything ok!
- FreeCAD.ActiveDocument.openTransaction(translate("Path_Dressup", "Create Dress-up"))
+ FreeCAD.ActiveDocument.openTransaction(translate("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/PathDressupDragknife.py b/src/Mod/Path/PathScripts/PathDressupDragknife.py
index 34ccee8362..0613e18ffb 100644
--- a/src/Mod/Path/PathScripts/PathDressupDragknife.py
+++ b/src/Mod/Path/PathScripts/PathDressupDragknife.py
@@ -35,14 +35,8 @@ import PathScripts.PathUtils as P
"""Dragknife Dressup object and FreeCAD command"""
# Qt tanslation handling
-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)
+def translate(text, context = "PathDressup_DragKnife", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
movecommands = ['G1', 'G01', 'G2', 'G02', 'G3', 'G03']
rapidcommands = ['G0', 'G00']
@@ -488,19 +482,19 @@ class CommandDressupDragknife:
selection = FreeCADGui.Selection.getSelection()
if len(selection) != 1:
FreeCAD.Console.PrintError(
- translate("PathDressup_DragKnife", "Please select one path object\n"))
+ translate("Please select one path object\n"))
return
if not selection[0].isDerivedFrom("Path::Feature"):
FreeCAD.Console.PrintError(
- translate("PathDressup_DragKnife", "The selected object is not a path\n"))
+ translate("The selected object is not a path\n"))
return
if selection[0].isDerivedFrom("Path::FeatureCompoundPython"):
FreeCAD.Console.PrintError(
- translate("PathDressup_DragKnife", "Please select a Path object"))
+ translate("Please select a Path object"))
return
# everything ok!
- FreeCAD.ActiveDocument.openTransaction(translate("PathDressup_DragKnife", "Create Dress-up"))
+ FreeCAD.ActiveDocument.openTransaction(translate("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/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py
index df58190634..1c8d36bd6b 100644
--- a/src/Mod/Path/PathScripts/PathDrilling.py
+++ b/src/Mod/Path/PathScripts/PathDrilling.py
@@ -48,14 +48,8 @@ if FreeCAD.GuiUp:
"""Path Drilling object and FreeCAD command"""
# Qt tanslation handling
-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)
+def translate(text, context = "Path_Drilling", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectDrilling:
@@ -326,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("Path_Drilling", "Create Drilling"))
+ FreeCAD.ActiveDocument.openTransaction(translate("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 982992aad6..483b2e34c0 100644
--- a/src/Mod/Path/PathScripts/PathEngrave.py
+++ b/src/Mod/Path/PathScripts/PathEngrave.py
@@ -40,15 +40,8 @@ PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
# PathLog.trackModule('PathEngrave')
# Qt tanslation handling
-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)
-
+def translate(text, context = "Path_Engrave", 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 aacadb3fd5..4d303a6c8b 100644
--- a/src/Mod/Path/PathScripts/PathFacePocket.py
+++ b/src/Mod/Path/PathScripts/PathFacePocket.py
@@ -29,14 +29,8 @@ from PySide import QtCore, QtGui
"""Path Pocket object and FreeCAD command"""
# Qt tanslation handling
-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)
+def translate(text, context = "Path_FacePocket", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectFacePocket:
@@ -162,26 +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(
- "Path_FacePocket", "Please select an edges loop from one object, or a single face\n"))
+ FreeCAD.Console.PrintError(translate("Please select an edges loop from one object, or a single face\n"))
return
if len(selection[0].SubObjects) == 0:
- FreeCAD.Console.PrintError(translate(
- "Path_FacePocket", "Please select an edges loop from one object, or a single face\n"))
+ FreeCAD.Console.PrintError(translate("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("Path_FacePocket", "Please select only edges or a single face\n"))
+ FreeCAD.Console.PrintError(translate("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("Path_FacePocket", "The selected edges don't form a loop\n"))
+ FreeCAD.Console.PrintError(translate("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 fd2c2f31a9..3cf226cf20 100644
--- a/src/Mod/Path/PathScripts/PathFaceProfile.py
+++ b/src/Mod/Path/PathScripts/PathFaceProfile.py
@@ -29,14 +29,8 @@ from PySide import QtCore, QtGui
"""Path Profile object and FreeCAD command"""
# Qt tanslation handling
-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)
+def translate(text, context = "Path_FaceProfile", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectFaceProfile:
@@ -129,16 +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("Path_FaceProfile", "Please select one face or wire\n"))
+ FreeCAD.Console.PrintError(translate("Please select one face or wire\n"))
return
if len(selection[0].SubObjects) != 1:
- FreeCAD.Console.PrintError(
- translate("Path_FaceProfile", "Please select only one face or wire\n"))
+ FreeCAD.Console.PrintError(translate("Please select only one face or wire\n"))
return
if not selection[0].SubObjects[0].ShapeType in ["Face", "Wire"]:
- FreeCAD.Console.PrintError(
- translate("Path_FaceProfile", "Please select only a face or a wire\n"))
+ FreeCAD.Console.PrintError(translate("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 d5ae6452d4..d22cdb7fb2 100644
--- a/src/Mod/Path/PathScripts/PathFixture.py
+++ b/src/Mod/Path/PathScripts/PathFixture.py
@@ -28,15 +28,8 @@ import Path
from PySide import QtCore, QtGui
# Qt tanslation handling
-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)
-
+def translate(text, context = "Path_Fixture", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class Fixture:
def __init__(self,obj):
@@ -130,8 +123,7 @@ class CommandPathFixture:
return False
def Activated(self):
- FreeCAD.ActiveDocument.openTransaction(
- translate("Path_Fixture", "Create a Fixture Offset"))
+ FreeCAD.ActiveDocument.openTransaction(translate("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 46edda23be..e4e72925ab 100644
--- a/src/Mod/Path/PathScripts/PathFromShape.py
+++ b/src/Mod/Path/PathScripts/PathFromShape.py
@@ -27,15 +27,8 @@ import FreeCADGui
from PySide import QtCore, QtGui
# Qt tanslation handling
-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)
-
+def translate(text, context = "Path_FromShape", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
# TODO make the shape parametric
@@ -91,15 +84,15 @@ class CommandFromShape:
selection = FreeCADGui.Selection.getSelection()
if len(selection) != 1:
FreeCAD.Console.PrintError(
- translate("Path_FromShape", "Please select exactly one Part-based object\n"))
+ translate("Please select exactly one Part-based object\n"))
return
if not(selection[0].isDerivedFrom("Part::Feature")):
FreeCAD.Console.PrintError(
- translate("Path_FromShape", "Please select exactly one Part-based object\n"))
+ translate("Please select exactly one Part-based object\n"))
return
FreeCAD.ActiveDocument.openTransaction(
- translate("Path_FromShape", "Create path from shape"))
+ translate("Create path from shape"))
FreeCADGui.addModule("PathScripts.PathUtils")
FreeCADGui.doCommand(
"obj = FreeCAD.activeDocument().addObject('Path::FeatureShape','PathShape')")
diff --git a/src/Mod/Path/PathScripts/PathHop.py b/src/Mod/Path/PathScripts/PathHop.py
index 7509d00618..04211ed645 100644
--- a/src/Mod/Path/PathScripts/PathHop.py
+++ b/src/Mod/Path/PathScripts/PathHop.py
@@ -30,15 +30,8 @@ from PySide import QtCore, QtGui
"""Path Hop object and FreeCAD command"""
# Qt tanslation handling
-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)
-
+def translate(text, context = "Path_Hop", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectHop:
@@ -117,15 +110,15 @@ class CommandPathHop:
selection = FreeCADGui.Selection.getSelection()
if len(selection) != 1:
FreeCAD.Console.PrintError(
- translate("Path_Hop", "Please select one path object\n"))
+ translate("Please select one path object\n"))
return
if not selection[0].isDerivedFrom("Path::Feature"):
FreeCAD.Console.PrintError(
- translate("Path_Hop", "The selected object is not a path\n"))
+ translate("The selected object is not a path\n"))
return
FreeCAD.ActiveDocument.openTransaction(
- translate("Path_Hop", "Create Hop"))
+ translate("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 496c31e260..95f2172aa2 100644
--- a/src/Mod/Path/PathScripts/PathInspect.py
+++ b/src/Mod/Path/PathScripts/PathInspect.py
@@ -26,16 +26,10 @@ from PySide import QtCore, QtGui
import FreeCAD
import FreeCADGui
import Path
+
# Qt tanslation handling
-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)
-
+def translate(text, context = "Path_Inspect", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
# class OldHighlighter(QtGui.QSyntaxHighlighter):
@@ -138,7 +132,7 @@ class GCodeEditorDialog(QtGui.QDialog):
# Note
lab = QtGui.QLabel()
- lab.setText(translate("PathInspect", "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("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)
@@ -236,11 +230,11 @@ class CommandPathInspect:
selection = FreeCADGui.Selection.getSelection()
if len(selection) != 1:
FreeCAD.Console.PrintError(
- translate("Path_Inspect", "Please select exactly one path object\n"))
+ translate("Please select exactly one path object\n"))
return
if not(selection[0].isDerivedFrom("Path::Feature")):
FreeCAD.Console.PrintError(
- translate("Path_Inspect", "Please select exactly one path object\n"))
+ translate("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 0caf6bf1ca..f5c6bbc64b 100644
--- a/src/Mod/Path/PathScripts/PathJob.py
+++ b/src/Mod/Path/PathScripts/PathJob.py
@@ -46,14 +46,8 @@ if FreeCAD.GuiUp:
"""Path Job object and FreeCAD command"""
# Qt tanslation handling
-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)
+def translate(text, context = "Path_Job", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectPathJob:
@@ -182,7 +176,7 @@ class CommandJob:
@staticmethod
def Create():
- FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Create Job"))
+ FreeCAD.ActiveDocument.openTransaction(translate("Create Job"))
FreeCADGui.addModule('PathScripts.PathUtils')
FreeCADGui.addModule('PathScripts.PathLoadTool')
snippet = '''
@@ -199,7 +193,7 @@ obj.ViewObject.startEditing()
class TaskPanel:
def __init__(self, obj, deleteOnReject):
- FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Edit Job"))
+ FreeCAD.ActiveDocument.openTransaction(translate("Edit Job"))
self.obj = obj
self.deleteOnReject = deleteOnReject
self.form = FreeCADGui.PySideUic.loadUi(":/panels/JobEdit.ui")
@@ -233,7 +227,7 @@ class TaskPanel:
FreeCADGui.Control.closeDialog()
FreeCAD.ActiveDocument.abortTransaction()
if self.deleteOnReject:
- FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Uncreate Job"))
+ FreeCAD.ActiveDocument.openTransaction(translate("Uncreate Job"))
for child in self.obj.Group:
FreeCAD.ActiveDocument.removeObject(child.Name)
FreeCAD.ActiveDocument.removeObject(self.obj.Name)
@@ -315,7 +309,7 @@ class TaskPanel:
pass
def setFile(self):
- filename = QtGui.QFileDialog.getSaveFileName(self.form, translate("PathJob", "Select Output File", None), None, translate("Path Job", "All Files (*.*)", None))
+ filename = QtGui.QFileDialog.getSaveFileName(self.form, translate("Select Output File"), None, translate("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 a8a620f144..0ac08aa11f 100644
--- a/src/Mod/Path/PathScripts/PathLoadTool.py
+++ b/src/Mod/Path/PathScripts/PathLoadTool.py
@@ -38,14 +38,8 @@ PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
#PathLog.trackModule('PathLoadTool')
# Qt tanslation handling
-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)
+def translate(text, context = "Path_LoadTool", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class LoadTool():
@@ -184,7 +178,7 @@ class CommandPathLoadTool:
PathLog.track()
self.Create()
-# FreeCAD.ActiveDocument.openTransaction(translate("Path_LoadTool", "Create Tool Controller Object"))
+# FreeCAD.ActiveDocument.openTransaction(translate("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 5175d71741..98a2a17f8c 100644
--- a/src/Mod/Path/PathScripts/PathMillFace.py
+++ b/src/Mod/Path/PathScripts/PathMillFace.py
@@ -45,14 +45,8 @@ if FreeCAD.GuiUp:
"""Path Face object and FreeCAD command"""
# Qt tanslation handling
-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)
+def translate(context, text, disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectFace:
diff --git a/src/Mod/Path/PathScripts/PathPlane.py b/src/Mod/Path/PathScripts/PathPlane.py
index 538ef0da8e..36fa4ef60d 100644
--- a/src/Mod/Path/PathScripts/PathPlane.py
+++ b/src/Mod/Path/PathScripts/PathPlane.py
@@ -29,14 +29,8 @@ import Path
from PySide import QtCore, QtGui
# Qt tanslation handling
-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)
+def translate(text, context = "Path_Plane", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class Plane:
@@ -126,7 +120,7 @@ class CommandPathPlane:
def Activated(self):
FreeCAD.ActiveDocument.openTransaction(
- translate("Path_Plane", "Create a Selection Plane object"))
+ translate("Create a Selection Plane object"))
FreeCADGui.addModule("PathScripts.PathPlane")
snippet = '''
import Path
diff --git a/src/Mod/Path/PathScripts/PathPocket.py b/src/Mod/Path/PathScripts/PathPocket.py
index f4a4c8a8fc..3152bd1658 100644
--- a/src/Mod/Path/PathScripts/PathPocket.py
+++ b/src/Mod/Path/PathScripts/PathPocket.py
@@ -39,15 +39,8 @@ PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
# PathLog.trackModule('PathPocket')
# Qt tanslation handling
-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)
-
+def translate(context, text, disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectPocket:
diff --git a/src/Mod/Path/PathScripts/PathPost.py b/src/Mod/Path/PathScripts/PathPost.py
index dd58bca520..4c64611f70 100644
--- a/src/Mod/Path/PathScripts/PathPost.py
+++ b/src/Mod/Path/PathScripts/PathPost.py
@@ -44,14 +44,8 @@ PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
PathLog.trackModule(LOG_MODULE)
# Qt tanslation handling
-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)
+def translate(text, context = "Path_Post", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class DlgSelectPostProcessor:
@@ -202,7 +196,7 @@ class CommandPathPost:
def Activated(self):
PathLog.track()
FreeCAD.ActiveDocument.openTransaction(
- translate("Path_Post", "Post Process the Selected path(s)"))
+ translate("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 a23b370e89..56b6306f6e 100644
--- a/src/Mod/Path/PathScripts/PathPreferencesPathDressup.py
+++ b/src/Mod/Path/PathScripts/PathPreferencesPathDressup.py
@@ -28,16 +28,8 @@ from PySide import QtCore, QtGui
from PathScripts.PathPreferences import PathPreferences
# Qt tanslation handling
-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)
+def translate(text, context = "Path_PreferencesPathDressup", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
_dressups = []
@@ -47,7 +39,7 @@ def RegisterDressup(dressup):
class DressupPreferencesPage:
def __init__(self, parent=None):
self.form = QtGui.QToolBox()
- self.form.setWindowTitle(translate('PathPreferencesPathDressup', 'Dressups'))
+ self.form.setWindowTitle(translate('Dressups'))
pages = []
for dressup in _dressups:
page = dressup.preferencesPage()
diff --git a/src/Mod/Path/PathScripts/PathProfile.py b/src/Mod/Path/PathScripts/PathProfile.py
index 864ea8c3f8..69ba9c9342 100644
--- a/src/Mod/Path/PathScripts/PathProfile.py
+++ b/src/Mod/Path/PathScripts/PathProfile.py
@@ -40,18 +40,10 @@ PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtCore, QtGui
- # Qt tanslation handling
- 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(ctxt, txt):
- return txt
+# Qt tanslation handling
+def translate(context, text, disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
__title__ = "Path Profile Operation"
__author__ = "sliptonic (Brad Collette)"
diff --git a/src/Mod/Path/PathScripts/PathProfileEdges.py b/src/Mod/Path/PathScripts/PathProfileEdges.py
index 4f797bb3c6..aeff454fc6 100644
--- a/src/Mod/Path/PathScripts/PathProfileEdges.py
+++ b/src/Mod/Path/PathScripts/PathProfileEdges.py
@@ -39,18 +39,10 @@ PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtCore, QtGui
- # Qt tanslation handling
- 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(ctxt, txt):
- return txt
+# Qt tanslation handling
+def translate(context, text, disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
__title__ = "Path Profile Edges Operation"
__author__ = "sliptonic (Brad Collette)"
diff --git a/src/Mod/Path/PathScripts/PathSanity.py b/src/Mod/Path/PathScripts/PathSanity.py
index e6d3ac2bfc..1c9b84c33c 100644
--- a/src/Mod/Path/PathScripts/PathSanity.py
+++ b/src/Mod/Path/PathScripts/PathSanity.py
@@ -32,13 +32,8 @@ import FreeCADGui
import PathScripts.PathUtils as PU
# Qt tanslation handling
-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)
+def translate(text, context = "Path_Sanity", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
def review(obj):
@@ -46,31 +41,31 @@ def review(obj):
toolcontrolcount = 0
if len(obj.Tooltable.Tools) == 0:
- FreeCAD.Console.PrintWarning(translate("Path_Sanity", "Machine: " + str(obj.Label) + " has no tools defined in the tool table\n"))
+ FreeCAD.Console.PrintWarning(translate("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("Path_Sanity", "It appears the machine limits haven't been set. Not able to check path extents.\n"))
+ FreeCAD.Console.PrintWarning(translate("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("Path_Sanity", "Tool Controller: " + str(item.Label) + " is using ID 0 which the undefined default. Please set a real tool.\n"))
+ FreeCAD.Console.PrintWarning(translate("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("Path_Sanity", "Tool Controller: " + str(item.Label) + " is using tool: " + str(item.ToolNumber) + " which is invalid\n"))
+ FreeCAD.Console.PrintError(translate("Tool Controller: " + str(item.Label) + " is using tool: " + str(item.ToolNumber) + " which is invalid\n"))
elif tool.Diameter == 0:
- FreeCAD.Console.PrintError(translate("Path_Sanity", "Tool Controller: " + str(item.Label) + " is using tool: " + str(item.ToolNumber) + " which has a zero diameter\n"))
+ FreeCAD.Console.PrintError(translate("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("Path_Sanity", "Tool Controller: " + str(item.Label) + " has a 0 value for the Horizontal feed rate\n"))
+ FreeCAD.Console.PrintWarning(translate("Tool Controller: " + str(item.Label) + " has a 0 value for the Horizontal feed rate\n"))
if item.VertFeed == 0:
- FreeCAD.Console.PrintWarning(translate("Path_Sanity", "Tool Controller: " + str(item.Label) + " has a 0 value for the Vertical feed rate\n"))
+ FreeCAD.Console.PrintWarning(translate("Tool Controller: " + str(item.Label) + " has a 0 value for the Vertical feed rate\n"))
if item.SpindleSpeed == 0:
- FreeCAD.Console.PrintWarning(translate("Path_Sanity", "Tool Controller: " + str(item.Label) + " has a 0 value for the spindle speed\n"))
+ FreeCAD.Console.PrintWarning(translate("Tool Controller: " + str(item.Label) + " has a 0 value for the spindle speed\n"))
if toolcontrolcount == 0:
- 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"))
+ FreeCAD.Console.PrintWarning(translate("A Tool Controller was not found. Default values are used which is dangerous. Please add a Tool Controller.\n"))
class CommandPathSanity:
@@ -91,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("Path_Sanity","Please select a path Project to check\n"))
+ FreeCAD.Console.PrintError(translate("Please select a path Project to check\n"))
return
if not(selection[0].TypeId == "Path::FeatureCompoundPython"):
- FreeCAD.Console.PrintError(translate("Path_Sanity","Please select a path project to check\n"))
+ FreeCAD.Console.PrintError(translate("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 2b5af97f15..701bc0c818 100644
--- a/src/Mod/Path/PathScripts/PathSimpleCopy.py
+++ b/src/Mod/Path/PathScripts/PathSimpleCopy.py
@@ -28,15 +28,8 @@ from PySide import QtCore, QtGui
"""Path SimpleCopy command"""
# Qt tanslation handling
-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)
-
+def translate(text, context = "Path_SimpleCopy", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class CommandPathSimpleCopy:
@@ -58,15 +51,15 @@ class CommandPathSimpleCopy:
selection = FreeCADGui.Selection.getSelection()
if len(selection) != 1:
FreeCAD.Console.PrintError(
- translate("Path_SimpleCopy", "Please select exactly one path object\n"))
+ translate("Please select exactly one path object\n"))
return
if not(selection[0].isDerivedFrom("Path::Feature")):
FreeCAD.Console.PrintError(
- translate("Path_SimpleCopy", "Please select exactly one path object\n"))
+ translate("Please select exactly one path object\n"))
return
FreeCAD.ActiveDocument.openTransaction(
- translate("Path_SimpleCopy", "Simple Copy"))
+ translate("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 8ed265a140..c8301e112c 100644
--- a/src/Mod/Path/PathScripts/PathStock.py
+++ b/src/Mod/Path/PathScripts/PathStock.py
@@ -27,15 +27,10 @@ import FreeCADGui
from FreeCAD import Vector
from PySide import QtCore, QtGui
import Part
-# Qt tanslation handling
-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)
+# Qt tanslation handling
+def translate(text, context = "Path_Stock", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class Stock:
@@ -105,8 +100,7 @@ class CommandPathStock:
return FreeCAD.ActiveDocument is not None
def Activated(self):
- FreeCAD.ActiveDocument.openTransaction(translate(
- "PathStock", "Creates a 3D object to represent raw stock to mill the part out of"))
+ FreeCAD.ActiveDocument.openTransaction(translate("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 6886d7fca8..72132f7f01 100644
--- a/src/Mod/Path/PathScripts/PathStop.py
+++ b/src/Mod/Path/PathScripts/PathStop.py
@@ -28,15 +28,8 @@ import Path
from PySide import QtCore, QtGui
# Qt tanslation handling
-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)
-
+def translate(text, context = "Path_Stop", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class Stop:
def __init__(self,obj):
@@ -123,7 +116,7 @@ class CommandPathStop:
def Activated(self):
FreeCAD.ActiveDocument.openTransaction(
- translate("Path_Stop", "Add Optional or Mandatory Stop to the program"))
+ translate("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 3851e0ab9a..d1b174944a 100644
--- a/src/Mod/Path/PathScripts/PathSurface.py
+++ b/src/Mod/Path/PathScripts/PathSurface.py
@@ -49,15 +49,8 @@ __url__ = "http://www.freecadweb.org"
"""Path surface object and FreeCAD command"""
# Qt tanslation handling
-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)
-
+def translate(text, context = "Path_Surface", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectSurface:
@@ -266,7 +259,7 @@ class ObjectSurface:
def execute(self, obj):
import MeshPart
FreeCAD.Console.PrintWarning(
- translate("PathSurface", "Hold on. This might take a minute.\n"))
+ translate("Hold on. This might take a minute.\n"))
output = ""
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'
@@ -305,7 +298,7 @@ class ObjectSurface:
import ocl
except:
FreeCAD.Console.PrintError(translate(
- "PathSurface", "This operation requires OpenCamLib to be installed.\n"))
+ "This operation requires OpenCamLib to be installed.\n"))
return
if mesh.TypeId.startswith('Mesh'):
@@ -404,7 +397,7 @@ class CommandPathSurfacing:
zbottom = 0
FreeCAD.ActiveDocument.openTransaction(
- translate("Path_Surfacing", "Create Surface"))
+ translate("Create Surface"))
FreeCADGui.addModule("PathScripts.PathSurface")
FreeCADGui.doCommand(
'obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Surface")')
@@ -516,12 +509,12 @@ class TaskPanel:
selection = FreeCADGui.Selection.getSelectionEx()
if len(selection) != 1:
FreeCAD.Console.PrintError(translate(
- "PathSurface", "Please select a single solid object from the project tree\n"))
+ "Please select a single solid object from the project tree\n"))
return
if not len(selection[0].SubObjects) == 0:
FreeCAD.Console.PrintError(translate(
- "PathSurface", "Please select a single solid object from the project tree\n"))
+ "Please select a single solid object from the project tree\n"))
return
sel = selection[0].Object
@@ -538,7 +531,7 @@ class TaskPanel:
else:
FreeCAD.Console.PrintError(
- translate("PathSurface", "Cannot work with this object\n"))
+ translate("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 0412cbc054..17f6261e72 100644
--- a/src/Mod/Path/PathScripts/PathToolLenOffset.py
+++ b/src/Mod/Path/PathScripts/PathToolLenOffset.py
@@ -29,14 +29,8 @@ from PathScripts import PathUtils
from PySide import QtCore, QtGui
# Qt tanslation handling
-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)
+def translate(text, context = "Path_ToolLenOffset", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class ToolLenOffset:
@@ -139,7 +133,7 @@ class CommandPathToolLenOffset:
def Activated(self):
FreeCAD.ActiveDocument.openTransaction(
- translate("Path_ToolLenOffset", "Create a Selection Plane object"))
+ translate("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 005f40bc00..14267f0527 100644
--- a/src/Mod/Path/PathScripts/PathToolLibraryManager.py
+++ b/src/Mod/Path/PathScripts/PathToolLibraryManager.py
@@ -38,15 +38,8 @@ LOG_MODULE = 'PathToolLibraryManager'
PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
#PathLog.trackModule('PathToolLibraryManager')
-try:
- _encoding = QtGui.QApplication.UnicodeUTF8
-
- def _translate(context, text, disambig):
- return QtGui.QApplication.translate(context, text, disambig, _encoding)
-except AttributeError:
- def _translate(context, text, disambig):
- return QtGui.QApplication.translate(context, text, disambig)
-
+def translate(text, context = "Path_ToolLibraryManager", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
# Tooltable XML readers
class FreeCADTooltableHandler(xml.sax.ContentHandler):
diff --git a/src/Mod/Path/PathScripts/PathToolTableEdit.py b/src/Mod/Path/PathScripts/PathToolTableEdit.py
index debc9b4b53..97ec337fb2 100644
--- a/src/Mod/Path/PathScripts/PathToolTableEdit.py
+++ b/src/Mod/Path/PathScripts/PathToolTableEdit.py
@@ -26,13 +26,8 @@ import FreeCAD,FreeCADGui
from PySide import QtCore,QtGui
# Qt tanslation handling
-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)
+def translate(text, context = "Path_ToolTableEdit", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
class CommandPathToolTableEdit:
def GetResources(self):
@@ -45,7 +40,7 @@ class CommandPathToolTableEdit:
return not FreeCAD.ActiveDocument is None
def Activated(self):
- FreeCAD.ActiveDocument.openTransaction(translate("Path_ToolTableEdit","Edits a Tool Table in a selected Project"))
+ FreeCAD.ActiveDocument.openTransaction(translate("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()')
diff --git a/src/Mod/Path/PathScripts/TooltableEditor.py b/src/Mod/Path/PathScripts/TooltableEditor.py
index f55d275ae6..f1c961d460 100644
--- a/src/Mod/Path/PathScripts/TooltableEditor.py
+++ b/src/Mod/Path/PathScripts/TooltableEditor.py
@@ -38,15 +38,9 @@ try:
except AttributeError:
def _fromUtf8(s):
return s
-try:
- _encoding = QtGui.QApplication.UnicodeUTF8
-
- def _translate(context, text, disambig):
- return QtGui.QApplication.translate(context, text, disambig, _encoding)
-except AttributeError:
- def _translate(context, text, disambig):
- return QtGui.QApplication.translate(context, text, disambig)
+def translate(text, context = "Path_ToolTableEditor", disambig=None):
+ return QtCore.QCoreApplication.translate(context, text, disambig)
# Tooltable XML readers