def handleTime(self): text = self.getText() start = text.find('<<') end = text.find('>>') # make sure the order is << then >> hasTime = True if start == -1 or end == -1 or end - start <= 3: hasTime = False if hasTime: timeStr = text[start + 2:end].strip() parsedTime = timeOps.parseTime(timeStr) self.parsedTime = parsedTime # calculate time diff diffStr = timeOps.timeDiff(parsedTime, short=True) #print diffStr if not self.hasTime: self.hasTime = True #print "starting thread" self.watchTime() #self.canvas.itemconfig(self.labelIndex, text=diffStr) else: self.hasTime = False self.canvas.itemconfig(self.labelIndex, text="")
def handleTime(self): text = self.getText() start = text.find('<<') end = text.find('>>') # make sure the order is << then >> hasTime=True if start == -1 or end == -1 or end-start <= 3: hasTime=False if hasTime: timeStr = text[start+2:end].strip() parsedTime = timeOps.parseTime(timeStr) self.parsedTime = parsedTime # calculate time diff diffStr = timeOps.timeDiff(parsedTime, short=True) #print diffStr if not self.hasTime: self.hasTime = True #print "starting thread" self.watchTime() #self.canvas.itemconfig(self.labelIndex, text=diffStr) else: self.hasTime = False self.canvas.itemconfig(self.labelIndex, text="")
def watchTime(self): if not self.hasTime: return diffStr = timeOps.timeDiff(self.parsedTime, short=True) #print "watch: ", diffStr self.canvas.itemconfig(self.labelIndex, text=diffStr) t = threading.Timer(5, self.watchTime) #, [[], stage+1, height]) t.daemon = True t.start()
def watchTime(self): if not self.hasTime: return diffStr = timeOps.timeDiff(self.parsedTime, short=True) #print "watch: ", diffStr self.canvas.itemconfig(self.labelIndex, text=diffStr) t = threading.Timer(5, self.watchTime)#, [[], stage+1, height]) t.daemon = True t.start()