Example #1
0
def handler_add(data):
    skip, time = parse_date(data)
    if skip:
        addReminder(name=" ".join(data.split()[skip:]),
                    time=time,
                    hidden=False,
                    uuid=uuid4().hex)
Example #2
0
def handlerAddDue(data):
    words = data.split()
    try:
        index = getItem(words[0], todoList)
    except ValueError:
        error(
            "The Index must be composed of numbers. Subitems are separated by a dot."
        )
        return
    except IndexError:
        error("The Index for this item is out of range.")
        return
    item = todoList
    for i in index:
        item = item['items'][i]
    removeReminder(item['uuid'])
    skip, item['due'] = parse_date(" ".join(words[1:]))
    urgency = 0
    if 'priority' in item:
        if item['priority'] >= 100:
            urgency = 2
        elif item['priority'] >= 50:
            urgency = 1
    addReminder(name=item['name'],
                body=item['comment'],
                uuid=item['uuid'],
                time=item['due'],
                urgency=urgency)
    write_file("todolist.txt", todoList)
Example #3
0
 def parse_date_timestamp(self, date):
     date = parse_date(date)
     if date[0] == 0:
         return None
     timestamp = time.mktime(date[1].timetuple())
     return timestamp - time.time()
Example #4
0
 def parse_date_timestamp(self, date):
     date = parse_date(date)
     if date[0] == 0:
         return None
     timestamp = time.mktime(date[1].timetuple())
     return timestamp - time.time()