Vcarve translation cleanup

This commit is contained in:
sliptonic
2022-01-21 13:59:02 -06:00
parent d39d91f90e
commit b60a97f2b4
2 changed files with 21 additions and 28 deletions

View File

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

View File

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