예제 #1
0
    def touch(self, time):
        if type(time) is str:
            time = CTU.parse_time_point(time)
        if self.ongoing_action is None:
            fail('No ongoing task to touch at ' + CTU.time_point_string(time))

        self.switch(self.ongoing_action[0], time)
예제 #2
0
 def start(self, label, time):
     if type(time) is str:
         time = CTU.parse_time_point(time)
     if self.ongoing_action is not None:
         fail(self.ongoing_action[0] + ' already running, can\'t start ' +
              label + ' at ' + CTU.time_point_string(time))
     self.ongoing_action = (label, time)
예제 #3
0
    def stop(self, time):
        if type(time) is str:
            time = CTU.parse_time_point(time)
        if self.ongoing_action is None:
            fail('Nothing to stop (at ' + CTU.time_point_string(time) + ')')

        label = self.ongoing_action[0]
        passed_time = time - self.ongoing_action[1]
        if passed_time < 0:
            if self.allowed_leaps <= 0:
                fail('Not enough dayleaps for period ' +
                     CTU.time_point_string(self.ongoing_action[1]) + ' - ' +
                     CTU.time_point_string(time))
            self.allowed_leaps -= 1
            passed_time += 24 * 60

        self.checkin(label, passed_time)
        self.ongoing_action = None
예제 #4
0
 def pop_stop(self, time):
     if type(time) is str:
         time = CTU.parse_time_point(time)
     self.start(self.task_stack.pop(), time)
예제 #5
0
 def push_stop(self, time):
     if type(time) is str:
         time = CTU.parse_time_point(time)
     self.task_stack.append(self.ongoing_action[0])
     self.stop(time)
예제 #6
0
 def push(self, label, time):
     if type(time) is str:
         time = CTU.parse_time_point(time)
     self.task_stack.append(self.ongoing_action[0])
     self.switch(label, time)
예제 #7
0
 def switch(self, label, time):
     if type(time) is str:
         time = CTU.parse_time_point(time)
     self.stop(time)
     self.start(label, time)