summaryrefslogtreecommitdiff
path: root/src/ui.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ui.py39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/ui.py b/src/ui.py
index 13d0039..d5418bc 100644
--- a/src/ui.py
+++ b/src/ui.py
@@ -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)