From b60a97f2b42a903c01fad51e7ddf950a84f155eb Mon Sep 17 00:00:00 2001 From: sliptonic Date: Fri, 21 Jan 2022 13:59:02 -0600 Subject: [PATCH] Vcarve translation cleanup --- src/Mod/Path/PathScripts/PathVcarve.py | 37 ++++++++++------------- src/Mod/Path/PathScripts/PathVcarveGui.py | 12 +++----- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathVcarve.py b/src/Mod/Path/PathScripts/PathVcarve.py index 898f5faf1f..2a86f3dff8 100644 --- a/src/Mod/Path/PathScripts/PathVcarve.py +++ b/src/Mod/Path/PathScripts/PathVcarve.py @@ -29,8 +29,9 @@ import PathScripts.PathOp as PathOp import PathScripts.PathUtils as PathUtils import PathScripts.PathGeom as PathGeom import PathScripts.PathPreferences as PathPreferences - import math +from PySide.QtCore import QT_TRANSLATE_NOOP + from PySide import QtCore @@ -43,14 +44,14 @@ EXTERIOR2 = 3 COLINEAR = 4 TWIN = 5 -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()) -# Qt translation handling -def translate(context, text, disambig=None): - return QtCore.QCoreApplication.translate(context, text, disambig) - +translate = FreeCAD.Qt.translate VD = [] Vertex = {} @@ -217,8 +218,8 @@ class ObjectVcarve(PathEngraveBase.ObjectOp): "App::PropertyLinkList", "BaseShapes", "Path", - QtCore.QT_TRANSLATE_NOOP( - "PathVcarve", "Additional base objects to be engraved" + QT_TRANSLATE_NOOP( + "App::Property", "Additional base objects to be engraved" ), ) obj.setEditorMode("BaseShapes", 2) # hide @@ -229,16 +230,16 @@ class ObjectVcarve(PathEngraveBase.ObjectOp): "App::PropertyFloat", "Discretize", "Path", - QtCore.QT_TRANSLATE_NOOP( - "PathVcarve", "The deflection value for discretizing arcs" + QT_TRANSLATE_NOOP( + "App::Property", "The deflection value for discretizing arcs" ), ) obj.addProperty( "App::PropertyFloat", "Colinear", "Path", - QtCore.QT_TRANSLATE_NOOP( - "PathVcarve", + QT_TRANSLATE_NOOP( + "App::Property", "Cutoff for removing colinear segments (degrees). \ default=10.0.", ), @@ -247,7 +248,7 @@ class ObjectVcarve(PathEngraveBase.ObjectOp): "App::PropertyFloat", "Tolerance", "Path", - QtCore.QT_TRANSLATE_NOOP("PathVcarve", ""), + QT_TRANSLATE_NOOP("App::Property", "Vcarve Tolerance"), ) obj.Colinear = 10.0 obj.Discretize = 0.01 @@ -385,15 +386,9 @@ class ObjectVcarve(PathEngraveBase.ObjectOp): ) except Exception as e: - # PathLog.error(e) - # traceback.print_exc() PathLog.error( - translate( - "PathVcarve", - "Error processing Base object. Engraving operation will produce no output.", - ) + "Error processing Base object. Engraving operation will produce no output." ) - # raise e def opUpdateDepths(self, obj, ignoreErrors=False): """updateDepths(obj) ... engraving is always done at the top most z-value""" diff --git a/src/Mod/Path/PathScripts/PathVcarveGui.py b/src/Mod/Path/PathScripts/PathVcarveGui.py index 4cf0f99d63..c044763d71 100644 --- a/src/Mod/Path/PathScripts/PathVcarveGui.py +++ b/src/Mod/Path/PathScripts/PathVcarveGui.py @@ -27,23 +27,22 @@ import PathScripts.PathVcarve as PathVcarve import PathScripts.PathLog as PathLog import PathScripts.PathOpGui as PathOpGui import PathScripts.PathUtils as PathUtils - from PySide import QtCore, QtGui + __title__ = "Path Vcarve Operation UI" __author__ = "sliptonic (Brad Collette)" __url__ = "http://www.freecadweb.org" __doc__ = "Vcarve operation page controller and command implementation." + 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): @@ -70,8 +69,7 @@ class TaskPanelBaseGeometryPage(PathOpGui.TaskPanelBaseGeometryPage): continue if base in shapes: PathLog.notice( - (translate("Path", "Base shape %s already in the list") + "\n") - % (sel.Object.Label) + "Base shape %s already in the list".format(sel.Object.Label) ) continue if base.isDerivedFrom("Part::Part2DObject"): @@ -79,7 +77,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: