Scenario: Minor change.

scenarios
Pierre-Antoine Rouby 2024-09-03 11:17:03 +02:00
parent cc84b96024
commit 8f4d233965
3 changed files with 12 additions and 10 deletions

View File

@ -57,7 +57,7 @@ class ScenarioItem(QGraphicsTextItem):
tag = " "
if self.graph.scenario_has_child(self.scenario):
tag = "🛡️ "
tag = " "
self.setPlainText(tag + self.scenario.name)
self.setDefaultTextColor(Qt.black)
@ -207,8 +207,7 @@ class EdgeItem(QGraphicsItem):
class GraphWidget(QGraphicsView):
changeEdge = pyqtSignal(object)
changeNode = pyqtSignal(object)
changeScenario = pyqtSignal(object)
def __init__(self, study, parent=None,
min_size=(400, 400), max_size=None,
@ -389,7 +388,8 @@ class GraphWidget(QGraphicsView):
# Create and exec menu
m = m_type(
event=event, pos=pos, items=items,
graph=self._study, trad=self._trad, parent=self
graph=self._study, trad=self._trad,
parent=self
)
m.run()
@ -397,11 +397,15 @@ class GraphWidget(QGraphicsView):
if type(item) is not ScenarioItem:
return
self._study.save()
self._study.reload_from_scenario(item.scenario)
self.display_update()
self.changeScenario.emit(self.sender())
def new_scenario(self, pos):
self._study.save()
scenario = self._study.new_scenario_from_current()
scenario.set_pos(pos.x(), pos.y())
self.display_update()
self.changeScenario.emit(self.sender())

View File

@ -79,4 +79,5 @@ class ScenariosTableModel(PamhyrTableModel):
self.dataChanged.emit(index, index)
def update(self):
self._lst = self._data.scenarios.lst
self.layoutChanged.emit()

View File

@ -111,10 +111,7 @@ class ScenariosWindow(PamhyrWindow):
def setup_connections(self):
self._scenarios_model.dataChanged.connect(self.update)
# self._scenarios_model.dataChanged.connect(
# self._graph_widget.rename_scenarios
# )
# self._graph_widget.changeScenarios.connect(self.update)
self._graph_widget.changeScenario.connect(self.update)
def _undo(self):
self._undo_stack.undo()