summaryrefslogtreecommitdiff
path: root/src/editorui/paths.py
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-07-23 13:29:54 -0500
committerColin Noga <Tempus@chronometry.ca>2012-07-23 13:29:54 -0500
commit1498632b8bc91d0f83dcbfbdd03fa7499ef0985e (patch)
treebc43b079e61da3c617a103564e6e422f7933bcbb /src/editorui/paths.py
parente3bbfbabe74bb525adcf16b784338c4cf4e7507c (diff)
downloadkoopatlas-1498632b8bc91d0f83dcbfbdd03fa7499ef0985e.tar.gz
koopatlas-1498632b8bc91d0f83dcbfbdd03fa7499ef0985e.zip
Streamlined node drawing with auto-tilesets (bypass with Alt-click), double click a node layer to jump to it, selecting a path/node layer makes it visibly red (except level nodes)
Diffstat (limited to '')
-rw-r--r--src/editorui/paths.py32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/editorui/paths.py b/src/editorui/paths.py
index a40ab2b..4110188 100644
--- a/src/editorui/paths.py
+++ b/src/editorui/paths.py
@@ -111,7 +111,7 @@ class KPEditorNode(KPEditorItem):
self._levelRect = self._boundingRect
self._stopRect = QtCore.QRectF(-12, -12, 24, 24)
self._tinyRect = QtCore.QRectF(-6, -6, 12, 12)
-
+ self.isLayerSelected = False
if not hasattr(KPEditorNode, 'SELECTION_PEN'):
KPEditorNode.SELECTION_PEN = QtGui.QPen(Qt.blue, 1, Qt.DotLine)
@@ -261,6 +261,11 @@ class KPEditorNode(KPEditorItem):
exit.qtItem.updatePosition()
+ def setLayerSelected(self, selected):
+ self.isLayerSelected = selected
+ self.update()
+
+
def paint(self, painter, option, widget):
painter.setRenderHint(QtGui.QPainter.Antialiasing)
@@ -294,14 +299,20 @@ class KPEditorNode(KPEditorItem):
selectionRect = self._boundingRect.adjusted(1,5,-1,-5)
elif len(node.exits) != 2:
- brush = QtGui.QBrush(QtGui.QColor(255, 220, 220))
+ if self.isLayerSelected:
+ brush = QtGui.QBrush(QtGui.QColor(255, 40, 40))
+ else:
+ brush = QtGui.QBrush(QtGui.QColor(255, 220, 220))
painter.setPen(QtGui.QColor(255, 255, 255))
painter.setBrush(brush)
painter.drawEllipse(self._stopRect)
selectionRect = self._stopRect.adjusted(-1,-1,1,1)
else:
- brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
+ if self.isLayerSelected:
+ brush = QtGui.QBrush(QtGui.QColor(255, 40, 40))
+ else:
+ brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
painter.setPen(QtGui.QColor(255, 255, 255))
painter.setBrush(brush)
painter.drawEllipse(self._tinyRect)
@@ -640,6 +651,7 @@ class KPEditorPath(QtGui.QGraphicsLineItem):
self._startNodeRef = weakref.ref(startNode)
self._endNodeRef = weakref.ref(endNode)
self._pathRef = weakref.ref(path)
+ self.isLayerSelected = False
path.qtItem = self
@@ -685,11 +697,23 @@ class KPEditorPath(QtGui.QGraphicsLineItem):
self.setLine(QtCore.QLineF(-dx, -dy, dx, dy))
+ def setLayerSelected(self, selected):
+ self.isLayerSelected = selected
+ self.update()
+
+
def paint(self, painter, option, widget):
painter.setRenderHint(QtGui.QPainter.Antialiasing)
- painter.setPen(KPEditorPath.PEN)
+ if self.isLayerSelected:
+ brush = QtGui.QBrush(QtGui.QColor(255, 40, 40, 200))
+ pen = QtGui.QPen(brush, 12, Qt.SolidLine, Qt.RoundCap)
+ painter.setPen(pen)
+ painter.setBrush(brush)
+ else:
+ painter.setPen(KPEditorPath.PEN)
+
painter.drawLine(self.line())
if self.isSelected():