Pamhyr2, Scenario: Add Read only mode.

This commit is contained in:
Pierre-Antoine Rouby committed 2024-09-03 15:25:29 +02:00
1 parent 8f0535dc5c
commit 8afa3d1e30
9 files changed
+103 -17

No files matched your search

+12 -1
View File
@@ -61,7 +61,7 @@ class ScenarioItem(QGraphicsTextItem):
if self.graph.scenario_has_child(self.scenario):
tag = "⛔ "
self.setPlainText(tag + self.scenario.name)
self.setHtml(tag + self.scenario.name)
self.setDefaultTextColor(Qt.black)
self.setFlag(QGraphicsItem.ItemIsMovable)
@@ -412,7 +412,9 @@ class GraphWidget(QGraphicsView):
self._study.save()
self._study.reload_from_scenario(item.scenario)
self._close_other_window()
self.exec_with_waiting_window(fn, "select_scenario")
self.changeScenario.emit(self.sender())
def new_scenario(self, pos):
@@ -421,5 +423,14 @@ class GraphWidget(QGraphicsView):
scenario = self._study.new_scenario_from_current()
scenario.set_pos(pos.x(), pos.y())
self._close_other_window()
self.exec_with_waiting_window(fn, "new_scenario")
self.changeScenario.emit(self.sender())
def _close_other_window(self):
self.parent\
.parent\
._close_sub_window(
exceptions=["Scenarios", "Debug REPL"]
)