Beispiel #1
0
    def execute(self, args, allow_adium_update=True):
        clockout_time = parse_date(args.time) if args.time else now

        project, clockin_time = self.clocked_in_info()

        if project:
            if clockout_time >= clockin_time:
                write_clockout(clockout_time)

                log.info("Clocked out of %s at %s" % (project, clockout_time.strftime(user_date_format)))

                conf = load_config()
                if allow_adium_update and conf["adium"]:
                    time_str = clockout_time.strftime(user_date_format)
                    adium_str = (
                        "Not currently tracking time. Last seen at %(location)s working on %(project)s. (updated %(time)s)"
                        % dict(location=conf["location"], project=project, time=time_str)
                    )
                    if set_adium_status(adium_str + blurb, args.away):
                        log.info("Updated Adium status to: %s" % adium_str)
                    else:
                        log.info("Couldn't update Adium status")
            else:
                log.info("Clockout time is before last clockin time. Clockout failed.")
        else:
            log.info("Not clocked into anything. Clockout failed.")
Beispiel #2
0
    def execute(self, args):
        project, clockin_time = self.clocked_in_info()
        if project:
            commands["clockout"].execute(args, allow_adium_update=False)

        clockin_time = parse_date(args.time) if args.time else now

        write_clockin(args.project, clockin_time)

        log.info("Clocked into %s at %s" % (args.project, clockin_time.strftime(user_date_format)))

        conf = load_config()
        if conf["adium"]:
            time_str = clockin_time.strftime(user_date_format)
            adium_str = "At %(location)s working on %(project)s. (updated %(time)s)" % dict(
                location=conf["location"], project=args.project, time=time_str
            )
            if set_adium_status(adium_str + blurb, args.away):
                log.info("Updated Adium status to: %s" % adium_str)
            else:
                log.info("Couldn't update Adium status")