Rémi Deletrain
2015-03-13 17:09:28 UTC
Hello everyone,
I am trying to change the maya channelBox.
Until now addin PySide window easily.
that is my code:
____________________________________________________________________________________________________________________________________
#===========================================================================
# Import Modules
#===========================================================================
import pymel.core as pmc
from PySide import QtGui, QtCore
from shiboken import wrapInstance
from maya.OpenMayaUI import MQtUtil
#===========================================================================
# My Channel Box
#===========================================================================
class MyChannelBox(QtGui.QMainWindow):
#=======================================================================
# Init and ui
#=======================================================================
def __init__(self, parent_name=None):
parent_name = wrapInstance(long(MQtUtil.mainWindow()),
QtGui.QWidget)
super(MyChannelBox, self).__init__(parent_name)
self.setFixedSize(300, 500)
# Add Widget
self.__masterWidget = QtGui.QWidget()
self.setCentralWidget(self.__masterWidget)
# Add a layout
self.__masterLayout = QtGui.QVBoxLayout(self)
self.__masterLayout.setContentsMargins(0, 0, 0, 0)
self.__masterLayout.setSpacing(0)
self.__masterWidget.setLayout(self.__masterLayout)
# Add ChannelBox
if not pmc.channelBox('myChanelBox', exists=True):
pmc.channelBox(
'myChanelBox',
width=300,
height=500,
attrColor=(1.0, 0.0, 0.0),
attrBgColor=(1.0, 0.0, 0.0),
)
self.__popup = pmc.popupMenu()
pmc.popupMenu(
self.__popup,
edit=True,
postMenuCommand=lambda *x:
pmc.mel.generateChannelMenu(self.__popup, True)
)
channelBox_widget =
wrapInstance(long(MQtUtil.findControl('myChanelBox')), QtGui.QWidget)
self.__masterLayout.addWidget(channelBox_widget)
def main():
windowIS = MyChannelBox()
channelBox_widget =
wrapInstance(long(MQtUtil.findControl('myChanelBox')), QtGui.QWidget)
windowIS.show()
channelBox_widget.show()
____________________________________________________________________________________________________________________________________
I try to do it in pyside with shiboken wrapInstance and maya.OpenMayaUI. I
can trace the differente widget but not change the items. I wish I could
add icons or change the background color.
Has someone already done this exercise with PySide or other?
The objectif is not to transform the functionalities of the channel box but
just to change a little bit the display for my animator
I am trying to change the maya channelBox.
Until now addin PySide window easily.
that is my code:
____________________________________________________________________________________________________________________________________
#===========================================================================
# Import Modules
#===========================================================================
import pymel.core as pmc
from PySide import QtGui, QtCore
from shiboken import wrapInstance
from maya.OpenMayaUI import MQtUtil
#===========================================================================
# My Channel Box
#===========================================================================
class MyChannelBox(QtGui.QMainWindow):
#=======================================================================
# Init and ui
#=======================================================================
def __init__(self, parent_name=None):
parent_name = wrapInstance(long(MQtUtil.mainWindow()),
QtGui.QWidget)
super(MyChannelBox, self).__init__(parent_name)
self.setFixedSize(300, 500)
# Add Widget
self.__masterWidget = QtGui.QWidget()
self.setCentralWidget(self.__masterWidget)
# Add a layout
self.__masterLayout = QtGui.QVBoxLayout(self)
self.__masterLayout.setContentsMargins(0, 0, 0, 0)
self.__masterLayout.setSpacing(0)
self.__masterWidget.setLayout(self.__masterLayout)
# Add ChannelBox
if not pmc.channelBox('myChanelBox', exists=True):
pmc.channelBox(
'myChanelBox',
width=300,
height=500,
attrColor=(1.0, 0.0, 0.0),
attrBgColor=(1.0, 0.0, 0.0),
)
self.__popup = pmc.popupMenu()
pmc.popupMenu(
self.__popup,
edit=True,
postMenuCommand=lambda *x:
pmc.mel.generateChannelMenu(self.__popup, True)
)
channelBox_widget =
wrapInstance(long(MQtUtil.findControl('myChanelBox')), QtGui.QWidget)
self.__masterLayout.addWidget(channelBox_widget)
def main():
windowIS = MyChannelBox()
channelBox_widget =
wrapInstance(long(MQtUtil.findControl('myChanelBox')), QtGui.QWidget)
windowIS.show()
channelBox_widget.show()
____________________________________________________________________________________________________________________________________
I try to do it in pyside with shiboken wrapInstance and maya.OpenMayaUI. I
can trace the differente widget but not change the items. I wish I could
add icons or change the background color.
Has someone already done this exercise with PySide or other?
The objectif is not to transform the functionalities of the channel box but
just to change a little bit the display for my animator
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/0b39a7de-136a-4328-9de8-b1353bc9cb41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/0b39a7de-136a-4328-9de8-b1353bc9cb41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.