def fillTimes(self, requiredLength): n = len(self.segments) if not n: self.empty = True for _ in range(requiredLength - n): self.segments.append(timeh.blank()) self.totals.append(timeh.blank())
def skipSegment(self, time): self.currentRun.addSegment(timeh.blank(), timeh.blank()) self.bptList.update(time - self.starttime) for i in range(self.numComparisons): self.comparisons[i].updateDiffs(timeh.blank(), timeh.blank()) self.splitnum = self.splitnum + 1 self.splitstarttime = time if self.splitnum >= len(self.splitnames): self.runEnded = True self.localSave()
def getString(self,name,index,options={}): if (name == "segments"): return timeh.timeToString(self.segments[index],options) if (name == "totals"): return timeh.timeToString(self.totals[index],options) if (name == "segmentDiffs"): return timeh.timeToString(self.segmentDiffs[index],options) if (name == "totalDiffs"): return timeh.timeToString(self.totalDiffs[index],options) return timeh.blank()
def setTotals(self): if not len(self.bests): self.total = timeh.blank() self.totalBests = [] return total = self.bests[0] self.totalBests[0] = total for i in range(1,len(self.bests)): total = timeh.add(total,self.bests[i]) self.totalBests[i] = total self.total = total
def getAverages(self): averages = [] for i in range(len(self.splitnames)): average = [] for j in range(int((len(self.completeCsv[0]) - 1) / 2)): time = timeh.stringToTime(self.completeCsv[i + 1][2 * j + 1]) if not timeh.isBlank(time): average.append( timeh.stringToTime(self.completeCsv[i + 1][2 * j + 1])) if not timeh.isBlank(self.currentRun.segments[i]): average.append(self.currentRun.segments[i]) averageTime = timeh.sumTimeList(average) if timeh.isBlank(averageTime): averages.append(timeh.blank()) else: averages.append(averageTime / len(average)) return SumList.SumList(averages)
def setMainDiffs(self): for i in range(self.numRows-1): split = self.splits.currentSplits[i] if self.splits.typeChecker.isEmpty(split): self.rows[i].setDiff(text="") elif self.splits.typeChecker.isGroup(split): if (split.end < self.state.splitnum): if split.start > 0: groupChange = timeh.difference(\ timeh.difference(\ self.state.currentRun.totals[split.end],\ self.state.currentRun.totals[split.start]\ ),\ timeh.difference(\ self.state.currentComparison.totals[split.end],\ self.state.currentComparison.totals[split.start]\ )\ ) if timeh.isBlank(groupChange): diffColour = self.config["diff"]["colours"]["skipped"] else: diffColour=self.getCurrentDiffColour(\ groupChange,\ self.state.currentComparison.totalDiffs[split.end]\ ) else: diffColour=self.getCurrentDiffColour(\ timeh.blank(),\ self.state.currentComparison.totalDiffs[split.end]\ ) self.rows[i].setDiff(\ text=self.formatDiff(self.state.currentComparison.totalDiffs[split.end]),\ fg=diffColour\ ) else: self.rows[i].setDiff(text="") else: if (split.index < self.state.splitnum): self.rows[i].setDiff(\ text=self.formatDiff(self.state.currentComparison.totalDiffs[split.index]),\ fg=self.findDiffColour(split.index)\ ) else: self.rows[i].setDiff(text="")
def insertNewSegment(self,segment): self.bests.insert(segment,timeh.blank()) if segment < len(self.totalBests): self.totalBests.insert(segment,self.totalBests[segment]) else: self.totalBests.insert(segment,timeh.blank())
def addComparison(self): self.headerRow.addHeaders(["New Split", "New Comparison"]) for row in self.rows: row.addComparison() self.comparisons.append( SumList.SumList([timeh.blank() for _ in self.rows]))
def updateDiffs(self,splittime,totaltime): if (not(len(self.segmentDiffs)) or not timeh.isBlank(self.totalDiffs[-1])): self.segmentDiffs.append(timeh.difference(splittime,self.segments[len(self.segmentDiffs)])) else: self.segmentDiffs.append(timeh.blank()) self.totalDiffs.append(timeh.difference(totaltime,self.totals[len(self.totalDiffs)]))
def addSegment(self, segment, total): if (not (len(self.segments)) or not timeh.isBlank(self.totals[-1])): self.segments.append(segment) else: self.segments.append(timeh.blank()) self.totals.append(total)