I think I managed to find the macro through the links your provided (but it would be simpler to get it here).
Some remarks :
* The way you use the QT class inheritance can IMO be improved. Rather than using a base QDockWidget and having a custom UI push inside it, it would be simpler to create your own class at widget level (eg. class ALGDockWidget) that will directly inherit QDockWidget class. So you can setup a custom UI, but also custom title, ... in this single class. You can have a look how I did it
in this macro
* At the same link, you can be interested in using the
QtCore.Qt.WA_DeleteOnClose attribute. That makes the widget to be automatically deleted when closed so memory is freed.
* On L54, I'm not sure I like that your macro clears the Report view while maybe I don't want it
* On L78-88, better do
PrintXXX(str(msg) + "\n"). The way it is now, messages will never appear in the status bar because immediately overwritten by a blank line with CRLF.
* On L61-63, following code seems totally useless to me
Code: Select all
doc=FreeCAD.ActiveDocument
if doc is not None:
FreeCAD.setActiveDocument(doc.Name)
* On L69-75, the helper functions seems a bit harmful as they apply on a hard coded object. At least set object as argument. If you go for my first remark, you can (even better) integrate these functions in the class.
* On L389, your
Alg_checkInstance function seems to be dead code as never called.
* On
Alg_singleInstance function, you can directly use
findChildren(QtGui.QDockWidget, 'exportSTL') so you get a list of only instances of your widget and delete it.
* More comment in the code may be appreciated.
Voila.
This is a first quick review of the structure. If I have some more time and you're interested, I'll have a deeper look into it later.