While in part design-sketcher I want to add a close button to a macro, this would be the close button in sketcher-comboview-tasks. Is there a way to signal the close button is pressed?
Thanks
Code: Select all
mw = FreeCADGui.getMainWindow()
dw= mw.findChildren(QtGui.QDockWidget)
for i in dw:
if i.objectName() == "Combo View":
tab = i.findChild(QtGui.QTabWidget)
tab.setCurrentIndex(0)
You can greatly simplify :
Code: Select all
FreeCADGui.getMainWindow().findChild(QtGui.QDockWidget, "Combo View").findChild(QtGui.QTabWidget).setCurrentIndex(0)
Code: Select all
>>> FreeCADGui.getMainWindow().findChild(QtGui.QDockWidget, "Combo View").findChild(QtGui.QTabWidget).setCurrentIndex(0)
Traceback (most recent call last):
File "<input>", line 1, in <module>
NameError: name 'QtGui' is not defined
Code: Select all
import FreeCAD
import FreeCADGui
import time
from pivy import coin
import FreeCAD as App, FreeCADGui
from PySide import QtGui,QtCore
Code: Select all
from PySide import QtGui
Using the list of imports and executing this line I get no error and FreeCAD switches the tab in ComboView from Tasks to Model. The Sketch stays in edit mode in Sketcher.openBrain wrote: ↑Tue Nov 12, 2019 6:03 pmCode: Select all
FreeCADGui.getMainWindow().findChild(QtGui.QDockWidget, "Combo View").findChild(QtGui.QTabWidget).setCurrentIndex(0)