mirror of https://gitlab.com/pamhyr/pamhyr2
Scenario: Add waiting dialog.
parent
8f4d233965
commit
a412f2f18f
|
|
@ -34,6 +34,8 @@ from PyQt5.QtWidgets import (
|
||||||
QGraphicsItem, QGraphicsTextItem, QMenu,
|
QGraphicsItem, QGraphicsTextItem, QMenu,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from View.WaitingDialog import WaitingDialog
|
||||||
|
|
||||||
from View.Scenarios.UndoCommand import *
|
from View.Scenarios.UndoCommand import *
|
||||||
from View.Scenarios.ContextMenu import (
|
from View.Scenarios.ContextMenu import (
|
||||||
DefaultMenu, ScenarioMenu,
|
DefaultMenu, ScenarioMenu,
|
||||||
|
|
@ -366,6 +368,14 @@ class GraphWidget(QGraphicsView):
|
||||||
self.update()
|
self.update()
|
||||||
super(GraphWidget, self).mouseMoveEvent(event)
|
super(GraphWidget, self).mouseMoveEvent(event)
|
||||||
|
|
||||||
|
def exec_with_waiting_window(self, fn, action_str):
|
||||||
|
dlg = WaitingDialog(
|
||||||
|
payload_fn=fn,
|
||||||
|
title=action_str,
|
||||||
|
parent=self.parent
|
||||||
|
)
|
||||||
|
dlg.exec_()
|
||||||
|
|
||||||
# Contextual menu
|
# Contextual menu
|
||||||
|
|
||||||
def contextMenuEvent(self, event):
|
def contextMenuEvent(self, event):
|
||||||
|
|
@ -397,15 +407,18 @@ class GraphWidget(QGraphicsView):
|
||||||
if type(item) is not ScenarioItem:
|
if type(item) is not ScenarioItem:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def fn():
|
||||||
self._study.save()
|
self._study.save()
|
||||||
self._study.reload_from_scenario(item.scenario)
|
self._study.reload_from_scenario(item.scenario)
|
||||||
|
|
||||||
|
self.exec_with_waiting_window(fn, "select_scenario")
|
||||||
self.changeScenario.emit(self.sender())
|
self.changeScenario.emit(self.sender())
|
||||||
|
|
||||||
def new_scenario(self, pos):
|
def new_scenario(self, pos):
|
||||||
|
def fn():
|
||||||
self._study.save()
|
self._study.save()
|
||||||
|
|
||||||
scenario = self._study.new_scenario_from_current()
|
scenario = self._study.new_scenario_from_current()
|
||||||
scenario.set_pos(pos.x(), pos.y())
|
scenario.set_pos(pos.x(), pos.y())
|
||||||
|
|
||||||
|
self.exec_with_waiting_window(fn, "new_scenario")
|
||||||
self.changeScenario.emit(self.sender())
|
self.changeScenario.emit(self.sender())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue