diff options
author | Colin Noga <Tempus@Spectrum-Song.local> | 2011-11-09 19:00:49 -0600 |
---|---|---|
committer | Colin Noga <Tempus@Spectrum-Song.local> | 2011-11-09 19:00:49 -0600 |
commit | 58397adbf19eb20d1359fa591a147ec7117821e6 (patch) | |
tree | b10f63a3b60c42b3d23a29070b674a59b8308adf /src/tileset.py | |
parent | 033904483314a538b2ab44d8b718750745a99e8f (diff) | |
download | koopatlas-58397adbf19eb20d1359fa591a147ec7117821e6.tar.gz koopatlas-58397adbf19eb20d1359fa591a147ec7117821e6.zip |
KPObjectSelector and everything it needs is all setup. Emits objects as required, and can return an object with currentSelectedObject().
Diffstat (limited to '')
-rw-r--r-- | src/tileset.py | 35 |
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 |