Esempio n. 1
0
def getSenvValueEditor(envName, parent):
    """Factory method, requires: string, and QWidget as a parent for returned editor.
    Factory returns a tuple of widget and a label for it.

    :return: (Qt.QWidget, str) """
    label = "value:"
    if envName == "ActiveMntGrp":
        editor = MSAttrListComboBoxParam(parent)
    elif envName == "ExtraColumns":
        editor = ExtraColumnsEditor(parent)
        label = None
    elif envName == "JsonRecorder":
        editor = CheckBoxParam(parent)
    elif envName == "ScanDir":
        editor = DirPathParam(parent)
    elif envName == "ScanFile":
        editor = LineEditParam(parent)
    else:
        editor = LineEditParam(parent)
    return editor, label
Esempio n. 2
0
 def createEditor(self, parent, option, index):
     if index.column() == 1:
         node = index.model().nodeFromIndex(index)
         if isinstance(node, macro.SingleParamNode):
             paramType = node.type()
             if paramType in globals.EDITOR_COMBOBOX_PARAMS:
                 comboBox = AttrListComboBoxParam(parent, node)
                 comboBox.setUseParentModel(True)
                 return comboBox
             elif paramType in globals.EDITOR_SPINBOX_PARAMS:
                 return SpinBoxParam(parent, node)
             elif paramType in globals.EDITOR_DOUBLESPINBOX_PARAMS:
                 return DoubleSpinBoxParam(parent, node)
             elif paramType in globals.EDITOR_LINEEDIT_PARAMS:
                 return LineEditParam(parent, node)
             elif paramType in globals.EDITOR_FILEDIALOG_PARAMS:
                 return FileDialogParam(parent, node)
     return Qt.QItemDelegate.createEditor(self, parent, option, index)