Commit Graph

86 Commits

Author SHA1 Message Date
wmayer
ee0fad4c90 App: modernize C++: use default member init 2023-08-23 19:51:44 +02:00
wmayer
26f16f7410 App: modernize C++: use range-based for loop 2023-08-14 16:40:25 +02:00
0penBrain
ba25e9a82f [Core] Add possibility to set color with tuple of integers, fixes #8344 2023-02-12 18:16:59 +01:00
berniev
1cc6329eab App: use empty 2022-08-06 19:29:59 +02:00
berniev
65a356835b App: Modernise ctors dtors defs etc 2022-08-01 00:34:46 +02:00
berniev
b40de7a509 remove redundant void 2022-07-31 10:27:44 +02:00
andrea
0c4c3cc786 Remove unused code into App 2022-07-23 14:27:50 +02:00
wmayer
201f4c9a5a Core: replace PyObject_IsTrue with Base::asBoolean 2022-07-16 14:04:05 +02:00
wmayer
7db925d991 App: fix memory leaks in Enumeration class and simplify code 2022-06-25 18:18:57 +02:00
marioalexis
22763c9e4f App: Use PyObject_IsTrue in combination with conditional ternary operator 2022-06-22 19:50:03 -04:00
Chris Hennes
132a1d7e55 App: PR6497 move return statement to new line 2022-03-29 12:33:37 -05:00
wmayer
58a719e207 Base: move ILogger sub-classes to their own source files in order to reduce including stream classes in client code 2022-03-06 10:13:47 +01:00
Uwe
b4fff07d9e [App] Expression and Extension: remove unused includes 2022-02-25 18:06:57 +01:00
Uwe
c7910825a3 [App] Placement and Property: remove unused includes 2022-02-24 01:09:00 +01:00
Zheng, Lei
08cdd323b6 App: add Property::isSame() API
To compare if two property contains the same content. The default
implementation in Property uses the persistense interface to save both
properties to string and compares the content. This may not work at the
moment if the property saves content in separate file or in binary.

Various properties have cheaper implementation to direct compare their
internal values.
2021-12-21 21:41:02 -07:00
Chris Hennes
1f43b3f933 App: fix compilation of PropertyStandard.cpp during cherry-pick 2021-11-14 20:45:09 -06:00
Zheng, Lei
72ae26dfee App/Gui: improve expression binding of PropertyEnumeration
The enumeration items are exposed through sub path '.Enum'. When
'ShowAll' is enabled in property view, this sub path is exposed as a
sub property item named 'Enum', and can be either manually edited or
bound with an expression.
2021-11-14 20:45:09 -06:00
wmayer
44e82ac3c4 App: remove some more deprecated Py2 code
and remove deprecated void from function signature and replace 0 or NULL with nullptr
2021-04-26 10:55:56 +02:00
wmayer
48b42f8355 App: add convenience methods to get minimum, maximum and step size of property constraints 2021-03-03 08:12:03 +01:00
vosk
9f72a7b406 [App] [skip ci] - Fix python new references leaking 2021-02-19 17:25:25 +01:00
luz paz
bfdffb50be App: Fix header uniformity, trailing whitespace, and doxygen headers 2020-11-19 13:38:37 +01:00
M G Berberich
6d1b292280 [PartDesign] Dynamic hole cut-types
‣ Make countersink and counterbore on metric holes freely definable by user.

‣ Fixed the Naming of M1.6, M2, M2.5 and M3.5

‣ Added constructor for custom enums from Enums to PropertyEnumeration

‣ Put definitions of cut-types (counterbore/countersink) for
  screwtypes into json-files for easy modification.

‣ Allow users to put its own definitions in json-files in
  [UserDir]/Mod/PartDesign/Resources/Hole

‣ Contains several examples of cut-type definition json-files that are
  propably not production-ready.

This uses a local copy of nlohmann::json¹ to read json-files.

__________
¹ This is a very nice,header-only C++ library under the MIT License
  (https://github.com/nlohmann/json). I copied the single-file-version
  and the forward-declaration-header into …/PartDesign/App/ so no new
  dependencies arise.
2020-10-31 12:49:00 +01:00
wmayer
a29d834bd3 App: [skip ci] fix PropertyEnumeration::setEnums to avoid to produce index values out of range 2020-10-19 16:09:57 +02:00
Priit Laes
6a6a6f3d25 build: boost: Drop branches requiring boost-1.46 2020-10-13 12:56:28 +02:00
wmayer
8fcd436de1 + fix Enumeration::contains: the current index is irrelevant when searching for an entry in the enumeration
+ only print a warning if the enumeration is not empty but the restored index is < 0
2020-05-19 08:45:02 +02:00
wmayer
bdea1ec0f6 App: [skip ci] remove duplicate check 2020-05-09 16:44:08 +02:00
Zheng, Lei
9c4c8acb6e App: fix some property's setPathValue() 2020-05-09 16:36:33 +02:00
wmayer
1a3285219a App: [skip ci] handle types long and unsigned long in PropertyFloat::setPathValue() 2020-04-27 12:44:54 +02:00
Zheng, Lei
937b331802 App: fix PropertyBool::setPathValue() 2020-04-01 13:28:05 +02:00
luz.paz
4f308dc03c src/App: [skip ci] fix header uniformity
This PR fixes header uniformity across all `src/App` files
2019-12-25 11:38:43 +01:00
wmayer
b50b21576e core system
force strict ISO C++ (-Wpedantic)
TODO: still a lot of variadic macros are not valid ISO C++
2019-09-18 01:01:14 +02:00
wmayer
12e92fef31 encode keys of PropertyMap when saving as XML 2019-09-05 18:51:35 +02:00
Zheng, Lei
4f383de1f5 App: ignore unit in PropertyBool/Float/Integer
In other word, those property now accept expression result with a unit,
by ignoring it.
2019-08-30 15:50:26 +02:00
Zheng, Lei
161ad0578a 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.
2019-08-17 14:52:09 +02: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
9346d76aa2 fix bug when checking for str type in PropertyEnumeration::setPyObject 2019-04-07 12:16:18 +02:00
wmayer
6363c90a20 PVS: V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. 2019-03-08 18:56:16 +01:00
wmayer
27615abce1 implement a direct way to set single or double precision when writing/reading properties using floating point numbers 2018-10-23 19:38:03 +02:00
luz.paz
baa6d89328 Typos and whitespace fixes 2018-08-07 11:13:31 -04:00
wmayer
9faa7fc57f fix exception raised on project load for invalid enums 2018-08-07 15:23:56 +02:00
wmayer
8f19b46d26 Some fixes for PropertyEnumeration:
+ when reading an enumeration ignore negative indexes and print a warning
+ raise an exception when trying to get the current value of an invalid enumeration
2018-06-09 20:00:28 +02:00
looooo
e80b5678cc Arch: Survey: fix py3 unicode problems 2018-06-04 19:23:42 +02:00
luz.paz
051d910db9 Misc. comment typos
[skip ci]
2018-01-20 14:04:22 +01:00
Peter Lama
76474951d2 Attacher UX enhancements
- New editor for MapMode with button to open attacher dialog
- Hide attachment properties when they are not applicable
- Disable super placement ui in attacher dialog when object is not attached
- Always select used mode in mode list
2017-09-20 19:24:35 +02:00
wmayer
c4ca27ec8a allow to set constraints via Python 2017-07-16 11:09:48 +02:00
looooo
ca3e58e2f3 py3: App: files D-Z ported to python3
issue 0000995
diff to py3-branch will remain in the following files in src/App:
- ExtensionContainer.cpp
- FeaturePythonPyImp.h +.inl
most likely these files depend on Tools and Base
2017-05-11 19:19:17 +02:00
wmayer
1673ab801e use specialized exception classes 2017-04-28 18:49:11 +02:00
wmayer
b0eed05a73 Extend Py interface of PropertyStringList to accept all sequence types 2017-04-24 11:12:12 +02:00
Zheng, Lei
378f99f1b3 Added App::PropertyPrecision
The purpose of this property and the associated property item is to
properly display floating value of many decimal points, such as
Precision::Confusion()
2017-03-15 10:46:32 -03:00
wmayer
88485684a5 improve unicode support for enumeration properties 2016-11-14 15:22:21 +01:00