Looking for signals for New Document and Properties Changed

Need help, or want to share a macro? Post here!
Post Reply
freedman
Posts: 2237
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Looking for signals for New Document and Properties Changed

Post by freedman »

If you have a second, I searched a bunch and can't the references.

Usage: I'm running a macro and a user can change documents, I need the signal that tells me the document has changed.

Usage: I'm running a macro and a user changes Properties, I need a signal for that, I think it signals on any change of the Properties.

Here is the one for changing Workbenches if you want to trade. :)

Code: Select all

        
        mw=Gui.getMainWindow()
        mw.workbenchActivated.connect(self.wbChange)
Thanks
ickby
Posts: 3095
Joined: Wed Oct 05, 2011 7:36 am

Re: Looking for signals for New Document and Properties Changed

Post by ickby »

Dir that you need document observers. I the GUI doc observer I think I think it is this one for document change: https://github.com/FreeCAD/FreeCAD/blob ... on.h#L109

Property change is excepted by app document observers .

The way you showed in the example code is how Qt signals work. With that method you only connect to things that are provided by Qt, and hence can find in their documentation. To my knowledge freecad does not provide any custom signals.
openBrain
Posts: 6747
Joined: Fri Nov 09, 2018 5:38 pm

Re: Looking for signals for New Document and Properties Changed

Post by openBrain »

ickby wrote: Fri Jun 11, 2021 11:31 am Dir that you need document observers. I the GUI doc observer I think I think it is this one for document change: https://github.com/FreeCAD/FreeCAD/blob ... on.h#L109
For sake of precision, list of slots available for a DocumentObserver added in FreeCAD namespace is here :
https://github.com/FreeCAD/FreeCAD/blob ... h#L55-L113

And for DocumentObserver added in FreeCADGui namespace:
https://github.com/FreeCAD/FreeCAD/blob ... .h#L53-L74
freedman
Posts: 2237
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Looking for signals for New Document and Properties Changed

Post by freedman »

I need to stop doing searches and start looking more at the source code. It makes since these would be found as header files in App and GUI.
Thank you.
Post Reply