Пример #1
0
    def initComponents(self):
        self.setLayout(Qt.QFormLayout())

        self.layout().addRow(Qt.QLabel("Setting environment variable:", self))

        self.nameComboBox = ComboBoxParam(self)
        self.nameComboBox.addItems(
            ["ActiveMntGrp", "ExtraColumns", "JsonRecorder", "ScanFile", "ScanDir"])
        self.nameComboBox.setEditable(True)
        self.connect(self.nameComboBox, Qt.SIGNAL(
            "currentIndexChanged(int)"), self.onNameComboBoxChanged)
        self.layout().addRow("name:", self.nameComboBox)

        nameIndex = self.model().index(0, 1, self.rootIndex())
        self.nameComboBox.setIndex(nameIndex)
Пример #2
0
    def initComponents(self):
        self.setLayout(Qt.QFormLayout())

        self.layout().addRow(Qt.QLabel("Setting environment variable:", self))

        self.nameComboBox = ComboBoxParam(self)
        self.nameComboBox.addItems(["ActiveMntGrp", "ExtraColumns", "JsonRecorder", "ScanFile", "ScanDir"])
        self.nameComboBox.setEditable(True)
        self.connect(self.nameComboBox, Qt.SIGNAL("currentIndexChanged(int)"), self.onNameComboBoxChanged)
        self.layout().addRow("name:", self.nameComboBox)

        nameIndex = self.model().index(0, 1, self.rootIndex())
        self.nameComboBox.setIndex(nameIndex)
Пример #3
0
class SenvEditor(Qt.QWidget, MacroParametersEditor):
    def __init__(self, parent=None):
        Qt.QWidget.__init__(self, parent)
        MacroParametersEditor.__init__(self)
        self.valueWidget = None

    def initComponents(self):
        self.setLayout(Qt.QFormLayout())

        self.layout().addRow(Qt.QLabel("Setting environment variable:", self))

        self.nameComboBox = ComboBoxParam(self)
        self.nameComboBox.addItems([
            "ActiveMntGrp", "ExtraColumns", "JsonRecorder", "ScanFile",
            "ScanDir"
        ])
        self.nameComboBox.setEditable(True)
        self.nameComboBox.currentIndexChanged.connect(
            self.onNameComboBoxChanged)
        self.layout().addRow("name:", self.nameComboBox)

        nameIndex = self.model().index(0, 1, self.rootIndex())
        self.nameComboBox.setIndex(nameIndex)

    def setRootIndex(self, rootIndex):
        self._rootIndex = rootIndex
        self.initComponents()

    def rootIndex(self):
        return self._rootIndex

    def model(self):
        return self._model

    def setModel(self, model):
        self._model = model
        if isinstance(model, ParamEditorModel):
            self.setRootIndex(Qt.QModelIndex())

    def onNameComboBoxChanged(self, index):
        # note that the index parameter is ignored!
        text = str(self.nameComboBox.currentText())
        if self.valueWidget is not None:
            label = self.layout().labelForField(self.valueWidget)
            if label is not None:
                self.layout().removeWidget(label)
                label.setParent(None)
                label = None

            self.layout().removeWidget(self.valueWidget)
            self.valueWidget.resetValue()
            self.valueWidget.setParent(None)
            self.valueWidget = None

        self.valueWidget, label = getSenvValueEditor(text, self)

        paramRepeatIndex = self.model().index(1, 0, self.rootIndex())
        repeatIndex = paramRepeatIndex.child(0, 0)
        valueIndex = repeatIndex.child(0, 1)
        self.valueWidget.setIndex(valueIndex)

        if label:
            self.layout().addRow(label, self.valueWidget)
        else:
            self.layout().addRow(self.valueWidget)
Пример #4
0
class SenvEditor(Qt.QWidget, MacroParametersEditor):

    def __init__(self, parent=None):
        Qt.QWidget.__init__(self, parent)
        MacroParametersEditor.__init__(self)
        self.valueWidget = None

    def initComponents(self):
        self.setLayout(Qt.QFormLayout())

        self.layout().addRow(Qt.QLabel("Setting environment variable:", self))

        self.nameComboBox = ComboBoxParam(self)
        self.nameComboBox.addItems(["ActiveMntGrp", "ExtraColumns", "JsonRecorder", "ScanFile", "ScanDir"])
        self.nameComboBox.setEditable(True)
        self.connect(self.nameComboBox, Qt.SIGNAL("currentIndexChanged(int)"), self.onNameComboBoxChanged)
        self.layout().addRow("name:", self.nameComboBox)

        nameIndex = self.model().index(0, 1, self.rootIndex())
        self.nameComboBox.setIndex(nameIndex)

    def setRootIndex(self, rootIndex):
        self._rootIndex = rootIndex
        self.initComponents()

    def rootIndex(self):
        return self._rootIndex

    def model(self):
        return self._model

    def setModel(self, model):
        self._model = model
        if isinstance(model, ParamEditorModel):
            self.setRootIndex(Qt.QModelIndex())

    def onNameComboBoxChanged(self, index):
        text = str(self.nameComboBox.currentText())
        if self.valueWidget is not None:
            label = self.layout().labelForField(self.valueWidget)
            if label is not None:
                self.layout().removeWidget(label)
                label.setParent(None)
                label = None

            self.layout().removeWidget(self.valueWidget)
            self.valueWidget.resetValue()
            self.valueWidget.setParent(None)
            self.valueWidget = None

        self.valueWidget, label = getSenvValueEditor(text, self)

        paramRepeatIndex = self.model().index(1, 0, self.rootIndex())
        repeatIndex = paramRepeatIndex.child(0, 0)
        valueIndex = repeatIndex.child(0, 1)
        self.valueWidget.setIndex(valueIndex)

        if label:
            self.layout().addRow(label, self.valueWidget)
        else:
            self.layout().addRow(self.valueWidget)