Holding tag translation cleanup

This commit is contained in:
sliptonic
2022-01-24 16:52:54 -06:00
parent cf864c4ff1
commit 44e4e8bddc
4 changed files with 61 additions and 76 deletions

View File

@@ -20,6 +20,9 @@
# * *
# ***************************************************************************
from PathScripts.PathDressupTagPreferences import HoldingTagPreferences
from PathScripts.PathUtils import waiting_effects
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import Path
import PathScripts.PathDressup as PathDressup
@@ -30,24 +33,23 @@ import PathScripts.PathUtils as PathUtils
import copy
import math
from PathScripts.PathDressupTagPreferences import HoldingTagPreferences
from PathScripts.PathUtils import waiting_effects
from PySide import QtCore
# lazily loaded modules
from lazy_loader.lazy_loader import LazyLoader
Part = LazyLoader("Part", globals(), "Part")
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
# PathLog.trackModule()
if False:
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
PathLog.trackModule(PathLog.thisModule())
else:
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
translate = FreeCAD.Qt.translate
failures = []
# Qt translation handling
def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)
def debugEdge(edge, prefix, force=False):
if force or PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG:
@@ -956,56 +958,50 @@ class ObjectTagDressup:
"App::PropertyLink",
"Base",
"Base",
QtCore.QT_TRANSLATE_NOOP("Path_DressupTag", "The base path to modify"),
QT_TRANSLATE_NOOP("App::Property", "The base path to modify"),
)
obj.addProperty(
"App::PropertyLength",
"Width",
"Tag",
QtCore.QT_TRANSLATE_NOOP("Path_DressupTag", "Width of tags."),
QT_TRANSLATE_NOOP("App::Property", "Width of tags."),
)
obj.addProperty(
"App::PropertyLength",
"Height",
"Tag",
QtCore.QT_TRANSLATE_NOOP("Path_DressupTag", "Height of tags."),
QT_TRANSLATE_NOOP("App::Property", "Height of tags."),
)
obj.addProperty(
"App::PropertyAngle",
"Angle",
"Tag",
QtCore.QT_TRANSLATE_NOOP(
"Path_DressupTag", "Angle of tag plunge and ascent."
),
QT_TRANSLATE_NOOP("App::Property", "Angle of tag plunge and ascent."),
)
obj.addProperty(
"App::PropertyLength",
"Radius",
"Tag",
QtCore.QT_TRANSLATE_NOOP(
"Path_DressupTag", "Radius of the fillet for the tag."
),
QT_TRANSLATE_NOOP("App::Property", "Radius of the fillet for the tag."),
)
obj.addProperty(
"App::PropertyVectorList",
"Positions",
"Tag",
QtCore.QT_TRANSLATE_NOOP(
"Path_DressupTag", "Locations of inserted holding tags"
),
QT_TRANSLATE_NOOP("App::Property", "Locations of inserted holding tags"),
)
obj.addProperty(
"App::PropertyIntegerList",
"Disabled",
"Tag",
QtCore.QT_TRANSLATE_NOOP("Path_DressupTag", "IDs of disabled holding tags"),
QT_TRANSLATE_NOOP("App::Property", "IDs of disabled holding tags"),
)
obj.addProperty(
"App::PropertyInteger",
"SegmentationFactor",
"Tag",
QtCore.QT_TRANSLATE_NOOP(
"Path_DressupTag",
QT_TRANSLATE_NOOP(
"App::Property",
"Factor determining the # of segments used to approximate rounded tags.",
),
)

View File

@@ -20,6 +20,8 @@
# * *
# ***************************************************************************
from PathScripts.PathDressupTagPreferences import HoldingTagPreferences
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import PathScripts.PathDressup as PathDressup
import PathScripts.PathGeom as PathGeom
@@ -33,16 +35,14 @@ from lazy_loader.lazy_loader import LazyLoader
DraftGeomUtils = LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils")
Part = LazyLoader("Part", globals(), "Part")
from PathScripts.PathDressupTagPreferences import HoldingTagPreferences
from PySide import QtCore
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
# PathLog.trackModule()
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
MaxInt = 99999999999999
@@ -122,56 +122,50 @@ class ObjectDressup:
"App::PropertyLink",
"Base",
"Base",
QtCore.QT_TRANSLATE_NOOP("Path_DressupTag", "The base path to modify"),
QT_TRANSLATE_NOOP("App::Property", "The base path to modify"),
)
obj.addProperty(
"App::PropertyLength",
"Width",
"Tag",
QtCore.QT_TRANSLATE_NOOP("Path_DressupTag", "Width of tags."),
QT_TRANSLATE_NOOP("App::Property", "Width of tags."),
)
obj.addProperty(
"App::PropertyLength",
"Height",
"Tag",
QtCore.QT_TRANSLATE_NOOP("Path_DressupTag", "Height of tags."),
QT_TRANSLATE_NOOP("App::Property", "Height of tags."),
)
obj.addProperty(
"App::PropertyAngle",
"Angle",
"Tag",
QtCore.QT_TRANSLATE_NOOP(
"Path_DressupTag", "Angle of tag plunge and ascent."
),
QT_TRANSLATE_NOOP("App::Property", "Angle of tag plunge and ascent."),
)
obj.addProperty(
"App::PropertyLength",
"Radius",
"Tag",
QtCore.QT_TRANSLATE_NOOP(
"Path_DressupTag", "Radius of the fillet for the tag."
),
QT_TRANSLATE_NOOP("App::Property", "Radius of the fillet for the tag."),
)
obj.addProperty(
"App::PropertyVectorList",
"Positions",
"Tag",
QtCore.QT_TRANSLATE_NOOP(
"Path_DressupTag", "Locations of inserted holding tags"
),
QT_TRANSLATE_NOOP("App::Property", "Locations of inserted holding tags"),
)
obj.addProperty(
"App::PropertyIntegerList",
"Disabled",
"Tag",
QtCore.QT_TRANSLATE_NOOP("Path_DressupTag", "IDs of disabled holding tags"),
QT_TRANSLATE_NOOP("App::Property", "IDs of disabled holding tags"),
)
obj.addProperty(
"App::PropertyInteger",
"SegmentationFactor",
"Tag",
QtCore.QT_TRANSLATE_NOOP(
"Path_DressupTag",
QT_TRANSLATE_NOOP(
"App::Property",
"Factor determining the # of segments used to approximate rounded tags.",
),
)

View File

@@ -20,26 +20,27 @@
# * *
# ***************************************************************************
from PySide import QtCore, QtGui
from PySide.QtCore import QT_TRANSLATE_NOOP
from pivy import coin
import FreeCAD
import FreeCADGui
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathDressupHoldingTags as PathDressupTag
import PathScripts.PathGeom as PathGeom
import PathScripts.PathGetPoint as PathGetPoint
import PathScripts.PathDressupHoldingTags as PathDressupTag
import PathScripts.PathLog as PathLog
import PathScripts.PathPreferences as PathPreferences
import PathScripts.PathUtils as PathUtils
from PySide import QtCore, QtGui
from pivy import coin
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
# PathLog.trackModule()
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
def addDebugDisplay():
@@ -60,9 +61,7 @@ class PathDressupTagTaskPanel:
self.getPoint = PathGetPoint.TaskPanel(self.form.removeEditAddGroup, True)
self.jvo = PathUtils.findParentJob(obj).ViewObject
if jvoVisibility is None:
FreeCAD.ActiveDocument.openTransaction(
translate("PathDressup_HoldingTags", "Edit HoldingTags Dress-up")
)
FreeCAD.ActiveDocument.openTransaction("Edit HoldingTags Dress-up")
self.jvoVisible = self.jvo.isVisible()
if self.jvoVisible:
self.jvo.hide()
@@ -207,9 +206,7 @@ class PathDressupTagTaskPanel:
self.Disabled = self.obj.Disabled
self.updateTagsView()
else:
PathLog.error(
translate("Path_DressupTag", "Cannot copy tags - internal error") + "\n"
)
PathLog.error("Cannot copy tags - internal error")
def updateModel(self):
self.getFields()
@@ -381,7 +378,7 @@ class PathDressupTagViewProvider:
def debugDisplay(self):
# if False and addDebugDisplay():
# if not hasattr(self.vobj, 'Debug'):
# self.vobj.addProperty('App::PropertyLink', 'Debug', 'Debug', QtCore.QT_TRANSLATE_NOOP('Path_DressupTag', 'Some elements for debugging'))
# self.vobj.addProperty('App::PropertyLink', 'Debug', 'Debug', QT_TRANSLATE_NOOP('Path_DressupTag', 'Some elements for debugging'))
# dbg = self.vobj.Object.Document.addObject('App::DocumentObjectGroup', 'TagDebug')
# self.vobj.Debug = dbg
# return True
@@ -559,9 +556,7 @@ def Create(baseObject, name="DressupTag"):
Create(basePath, name = 'DressupTag') ... create tag dressup object for the given base path.
Use this command only iff the UI is up - for batch processing see PathDressupTag.Create
"""
FreeCAD.ActiveDocument.openTransaction(
translate("Path_DressupTag", "Create a Tag dressup")
)
FreeCAD.ActiveDocument.openTransaction("Create a Tag dressup")
obj = PathDressupTag.Create(baseObject, name)
obj.ViewObject.Proxy = PathDressupTagViewProvider(obj.ViewObject)
FreeCAD.ActiveDocument.commitTransaction()
@@ -575,8 +570,8 @@ class CommandPathDressupTag:
def GetResources(self):
return {
"Pixmap": "Path_Dressup",
"MenuText": QtCore.QT_TRANSLATE_NOOP("Path_DressupTag", "Tag Dress-up"),
"ToolTip": QtCore.QT_TRANSLATE_NOOP(
"MenuText": QT_TRANSLATE_NOOP("Path_DressupTag", "Tag Dress-up"),
"ToolTip": QT_TRANSLATE_NOOP(
"Path_DressupTag", "Creates a Tag Dress-up object from a selected path"
),
}
@@ -599,9 +594,7 @@ class CommandPathDressupTag:
baseObject = selection[0]
# everything ok!
FreeCAD.ActiveDocument.openTransaction(
translate("Path_DressupTag", "Create Tag Dress-up")
)
FreeCAD.ActiveDocument.openTransaction("Create Tag Dress-up")
FreeCADGui.addModule("PathScripts.PathDressupTagGui")
FreeCADGui.doCommand(
"PathScripts.PathDressupTagGui.Create(App.ActiveDocument.%s)"

View File

@@ -21,15 +21,17 @@
# ***************************************************************************
import FreeCAD
import PathScripts.PathLog as PathLog
import PathScripts.PathPreferences as PathPreferences
import PathScripts.PathPreferencesPathDressup as PathPreferencesPathDressup
from PySide import QtCore
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
class HoldingTagPreferences: