예제 #1
0
    def addInitializeFromExistingTab(self):
        self.addTab("Initialize from existing")

        case_model = CaseSelectorModel()
        target_case_selector = ComboChoice(case_model, "Target case",
                                           "init/current_case_selection")
        self.addRow(target_case_selector)

        initialized_cases = ComboChoice(InitializedCaseSelectorModel(),
                                        "Source case", "init/source_case")
        self.addRow(initialized_cases)

        #self.addRow("State", "Analyzed/Forecast")

        timestep_group = RowGroup("Timestep")
        history_length = HistoryLengthModel()
        history_length_spinner = IntegerSpinner(history_length, "Timestep",
                                                "config/init/history_length")
        timestep_group.addWidget(history_length_spinner)

        initial = QToolButton()
        initial.setText("Initial")
        initial.clicked.connect(history_length.setToMin)
        timestep_group.addWidget(initial)

        end_of_time = QToolButton()
        end_of_time.setText("End of time")
        end_of_time.clicked.connect(history_length.setToMax)
        timestep_group.addWidget(end_of_time)

        timestep_group.addGroupStretch()

        self.addRow(timestep_group)

        self.addSpace(10)

        row_group = RowGroup()
        parameter_model = InitializationParametersModel()
        parameter_check_list = CheckList(parameter_model, "Parameters",
                                         "init/select_parameters")
        parameter_check_list.setMaximumWidth(300)
        row_group.addWidget(parameter_check_list)

        member_model = InitializationMembersModel()
        member_check_list = CheckList(member_model, "Members",
                                      "init/select_members")
        member_check_list.setMaximumWidth(150)
        row_group.addWidget(member_check_list)

        self.addRow(row_group)

        self.addSpace(10)

        initialize_from_existing = InitializeFromExistingCaseModel()
        self.addRow(
            Button(initialize_from_existing,
                   help_link="init/initialize_from_existing"))

        self.addSpace(10)
예제 #2
0
    def buttonTriggered(self):
        source_case = InitializedCaseSelectorModel().getCurrentChoice()
        source_report_step = HistoryLengthModel().getSpinnerValue()
        selected_members = InitializationMembersModel().getSelectedItems()
        total_member_count = EnsembleSizeModel().getSpinnerValue()

        member_mask = BoolVector.createFromList(total_member_count, selected_members)
        selected_parameters = StringList((InitializationParametersModel()).getSelectedItems())

        self.ert().getEnkfFsManager().customInitializeCurrentFromExistingCase(source_case, source_report_step, member_mask, selected_parameters)

        self.observable().notify(ButtonModelMixin.BUTTON_TRIGGERED_EVENT)
예제 #3
0
 def buttonIsEnabled(self):
     return len(InitializedCaseSelectorModel().getChoices()) > 0
예제 #4
0
 def __init__(self):
     InitializedCaseSelectorModel().observable().attach(InitializedCaseSelectorModel.CHOICE_LIST_CHANGED_EVENT, self.__caseChanged)
     super(InitializeFromExistingCaseModel, self).__init__()