Property: * Extended property status bitset. Mirror most of PropertyType and allow dynamic change property type. * Cache property name and type to improve performance * Centralize property status change signalling * Change aboutToSetValue()/hasSetValue() to virtual * Add new API getFullName() to obtain full quanlified name of the property AtomicPropertyChangeInterface: * Allow calling aboutToSetValue()/hasSetValue() when actually changed PropertyLists: * Refactor implementation by an abstract class PropertyListBase and a template class PropertyListsT, to allow better code reuse. PropertyListT is derived from AtomicPropertyChangeInterface to allow more efficient change on individual elements. * All list type property now accept setting python value as a dictionary with index as key to set individual element of a list. * Add touch list for more efficient handling of value changes. The list contains the index of changed value. And empty touch list should be treated as the entire list is changed. PropertyContainerPy expose this functionality with getPropertyTouchList(). PropertyPersistentObject: * New property to allow dynamic creation of any FreeCAD object derived from Base::Persistence, and use it as a property. DynamicProperty: * Use boost multi_index_container for efficient property lookup while keeping order. * Modify to be allowed to use in PropertyContainer directly PropertyContainer: * Use boost multi_index_container for efficient property lookup while keeping order. * Allow adding/removing dynamic property on all property container * Modify Save/Restore() to persist property status, and better handle transient property which can now be dynamically enabled/disabled per object. * Add new API getFullName() to obtain full quanlified name of the property. Implemented by Document, DocumentObject, and also ViewProviderDocumentObject if future patch DocumentObject and FeaturePython are modified to accommondate the dynamic property changes. Removed get/setCustomAttribute() implementation from DocumentObjectPy, and rely on PropertyContainerPy for the implementation, because of the additional dynamic property support in property container. Gui::ViewProviderDocumentObject, which is derived from PropertyContainer, is also modified accordingly
115 lines
4.7 KiB
XML
115 lines
4.7 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
|
|
<PythonExport
|
|
Father="PersistencePy"
|
|
Name="PropertyContainerPy"
|
|
TwinPointer="PropertyContainer"
|
|
Twin="PropertyContainer"
|
|
Include="App/PropertyContainer.h"
|
|
Namespace="App"
|
|
FatherInclude="Base/PersistencePy.h"
|
|
FatherNamespace="Base"
|
|
DisableNotify="true">
|
|
<Documentation>
|
|
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
|
|
<UserDocu>This is a Persistence class</UserDocu>
|
|
</Documentation>
|
|
<Methode Name="getPropertyByName">
|
|
<Documentation>
|
|
<UserDocu>Return the value of a named property.</UserDocu>
|
|
</Documentation>
|
|
</Methode>
|
|
<Methode Name="getPropertyTouchList">
|
|
<Documentation>
|
|
<UserDocu>Return a list of index of touched values for list type properties.</UserDocu>
|
|
</Documentation>
|
|
</Methode>
|
|
<Methode Name="getTypeOfProperty">
|
|
<Documentation>
|
|
<UserDocu>Return the type of a named property. This can be (Hidden,ReadOnly,Output) or any combination. </UserDocu>
|
|
</Documentation>
|
|
</Methode>
|
|
<Methode Name="getTypeIdOfProperty">
|
|
<Documentation>
|
|
<UserDocu>Returns the C++ class name of a named property.</UserDocu>
|
|
</Documentation>
|
|
</Methode>
|
|
<Methode Name="setEditorMode">
|
|
<Documentation>
|
|
<UserDocu>Set the behaviour of the property in the property editor.
|
|
0 - default behaviour
|
|
1 - item is ready-only
|
|
2 - item is hidden
|
|
</UserDocu>
|
|
</Documentation>
|
|
</Methode>
|
|
<Methode Name="getEditorMode">
|
|
<Documentation>
|
|
<UserDocu>Get the behaviour of the property in the property editor.
|
|
It returns a list of strings with the current mode. If the list is empty there are no special restrictions.
|
|
If the list contains 'ReadOnly' then the item appears in the property editor but is disabled.
|
|
If the list contains 'Hidden' then the item even doesn't appear in the property editor.
|
|
</UserDocu>
|
|
</Documentation>
|
|
</Methode>
|
|
<Methode Name="getGroupOfProperty">
|
|
<Documentation>
|
|
<UserDocu>Return the name of the group which the property belongs to in this class. The properties sorted in different named groups for convenience.</UserDocu>
|
|
</Documentation>
|
|
</Methode>
|
|
<Methode Name="setPropertyStatus">
|
|
<Documentation>
|
|
<UserDocu>
|
|
setPropertyStatus(name,val): Set property status
|
|
|
|
name(String): property name
|
|
|
|
val(String|Int|[String|Int...]): text or integer value, or list/tuple of
|
|
values. Call getPropertyStatus() to get a list of supported text value.
|
|
If the text start with '-' or the integer value is negative, then the
|
|
status is cleared.
|
|
</UserDocu>
|
|
</Documentation>
|
|
</Methode>
|
|
<Methode Name="getPropertyStatus">
|
|
<Documentation>
|
|
<UserDocu>
|
|
getPropertyStatus(name=''): Get property status.
|
|
|
|
name(String): property name. If name is empty, return a list of supported
|
|
text names of the status.
|
|
</UserDocu>
|
|
</Documentation>
|
|
</Methode>
|
|
<Methode Name="getDocumentationOfProperty">
|
|
<Documentation>
|
|
<UserDocu>Return the documentation string of the property of this class.</UserDocu>
|
|
</Documentation>
|
|
</Methode>
|
|
<Methode Name="dumpPropertyContent" Keyword="true" Const="true">
|
|
<Documentation>
|
|
<UserDocu>Dumps the content of the property, both the XML representation as well as the additional datafiles
|
|
required, into a byte representation. It will be returned as byte array.
|
|
dumpPropertyContent(propertyname) -- returns a byte array with full content
|
|
dumpPropertyContent(propertyname, [Compression=1-9]) -- Sets the data compression from 0 (no) to 9 (max)
|
|
</UserDocu>
|
|
</Documentation>
|
|
</Methode>
|
|
<Methode Name="restorePropertyContent">
|
|
<Documentation>
|
|
<UserDocu>Restore the content of given property from a byte representation as stored by \"dumpContent\".
|
|
It could be restored from any python object implementing the buffer protocol.
|
|
restorePropertyContent(propertyname, buffer) -- restores from the given byte array
|
|
</UserDocu>
|
|
</Documentation>
|
|
</Methode>
|
|
<Attribute Name="PropertiesList" ReadOnly="true">
|
|
<Documentation>
|
|
<UserDocu>A list of all property names</UserDocu>
|
|
</Documentation>
|
|
<Parameter Name="PropertiesList" Type="List"/>
|
|
</Attribute>
|
|
<CustomAttributes />
|
|
</PythonExport>
|
|
</GenerateModel>
|