diff options
author | Treeki <treeki@gmail.com> | 2011-11-10 04:18:03 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-11-10 04:18:03 +0100 |
commit | 9d4c8e28b33689750e44b4c1f390caaf5c9b878e (patch) | |
tree | f70ff51930c0c1aa647d9050499358f80a983cee /src/editorui.py | |
parent | a7655cdfd41c06f8a5ac9b696289ec74bbb4261a (diff) | |
download | koopatlas-9d4c8e28b33689750e44b4c1f390caaf5c9b878e.tar.gz koopatlas-9d4c8e28b33689750e44b4c1f390caaf5c9b878e.zip |
some work on the layer handling
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 |