diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/editorui/editormain.py | 3 | ||||
-rw-r--r-- | src/editorui/paths.py | 12 | ||||
-rw-r--r-- | src/ui.py | 39 |
3 files changed, 38 insertions, 16 deletions
diff --git a/src/editorui/editormain.py b/src/editorui/editormain.py index 46660f4..6161e7d 100644 --- a/src/editorui/editormain.py +++ b/src/editorui/editormain.py @@ -64,7 +64,7 @@ class KPMapScene(QtGui.QGraphicsScene): @QtCore.pyqtSlot(int) - def viewportUpdateProxy(self, value): + def viewportUpdateProxy(self, valueA = None, value = None): self.views()[0].viewport().update() @@ -252,6 +252,7 @@ class KPMapScene(QtGui.QGraphicsScene): elif isinstance(layer, KPPathLayer): for pnLayer in reversed(KP.mainWindow.pathNodeList.getLayers()): + if not pnLayer.visible: continue # Render Tiles left, top = pnLayer.cacheBasePos diff --git a/src/editorui/paths.py b/src/editorui/paths.py index 55bfac0..b240b22 100644 --- a/src/editorui/paths.py +++ b/src/editorui/paths.py @@ -142,7 +142,6 @@ class KPEditorNode(KPEditorItem): self.transitionProxy = self.HiddenProxy(self.transition, self, -102, 24) self.transition.currentIndexChanged.connect(self.transitionChange) - self._updatePosition() @@ -183,6 +182,7 @@ class KPEditorNode(KPEditorItem): self.update() + KP.mainWindow.pathNodeList.update() @QtCore.pyqtSlot(int) @@ -191,6 +191,8 @@ class KPEditorNode(KPEditorItem): node = self._nodeRef() node.level[0] = world + KP.mainWindow.pathNodeList.update() + @QtCore.pyqtSlot(int) def stageChange(self, stage): @@ -198,6 +200,8 @@ class KPEditorNode(KPEditorItem): node = self._nodeRef() node.level[1] = stage + KP.mainWindow.pathNodeList.update() + @QtCore.pyqtSlot(int) def foreignIDChange(self, ID): @@ -205,6 +209,8 @@ class KPEditorNode(KPEditorItem): node = self._nodeRef() node.foreignID = ID + KP.mainWindow.pathNodeList.update() + @QtCore.pyqtSlot(int) def transitionChange(self, index): @@ -212,6 +218,8 @@ class KPEditorNode(KPEditorItem): node = self._nodeRef() node.transition = index + KP.mainWindow.pathNodeList.update() + @QtCore.pyqtSlot(str) def mapChangeChange(self, mapname): @@ -219,6 +227,8 @@ class KPEditorNode(KPEditorItem): node = self._nodeRef() node.mapChange = mapname + KP.mainWindow.pathNodeList.update() + def _updatePosition(self): self.ignoreMovement = True @@ -16,7 +16,7 @@ class KPPathNodeList(QtGui.QWidget): self.layer = layer self.associate = associate - self.setFlags(Qt.ItemIsSelectable | Qt.ItemIsDragEnabled | Qt.ItemIsEnabled) + self.setFlags(Qt.ItemIsSelectable | Qt.ItemIsDragEnabled | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable) def data(self, index, role=Qt.DisplayRole): @@ -26,33 +26,35 @@ class KPPathNodeList(QtGui.QWidget): node = self.associate if node.level: - return QtGui.QIcon('LevelNodeIcon') + return KP.icon('BlackLevel') elif node.mapChange != None: - return QtGui.QIcon('ExitNodeIcon') + return KP.icon('Exit') elif len(node.exits) != 2: - return QtGui.QIcon('StopNodeIcon') + return KP.icon('Stop') else: - return QtGui.QIcon('ThroughNodeIcon') + return KP.icon('Through') else: - return QtGui.QIcon('PathIcon') + return KP.icon('LayerPath') elif role == Qt.DisplayRole: if isinstance(self.associate, KPNode): node = self.associate if node.level: - return "Level Node: {0}".format(node.level) + return "Level: {0}".format(node.level) elif node.mapChange != None: - return "Exit to World {0}, entrance {1}".format(mapID, foreignID) + return "Exit: World {0}, entrance {1}".format(node.mapID, node.foreignID) elif len(node.exits) == 3: - return "3-way Junction" + return "Node: 3-way Junction" elif len(node.exits) == 4: - return "4-way Junction" + return "Node: 4-way Junction" + elif (len(node.exits) == 1) or (len(node.exits) == 0): + return "Node: End Point" elif len(node.exits) > 4: return "Illegal Node" else: - return "Pass Through Node" + return "Node: Pass-Through" else: AnimationList = ["Walk", "WalkSand", "WalkSnow", "WalkIce", @@ -67,10 +69,18 @@ class KPPathNodeList(QtGui.QWidget): return 'Path: {0} Exit, {1}'.format(unlock, animation) + elif role == Qt.CheckStateRole: + return (Qt.Checked if self.layer.visible else Qt.Unchecked) + else: return QtGui.QTreeWidgetItem.data(self, index, role) + def setData(self, column, role = Qt.EditRole, value = None): + if role == Qt.CheckStateRole: + self.layer.visible = value.toBool() + + def layer(self): return self.layer @@ -88,6 +98,7 @@ class KPPathNodeList(QtGui.QWidget): self.tree.setColumnCount(1) self.tree.setDragEnabled(True) self.tree.setDragDropMode(self.tree.InternalMove) + self.tree.setHeaderHidden(True) self.tree.itemClicked.connect(self.handleRowChanged) self.layout.addWidget(self.tree) @@ -99,8 +110,8 @@ class KPPathNodeList(QtGui.QWidget): def setupToolbar(self, tb): - self.actAddFolder = tb.addAction(KP.icon('LayerNewTile'), 'Add Folder', self.addFolder) - self.actRemoveFolder = tb.addAction(KP.icon('LayerNewObjects'), 'Remove Folder', self.removeFolder) + self.actAddFolder = tb.addAction(KP.icon('NewFolder'), 'Add Folder', self.addFolder) + self.actRemoveFolder = tb.addAction(KP.icon('DelFolder'), 'Remove Folder', self.removeFolder) self.selectTileset = tb.addAction(KP.icon('LayerNewTile'), 'Select Tileset', self.setTileset) selectedLayerChanged = QtCore.pyqtSignal(KPLayer) @@ -115,7 +126,7 @@ class KPPathNodeList(QtGui.QWidget): def addFolder(self): item = QtGui.QTreeWidgetItem(self.tree) - item.setIcon(0, QtGui.QIcon('Folder')) + item.setIcon(0, KP.icon('Folder')) item.setText(0, 'Untitled Folder') item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsDragEnabled | Qt.ItemIsDropEnabled | Qt.ItemIsEditable | Qt.ItemIsEnabled) |