コード例 #1
0
    def __init__(self,
                 options,
                 title='Checkboxes',
                 selected_indexes=[],
                 parent=None):
        super(CheckBoxGroup, self).__init__()
        self.setTitle(title)
        self.setLayout(QVBoxLayout())
        self._button_group = QButtonGroup()
        self._button_group.setExclusive(False)
        self._options = options
        if parent == None:
            parent = self

        for (button_id, option) in enumerate(self._options):

            checkbox = QCheckBox(option.get('title', 'option %d' % button_id))
            checkbox.setEnabled(option.get('enabled', True))
            checkbox.setChecked(button_id in selected_indexes)
            checkbox.setToolTip(option.get('tooltip', ''))

            self._button_group.addButton(checkbox, button_id)
            parent.layout().addWidget(checkbox)
            if 'description' in option:
                parent.layout().addWidget(QLabel(option['description']))
コード例 #2
0
 def _add_parameter(self, param):
     key = QTableWidgetItem(param.key)
     key.setFlags(key.flags() & ~Qt.ItemIsEditable)
     row = self.skill_params_table.rowCount()
     self.skill_params_table.insertRow(row)
     #row = row-1
     self.skill_params_table.setItem(row, 0, key)
     if param.dataTypeIs(bool):
         cbox = QCheckBox()
         if param.hasSpecifiedDefault():
             cbox.setChecked(param.default)
         self.skill_params_table.setCellWidget(row, 1, cbox)
     elif param.dataTypeIs(Element):
         combobox = QComboBox()
         self.skill_params_table.setCellWidget(row, 1, combobox)
         matches = self._wmi.resolve_elements(param.default)
         if param.paramTypeIs(ParamTypes.Optional):
             combobox.addItem("", None)
         for e in matches:
             combobox.addItem(e.printState(), e._id)
     else:
         lineedit = QLineEdit()
         if param.isSpecified():
             lineedit.setText(str(param.value))
         self.skill_params_table.setCellWidget(row, 1, lineedit)
コード例 #3
0
    def __init__(self, options, title='Checkboxes', selected_indexes=[], parent=None):
        super(CheckBoxGroup, self).__init__()
        self.setTitle(title)
        self.setLayout(QVBoxLayout())
        self._button_group = QButtonGroup()
        self._button_group.setExclusive(False)
        self._options = options
        if parent == None:
            parent = self
        
        for (button_id, option) in enumerate(self._options):

            checkbox = QCheckBox(option.get('title', 'option %d' % button_id))
            checkbox.setEnabled(option.get('enabled', True))
            checkbox.setChecked(button_id in selected_indexes)
            checkbox.setToolTip(option.get('tooltip', ''))

            self._button_group.addButton(checkbox, button_id)
            parent.layout().addWidget(checkbox)
            if 'description' in option:
                parent.layout().addWidget(QLabel(option['description']))