Beispiel #1
0
    def frameUpdate(self):
        if not self.state.runEnded\
            and (not timeh.greater(self.state.currentComparison.totals[self.state.splitnum],self.state.totalTime)\
            or not timeh.greater(self.state.comparisons[0].segments[self.state.splitnum],self.state.segmentTime)):

            self.showCurrentSplitDiff()
        if not self.state.runEnded:
            self.updateGroupTimer()
Beispiel #2
0
    def setPreviousColour(self):
        split = self.state.splitnum-1
        if timeh.isBlank(self.state.comparisons[0].segments[split])\
            or timeh.isBlank(self.state.currentRun.segments[split])\
            or timeh.isBlank(self.state.currentComparison.segments[split]):
            return self.config["colours"]["skipped"]

        if timeh.greater(self.state.comparisons[0].segments[split],self.state.currentRun.segments[split]):
            return self.config["colours"]["gold"]

        elif timeh.greater(self.state.currentComparison.segments[split],self.state.currentRun.segments[split]):
            return self.config["colours"]["gaining"]

        else:
            return self.config["colours"]["losing"]
Beispiel #3
0
 def getCurrentDiffColour(self,segmentDiff,totalDiff):
     if timeh.greater(0,totalDiff):
         # if comparison segment is blank or current segment is
         # ahead
         if timeh.greater(0,segmentDiff):
             return self.config["diff"]["colours"]["aheadGaining"]
         else:
             return self.config["diff"]["colours"]["aheadLosing"]
     else:
         # if comparison segment is blank or current segment is
         # behind
         if timeh.greater(segmentDiff,0):
             return self.config["diff"]["colours"]["behindLosing"]
         else:
             return self.config["diff"]["colours"]["behindGaining"]
Beispiel #4
0
 def isPB(self):
     if self.currentRun.lastNonBlank() > self.comparisons[2].lastNonBlank():
         return True
     if self.currentRun.lastNonBlank() < self.comparisons[2].lastNonBlank():
         return False
     if timeh.greater(0, self.comparisons[2].totalDiffs[-1]):
         return True
     return False
Beispiel #5
0
 def updateBestExit(self, splitnum):
     if not timeh.greater(self.state.comparisons[3].totalDiffs[splitnum],0)\
         or\
         (timeh.isBlank(self.state.comparisons[3].totals[splitnum])\
         and not timeh.isBlank(self.state.currentRun.totals[splitnum])):
         self.info.configure(text="Yes", fg=self.config["colours"]["yes"])
     else:
         self.info.configure(text="No", fg=self.config["colours"]["no"])
Beispiel #6
0
    def frameUpdate(self):
        if self.state.runEnded:
            return
        if self.state.splitnum and self.shouldHide():
            self.hide()
            return
        if (not timeh.greater(self.state.comparisons[0].segments[self.state.splitnum],self.state.segmentTime)\
            and not timeh.isBlank(self.state.comparisons[0].segments[self.state.splitnum]))\
            or (not timeh.greater(self.state.comparisons[3].totals[self.state.splitnum],self.state.totalTime)\
            and not timeh.isBlank(self.state.comparisons[3].totals[self.state.splitnum]))\
            and not (self.state.splitnum and timeh.isBlank(self.state.currentRun.totals[self.state.splitnum-1])):

            if self.shouldHide():
                self.hide()
                return

            self.setTimes(self.state.totalTime, previous=False)
Beispiel #7
0
    def setColour(self, segment, total, split):
        if timeh.greater(self.state.comparisons[3].totals[split], total):

            if timeh.greater(self.state.comparisons[3].segments[split],
                             segment):
                return self.config["colours"]["aheadGaining"]

            else:
                return self.config["colours"]["aheadLosing"]

        else:
            if timeh.greater(self.state.comparisons[3].segments[split],
                             segment):
                return self.config["colours"]["behindGaining"]

            else:
                return self.config["colours"]["behindLosing"]
Beispiel #8
0
    def setCurrentColour(self):
        split = self.state.splitnum
        if timeh.isBlank(self.state.currentComparison.segments[split]):
            return self.config["colours"]["skipped"]

        elif timeh.greater(self.state.currentComparison.segments[split],self.state.segmentTime):
            return self.config["colours"]["gaining"]
        else:
            return self.config["colours"]["losing"]
Beispiel #9
0
 def onSplit(self, time):
     self.runEnded = True
     splitTime = time - self.starttime
     self.currentTime = splitTime
     self.unSaved = True
     if timeh.greater(self.bestTime, splitTime):
         self.bestTime = splitTime
     self.unSaved = True
     return 4
Beispiel #10
0
    def completeSegment(self, time):
        totalTime = time - self.starttime
        splitTime = time - self.splitstarttime
        self.currentRun.addSegment(splitTime, totalTime)
        self.bptList.update(totalTime)

        for i in range(self.numComparisons):
            self.comparisons[i].updateDiffs(splitTime, totalTime)
        if timeh.isBlank(
                self.currentBests.bests[self.splitnum]) or not timeh.greater(
                    self.currentRun.segments[-1],
                    self.currentBests.bests[self.splitnum]):
            self.currentBests.update(splitTime, self.splitnum)
        if timeh.isBlank(
                self.bestExits.totals[self.splitnum]) or not timeh.greater(
                    totalTime, self.bestExits.totals[self.splitnum]):
            self.bestExits.update(totalTime, self.splitnum)
        self.splitnum = self.splitnum + 1
        self.splitstarttime = time
        if self.splitnum >= len(self.splitnames):
            self.runEnded = True
            self.localSave()
Beispiel #11
0
    def frameUpdate(self):
        if self.state.runEnded:
            return
        if self.state.splitnum and self.shouldHide():
            self.hide()
            return
        if not timeh.greater(self.state.comparisons[0].segments[self.state.splitnum],self.state.segmentTime)\
            and not timeh.isBlank(self.state.comparisons[0].segments[self.state.splitnum])\
            and not (self.state.splitnum and timeh.isBlank(self.state.currentRun.segments[self.state.splitnum-1])):

            if self.state.splitnum and self.shouldHide():
                self.hide()
                return

            self.header.configure(text="Current Segment:")
            self.setTimes(self.state.segmentTime,previous=False)
Beispiel #12
0
 def findDiffColour(self,splitIndex):
     # Either the split in this run is blank, or we're comparing
     # to something that's blank
     if \
         timeh.isBlank(self.state.currentRun.totals[splitIndex]) \
         or timeh.isBlank(self.state.currentComparison.totals[splitIndex]):
         return self.config["diff"]["colours"]["skipped"]
     # This split is the best ever. Mark it with the gold colour
     elif not timeh.isBlank(self.state.comparisons[0].segmentDiffs[splitIndex]) \
         and timeh.greater(0,self.state.comparisons[0].segmentDiffs[splitIndex]):
         return self.config["diff"]["colours"]["gold"]
     else:
         return self.getCurrentDiffColour(\
             self.state.currentComparison.segmentDiffs[splitIndex],\
             self.state.currentComparison.totalDiffs[splitIndex]\
         )
Beispiel #13
0
 def frameUpdate(self):
     if self.state.runEnded:
         return
     if self.shouldHide():
         self.hide()
         return
     if not timeh.greater(
             self.state.comparisons[0].segments[self.state.splitnum],
             self.state.segmentTime):
         self.info.configure(
             text=\
                 timeh.timeToString(\
                     timeh.add(\
                         timeh.difference(self.state.segmentTime,self.state.comparisons[0].segments[self.state.splitnum]),\
                         self.state.bptList.total
                     ), \
                     {\
                         "precision": self.config["precision"]\
                     }\
                 )\
         )
Beispiel #14
0
    def timerColour(self):
        splitnum = self.state.splitnum
        comparisonTime = self.state.currentComparison.totals[splitnum]
        comparisonSegment = self.state.currentComparison.segments[splitnum]
        goldSegment = self.state.comparisons[0].segments[splitnum]

        # last split skipped
        if self.state.splitnum \
            and timeh.isBlank(self.state.currentRun.totals[-1]):
            # total blank or ahead of total
            if timeh.greater(comparisonTime, self.state.totalTime):
                return self.config["mainTimer"]["colours"]["main"]
            # behind total
            else:
                return self.config["mainTimer"]["colours"]["behindLosing"]
        # total blank
        if timeh.isBlank(comparisonTime):
            # gold blank or ahead of gold
            if timeh.greater(goldSegment, self.state.segmentTime):
                return self.config["mainTimer"]["colours"]["main"]
            # behind gold
            else:
                return self.config["mainTimer"]["colours"]["behindLosing"]
        # ahead of total
        elif timeh.greater(comparisonTime, self.state.totalTime):
            # segment blank
            if timeh.isBlank(comparisonSegment):
                # gold blank or ahead of gold
                if timeh.greater(goldSegment, self.state.segmentTime):
                    return self.config["mainTimer"]["colours"]["main"]
                # behind gold
                else:
                    return self.config["mainTimer"]["colours"]["aheadLosing"]
            # ahead of segment
            elif timeh.greater(comparisonSegment, self.state.segmentTime):
                # gold blank or ahead of gold
                if timeh.greater(goldSegment, self.state.segmentTime):
                    return self.config["mainTimer"]["colours"]["main"]
                # behind gold
                else:
                    return self.config["mainTimer"]["colours"][
                        "notGoldAheadGaining"]
            # behind segment
            else:
                return self.config["mainTimer"]["colours"]["aheadLosing"]
        # behind total
        else:
            # segment blank
            if timeh.isBlank(comparisonSegment):
                # gold blank or behind gold
                if timeh.greater(self.state.segmentTime, goldSegment):
                    return self.config["mainTimer"]["colours"]["behindLosing"]
                # ahead of gold
                else:
                    return self.config["mainTimer"]["colours"]["behindGaining"]
            # ahead of segment
            elif timeh.greater(comparisonSegment, self.state.segmentTime):
                # gold blank or ahead of gold
                if timeh.greater(goldSegment, self.state.segmentTime):
                    return self.config["mainTimer"]["colours"]["behindGaining"]
                # behind gold
                else:
                    return self.config["mainTimer"]["colours"][
                        "notGoldBehindGaining"]
            # behind segment
            else:
                return self.config["mainTimer"]["colours"]["behindLosing"]