def __init__(self): QWidget.__init__(self) layout = QVBoxLayout() simulation_mode_layout = QHBoxLayout() simulation_mode_layout.addSpacing(10) simulation_mode_model = SimulationModeModel() simulation_mode_model.observable().attach( SimulationModeModel.CURRENT_CHOICE_CHANGED_EVENT, self.toggleSimulationMode ) simulation_mode_combo = ComboChoice(simulation_mode_model, "Simulation mode", "run/simulation_mode") simulation_mode_layout.addWidget(QLabel(simulation_mode_combo.getLabel()), 0, Qt.AlignVCenter) simulation_mode_layout.addWidget(simulation_mode_combo, 0, Qt.AlignVCenter) # simulation_mode_layout.addStretch() simulation_mode_layout.addSpacing(20) self.run_button = QToolButton() self.run_button.setIconSize(QSize(32, 32)) self.run_button.setText("Start Simulation") self.run_button.setIcon(util.resourceIcon("ide/gear_in_play")) self.run_button.clicked.connect(self.runSimulation) self.run_button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) HelpedWidget.addHelpToWidget(self.run_button, "run/start_simulation") simulation_mode_layout.addWidget(self.run_button) simulation_mode_layout.addStretch(1) layout.addSpacing(5) layout.addLayout(simulation_mode_layout) layout.addSpacing(10) self.simulation_stack = QStackedWidget() self.simulation_stack.setLineWidth(1) self.simulation_stack.setFrameStyle(QFrame.StyledPanel) layout.addWidget(self.simulation_stack) self.simulation_widgets = {} self.addSimulationConfigPanel(EnsembleExperimentPanel()) self.addSimulationConfigPanel(SensitivityStudyPanel()) self.addSimulationConfigPanel(EnsembleSmootherPanel()) self.addSimulationConfigPanel(IteratedEnsembleSmootherPanel()) self.setLayout(layout)
def __init__(self): QWidget.__init__(self) layout = QVBoxLayout() simulation_mode_layout = QHBoxLayout() simulation_mode_layout.addSpacing(10) simulation_mode_model = SimulationModeModel() simulation_mode_model.observable().attach(SimulationModeModel.CURRENT_CHOICE_CHANGED_EVENT, self.toggleSimulationMode) simulation_mode_combo = ComboChoice(simulation_mode_model, "Simulation mode", "run/simulation_mode") simulation_mode_layout.addWidget(QLabel(simulation_mode_combo.getLabel()), 0, Qt.AlignVCenter) simulation_mode_layout.addWidget(simulation_mode_combo, 0, Qt.AlignVCenter) # simulation_mode_layout.addStretch() simulation_mode_layout.addSpacing(20) self.run_button = QToolButton() self.run_button.setIconSize(QSize(32, 32)) self.run_button.setText("Start Simulation") self.run_button.setIcon(util.resourceIcon("ide/gear_in_play")) self.run_button.clicked.connect(self.runSimulation) self.run_button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) HelpedWidget.addHelpToWidget(self.run_button, "run/start_simulation") simulation_mode_layout.addWidget(self.run_button) simulation_mode_layout.addStretch(1) layout.addSpacing(5) layout.addLayout(simulation_mode_layout) layout.addSpacing(10) self.simulation_stack = QStackedWidget() self.simulation_stack.setLineWidth(1) self.simulation_stack.setFrameStyle(QFrame.StyledPanel) layout.addWidget(self.simulation_stack) self.simulation_widgets = {} self.addSimulationConfigPanel(EnsembleExperimentPanel()) self.addSimulationConfigPanel(EnsembleSmootherPanel()) self.addSimulationConfigPanel(MultipleDataAssimilationPanel()) self.addSimulationConfigPanel(IteratedEnsembleSmootherPanel()) self.setLayout(layout)
def __init__(self): RowPanel.__init__(self, "Simulation") self.addLabeledSeparator("Simulation settings") case_model = CaseSelectorModel() case_selector = ComboChoice(case_model, "Current case", "init/current_case_selection") self.addRow(case_selector) # Give a warning if the case is not initialized! IsCaseInitializedModel().observable().attach(IsCaseInitializedModel.TEXT_VALUE_CHANGED_EVENT, self.updateSimulationStatus) runpath_model = RunPathModel() self.addRow(PathFormatChooser(runpath_model, "Runpath", "config/simulation/runpath")) ensemble_size_model = EnsembleSizeModel() self.addRow(IntegerSpinner(ensemble_size_model, "Number of realizations", "config/ensemble/num_realizations")) simulation_mode_model = SimulationModeModel() self.addRow(ComboChoice(simulation_mode_model, "Simulation mode", "run/simulation_mode")) self.addSpace(10) self.run = FunctionButtonModel("Run", self.runSimulation) self.run.setEnabled(SimulationModeModel().getCurrentChoice().buttonIsEnabled()) self.run_button = Button(self.run, label="Start simulation", help_link="run/run") self.run_button.addStretch() self.config_and_run = FunctionButtonModel("Configure and Run", self.configureAndRunSimulation) self.config_and_run.setEnabled(SimulationModeModel().getCurrentChoice().buttonIsEnabled()) self.run_button.addOption(self.config_and_run) self.run_button.addOption(OneMoreIteration()) self.addRow(self.run_button) self.addSpace(10) self.warning_panel = WarningPanel() self.addRow(self.warning_panel) simulation_mode_model.observable().attach(SimulationModeModel.CURRENT_CHOICE_CHANGED_EVENT, self.toggleSimulationMode) self.updateSimulationStatus()
def toggleSimulationMode(self): model = SimulationModeModel().getCurrentChoice() self.run.setEnabled(model.buttonIsEnabled()) self.config_and_run.setEnabled(model.buttonIsEnabled())
def configureAndRunSimulation(self): simulation_model = SimulationModeModel().getCurrentChoice() print("Configure!!!") simulation_model.buttonTriggered()
def getCurrentSimulationMode(self): return SimulationModeModel().getCurrentChoice()