mirror of https://gitlab.com/pamhyr/pamhyr2
Scenario: Add protected tag in front of name and alternative color.
parent
5c3464a303
commit
9b40b7eb39
|
|
@ -55,7 +55,11 @@ class ScenarioItem(QGraphicsTextItem):
|
|||
|
||||
self.setPos(QPointF(self.scenario.x, self.scenario.y))
|
||||
|
||||
self.setPlainText(self.scenario.name)
|
||||
tag = " "
|
||||
if self.graph.scenario_has_child(self.scenario):
|
||||
tag = "🛡️ "
|
||||
|
||||
self.setPlainText(tag + self.scenario.name)
|
||||
self.setDefaultTextColor(Qt.black)
|
||||
|
||||
self.setFlag(QGraphicsItem.ItemIsMovable)
|
||||
|
|
@ -85,6 +89,8 @@ class ScenarioItem(QGraphicsTextItem):
|
|||
color = QColor("#eeaba5")
|
||||
elif self.scenario.id == 0:
|
||||
color = QColor("#d3c1d8")
|
||||
elif self.graph.scenario_has_child(self.scenario):
|
||||
color = QColor("#e6e6e6")
|
||||
|
||||
painter.setPen(
|
||||
QPen(
|
||||
|
|
@ -288,11 +294,18 @@ class GraphWidget(QGraphicsView):
|
|||
self.scene().clear()
|
||||
self.create_items()
|
||||
|
||||
def scenario_has_child(self, scenario):
|
||||
for scenar in self.graph.scenarios.lst:
|
||||
if scenar.parent is scenario:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def drawBackground(self, painter, rect):
|
||||
sceneRect = self.sceneRect()
|
||||
painter.fillRect(
|
||||
rect.intersected(sceneRect),
|
||||
QBrush(Qt.lightGray)
|
||||
QBrush(QColor("#e6e6e6"))
|
||||
)
|
||||
painter.setBrush(Qt.NoBrush)
|
||||
painter.drawRect(sceneRect)
|
||||
|
|
|
|||
Loading…
Reference in New Issue