Commit Graph

26 Commits

Author SHA1 Message Date
Zheng, Lei
2a3951ca32 Spreadsheet: change alias handling
No longer add dynamic property for alias, simply rely on
get(Dynamic)PropertyByName() to check for aliases.

Add new API PropertyContainer::getPropertyNamedList() so that
ExpressionCompleter can discover properties with aliases.
2021-12-21 21:41:02 -07:00
Zheng, Lei
66038006d7 App: do not auto rename new dynamic property
Instead, throw exception in case of duplicate name. Use boolean
parameter 'Preferences/Document/AutoNameDynamicProperty' to get back
the old behavior.
2021-11-21 19:03:53 -06:00
Zheng, Lei
8cf3cf330b App/Gui: allow change dynamic property group and documentation
Exposed as PropertyContainerPy.setGroup/DocumentationOfProperty.

Added a menu action to property view for rename dynamic property group.
2021-11-14 20:45:09 -06:00
wmayer
5d5d05616f App: [skip ci] AddressSanitizer: heap-use-after-free
When removing a dynamic property its myName member must be nullified as the memory has been de-allocated
2021-02-27 02:21:14 +01:00
luz paz
bfdffb50be App: Fix header uniformity, trailing whitespace, and doxygen headers 2020-11-19 13:38:37 +01:00
Zheng, Lei
d441a9ded5 App: make deleting dynamic property safer
Dynamic property can be removed at any time, even during triggering of
onChanged() signal of the removing property. This patch introduced
static function Property::destroy() to make it safer by queueing any
removed property, and only deleting them when no onChanged() call is
active.
2020-03-21 15:43:03 +01:00
Zheng, Lei
f4205130ae App: Property related API changes
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
2019-08-17 14:52:09 +02:00
wmayer
3a6afac8b2 improve whitespaces 2018-10-18 23:31:55 +02:00
wmayer
833c2c601e add missing newlines 2018-06-09 11:47:12 +02:00
wmayer
41db9e2a55 support to handle changed types when reading dynamic properties 2018-03-14 17:20:03 +01:00
Unknown
a8ecffb652 Misc. typo fixes
Various workbenches
2017-12-23 14:30:30 +01:00
wmayer
2059d47e2c move encodeAttribute from Property to Persitence to avoid code duplication 2017-11-26 18:38:45 +01:00
wmayer
1673ab801e use specialized exception classes 2017-04-28 18:49:11 +02:00
Stefan Tröger
cd1c753fa2 Extensions: Implement persistence 2016-12-11 19:27:35 +01:00
wmayer
b1b5e59364 fix regression from pr334 2016-11-10 21:07:52 +01:00
Stefan Tröger
ad1cac3867 Fix PythonFeature Group persistance 2016-11-09 21:47:01 -02:00
Stefan Tröger
22fa3b3922 Extension: Fix order-of-initialisation crash
FreeCADs property system utilises some pointer math to calculate the offset between
property and base class. Due to virtual inheritance of th ePropertyContainer the memory
layout has been changed to rather random, which has lead to crashes dependend on the
order of object initialisation.

The solution is to not make PropertyContaner virtual but a class below, Base::Persitance.
Then the memory layout is random for Persistance, but it is perfectly aligned for the
base class chains from PropertyContainer onwards as well as from Extension onwards.
Hence the proeprty system was changed to take the offset always from those two.
2016-10-08 12:48:34 +02:00
wmayer
7c359b7b30 + handle exceptions when restoring dynamic properties 2015-12-21 18:24:12 +01:00
wmayer
c159a8ddc2 + fix inconsistencies in using DynamicProperty class 2015-11-17 12:22:07 +01:00
wmayer
ba21766096 + property editor handles case when dynamic property is removed 2015-11-16 15:24:36 +01:00
wmayer
d71d8943cb + handle single quote when writing XML 2015-07-30 11:52:50 +02:00
wmayer
cc775f9254 + fix -Wnull-conversion, -Woverloaded-virtual, -Wlogical-not-parentheses, -Wsometimes-uninitialized 2014-08-26 19:14:13 +02:00
wmayer
020181a96c + Fix typo 2013-12-30 12:57:08 +01:00
wmayer
b8eb776179 + Do not write transient properties of Python feature classes to project file 2013-11-24 17:08:28 +01:00
wmayer
77144681ef Allow to remove user-defined properties 2012-11-04 13:24:22 +01:00
wmayer
120ca87015 + unify DLL export defines to namespace names
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5000 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-10 13:44:52 +00:00