From 763dc231cf9eb776e4a4825d8463344fc7630a15 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Tue, 25 Jan 2022 17:56:23 -0600 Subject: [PATCH] PropertyBag translation cleanup --- src/Mod/Path/PathScripts/PathOp.py | 2 +- src/Mod/Path/PathScripts/PathPropertyBag.py | 16 +++++++---- .../Path/PathScripts/PathPropertyBagGui.py | 27 ++++++++----------- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py index a4464cd73e..c7a73c892c 100644 --- a/src/Mod/Path/PathScripts/PathOp.py +++ b/src/Mod/Path/PathScripts/PathOp.py @@ -417,12 +417,12 @@ class ObjectOp(object): self.addOpValues(obj, ["tooldia"]) if FeatureCoolant & features: + oldvalue = str(obj.CoolantMode) if hasattr(obj, "CoolantMode") else "None" if ( hasattr(obj, "CoolantMode") and not obj.getTypeIdOfProperty("CoolantMode") == "App::PropertyEnumeration" ): - oldvalue = str(obj.CoolantMode) obj.removeProperty("CoolantMode") if not hasattr(obj, "CoolantMode"): diff --git a/src/Mod/Path/PathScripts/PathPropertyBag.py b/src/Mod/Path/PathScripts/PathPropertyBag.py index 7f797126ed..27fef993c5 100644 --- a/src/Mod/Path/PathScripts/PathPropertyBag.py +++ b/src/Mod/Path/PathScripts/PathPropertyBag.py @@ -20,18 +20,24 @@ # * * # *************************************************************************** +from PySide.QtCore import QT_TRANSLATE_NOOP import FreeCAD -import PySide import re +import PathScripts.PathLog as PathLog __title__ = "Generic property container to store some values." __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecadweb.org" __doc__ = "A generic container for typed properties in arbitrary categories." +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 PySide.QtCore.QCoreApplication.translate(context, text, disambig) + +translate = FreeCAD.Qt.translate SupportedPropertyType = { @@ -66,8 +72,8 @@ class PropertyBag(object): "App::PropertyStringList", self.CustomPropertyGroups, "Base", - PySide.QtCore.QT_TRANSLATE_NOOP( - "PathPropertyBag", "List of custom property groups" + QT_TRANSLATE_NOOP( + "App::Property", "List of custom property groups" ), ) self.onDocumentRestored(obj) diff --git a/src/Mod/Path/PathScripts/PathPropertyBagGui.py b/src/Mod/Path/PathScripts/PathPropertyBagGui.py index 60e905d98b..81d59fac09 100644 --- a/src/Mod/Path/PathScripts/PathPropertyBagGui.py +++ b/src/Mod/Path/PathScripts/PathPropertyBagGui.py @@ -20,10 +20,9 @@ # * * # *************************************************************************** +from PySide import QtCore, QtGui import FreeCAD import FreeCADGui - -# import PathGui import PathScripts.PathIconViewProvider as PathIconViewProvider import PathScripts.PathLog as PathLog import PathScripts.PathPropertyBag as PathPropertyBag @@ -31,19 +30,19 @@ import PathScripts.PathPropertyEditor as PathPropertyEditor import PathScripts.PathUtil as PathUtil import re -from PySide import QtCore, QtGui __title__ = "Property Bag Editor" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecadweb.org" __doc__ = "Task panel editor for a PropertyBag" -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 class ViewProvider(object): @@ -248,9 +247,7 @@ class TaskPanel(object): # initialized later self.model = None self.delegate = None - FreeCAD.ActiveDocument.openTransaction( - translate("PathPropertyBag", "Edit PropertyBag") - ) + FreeCAD.ActiveDocument.openTransaction("Edit PropertyBag") Panel.append(self) def updateData(self, topLeft, bottomRight): @@ -428,9 +425,7 @@ class TaskPanel(object): def Create(name="PropertyBag"): """Create(name = 'PropertyBag') ... creates a new setup sheet""" - FreeCAD.ActiveDocument.openTransaction( - translate("PathPropertyBag", "Create PropertyBag") - ) + FreeCAD.ActiveDocument.openTransaction("Create PropertyBag") pcont = PathPropertyBag.Create(name) PathIconViewProvider.Attach(pcont.ViewObject, name) return pcont @@ -447,9 +442,9 @@ class PropertyBagCreateCommand(object): def GetResources(self): return { - "MenuText": translate("PathPropertyBag", "PropertyBag"), + "MenuText": translate("Path_PropertyBag", "PropertyBag"), "ToolTip": translate( - "PathPropertyBag", + "Path_PropertyBag", "Creates an object which can be used to store reference properties.", ), }