Extend python document observer capabilities
Extend python document observer capabilities
Hello,
for a small python project of mine I need some comprehensive document observation capabilities. This is done via document observers, however, some key things are not yet observable. Hence I implemented some additions to the current capabilities:
- Finished recompute for objects and the whole document
- Transactions: open, commit and abort
- onBeforeChange for notifications of properties that are about to be changed
- document property changes
- Add/Remove dynamic properties to objects
- New Gui document observer, for added viewproviders and changes to viewprovider properties
- Start/Finish edit mode of viewproviders
Furthermore I added testcases for all the python document observer capabilities.
Pull request:
https://github.com/FreeCAD/FreeCAD/pull/1707
Regards,
Stefan
for a small python project of mine I need some comprehensive document observation capabilities. This is done via document observers, however, some key things are not yet observable. Hence I implemented some additions to the current capabilities:
- Finished recompute for objects and the whole document
- Transactions: open, commit and abort
- onBeforeChange for notifications of properties that are about to be changed
- document property changes
- Add/Remove dynamic properties to objects
- New Gui document observer, for added viewproviders and changes to viewprovider properties
- Start/Finish edit mode of viewproviders
Furthermore I added testcases for all the python document observer capabilities.
Pull request:
https://github.com/FreeCAD/FreeCAD/pull/1707
Regards,
Stefan
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Extend python document observer capabilities
Thank you for sharing this, I see nice new possibilities.
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Extend python document observer capabilities
Nice!
Also wanted:
* aboutToSaveDocument (for save, save-as, save a copy, save on exit, but not for auto backups)
* onDocumentSaved
Also wanted:
* aboutToSaveDocument (for save, save-as, save a copy, save on exit, but not for auto backups)
* onDocumentSaved
Re: Extend python document observer capabilities
Werner merged and also considered DeepSOICs whiches. Thanks!
Re: Extend python document observer capabilities
There two further slots: slotStartSaveDocument and slotFinishSaveDocument.
In case you have to distinguish between the three save methods then:
* for saveAs you have to use slotBeforeChangeDocument or slotChangedDocument because it notifies you when the FileName property changes
* for saveCopy you can compare the passed file name with FileName. If they are different then saveCopy is invoked
In case you have to distinguish between the three save methods then:
* for saveAs you have to use slotBeforeChangeDocument or slotChangedDocument because it notifies you when the FileName property changes
* for saveCopy you can compare the passed file name with FileName. If they are different then saveCopy is invoked
Re: Extend python document observer capabilities
This document observer is becoming a pretty powerful thing... Thanks folks!
Re: Extend python document observer capabilities
Can someone with technical understanding volunteer to document this ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Extend python document observer capabilities
Opened a request on the FC Dev Blog, anyone interested in contributing ?
https://github.com/FreeCAD/FreeCAD-blog/issues/6
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Extend python document observer capabilities
Thanks!wmayer wrote: ↑Tue Oct 09, 2018 1:39 pm There two further slots: slotStartSaveDocument and slotFinishSaveDocument.
In case you have to distinguish between the three save methods then:
* for saveAs you have to use slotBeforeChangeDocument or slotChangedDocument because it notifies you when the FileName property changes
* for saveCopy you can compare the passed file name with FileName. If they are different then saveCopy is invoked