Commit Graph

36 Commits

Author SHA1 Message Date
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
Yorik van Havre 4f5e304d64 Fixed wrong encoding in App.openTransaction 2018-05-21 12:11:46 -03:00
wmayer 09737f2db3 rename method from remObject to removeObject to be more readable 2017-09-13 18:57:38 +02:00
Stefan Tröger ab85c6e784 Make InList hadling and topological sort more robust. fixes #0002871 2017-09-09 16:47:07 +02:00
wmayer 033242ead8 protect document against nested recomputes
+ convert ObjectStatusLocker into a template class to make its usage more flexible
+ add status flag 'Recomputing' and set in Document::recompute to detect and avoid nested calls of recompute
2017-07-17 18:24:10 +02:00
wmayer 619fb173df fix crash when argument list of openTransaction() is empty 2017-06-18 16:20:12 +02:00
wmayer b77d8cac4f minor fixes for pr749 2017-05-11 19:47:54 +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
DeepSOIC 03f9d8121f App: expose recompute controlling to Python
Add readable-writeable attribute "RecomputesFrozen" to DocumentObject.
2017-03-26 14:45:20 +02:00
wmayer 72c7a8ab00 change old DAG implementation to pass unit tests 2017-01-22 17:03:59 +01:00
wmayer db0fe5b200 change old DAG implementation to pass unit tests 2017-01-22 15:32:31 +01:00
Stefan Tröger 4f8e046f7f DAG: Fix preprocessor definition inconsistencies 2017-01-21 19:15:36 +01:00
Stefan Tröger d9adc9cd6c DAG: Add document graph recompute test 2017-01-21 19:15:36 +01:00
Stefan Tröger 665eb63d4c DAG: Change object graph handling to be bidirectional 2017-01-21 19:15:36 +01:00
wmayer 05a25967bd convert utf-8 encoded path name to escaped unicode when saving document with Python 2016-09-12 20:58:41 +02:00
wmayer f37b70b141 fix accessing freed memory in DocumentPy::openTransaction 2016-09-07 13:00:20 +02:00
Yorik van Havre 9e75213c92 Document.openTransaction() now accepts unicode 2016-03-22 12:20:58 -03:00
wmayer e9594501dd + use dedicated exception classes for expression and parsing errors 2015-09-27 23:17:33 +02:00
Mateusz Skowroński 43a4a5938c Fix files encoding. Go from ISO8859-1 to UTF-8. 2015-09-21 19:50:49 -03:00
wmayer 7d09444dd9 + fixes #0001237: the project file is not saved when the /tmp directory is full, but the user is not aware of it 2015-09-19 18:59:22 +02:00
Yorik van Havre da2c497671 Added SaveCopy command
This command saves a copy of the current document under a new name,
without modifying the document itself.

Available in menu File -> Save a Copy or from python with
FreeCAD.ActiveDocument.saveCopy(filename)
2015-09-02 13:38:14 -03:00
wmayer 11239b034c + always keep digits at end when using copyObject, remove deprecated third parameter 2015-04-29 16:33:20 +02:00
wmayer c02590c666 + support of merging projects on App level 2014-12-07 00:38:53 +01:00
wmayer a96f390097 + fix build problems with Python & MacOSX 2014-10-13 22:02:57 +02:00
Sebastian Hoogen ed66ada1cf issue #1700 replace PyExc_Exception 2014-09-17 11:15:57 +02:00
wmayer f62ff52302 + fixes #0001501: Add Ability to Export Dependency Graph as SVG and PNG 2014-04-07 14:26:43 +02:00
wmayer 3153ccd8b2 + Add method load() to Document class in Python 2013-11-22 17:53:31 +01:00
wmayer 2bbe465229 + Make transient directory of the form ExeName_Doc_{UUID}_{HASH}_{PID}
+ Set some properties in Document read-only

+ Implement Document::saveAs

+ Fix PropertyUUID::setValue()

+ Add a field for UUID in document information panel
2013-05-04 03:16:34 +02:00
wmayer 41da5e95e3 0001071: addObject with four arguments does not return the DocumentObject 2013-03-28 21:33:39 +01:00
wmayer 0ebffa930a Do not pass 0 to PyObject_IsTrue 2012-12-30 23:16:56 +01:00
wmayer 1b345c193e Use PyObject_IsTrue to check argument 2012-12-29 15:59:54 +01:00
wmayer 9170bfe045 Export object dependencies to graphviz file 2012-06-12 19:03:29 +02:00
wmayer f19a0d20da Add parameter to keep trailing digits in object name of copy, other little fix 2012-05-25 12:12:30 +02:00
wmayer c1f8018a12 Add method Document::findObject() 2012-05-23 16:57:36 +02: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