mirror of https://gitlab.com/pamhyr/pamhyr2
Scenario: Add some colors!
parent
71bea2eea4
commit
5c3464a303
|
|
@ -66,11 +66,31 @@ class ScenarioItem(QGraphicsTextItem):
|
||||||
def type(self):
|
def type(self):
|
||||||
return ScenarioItem.Type
|
return ScenarioItem.Type
|
||||||
|
|
||||||
|
def boundingRect(self):
|
||||||
|
extra = 6
|
||||||
|
return super(ScenarioItem, self)\
|
||||||
|
.boundingRect()\
|
||||||
|
.normalized()\
|
||||||
|
.adjusted(
|
||||||
|
-extra, -extra,
|
||||||
|
extra, extra
|
||||||
|
)
|
||||||
|
|
||||||
@timer
|
@timer
|
||||||
def paint(self, painter, option, widget):
|
def paint(self, painter, option, widget):
|
||||||
color = QColor(Qt.white)
|
extra = 2
|
||||||
|
pcolor = QColor(Qt.black)
|
||||||
|
color = QColor("#aac3d7")
|
||||||
|
if self.graph.graph.status.scenario is self.scenario:
|
||||||
|
color = QColor("#eeaba5")
|
||||||
|
elif self.scenario.id == 0:
|
||||||
|
color = QColor("#d3c1d8")
|
||||||
|
|
||||||
painter.setPen(Qt.NoPen)
|
painter.setPen(
|
||||||
|
QPen(
|
||||||
|
pcolor, 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin
|
||||||
|
)
|
||||||
|
)
|
||||||
painter.setBrush(QBrush(color))
|
painter.setBrush(QBrush(color))
|
||||||
painter.drawEllipse(self.boundingRect())
|
painter.drawEllipse(self.boundingRect())
|
||||||
|
|
||||||
|
|
@ -172,10 +192,11 @@ class EdgeItem(QGraphicsItem):
|
||||||
return poly
|
return poly
|
||||||
|
|
||||||
def get_line_item_point(self, item):
|
def get_line_item_point(self, item):
|
||||||
|
item_extra = 6
|
||||||
rect = item.boundingRect()
|
rect = item.boundingRect()
|
||||||
return QPointF(
|
return QPointF(
|
||||||
item.pos().x() + (rect.width() / 2.0),
|
item.pos().x() + ((rect.width() - item_extra) / 2.0),
|
||||||
item.pos().y() + (rect.height() / 2.0)
|
item.pos().y() + ((rect.height() - item_extra) / 2.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue