Adverti horiz upsell
Color syntaxing the Script Editor Reporter
Color syntaxing the Script Editor Reporter
Mehdi Louala, updated 2017-04-16 11:20:08 UTC 2,312 views  Rating:
(0 ratings)
Page 1 of 5

Hi there,
As a script TD, rigger, or anybody who need to open the Maya's Script Editor, aren't you tired to scroll through tons of grey lines like these one below ? What about color syntaxing all this stuff ?

Here is a tutorial to set a PyQt class in order to override the color syntax of Maya's Script editor reporter.
The tutorial has been originally wrote for, feel free, to check the other tutorial we released :-) !


This tutorial will be a nice occasion to have a look to PyQt in a very light way, and how we can associate its strength with Maya, our aim is the following ; the Command History of Maya is a bit sickly and pale so we're going to add some colors to make it more readable.

We'll first try to identify the scriptEditor's window, then we'll manage to get the correct QTextEdit child object, finally we'll assigne a QSyntaxHighlighter to it. Regular expressions basic knowledge may be useful to create your own coloring, let's start !

Tips ; These two websites are great help if you want to learn more about regular expressions !
Online Regex Tester
Wikipedia's article


Identify our aim

So we're going to search the PyQt widget we want thank to the wrapinstance function from sip, aka wrapInstance for shiboken in completion with the wonderful class MQtUtil from OpenMayaUI in order to search inside Maya the widgets we are looking for. First let's find the Maya main window, which will be an easy shot;

Note ; The wrapInstance function needs a unique 'id' corresponding to the QWidget, and the main class of the widget, for our current example we're looking for the main window, so the class will be a QWidget

from PySide import QtCore, QtGui
from shiboken import wrapInstance
from maya.OpenMayaUI import MQtUtil
maya_win = wrapInstance(long(MQtUtil.mainWindow()), QWidget)

Fine, now we can loop through children to find the scriptEditor window, several ways of approach can be used, we're just going to find all the children which contains 'script' in their object name, I'm pretty confident this will be the case for our script Editor window =)

for child in maya_win.children():
    if 'script' in child.objectName():
        print 'CHILD => %s' % child.objectName()

One shot ! You should see something like that ;

# CHILD => scriptEditorPanel1Window 

 We now have the name of our scriptEditor window and especially the corresponding object. Our second task will be to iterate inside its numerous children to find the QTextEdit of the History. The method is quite the same as above, except we need to do this recursively in all children and children's children to find all the QTextEdit instances to get the correct object's name. We spare you the pain of the search, so the name QTextEdit we're looking for is named cmdScrollFieldReporter1, take note that this widget have a unique name, and that a number is automatically added at the end. This means we could meet cmdScrollFieldReporter4.

Thank to the wonderful class MQtUtil we can now access to the widget using the function findControl

script_stdout = wrapInstance(long(MQtUtil.findControl('cmdScrollFieldReporter1')), QTextEdit)

Considering the fact that we don't now exactly the index of the widget's name we're going to use a little while loop to find the correct occurence ;

getting the correct scriptEditor Reporter instance
i = 1
while i:
        se_edit = wrapInstance(long(MQtUtil.findControl('cmdScrollFieldReporter%i' % i)),
    except TypeError:
        i += 1

Alright ! Now we have our widget we can work on the coloring


  • lukenlow

    lukenlow said about 1 month ago:

    I was always amazed at what cool tips you give on your blog! Great post, as always!
  • stellaeden

    stellaeden said about 1 month ago:

    Content editors are utilized more in TV appears than in films and it simply needs the name says - they work with the essayists and alter the content. Jiu jitsu gi supplier
  • said 2 months ago:

    I think this is a very useful tutorial. I myself was practicing the same thing and wanted to know if it was the only way to set the color syntax for
  • aaravydv

    aaravydv said 3 months ago:

    Just make sure you are authorized right into your bing rewards dashboard represent the web browser you're using on both mobile and also PC to be able to make points.
  • morganstone

    morganstone said 6 months ago:

    Script Editors survey and bolster connections amongst Screenwriters and Producers. write my assignment cheap. They must be available at all content improvement gatherings to ensure that all gatherings share a similar vision for the venture. They likewise keep a record of any choices made.
  • alva taylor

    alva taylor said 7 months ago:

    I agree! happy wheels 2.0

Please sign up or sign in to post a comment.