Using Maya's color scheme on stand alone PyQt apps?

790 views
Skip to first unread message

Panupat Chongstitwattana

unread,
Jan 21, 2012, 10:36:58 PM1/21/12
to python_in...@googlegroups.com
Is there a way to do this? I'm thinking about the nice dark color scheme of Maya 2011+.

Ravi Jagannadhan

unread,
Jan 22, 2012, 9:57:50 AM1/22/12
to python_in...@googlegroups.com, python_in...@googlegroups.com
I think that color is all 42s for RGB (assuming you meant the window colour)....

"Where we have strong emotions, we're liable to fool ourselves" - Carl Sagan.

On Jan 21, 2012, at 7:36 PM, Panupat Chongstitwattana <panu...@gmail.com> wrote:

Is there a way to do this? I'm thinking about the nice dark color scheme of Maya 2011+.

John Patrick

unread,
Jan 22, 2012, 4:10:24 PM1/22/12
to python_in...@googlegroups.com, python_in...@googlegroups.com
Not in front of a machine so I can't try myself, but the style() method of Maya's Qapplication may give you what you need.  You can then set the style of the standalone qapplication with setStyle

You get the current qapplication instance with the instance() class method of QtGui.QApplication

JP
Sent from my iPhone

On Jan 21, 2012, at 7:36 PM, Panupat Chongstitwattana <panu...@gmail.com> wrote:

Is there a way to do this? I'm thinking about the nice dark color scheme of Maya 2011+.

--

Ricardo Viana

unread,
Jan 22, 2012, 5:58:28 PM1/22/12
to python_in...@googlegroups.com
Yes. I used setStyleSheet('background-color: rgb(42,42,42);color: rgb(255,255,255)')

Best regards
Ricardo Viana

On Jan 22, 2012, at 3:36 AM, Panupat Chongstitwattana <panu...@gmail.com> wrote:

Is there a way to do this? I'm thinking about the nice dark color scheme of Maya 2011+.

--

Panupat

unread,
Jan 23, 2012, 10:04:29 AM1/23/12
to python_inside_maya
Thanks everyone. I was hoping Maya would store the stylesheet
somewhere I could reuse. But I guess setting the colors myself would
do :)

So far from Photoshop color picking

* {
background-color: rgb(64,64,64)
color: rgb(200,200,200)
}

:disabled {
color: rgb(96,96,96)
}

most text fields do have background of 48,48,48

best regard,
Panupat C.


On Jan 23, 5:58 am, Ricardo Viana <cgolhei...@gmail.com> wrote:
> Yes. I used setStyleSheet('background-color: rgb(42,42,42);color: rgb(255,255,255)')
>
> Best regards
> Ricardo Viana
>

John Patrick

unread,
Jan 23, 2012, 3:25:10 PM1/23/12
to python_in...@googlegroups.com
If you wanted to get a perfect match, you could build some functions like this:

from PyQt4 import QtGui
groups = ['Disabled', 'Active', 'Inactive', 'Normal']
roles = ['Window',
        'Background',
        'WindowText',
        'Foreground',
        'Base',
        'AlternateBase',
        'ToolTipBase',
        'ToolTipText',
        'Text',
        'Button',
        'ButtonText',
         'BrightText']


def getPaletteInfo():
    palette = QtGui.QApplication.palette()
    #build a dict with all the colors
    result = {}   
    for role in roles:
        for group in groups:
            qGrp = getattr(QtGui.QPalette, group)
            qRl = getattr(QtGui.QPalette, role)
            result['%s:%s' % (role, group)] =  palette.color(qGrp, qRl).rgba()
    return result
       
def setPaletteFromDct(dct):
    palette = QtGui.QPalette()
    for role in roles:
        for group in groups:
            color = QtGui.QColor(dct['%s:%s' % (role, group)])
            qGrp = getattr(QtGui.QPalette, group)
            qRl = getattr(QtGui.QPalette, role)
            palette.setColor(qGrp, qRl, color)
    QtGui.QApplication.setPalette(palette)


You could pickle out the dct you get in maya and use the other function to set it in the standalone app
JP
--
John Patrick
404-242-2675
jspa...@gmail.com
http://www.canyourigit.com

zhang jian

unread,
Jan 22, 2012, 3:35:03 AM1/22/12
to python_in...@googlegroups.com
You should use style/styleSheet to your app,

zhang

On Sun, Jan 22, 2012 at 11:36 AM, Panupat Chongstitwattana <panu...@gmail.com> wrote:
Is there a way to do this? I'm thinking about the nice dark color scheme of Maya 2011+.

--
Reply all
Reply to author
Forward
0 new messages