def test_optionMenuGrp(self): self.assertEqual(pm.currentParent(), self.win) self.assertEqual(pm.currentMenuParent(), None) with ui.ColumnLayout() as cl: self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), None) cmds.button() with ui.OptionMenuGrp() as m: self.assertEqual(pm.currentParent(), m) self.assertEqual(pm.currentMenuParent(), m.menu()) self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentParent(), self.win)
def test_rowGroupLayout(self): self.assertEqual(pm.currentParent(), self.win) self.assertEqual(pm.currentMenuParent(), None) with pm.textFieldButtonGrp( label='Label', text='Text', buttonLabel='Button' ) as tfbg: self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentMenuParent(), None) cmds.button() with pm.popupMenu() as m: self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentMenuParent(), m) with pm.menuItem(subMenu=1) as sm: self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentMenuParent(), sm) self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentMenuParent(), m) self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentParent(), self.win) fl = pm.formLayout() tfbg2 = pm.textFieldButtonGrp( label='Label', text='Text', buttonLabel='Button' ) self.assertEqual(pm.currentParent(), fl) with pm.columnLayout() as cl: cmds.button() with pm.popupMenu() as m: self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), m) with pm.menuItem(subMenu=1) as sm: self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), sm) self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), m) self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentParent(), fl)
def test_nestedMenu(self): self.assertEqual(pm.currentParent(), self.win) self.assertEqual(pm.currentMenuParent(), None) with ui.ColumnLayout() as cl: self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), None) cmds.button() with pm.popupMenu() as m: self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), m) with ui.MenuItem(subMenu=1) as sm: self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), sm) self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), m) self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentParent(), self.win)
def IsCurrentMenuParent(menuControl): """ Returns True if the given menu instance is the currently set parent (i.e. will be parent to any subsequently created menu items). :param menuControl: PyMel reference to a menu instance. """ return (menuControl == pm.currentMenuParent())
def test_rowGroupLayout(self): self.assertEqual(pm.currentParent(), self.win) self.assertEqual(pm.currentMenuParent(), None) with pm.textFieldButtonGrp(label='Label', text='Text', buttonLabel='Button') as tfbg: self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentMenuParent(), None) cmds.button() with pm.popupMenu() as m: self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentMenuParent(), m) with pm.menuItem(subMenu=1) as sm: self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentMenuParent(), sm) self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentMenuParent(), m) self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentParent(), self.win) fl = pm.formLayout() tfbg2 = pm.textFieldButtonGrp(label='Label', text='Text', buttonLabel='Button') self.assertEqual(pm.currentParent(), fl) with pm.columnLayout() as cl: cmds.button() with pm.popupMenu() as m: self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), m) with pm.menuItem(subMenu=1) as sm: self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), sm) self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), m) self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentParent(), fl)