diff options
Diffstat (limited to '')
-rw-r--r-- | src/editorui.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/editorui.py b/src/editorui.py index 51b148d..4eeca1d 100644 --- a/src/editorui.py +++ b/src/editorui.py @@ -1,6 +1,12 @@ from common import * class KPMapScene(QtGui.QGraphicsScene): + def __init__(self): + QtGui.QGraphicsScene.__init__(self) + + self.currentLayer = None + + def drawBackground(self, painter, rect): painter.fillRect(rect, Qt.white) @@ -58,6 +64,21 @@ class KPMapScene(QtGui.QGraphicsScene): srcY += 1 destY += 24 + + + def setCurrentLayer(self, layer): + if self.currentLayer is not None: + self.setLayerObjectsFlag(self.currentLayer, QtGui.QGraphicsItem.ItemIsSelectable, False) + + self.currentLayer = layer + self.setLayerObjectsFlag(layer, QtGui.QGraphicsItem.ItemIsSelectable, True) + + + def setLayerObjectsFlag(self, layer, flag, value): + for obj in layer.objects: + item = obj.qtItem + if item: + item.setFlag(flag, value) class KPEditorWidget(QtGui.QGraphicsView): pass |