def compareTags(self, x, y): timeCmp = cmp(self.getTagTimeInSeconds(x), self.getTagTimeInSeconds(y)) if timeCmp: return timeCmp elif len(x) != len(y): # If the timing is the same, sort alphabetically # Any number should be sorted numerically, do this by padding them with leading zeroes return cmp(plugins.padNumbersWithZeroes(x), plugins.padNumbersWithZeroes(y)) else: return cmp(x, y)
def insertIntoModel(self, parentIter, modelAttributes): if parentIter: paddedClassifier = plugins.padNumbersWithZeroes(modelAttributes[0]) follower = self.findChildIter( parentIter, lambda name: plugins.padNumbersWithZeroes(name) > paddedClassifier) return self.treeModel.insert_before(parentIter, follower, modelAttributes) else: return self.treeModel.append(parentIter, modelAttributes)
def tagSortKey(self, x): return self.getTagTimeInSeconds(x), plugins.padNumbersWithZeroes(x)
def getDateTagKey(self, info): return info[0], plugins.padNumbersWithZeroes(info[1])