From 38bad10701db2d1544c931f4aa33a10bd2782e9e Mon Sep 17 00:00:00 2001 From: sliptonic Date: Fri, 21 Jan 2022 16:34:08 -0600 Subject: [PATCH] Engrave translation cleanup --- src/Mod/Path/PathScripts/PathEngrave.py | 32 ++++++++++----------- src/Mod/Path/PathScripts/PathEngraveBase.py | 20 ++++++------- src/Mod/Path/PathScripts/PathEngraveGui.py | 17 ++++++----- 3 files changed, 33 insertions(+), 36 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathEngrave.py b/src/Mod/Path/PathScripts/PathEngrave.py index a87287119c..6496658aaf 100644 --- a/src/Mod/Path/PathScripts/PathEngrave.py +++ b/src/Mod/Path/PathScripts/PathEngrave.py @@ -27,23 +27,21 @@ import PathScripts.PathLog as PathLog import PathScripts.PathOp as PathOp import PathScripts.PathUtils as PathUtils -from PySide import QtCore +from PySide.QtCore import QT_TRANSLATE_NOOP + +__doc__ = "Class and implementation of Path Engrave operation" + +if False: + PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) + PathLog.trackModule(PathLog.thisModule()) +else: + PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) # lazily loaded modules from lazy_loader.lazy_loader import LazyLoader Part = LazyLoader("Part", globals(), "Part") -__doc__ = "Class and implementation of Path Engrave operation" - -PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) -# PathLog.trackModule(PathLog.thisModule()) - - -# Qt translation handling -def translate(context, text, disambig=None): - return QtCore.QCoreApplication.translate(context, text, disambig) - class ObjectEngrave(PathEngraveBase.ObjectOp): """Proxy class for Engrave operation.""" @@ -69,8 +67,8 @@ class ObjectEngrave(PathEngraveBase.ObjectOp): "App::PropertyLinkList", "BaseShapes", "Path", - QtCore.QT_TRANSLATE_NOOP( - "PathEngrave", "Additional base objects to be engraved" + QT_TRANSLATE_NOOP( + "App::Property", "Additional base objects to be engraved" ), ) obj.setEditorMode("BaseShapes", 2) # hide @@ -79,8 +77,8 @@ class ObjectEngrave(PathEngraveBase.ObjectOp): "App::PropertyLink", "BaseObject", "Path", - QtCore.QT_TRANSLATE_NOOP( - "PathEngrave", "Additional base objects to be engraved" + QT_TRANSLATE_NOOP( + "App::Property", "Additional base objects to be engraved" ), ) obj.setEditorMode("BaseObject", 2) # hide @@ -91,8 +89,8 @@ class ObjectEngrave(PathEngraveBase.ObjectOp): "App::PropertyInteger", "StartVertex", "Path", - QtCore.QT_TRANSLATE_NOOP( - "PathEngrave", "The vertex index to start the path from" + QT_TRANSLATE_NOOP( + "App::Property", "The vertex index to start the path from" ), ) self.setupAdditionalProperties(obj) diff --git a/src/Mod/Path/PathScripts/PathEngraveBase.py b/src/Mod/Path/PathScripts/PathEngraveBase.py index 978bcd39f3..fab2c1dfaf 100644 --- a/src/Mod/Path/PathScripts/PathEngraveBase.py +++ b/src/Mod/Path/PathScripts/PathEngraveBase.py @@ -20,6 +20,7 @@ # * * # *************************************************************************** +from lazy_loader.lazy_loader import LazyLoader import Path import PathScripts.PathGeom as PathGeom import PathScripts.PathLog as PathLog @@ -27,22 +28,17 @@ import PathScripts.PathOp as PathOp import PathScripts.PathOpTools as PathOpTools import copy -# lazily loaded modules -from lazy_loader.lazy_loader import LazyLoader +__doc__ = "Base class for all ops in the engrave family." +# lazily loaded modules DraftGeomUtils = LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils") Part = LazyLoader("Part", globals(), "Part") -from PySide import QtCore - -__doc__ = "Base class for all ops in the engrave family." - -PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) -# PathLog.trackModule(PathLog.thisModule()) - -# Qt translation handling -def translate(context, text, disambig=None): - return QtCore.QCoreApplication.translate(context, text, disambig) +if False: + PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) + PathLog.trackModule(PathLog.thisModule()) +else: + PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) class ObjectOp(PathOp.ObjectOp): diff --git a/src/Mod/Path/PathScripts/PathEngraveGui.py b/src/Mod/Path/PathScripts/PathEngraveGui.py index b9a82596ca..d90064e009 100644 --- a/src/Mod/Path/PathScripts/PathEngraveGui.py +++ b/src/Mod/Path/PathScripts/PathEngraveGui.py @@ -30,17 +30,20 @@ import PathScripts.PathUtils as PathUtils from PySide import QtCore, QtGui + __title__ = "Path Engrave Operation UI" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecadweb.org" __doc__ = "Engrave operation page controller and command implementation." -PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) -# PathLog.trackModule(PathLog.thisModule()) +if False: + PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) + PathLog.trackModule(PathLog.thisModule()) +else: + PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) -def translate(context, text, disambig=None): - return QtCore.QCoreApplication.translate(context, text, disambig) +translate = FreeCAD.Qt.translate class TaskPanelBaseGeometryPage(PathOpGui.TaskPanelBaseGeometryPage): @@ -86,7 +89,7 @@ class TaskPanelBaseGeometryPage(PathOpGui.TaskPanelBaseGeometryPage): # selectively add some elements of the drawing to the Base for sub in sel.SubElementNames: if "Vertex" in sub: - PathLog.info(translate("Path", "Ignoring vertex")) + PathLog.info("Ignoring vertex") else: self.obj.Proxy.addBase(self.obj, base, sub) else: @@ -166,9 +169,9 @@ Command = PathOpGui.SetupOperation( PathEngrave.Create, TaskPanelOpPage, "Path_Engrave", - QtCore.QT_TRANSLATE_NOOP("PathEngrave", "Engrave"), + QtCore.QT_TRANSLATE_NOOP("Path_Engrave", "Engrave"), QtCore.QT_TRANSLATE_NOOP( - "PathEngrave", "Creates an Engraving Path around a Draft ShapeString" + "Path_Engrave", "Creates an Engraving Path around a Draft ShapeString" ), PathEngrave.SetupProperties, )