DocumentObject: add allowDuplicateLabel/onBeforeChangeLabel()

These two APIs allow an object to control its own labeling rules.
The previous auto re-labeling for uniqueness logic is moved from
ObjectLabelObserver (resides in Application.cpp) to PropertyString.

DocumentObject::allowDuplicateLabel() is used to inform PropertyString
that the object allows duplicate label regardless of application
setting. onBeforeChangeLabel() is called before actual label change to
give object a chance to override the new label.
This commit is contained in:
Zheng, Lei
2019-07-04 17:25:55 +08:00
committed by wmayer
parent b4751145b4
commit 00166c2346
6 changed files with 190 additions and 123 deletions

View File

@@ -262,5 +262,11 @@ or None if the GUI is not up</UserDocu>
</Documentation>
<Parameter Name="Parents" Type="List"/>
</Attribute>
<Attribute Name="OldLabel" ReadOnly="true">
<Documentation>
<UserDocu>Contains the old label before change</UserDocu>
</Documentation>
<Parameter Name="OldLabel" Type="String"/>
</Attribute>
</PythonExport>
</GenerateModel>