def __init__(self, title, parent=None): QDialog.__init__(self, parent) self.__parent = parent self.setWindowTitle(title) self.setModal(True) self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) self.setWindowFlags(self.windowFlags() & ~Qt.WindowCloseButtonHint) self.setWindowFlags(self.windowFlags() & ~Qt.WindowCancelButtonHint) layout = QVBoxLayout() layout.setSizeConstraint(QLayout.SetFixedSize) widget = QWidget() widget_layout = QHBoxLayout() size = 64 spin_movie = util.resourceMovie("ide/loading.gif") spin_movie.setSpeed(60) spin_movie.setScaledSize(QSize(size, size)) spin_movie.start() processing_animation = QLabel() processing_animation.setMaximumSize(QSize(size, size)) processing_animation.setMinimumSize(QSize(size, size)) processing_animation.setMovie(spin_movie) widget_layout.addWidget(processing_animation) self.processing_label = QLabel("Processing job: '%s'" % title) widget_layout.addWidget(self.processing_label, Qt.AlignBottom) widget.setLayout(widget_layout) layout.addWidget(widget) button_layout = QHBoxLayout() self.close_button = QPushButton("Close") self.close_button.clicked.connect(self.closeButtonPressed.emit) button_layout.addStretch() button_layout.addWidget(self.close_button) layout.addStretch() layout.addLayout(button_layout) self.setLayout(layout) self.disposeDialog.connect(self.reject) self.presentInformation.connect(self.__presentInformation) self.presentError.connect(self.__presentError) self.closeButtonPressed.connect(self.__confirmCancel)
def createSpinWidget(self): widget = QWidget() layout = QHBoxLayout() size = 64 spin_movie = util.resourceMovie("ide/loading.gif") spin_movie.setSpeed(60) spin_movie.setScaledSize(QSize(size, size)) spin_movie.start() processing_animation = QLabel() processing_animation.setMaximumSize(QSize(size, size)) processing_animation.setMinimumSize(QSize(size, size)) processing_animation.setMovie(spin_movie) layout.addWidget(processing_animation) processing_label = QLabel("Processing workflow '%s'" % WorkflowsModel().getCurrentChoice()) layout.addWidget(processing_label, Qt.AlignBottom) widget.setLayout(layout) return widget
def __init__(self, run_model): QDialog.__init__(self) self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) self.setWindowFlags(self.windowFlags() & ~Qt.WindowCloseButtonHint) self.setModal(True) self.setWindowTitle("Simulations") assert isinstance(run_model, RunModelMixin) self.__run_model = run_model layout = QVBoxLayout() layout.setSizeConstraint(QLayout.SetFixedSize) self.simulations_tracker = SimulationsTracker() states = self.simulations_tracker.getList() self.total_progress = SimpleProgress() layout.addWidget(self.total_progress) status_layout = QHBoxLayout() status_layout.addStretch() self.__status_label = QLabel() status_layout.addWidget(self.__status_label) status_layout.addStretch() layout.addLayout(status_layout) self.progress = Progress() self.progress.setIndeterminateColor(self.total_progress.color) for state in states: self.progress.addState(state.state, QColor(*state.color), 100.0 * state.count / state.total_count) layout.addWidget(self.progress) legend_layout = QHBoxLayout() self.legends = {} for state in states: self.legends[state] = Legend("%s (%d/%d)", QColor(*state.color)) self.legends[state].updateLegend(state.name, 0, 0) legend_layout.addWidget(self.legends[state]) layout.addLayout(legend_layout) self.running_time = QLabel("") self.plot_tool = PlotTool() self.plot_tool.setParent(self) self.plot_button = QPushButton(self.plot_tool.getName()) self.plot_button.clicked.connect(self.plot_tool.trigger) self.kill_button = QPushButton("Kill simulations") self.done_button = QPushButton("Done") self.done_button.setHidden(True) button_layout = QHBoxLayout() size = 20 spin_movie = util.resourceMovie("ide/loading.gif") spin_movie.setSpeed(60) spin_movie.setScaledSize(QSize(size, size)) spin_movie.start() self.processing_animation = QLabel() self.processing_animation.setMaximumSize(QSize(size, size)) self.processing_animation.setMinimumSize(QSize(size, size)) self.processing_animation.setMovie(spin_movie) button_layout.addWidget(self.processing_animation) button_layout.addWidget(self.running_time) button_layout.addStretch() button_layout.addWidget(self.plot_button) button_layout.addWidget(self.kill_button) button_layout.addWidget(self.done_button) layout.addStretch() layout.addLayout(button_layout) self.setLayout(layout) self.kill_button.clicked.connect(self.killJobs) self.done_button.clicked.connect(self.accept) self.__updating = False self.__update_queued = False self.__simulation_started = False self.__update_timer = QTimer(self) self.__update_timer.setInterval(500) self.__update_timer.timeout.connect(self.updateRunStatus)
def __init__(self, run_model): QDialog.__init__(self) self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) self.setWindowFlags(self.windowFlags() & ~Qt.WindowCloseButtonHint) self.setModal(True) self.setWindowTitle("Simulations") assert isinstance(run_model, RunModelMixin) self.__run_model = run_model layout = QVBoxLayout() layout.setSizeConstraint(QLayout.SetFixedSize) self.simulations_tracker = SimulationsTracker() states = self.simulations_tracker.getList() self.total_progress = SimpleProgress() layout.addWidget(self.total_progress) status_layout = QHBoxLayout() status_layout.addStretch() self.__status_label = QLabel() status_layout.addWidget(self.__status_label) status_layout.addStretch() layout.addLayout(status_layout) self.progress = Progress() self.progress.setIndeterminateColor(self.total_progress.color) for state in states: self.progress.addState(state.state, QColor(*state.color), 100.0 * state.count / state.total_count) layout.addWidget(self.progress) legend_layout = QHBoxLayout() self.legends = {} for state in states: self.legends[state] = Legend("%s (%d/%d)", QColor(*state.color)) self.legends[state].updateLegend(state.name, 0, 0) legend_layout.addWidget(self.legends[state]) layout.addLayout(legend_layout) self.running_time = QLabel("") ert = None if isinstance(run_model, ErtConnector): ert = run_model.ert() self.plot_tool = PlotTool(ert) self.plot_tool.setParent(self) self.plot_button = QPushButton(self.plot_tool.getName()) self.plot_button.clicked.connect(self.plot_tool.trigger) self.plot_button.setEnabled(ert is not None) self.kill_button = QPushButton("Kill simulations") self.done_button = QPushButton("Done") self.done_button.setHidden(True) button_layout = QHBoxLayout() size = 20 spin_movie = util.resourceMovie("ide/loading.gif") spin_movie.setSpeed(60) spin_movie.setScaledSize(QSize(size, size)) spin_movie.start() self.processing_animation = QLabel() self.processing_animation.setMaximumSize(QSize(size, size)) self.processing_animation.setMinimumSize(QSize(size, size)) self.processing_animation.setMovie(spin_movie) button_layout.addWidget(self.processing_animation) button_layout.addWidget(self.running_time) button_layout.addStretch() button_layout.addWidget(self.plot_button) button_layout.addWidget(self.kill_button) button_layout.addWidget(self.done_button) layout.addStretch() layout.addLayout(button_layout) self.setLayout(layout) self.kill_button.clicked.connect(self.killJobs) self.done_button.clicked.connect(self.accept) self.__updating = False self.__update_queued = False self.__simulation_started = False self.__update_timer = QTimer(self) self.__update_timer.setInterval(500) self.__update_timer.timeout.connect(self.updateRunStatus)