Python feature/observer related changes

* Add new API and signal handler in document observer

* Pre initialize python handler function to improve performance. In
  case Python code use dynamic patching, i.e. add class method at
  runtime (which is rare and should be discouraged), the python feature
  can be re-initialized by simply assign proeprty Proxy again.

* Add property tracking in DocumentObjectT

* WidgetFactory adds support for accepting python QIcon, which is used
  by ViewProviderPythonFeature
This commit is contained in:
Zheng, Lei
2019-07-11 13:57:53 +08:00
committed by wmayer
parent f7edaabe43
commit ad57821cf9
12 changed files with 1875 additions and 950 deletions

View File

@@ -76,16 +76,25 @@ private:
static std::vector<DocumentObserverPython*> _instances;
typedef boost::signals2::connection Connection;
Connection connectApplicationCreatedDocument;
Connection connectApplicationDeletedDocument;
Connection connectApplicationRelabelDocument;
Connection connectApplicationRenameDocument;
Connection connectApplicationActivateDocument;
Connection connectDocumentCreatedObject;
Connection connectDocumentDeletedObject;
Connection connectDocumentChangedObject;
Connection connectDocumentObjectInEdit;
Connection connectDocumentObjectResetEdit;
#define FC_PY_GDOC_OBSERVER \
FC_PY_ELEMENT(CreatedDocument,_1) \
FC_PY_ELEMENT(DeletedDocument,_1) \
FC_PY_ELEMENT(RelabelDocument,_1) \
FC_PY_ELEMENT(RenameDocument,_1) \
FC_PY_ELEMENT(ActivateDocument,_1) \
FC_PY_ELEMENT(CreatedObject,_1) \
FC_PY_ELEMENT(DeletedObject,_1) \
FC_PY_ELEMENT(ChangedObject,_1,_2) \
FC_PY_ELEMENT(InEdit,_1) \
FC_PY_ELEMENT(ResetEdit,_1)
#undef FC_PY_ELEMENT
#define FC_PY_ELEMENT(_name,...) \
Connection connect##_name;\
Py::Object py##_name;
FC_PY_GDOC_OBSERVER
};
} //namespace Gui