Topic of this thread has changed, so I renamed the thread.
The old title was "How to add python modules to App/Gui?" --DeepSOIC
Hi!
When developing smart visibility in sketch edit, I decided to re-use TempoVis python module I made for AttachmentEditor.
TempoVis is a simple Python module that remembers visibility states of objects that were shown/hidden via its interface, and restores the original visibilities when the TV is deleted (or .restore() method is called explicitly). For Sketcher, I extended it to be able to save/restore camera as well.
It kind of feels funny to make Sketcher dependent on AttachmentEditor, although there is nothing fundamentally wrong with it, since sketcher depends on Part and attachment editor is in Part anyway.
But then came @sliptonic and said he wants to add something like in Path. Path also depends on Part, but you know.. it's a matter of time when someone would want this functionality from a module that does not depend on Part.
So, the module probably needs to be moved to more appropriate place. Somewhere in Gui, in proximity to GuiDocument... There are no Python modules in FreeCAD core I'm aware of, and I don't know how to add one, and where should it be written during build/install.
An alternative option may be to reimplement the module in C++, and make python binding. I'm not very wanting to do this, as Python gives a lot of convenience (e.g. I can easily test of object has Visibility property, and skip it if it doesn't). Another downside is that the module will probably swell by 3-5 times in size. The up side it will be easier to use from within C++ (but I had almost no trouble using Python TempoVis from Sketcher).
Opinions?