summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/editorui/editormain.py5
-rw-r--r--src/editorui/paths.py10
2 files changed, 14 insertions, 1 deletions
diff --git a/src/editorui/editormain.py b/src/editorui/editormain.py
index 8ffd034..f25452b 100644
--- a/src/editorui/editormain.py
+++ b/src/editorui/editormain.py
@@ -260,11 +260,14 @@ class KPEditorWidget(QtGui.QGraphicsView):
endNode = origPath._endNodeRef()
origPath.setEnd(node)
- origPath.qtItem.updatePosition()
nodeItem = KPEditorNode(node)
self.scene().addItem(nodeItem)
+ # TODO: fix this ugly bit of code
+ item._endNodeRef = weakref.ref(nodeItem)
+ item.updatePosition()
+
self.painting = node
self.paintingItem = item
self.paintBeginPosition = (x - 12, y - 12)
diff --git a/src/editorui/paths.py b/src/editorui/paths.py
index c8cac78..cec85fa 100644
--- a/src/editorui/paths.py
+++ b/src/editorui/paths.py
@@ -389,6 +389,11 @@ class KPEditorPath(QtGui.QGraphicsLineItem):
def updatePosition(self):
path = self._pathRef()
+ sn = path._startNodeRef()
+ en = path._endNodeRef()
+ if sn is None or en is None:
+ return
+
x1, y1 = path._startNodeRef().position
x2, y2 = path._endNodeRef().position
@@ -421,6 +426,11 @@ class KPEditorPath(QtGui.QGraphicsLineItem):
def remove(self, withItem=False):
+ if hasattr(self, 'hasBeenRemovedAlready'):
+ return
+
+ self.hasBeenRemovedAlready = True
+
path = self._pathRef()
layer = KP.map.pathLayer