Commit Graph

179 Commits

Author SHA1 Message Date
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
Zheng, Lei
ff1d1cd341 App: add New APIs for future Link function
DocumentObject:

* getSubObject(): the most important API for Link to work with
  hierarchies. The function is a inspired from and replaces the
  getPySubObjects(). It returns a child object following a dot separated
  subname reference, and can optionally return accumulated
  transformation, and/or a python object of the refered
  sub-object/element. The default implementation here is to look for
  link type property, and search for the referenced object. This patch also
  include other specialized implementation of this API, such as
  (GeoFeature)GroupExtension (through extensionGetSubObject()),
  PartDesign::Body, and so on. A link type object is expected to
  call the linked object's getSubObject() for resolving.

* getSubObjectList(): helper function to return a list of object
  referenced in the given subname.

* getSubObjects(): return a list of subname references of all children
  objects. The purpose of this function is similar to
  ViewProvider::claimChildren().  Container type object is expected to
  implement this function.  The reason it returns subname references
  instead of just object is to allow the container to skip hierarchies.
  For example, the Assembly3 container uses this to skip the constraint
  and element group.

* getLinkedObject(), obtain the linked object, and optionally with the
  accumulated transformation. It is expected to return a linked object
  or the object itself if it is not a link. In case there are multiple
  levels of linking involved, this function allows the caller to retrieve
  the linked object recursively.

* hasChildElement(), set/isElementVisible(), controls the children
  visibility for a group type object. Because the child object may be
  claimed by other objects, it is essential to have independent control
  of children visibilities. These APIs are designed to abstract how
  group manages the child visibility. For performance reason, these
  function are meant to control only the immediate child object.

* resolve(), helper function to parse subname reference and resolve the
  final object, and optionally the immediate parent of the final object,
  the final object reference name (for calling `set/isElementVisible()`),
  and the subname reference if there is one.

* touch(), add optional argument 'noRecompute' for better backward
  compatibility with the NoRecompute flag. By default, touch() causes
  recompute unless noRecompute is true

* signalChanged/signalBeforeChange, two new signal for tracking changes
  of a specific object.

* getViewProviderNameOverride(), return a string of the view provider
  type of this object. This allows Python class to override the view
  provider of an object. This feature will be used by ViewProviderLink
  which is designed to work with any object that has LinkBaseExtension.

* canLinkProperties(), will be used by Gui::PropertyView to display
  linked object properties together with the object's own properties.

* redirectSubname(), will be used by Gui::Tree to allow an object to
  redirect selection to some other object when (pre)selected in the tree
  view.

* Visibility, new property serve as the same purpose as view provider
  property of the same name. It is added here so that App namespace
  code can check for visibility without Gui module. This is useful,
  for example, when constructing a compound shape of a container that
  respects the children visibility.

* (has)hasHiddenMarker(), return or check for a special sub-element
  name used as marker for overriding sub-object visibility. Will be
  used by Gui::ViewProvider, it is put here for the same reason as
  adding Visibility property.

* getID(), return object internal identifier. Each object is now
  assigned an integer identifier that is unique within its containing
  document.

Document:

* ShowHidden, new property to tell tree view whether to show hidden
  object items.

* signalTouchedObject, new signal triggered when manually touch an
  object when calling its touch() function

* getObjectByID(), get object by its identifier

* addObject() is modified to allow overriding view provider

* has/getLinksTo(), helper function to obtain links to a given object.

Application:

* checkLinkDepth(), helper function to check recursive depth for link
  traversal. The depth is checked against the total object count of
  all opened documents. The count (_objCount) is internally updated
  whenever object is added or removed.

* has/getLinksTo(), same as Document::has/getLinksTo() but return links
  from all opened documents.

GroupExtension/OriginGroupExtension/DatumFeature/DatumCS/Part::Feature:
implement sepcialized getSubObject/getSubObjects().
2019-08-17 14:52:08 +02:00
Zheng, Lei
59417068f5 Base: improve exception
For better FC and Python exception mapping.
2019-08-17 14:52:08 +02:00
wmayer
8be5217976 For divide-by-zero issues write an error message intead of raising an exception 2019-06-20 14:43:16 +02:00
wmayer
4e4631707e Fix crash in case encoding of Python paths fails 2019-06-19 17:31:50 +02:00
wmayer
1406c03d18 fixes #0004000: Ability to suppress console output when running under python 2019-06-13 15:46:49 +02:00
luz.paz
0238906d38 Misc. typo and whitespace fixes
Found via `codespell`
2019-04-30 10:15:59 -03:00
joha2
106d3461f9 FreeCAD: Application: removed banner in Cmd RunMode 2019-03-31 11:27:14 +02:00
wmayer
2ccffbe406 fix -Winconsistent-missing-override 2019-02-28 22:55:46 +01:00
wmayer
1e343d339f PVS: V779 Unreachable code detected. It is possible that an error is present. 2019-02-17 20:12:56 +01:00
Abdullah Tahiri
a27e333852 Missing ExceptionProducer init for RestoreError 2018-11-27 13:23:44 -03:00
wmayer
7ceac311b3 add specialized exception type for bad graphs 2018-11-26 14:15:19 +01:00
wmayer
ddb20468ad some additions to pR 1794:
add a special XMLAttributeError class to indicate an error when accessing a missing attribute
in PropertyContainer::Restore make error handling more flexible
2018-11-19 19:07:56 +01:00
wmayer
f898eafd64 move from deprecated boost.signals to boost.signals2 library 2018-10-30 19:09:03 +01:00
wmayer
907cdb8fa0 add module for Qt translation stuff 2018-10-28 12:58:14 +01:00
wmayer
be586d089e improve whitespaces 2018-10-24 19:41:21 +02:00
wmayer
a53027342e rework error handling mechanism 2018-10-24 19:38:43 +02:00
wmayer
dc023afc84 emit signal when starting and finishing to save a document 2018-10-08 14:03:00 +02:00
wmayer
4ac34d06a8 minor fixes 2018-10-08 12:27:03 +02:00
ickby
f68e36de41 Expose document property changes to python document observer 2018-10-08 11:01:07 +02:00
ickby
238c8a8567 Expose onBeforeChange to python document observer 2018-10-08 10:52:52 +02:00
Stefan Tröger
0edf6892b3 Expose transaction events to document observer 2018-10-08 10:49:39 +02:00
Stefan Tröger
2a15d8fc3a Add signals for recomputed objects 2018-10-08 10:43:32 +02:00
luz.paz
b214f606c4 Misc. typo and whitespace fixes
ref: https://forum.freecadweb.org/viewtopic.php?f=3&t=30988#p256964
along with other misc. fixes
2018-09-19 17:26:03 +02:00
wmayer
189a729027 extend QuantityFormat to set denominator independent of user settings 2018-09-17 12:38:46 +02:00
hokieengr
77060a75a6 Added support for fractional inch user setting. 2018-09-17 10:32:04 +02:00
wmayer
3386567d99 issue #0003588: The path to the Addons does not allow special characters 2018-09-13 21:40:30 +02:00
wmayer
b79e1bfee4 get rid of private function _PyImport_FixupBuiltin for FreeCAD and FreeCADGui modules 2018-09-01 19:57:15 +02:00
wmayer
8c08635d30 get rid of private function _PyImport_FixupBuiltin for __FreeCADBase__ module 2018-09-01 16:26:18 +02:00
wmayer
3d70f9ed4f number of used decimals in UnitsApi must already be set when initializing App 2018-08-29 23:35:38 +02:00
wmayer
34172c851c improve handling as library if used by another application 2018-08-09 17:01:46 +02:00
wmayer
2e4d2dff03 fix possible UNICODE related build failure due to OCCT cmake flags 2018-08-06 12:29:43 +02:00
wmayer
b298e63bcc + implement direct and queued mode in console class 2018-07-25 17:25:32 +02:00
luz.paz
6e64b4f75d Misc. typos 2018-05-19 12:06:34 -04:00
luz.paz
505488c4f9 Misc. typos
Found via `codespell`
2018-04-25 09:41:33 -03:00
wmayer
b440dc830b behave like standard Python interpreter in console mode if no file name is passed 2018-04-21 16:42:54 +02:00
looooo
428f2555c2 py3: make __FreeCADBase__ importable
https://forum.freecadweb.org/viewtopic.php?f=10&t=12534&start=510#p220765
2018-03-30 11:28:15 +02:00
luz.paz
11b8f91c5d Misc. typos 2018-01-27 19:43:18 +01:00
Unknown
a8ecffb652 Misc. typo fixes
Various workbenches
2017-12-23 14:30:30 +01:00
wmayer
1cfae464b4 issue #0002973: Path to FreeCAD.app can't contain unicode 2017-12-02 19:37:05 +01:00
wmayer
3b479e00c2 allow to set console and unit test option without overriding each other
start unit tests in command line mode because the python pivy package is missing
2017-10-10 20:40:09 +02:00
luzpaz
ab8f8919b6 Misc. typos
+ some are doxy others are just comment code.  
+ some minor whitespace and grammatical tweaks. 
+ app/SCL/* typos have also been submitted upstream (https://github.com/stepcode/stepcode/pull/366). So it's ok to merge them in to master.
2017-10-04 17:59:11 +02:00
Stefan Tröger
987a5b36b9 Create special scope properties 2017-09-09 16:47:07 +02:00
Eivind Kvedalen
f8a76066da Added PropertyPosition and PropertyDirection classes. Basically PropertyVector classes with units. 2017-07-23 22:14:05 +02:00
Markus Hovorka
fc36dfed0d Add TextDocument with full size editor
A new document object App::TextDocument. It has a property Text which
holds the text of the document as a string. This commit also contains a
full size editor based on QPlainTextEdit. It can only be used by the
TextDocument and has a read only mode invoked for read only documents
(ReadOnly property set to true). The editor is invoked by a double
click on the TextDocument.
2017-07-04 19:36:10 +02:00
wmayer
654276c49d fix issues in CoordinateSystem class and expose to Python 2017-06-20 21:22:59 +02:00
wmayer
8ce343291b py3: fox compiler warnings
issue 0000995
2017-06-04 00:17:57 +02:00
Zheng, Lei
a6abf0b25a Console: added tag based log support 2017-05-13 17:46:38 +02:00
Abdullah Tahiri
ea725a8b7a Register exception producers in Application 2017-05-13 15:27:57 +02:00
Yorik van Havre
0d033757ae py3: App: files A-C ported to python3 2017-05-10 20:49:10 +02:00