def __init__(self, parent, comparisons, parentObj): super().__init__(parent, width=600, height=300) self.editor = parentObj self.rightFrame = tk.Frame(self.main()) self.rightFrame.pack(side="left", fill="y") self.headers = comparisons[0][1:] self.comparisonData = comparisons self.cornerLabel = tk.Label(self.corner(), text=comparisons[0][0]) self.cornerLabel.pack(side="right", fill="both") self.rows = [] self.originals = list(range(len(comparisons) - 1)) for i in range(1, len(comparisons)): row = EntryRow.EntryRow(self.rightFrame, self, comparisons[i][1:]) row.pack(side="top", fill="both") self.rows.append(row) self.comparisons = [] for i in range(1, len(comparisons[0]), 2): self.comparisons.append( SumList.SumList([ timeh.stringToTime(comparisons[j][i]) for j in range(1, len(comparisons)) ]))
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 getRows(completeCsv): rows = [] for i in range(len(completeCsv)): timeList = [] for j in range(len(completeCsv[i])): time = timeh.stringToTime(completeCsv[i][j]) if not timeh.isBlank(time): timeList.append(time) rows.append(timeList) return rows
def findBestExit(splitnum, complete): minVal = 100000000 for i in range(int((len(complete[0]) - 1) / 2)): val = timeh.stringToTime(complete[splitnum + 1][2 * i + 2]) if (timeh.isBlank(val)): continue if val < minVal: minVal = val if minVal == 100000000: return 'BLANK' return minVal
def updateComparisonValue(self, row, comparison, time): self.comparisons[comparison].update(timeh.stringToTime(time), self.rows.index(row)) self.updateComparison(comparison, ["label"])
def getTimesByCol(col, data_ref): times = [] for i in range(1, len(data_ref)): times.append(timeh.stringToTime(data_ref[i][col])) return times