PyQt UIC load supression

I’m importing the ui file using the pyQt uic load method but in Maya it prints out all of the widgets/ui elements inside of the ui file as it’s importing. Is there a way to suppress this? I’m tired of wasting 3-5sec waiting for this to print out each time I refresh the tool i’m developing.

In PyQt4/uic/properties.py and uiparser.py you can set the logging level to warning which will suppress these messages.

So, in both files add this line:

logger.setLevel(logging.WARNING)

After the line where ‘logger’ is defined obviously. I’d guess you could also suppress this by setting the root logger level to warning (I think maya sets it to info by default?) which would mean you wouldn’t have to modify PyQt source at all but I did it this way because I wanted to control it specifically on a per-module basis.

Just for completion sake:
You can do it this way too (without modify PyQt4 source code)

from PyQt4 import QtGui, QtCore, uic
import logging

uic.properties.logger.setLevel(logging.WARNING)
uic.uiparser.logger.setLevel(logging.WARNING)

[QUOTE=Jos;22366]Just for completion sake:
You can do it this way too (without modify PyQt4 source code)

from PyQt4 import QtGui, QtCore, uic
import logging

uic.properties.logger.setLevel(logging.WARNING)
uic.uiparser.logger.setLevel(logging.WARNING)

[/QUOTE]

Nice Jos! :slight_smile:

copy
paste

Thanks for the post!