summaryrefslogtreecommitdiff
path: root/src/tileset.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/tileset.py')
-rw-r--r--src/tileset.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/tileset.py b/src/tileset.py
index b0cb88c..c060f07 100644
--- a/src/tileset.py
+++ b/src/tileset.py
@@ -187,6 +187,25 @@ class KPGroupModel(QtCore.QAbstractListModel):
return self.container.objectCount()
+ def groupItem(self):
+ """Returns the group item"""
+
+ return self.container
+
+
+ def flags(self, index):
+ # item = QtCore.QAbstractItemModel.flags(self, index)
+
+ item, depth = self.container.getItem(index.row())
+
+ if isinstance(item, KPGroupItem):
+ return Qt.ItemFlags(32)
+ else:
+ return Qt.ItemFlags(33)
+
+ return Qt.ItemFlags(33)
+
+
def data(self, index, role=Qt.DisplayRole):
# Should return the contents of a row when asked for the index
#
@@ -261,6 +280,19 @@ class KPGroupItem(object):
self.alignment = Qt.AlignCenter
+ def getGroupList(self, returnList=[], depth=0):
+ """Gets a list of group names and indices for the sorter menu"""
+
+ returnList.append(((' ' * depth) + self.name, self.startIndex, self.endIndex))
+
+ depth += 1
+
+ for group in self.groups:
+ group.getGroupList(returnList, depth)
+
+ return returnList
+
+
def objectCount(self):
''' Retrieves the total number of items in this group and all it's children '''
@@ -352,6 +384,9 @@ class KPTileset(object):
getObjectIcon(KPTileObject, (width, height))
# Returns a render map for the Object at the given size
+ getModel()
+ # Returns the tileset's groupModel, which handles groups
+
overrideTile(Tile Index, QPixmap)
# Takes a 24x24 QPixmap and a tile index