How to find all existing xpm/png icon names come with maya after 2011 ?


#1

Hi all, i want to find all the xpm icons bundled with maya. i know that after maya 2011, they decided to use .png icons. and i found parts of icons in maya2011/icons folder, but i can’t find all the icons ( pre-2011, the xpm icons are in maya200*/bin/mayaRes.dll )

in 2011 2012 2013, i can’t find where cube.xpm is . ( or sphere.xpm etc)
how do i find all the names of these icons ?
( i know that part of the icons previously found in mayaRes.dll now shows in maya201*/icons folder as xpms (linux) or pngs(windows) )

is there a cube.xpm somewhere in a folder or in a dll file ( windows) ? and on linux, where do i find all the names ?


#2
cmds.resourceManager(nameFilter="*")
this will return all the available "system" icons.
found this usage in shelf editor, in this file
/maya2012/lib/python2.6/site-packages/maya/app/general/resourceBrowser.py
    
import maya.app.general.resourceBrowser as resourceBrowser
    resBrowser = resourceBrowser.resourceBrowser()
    path = resBrowser.run()
maybe the icons are in python resource file,need to investigate more

edit:
now the question is how do i use these icons in my pyqt gui ?
i tried


 		label=QLabel()
 		label.setPixmap(QPixmap('cube.xpm'))
 
 

but it’s not working, pyqt wants an absolute path to an image file or a image in resource file.
then what shall i do?
save all the png folders to a folder then use these images ?
by using this?

cmds.resourceManager(saveAs=(resName, path))

#3

This is a month old post, but I’ll reply in case someone needs the info.
The trick is to use the prefix “:/” at the begining of an image path, to let Qt load the image file from Maya’s Qt resource.

Sample to run from the script editor:

from PySide import QtGui, QtCore
test = QtGui.QWidget()
layout = QtGui.QHBoxLayout()
test.setLayout(layout)
test.show()

icon = QtGui.QIcon(":/cube.png")
button = QtGui.QToolButton()
button.setFixedSize(24,24)
button.setIcon(icon)
button.setIconSize(QtCore.QSize(20,20))

layout.addWidget(button)


#4

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.