def sortVariables(self, variable_list):
        analysis_module_variables_model = AnalysisModuleVariablesModel()
        sorted_list = ["#","#","#","#","#","#","#","#","#","#","#","#","#","#"]
        result = []
        for name in variable_list:
            pos = analysis_module_variables_model.getVariablePosition(name)
            sorted_list.insert(pos, name)
            sorted_list.__delitem__(pos+1)

        for item in sorted_list:
            if item <> "#":
                result.append(item)

        return result
Beispiel #2
0
    def sortVariables(self, variable_list):
        analysis_module_variables_model = AnalysisModuleVariablesModel()
        sorted_list = [
            "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#",
            "#"
        ]
        result = []
        for name in variable_list:
            pos = analysis_module_variables_model.getVariablePosition(name)
            sorted_list.insert(pos, name)
            sorted_list.__delitem__(pos + 1)

        for item in sorted_list:
            if item <> "#":
                result.append(item)

        return result
    def __init__(self, analysis_module_name, parent=None):
        QWidget.__init__(self, parent)

        self.__analysis_module_name = analysis_module_name

        layout = QFormLayout()
        variable_names = AnalysisModuleVariablesModel().getVariableNames(self.__analysis_module_name)

        if len(variable_names) == 0:
            label = QString("No variables found to edit")
            boxlayout = QHBoxLayout()
            layout.addRow(label, boxlayout)

        else:
            analysis_module_variables_model = AnalysisModuleVariablesModel()
            self.blockSignals(True)

            variable_names2 = self.sortVariables(variable_names)
            for variable_name in variable_names2:
                variable_type = analysis_module_variables_model.getVariableType(variable_name)
                variable_value = analysis_module_variables_model.getVariableValue(self.__analysis_module_name, variable_name)

                label_name = analysis_module_variables_model.getVariableLabelName(variable_name)
                if variable_type == bool:
                    spinner = self.createCheckBox(variable_name, variable_value, variable_type)
                
                elif variable_type == float:
                    spinner = self.createDoubleSpinBox(variable_name, variable_value, variable_type, analysis_module_variables_model)
                    
                elif variable_type == str:
                    spinner = self.createLineEdit(variable_name, variable_value, variable_type)
                    
                elif variable_type == int:
                    spinner = self.createSpinBox(variable_name, variable_value, variable_type, analysis_module_variables_model)
                   
                layout.addRow(label_name, spinner)
                if variable_name == "LAMBDA0":
                    label = QLabel("<span style=\"font-size:12pt; font-weight:300;font-style:italic;\"> Initial Lambda of -1.00 signifies that the value will be calculated</span>")
                    layout.addRow(label, None)

        self.setLayout(layout)
        self.blockSignals(False)
Beispiel #4
0
    def __init__(self, analysis_module_name, parent=None):
        QWidget.__init__(self, parent)

        self.__analysis_module_name = analysis_module_name

        layout = QFormLayout()
        variable_names = AnalysisModuleVariablesModel().getVariableNames(
            self.__analysis_module_name)

        if len(variable_names) == 0:
            label = QString("No variables found to edit")
            boxlayout = QHBoxLayout()
            layout.addRow(label, boxlayout)

        else:
            analysis_module_variables_model = AnalysisModuleVariablesModel()
            self.blockSignals(True)

            variable_names2 = self.sortVariables(variable_names)
            for variable_name in variable_names2:
                variable_type = analysis_module_variables_model.getVariableType(
                    variable_name)
                variable_value = analysis_module_variables_model.getVariableValue(
                    self.__analysis_module_name, variable_name)

                label_name = analysis_module_variables_model.getVariableLabelName(
                    variable_name)
                if variable_type == bool:
                    spinner = self.createCheckBox(variable_name,
                                                  variable_value,
                                                  variable_type)

                elif variable_type == float:
                    spinner = self.createDoubleSpinBox(
                        variable_name, variable_value, variable_type,
                        analysis_module_variables_model)

                elif variable_type == str:
                    spinner = self.createLineEdit(variable_name,
                                                  variable_value,
                                                  variable_type)

                elif variable_type == int:
                    spinner = self.createSpinBox(
                        variable_name, variable_value, variable_type,
                        analysis_module_variables_model)

                layout.addRow(label_name, spinner)
                if variable_name == "LAMBDA0":
                    label = QLabel(
                        "<span style=\"font-size:12pt; font-weight:300;font-style:italic;\"> Initial Lambda of -1.00 signifies that the value will be calculated</span>"
                    )
                    layout.addRow(label, None)

        self.setLayout(layout)
        self.blockSignals(False)
Beispiel #5
0
    def valueChanged(self, variable_name, variable_type, variable_control):
        value = None
        if variable_type == bool:
            assert isinstance(variable_control, QCheckBox)
            value = variable_control.isChecked()
        elif variable_type == float:
            assert isinstance(variable_control, QDoubleSpinBox)
            value = variable_control.value()
        elif variable_type == str:
            assert isinstance(variable_control, QLineEdit)
            value = variable_control.text()
            value = str(value).strip()
            if len(value) == 0:
                value = None
        elif variable_type == int:
            assert isinstance(variable_control, QSpinBox)
            value = variable_control.value()

        if value is not None:
            AnalysisModuleVariablesModel().setVariableValue(
                self.__analysis_module_name, variable_name, value)