Skip to content

Instantly share code, notes, and snippets.

@michaeltrainor
Created September 5, 2017 10:38
Show Gist options
  • Save michaeltrainor/27522ec94977d04de6fb9ad5e71d2c03 to your computer and use it in GitHub Desktop.
Save michaeltrainor/27522ec94977d04de6fb9ad5e71d2c03 to your computer and use it in GitHub Desktop.
# third party libraries
import pymel.core as pm
from PySide import QtGui
menus = [i for i in sorted(pm.lsUI(menus=True)) if isinstance(i.getParent(), pm.ui.Window) and isinstance(i, pm.ui.Menu)]
for i in sorted(menus):
if i.shortName() == "Test":
i.delete()
test = pm.menu("Test", parent=pm.MelGlobals()["gMainWindow"]).asQtObject()
class Section(QtGui.QWidgetAction):
def __init__(self, title, parent=None):
super(Section, self).__init__(parent)
self.setText(title)
self.setSeparator(True)
test.addAction(Section("Bar", test))
test.addMenu("FOOBAR")
test.addAction(Section("Fizz", test))
test.addMenu("FIZZBAZZ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment