Beispiel #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)
Beispiel #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)
Beispiel #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
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)