def __init__(self):
        SimulationConfigPanel.__init__(self, EnsembleSmoother( getQueueConfig( ) ))

        layout = QFormLayout()

        case_selector = CaseSelector()
        layout.addRow("Current case:", case_selector)

        run_path_label = QLabel("<b>%s</b>" % getRunPath())
        addHelpToWidget(run_path_label, "config/simulation/runpath")
        layout.addRow("Runpath:", run_path_label)

        number_of_realizations_label = QLabel("<b>%d</b>" % getRealizationCount())
        addHelpToWidget(number_of_realizations_label, "config/ensemble/num_realizations")
        layout.addRow(QLabel("Number of realizations:"), number_of_realizations_label)

        self._target_case_model = TargetCaseModel()
        self._target_case_field = StringBox(self._target_case_model, "config/simulation/target_case")
        self._target_case_field.setValidator(ProperNameArgument())
        layout.addRow("Target case:", self._target_case_field)

        self._analysis_module_selector = AnalysisModuleSelector(iterable=False, help_link="config/analysis/analysis_module")
        layout.addRow("Analysis Module:", self._analysis_module_selector)

        self._active_realizations_model = ActiveRealizationsModel()
        self._active_realizations_field = StringBox(self._active_realizations_model, "config/simulation/active_realizations")
        self._active_realizations_field.setValidator(RangeStringArgument(getRealizationCount()))
        layout.addRow("Active realizations", self._active_realizations_field)

        self._target_case_field.getValidationSupport().validationChanged.connect(self.simulationConfigurationChanged)
        self._active_realizations_field.getValidationSupport().validationChanged.connect(self.simulationConfigurationChanged)

        self.setLayout(layout)
Пример #2
0
    def test_proper_name_argument(self):

        argument = ProperNameArgument()

        self.assertTrue(argument.validate("NAME"))
        self.assertTrue(argument.validate("__NAME__"))
        self.assertTrue(argument.validate("<NAME>"))
        self.assertTrue(argument.validate("-NAME-"))

        self.assertFalse(argument.validate("-NA ME-"))
        self.assertFalse(argument.validate("NAME*"))
Пример #3
0
    def test_proper_name_argument(self):

        argument = ProperNameArgument()

        self.assertTrue(argument.validate("NAME"))
        self.assertTrue(argument.validate("__NAME__"))
        self.assertTrue(argument.validate("<NAME>"))
        self.assertTrue(argument.validate("-NAME-"))

        self.assertFalse(argument.validate("-NA ME-"))
        self.assertFalse(argument.validate("NAME*"))
Пример #4
0
def valid_name(user_input):
    validator = ProperNameArgument()
    validated = validator.validate(user_input)
    if validated.failed():
        strip_error_message_and_raise_exception(validated)
    return user_input
Пример #5
0
    def __init__(self):
        SimulationConfigPanel.__init__(self, EnsembleSmoother())

        layout = QFormLayout()

        case_model = CaseSelectorModel()
        case_selector = ComboChoice(case_model, "Current case",
                                    "init/current_case_selection")
        layout.addRow(case_selector.getLabel(), case_selector)

        run_path_model = RunPathModel()
        run_path_label = ActiveLabel(run_path_model, "Runpath",
                                     "config/simulation/runpath")
        layout.addRow(run_path_label.getLabel(), run_path_label)

        number_of_realizations_model = EnsembleSizeModel()
        number_of_realizations_label = ActiveLabel(
            number_of_realizations_model, "Number of realizations",
            "config/ensemble/num_realizations")
        layout.addRow(number_of_realizations_label.getLabel(),
                      number_of_realizations_label)

        target_case_model = TargetCaseModel()
        self.target_case_field = StringBox(target_case_model, "Target case",
                                           "config/simulation/target_case")
        self.target_case_field.setValidator(ProperNameArgument())
        layout.addRow(self.target_case_field.getLabel(),
                      self.target_case_field)

        analysis_module_model = AnalysisModuleModel()
        self.analysis_module_choice = ComboChoice(
            analysis_module_model, "Analysis Module",
            "config/analysis/analysis_module")

        self.variables_popup_button = QToolButton()
        self.variables_popup_button.setIcon(
            util.resourceIcon("ide/small/cog_edit.png"))
        self.variables_popup_button.clicked.connect(self.showVariablesPopup)
        self.variables_popup_button.setMaximumSize(20, 20)

        self.variables_layout = QHBoxLayout()
        self.variables_layout.addWidget(self.analysis_module_choice, 0,
                                        Qt.AlignLeft)
        self.variables_layout.addWidget(self.variables_popup_button, 0,
                                        Qt.AlignLeft)
        self.variables_layout.setContentsMargins(QMargins(0, 0, 0, 0))
        self.variables_layout.addStretch()

        layout.addRow(self.analysis_module_choice.getLabel(),
                      self.variables_layout)

        active_realizations_model = ActiveRealizationsModel()
        self.active_realizations_field = StringBox(
            active_realizations_model, "Active realizations",
            "config/simulation/active_realizations")
        self.active_realizations_field.setValidator(RangeStringArgument())
        layout.addRow(self.active_realizations_field.getLabel(),
                      self.active_realizations_field)

        self.target_case_field.validationChanged.connect(
            self.simulationConfigurationChanged)
        self.active_realizations_field.validationChanged.connect(
            self.simulationConfigurationChanged)

        self.setLayout(layout)