class LoadResultsPanel(QWidget): def __init__(self): QWidget.__init__(self) self.setMinimumWidth(500) self.setMinimumHeight(200) self._dynamic = False self.setWindowTitle("Load results manually") self.activateWindow() layout = QFormLayout() current_case = getCurrentCaseName() run_path_text = QTextEdit() run_path_text.setText(self.readCurrentRunPath()) run_path_text.setDisabled(True) run_path_text.setFixedHeight(80) layout.addRow("Load data from current run path: ",run_path_text) self._case_model = AllCasesModel() self._case_combo = QComboBox() self._case_combo.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength) self._case_combo.setMinimumContentsLength(20) self._case_combo.setModel(self._case_model) self._case_combo.setCurrentIndex(self._case_model.indexOf(current_case)) layout.addRow("Load into case:", self._case_combo) self._active_realizations_model = ActiveRealizationsModel() self._active_realizations_field = StringBox(self._active_realizations_model, "load_results_manually/Realizations") self._active_realizations_field.setValidator(RangeStringArgument()) layout.addRow("Realizations to load:", self._active_realizations_field) iterations_count = LoadResultsModel.getIterationCount() self._iterations_model = ValueModel(iterations_count) self._iterations_field = StringBox(self._iterations_model, "load_results_manually/iterations") self._iterations_field.setValidator(IntegerArgument(from_value=1)) layout.addRow("Iteration to load:", self._iterations_field) self.setLayout(layout) def readCurrentRunPath(self): current_case = getCurrentCaseName() run_path = LoadResultsModel.getCurrentRunPath() run_path = run_path.replace("<ERTCASE>",current_case) run_path = run_path.replace("<ERT-CASE>",current_case) return run_path def load(self): all_cases = self._case_model.getAllItems() selected_case = all_cases[self._case_combo.currentIndex()] realizations = self._active_realizations_model.getActiveRealizationsMask() iteration = self._iterations_model.getActiveIteration() LoadResultsModel.loadResults(selected_case, realizations, iteration) def setCurrectCase(self): current_case = getCurrentCaseName() self._case_combo.setCurrentIndex(self._case_model.indexOf(current_case))
class LoadResultsPanel(QWidget): def __init__(self): QWidget.__init__(self) self.setMinimumWidth(500) self.setMinimumHeight(200) self._dynamic = False self.setWindowTitle("Load results manually") self.activateWindow() layout = QFormLayout() current_case = getCurrentCaseName() run_path_text = QTextEdit() run_path_text.setText(self.readCurrentRunPath()) run_path_text.setDisabled(True) run_path_text.setFixedHeight(80) layout.addRow("Load data from current run path: ", run_path_text) self._case_model = AllCasesModel() self._case_combo = QComboBox() self._case_combo.setSizeAdjustPolicy( QComboBox.AdjustToMinimumContentsLength) self._case_combo.setMinimumContentsLength(20) self._case_combo.setModel(self._case_model) self._case_combo.setCurrentIndex( self._case_model.indexOf(current_case)) layout.addRow("Load into case:", self._case_combo) self._active_realizations_model = ActiveRealizationsModel() self._active_realizations_field = StringBox( self._active_realizations_model, "load_results_manually/Realizations") self._active_realizations_field.setValidator(RangeStringArgument()) layout.addRow("Realizations to load:", self._active_realizations_field) iterations_count = LoadResultsModel.getIterationCount() self._iterations_model = ValueModel(iterations_count) self._iterations_field = StringBox(self._iterations_model, "load_results_manually/iterations") self._iterations_field.setValidator(IntegerArgument(from_value=1)) layout.addRow("Iteration to load:", self._iterations_field) self.setLayout(layout) def readCurrentRunPath(self): current_case = getCurrentCaseName() run_path = LoadResultsModel.getCurrentRunPath() run_path = run_path.replace("<ERTCASE>", current_case) run_path = run_path.replace("<ERT-CASE>", current_case) return run_path def load(self): all_cases = self._case_model.getAllItems() selected_case = all_cases[self._case_combo.currentIndex()] realizations = self._active_realizations_model.getActiveRealizationsMask( ) iteration = self._iterations_model.getActiveIteration() LoadResultsModel.loadResults(selected_case, realizations, iteration) def setCurrectCase(self): current_case = getCurrentCaseName() self._case_combo.setCurrentIndex( self._case_model.indexOf(current_case))