22 lines
971 B
Plaintext
22 lines
971 B
Plaintext
import os, sys, json, traceback
|
|
import FreeCAD as App
|
|
import FreeCADGui as Gui
|
|
from PySide import QtCore
|
|
ROOT = os.path.abspath(os.environ.get('QI_ROOT') or os.getcwd())
|
|
|
|
def run_probe():
|
|
result = {'version': App.Version(), 'workbenches': list(Gui.listWorkbenches()), 'errors': []}
|
|
for name in ('PartWorkbench', 'PartDesignWorkbench', 'SketcherWorkbench', 'AssemblyWorkbench', 'TechDrawWorkbench', 'DraftWorkbench'):
|
|
try:
|
|
wb = Gui.getWorkbench(name)
|
|
result[name] = {'initialize': hasattr(wb, 'Initialize'), 'class': str(type(wb))}
|
|
Gui.activateWorkbench(name)
|
|
except Exception:
|
|
result['errors'].append(traceback.format_exc())
|
|
result['commands'] = list(Gui.listCommands())
|
|
with open(os.path.join(ROOT, 'artifacts', 'probe.json'), 'w', encoding='utf-8') as f:
|
|
json.dump(result, f, ensure_ascii=False, indent=2)
|
|
Gui.getMainWindow().close()
|
|
|
|
QtCore.QTimer.singleShot(1500, run_probe)
|