def __init__(self, human): super(HumanObjectSelector, self).__init__() self.human = human self._selected = 'skin' self.layout = gui.QtGui.QGridLayout(self) self.objectSelector = [] self.humanBox = gui.GroupBox('Human') self.layout.addWidget(self.humanBox) self.skinRadio = self.humanBox.addWidget( gui.RadioButton(self.objectSelector, "Skin", selected=True)) self.skinRadio.selectionName = 'skin' for pType in proxy.SimpleProxyTypes: self._addSelectorItem(pType.lower(), pType, self.humanBox, False) @self.skinRadio.mhEvent def onClicked(event): if self.skinRadio.selected: self.selected = 'skin' self.callEvent('onActivate', self.selected) self.humanObjectCount = len(self.objectSelector) self.clothesBox = gui.GroupBox('Clothes') self.layout.addWidget(self.clothesBox)
def _addSelectorItem(self, selectionName, label, parentWidget, isSelected = False): radioBtn = parentWidget.addWidget(gui.RadioButton(self.objectSelector, label, selected=isSelected)) radioBtn.selectionName = selectionName @radioBtn.mhEvent def onClicked(event): for radio in self.objectSelector: if radio.selected: self.selected = radio.selectionName log.debug( 'Selected clothing "%s" (%s)' % (radio.text(), radio.selectionName) ) self.callEvent('onActivate', self.selected) return