BIM+Draft: change object related version info to log messages

To inform the user warnings are shown if an object has new or modified properties in the current version. These warnings can however be confusing, especially if there are many. With this PR they are turned into log messages. They are also moved out of translation, and instead of the object Label the object Name is displayed.

Additionally:
Zero path length warnings for path arrays are now only displayed if the Align property is True.

See: #21180.
This commit is contained in:
Roy-043
2025-08-31 13:07:15 +02:00
committed by Yorik van Havre
parent 999a6d2631
commit 4677bfef79
16 changed files with 87 additions and 100 deletions

View File

@@ -94,21 +94,21 @@ class _ArchSchedule:
self.update_properties_1v1(obj)
def update_properties_0v21(self,obj):
from draftutils.messages import _wrn
from draftutils.messages import _log
sp = obj.Result
if sp is not None:
self.setSchedulePropertySpreadsheet(sp, obj)
obj.removeProperty("Result")
_wrn("v0.21, " + obj.Label + ", " + translate("Arch", "removed property 'Result', and added property 'AutoUpdate'"))
_log("v0.21, " + obj.Name + ", removed property 'Result', and added property 'AutoUpdate'")
if sp is not None:
_wrn("v0.21, " + sp.Label + ", " + translate("Arch", "added property 'Schedule'"))
_log("v0.21, " + sp.Name + ", added property 'Schedule'")
def update_properties_1v1(self,obj):
from draftutils.messages import _wrn
from draftutils.messages import _log
if obj.getTypeIdOfProperty("Description") == "App::PropertyStringList":
obj.Operation = obj.Description
obj.removeProperty("Description")
_wrn("v1.1, " + obj.Label + ", " + translate("Arch", "renamed property 'Description' to 'Operation'"))
_log("v1.1, " + obj.Name + ", renamed property 'Description' to 'Operation'")
for prop in ("Operation", "Value", "Unit", "Objects", "Filter", "CreateSpreadsheet", "DetailedResults"):
obj.setGroupOfProperty(prop,"Schedule")

View File

@@ -48,11 +48,8 @@ from draftutils import params
if FreeCAD.GuiUp:
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCADGui
from draftutils.translate import translate
else:
# \cond
def translate(ctxt,txt):
return txt
def QT_TRANSLATE_NOOP(ctxt,txt):
return txt
# \endcond
@@ -289,9 +286,14 @@ class _Stairs(ArchComponent.Component):
obj.removeProperty("OutlineWireLeft")
obj.removeProperty("OutlineWireRight")
self.update_properties_to_0v20(obj)
from draftutils.messages import _wrn
_wrn("v0.20.3, " + obj.Label + ", "
+ translate("Arch", "removed properties 'OutlineWireLeft' and 'OutlineWireRight', and added properties 'RailingLeft' and 'RailingRight'"))
from draftutils.messages import _log
_log(
"v0.20.3, "
+ obj.Name
+ ", "
+ "removed properties 'OutlineWireLeft' and 'OutlineWireRight', "
+ "and added properties 'RailingLeft' and 'RailingRight'"
)
def update_properties_0v19_to_0v20(self, obj):
doc = FreeCAD.ActiveDocument
@@ -303,9 +305,13 @@ class _Stairs(ArchComponent.Component):
obj.RailingLeft = railingLeftObject
obj.RailingRight = railingRightObject
self.update_properties_to_0v20(obj)
from draftutils.messages import _wrn
_wrn("v0.20.3, " + obj.Label + ", "
+ translate("Arch", "changed the type of properties 'RailingLeft' and 'RailingRight'"))
from draftutils.messages import _log
_log(
"v0.20.3, "
+ obj.Name
+ ", "
+ "changed the type of properties 'RailingLeft' and 'RailingRight'"
)
def update_properties_to_0v20(self, obj):
additions = obj.Additions

View File

@@ -255,7 +255,7 @@ class _Wall(ArchComponent.Component):
"""Method run when the document is restored. Re-adds the Arch component, and Arch wall properties."""
import DraftGeomUtils
from draftutils.messages import _wrn
from draftutils.messages import _log
ArchComponent.Component.onDocumentRestored(self,obj)
self.setProperties(obj)
@@ -273,15 +273,15 @@ class _Wall(ArchComponent.Component):
and not obj.Base.isDerivedFrom("Sketcher::SketchObject") \
and DraftGeomUtils.get_shape_normal(obj.Base.Shape) != Vector(0, 0, 1):
obj.Normal = Vector(0, 0, 1)
_wrn(
_log(
"v1.0, "
+ obj.Label
+ obj.Name
+ ", "
+ translate("Arch", "changed 'Normal' to [0, 0, 1] to preserve extrusion direction")
+ "changed 'Normal' to [0, 0, 1] to preserve extrusion direction"
)
if hasattr(obj,"ArchSketchData") and obj.ArchSketchData and Draft.getType(obj.Base) == "ArchSketch":
if hasattr(obj,"Width"): # TODO need test?
if hasattr(obj,"Width"): # TODO need test?
obj.setEditorMode("Width", ["ReadOnly"])
if hasattr(obj,"Align"):
obj.setEditorMode("Align", ["ReadOnly"])