Replaced default context argument with explicit call for pylupdate to pick up the strings and contexts.

This commit is contained in:
Markus Lampert
2017-06-03 12:12:27 -07:00
parent 57fed76be7
commit af699ab7e2
32 changed files with 110 additions and 125 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)')

View File

@@ -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:

View File

@@ -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)

View File

@@ -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")')

View File

@@ -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']

View File

@@ -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")')

View File

@@ -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")')

View File

@@ -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)')

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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')")

View File

@@ -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"""

View File

@@ -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(

View File

@@ -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("<b>Note</b>: 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", "<b>Note</b>: 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

View File

@@ -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()

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -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

View File

@@ -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")')

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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