Пример #1
0
 def _addOptionToLayout(self, parent, grid, i, o, v):
     from PyQt4.QtGui import QLabel, QComboBox, QSpinBox, QLineEdit, QCheckBox
     from PyQt4.QtCore import Qt
     e = ""
     fillHorizontal = False
     choiceOptions = self._getChoiceOptions(o[0])
     if choiceOptions is not None:
         e = QComboBox(parent)
         self._initChoiceOption(o[0], e, choiceOptions, v)
     elif type(v) == types.IntType:
         e = QSpinBox(parent)
         e.setMinimum(0)
         e.setMaximum(1000000)
         e.setSingleStep(1)
         e.setValue(v)
     elif type(v) == types.BooleanType:
         e = QCheckBox(parent)
         e.setCheckState(Qt.Checked if v else Qt.Unchecked)
         fillHorizontal = True
     else:
         e = QLineEdit(v, parent)
         fillHorizontal = True
         
     grid.addWidget(QLabel(o[1]), i, 0, Qt.AlignRight)
     grid.addWidget(e, i, 1, Qt.AlignLeft if fillHorizontal is False else Qt.Alignment(0))
     self.option_widgets[o[0]] = e