Hey guys,
When running an import, say of a 2 gb file, there is a progress bar lurking in the Help panel. Does anyone know how to tap into that one?
E.g.
import time
import threading
import maya.cmds
import maya.utils
path = r'/home/big_file.ma'
def thread():
maya.utils.executeInMainThreadWithResult(maya.cmds.file, path, i=True)
thread = threading.Thread(target=thread)
thread.daemon = True
thread.start()
# I'm looking for this one, to give me
# updates on progress, so that I can use it
# in a GUI.
progress = None
# Example use
while progress:
print progress.value
time.sleep(0.1)
print "Done"
Best,
Marcus
import maya.OpenMayaUI as mui
from PySide import QtGui
import shiboken
ptr = mui.MQtUtil.mainWindow()
win = shiboken.wrapInstance(long(ptr), QtGui.QWidget)
prog = win.findChild(QtGui.QProgressBar)
print prog.objectName()
def print_progress(val):
print "Progress!", val
prog.valueChanged.connect(print_progress)