def populateButtons(self): """ Create taurus commandbuttons for everything in modelcommand """ for modelcommand in self._modelcommands: button = TaurusCommandButton(self.frame) button.setCommand(modelcommand['command']) if 'model' in modelcommand: button.setModel(modelcommand['model']) else: button.setUseParentModel(True) if 'customtext' in modelcommand: button.setCustomText(modelcommand['customtext']) if 'dangermessage' in modelcommand: button.setDangerMessage(modelcommand['dangermessage']) if 'parameters' in modelcommand: button.setParameters(modelcommand['parameters']) if 'timeout' in modelcommand: button.setTimeout(modelcommand['timeout']) self.connect(button, Qt.SIGNAL('commandExecuted'), self.onCommandExectued) # Make button expand vertically button.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.frame.layout().addWidget(button) self._buttons.append(button)
class YAGScreenTVWriteWidget(TaurusWidget): def __init__(self, *args): TaurusWidget.__init__(self, *args) self.setLayout(QtGui.QHBoxLayout()) self.layout().setMargin(0) self.moveInButton = TaurusCommandButton(self) self.moveInButton.setUseParentModel(True) self.moveInButton.setCommand('MoveIn') self.moveInButton.setCustomText('Move In') self.moveOutButton = TaurusCommandButton(self) self.moveOutButton.setUseParentModel(True) self.moveOutButton.setCommand('MoveOut') self.moveOutButton.setCustomText('Move Out') self.layout().addWidget(self.moveInButton) self.layout().addWidget(self.moveOutButton)