def integration_action(task): edit_item = config.get(ck.KEY_EDIT_ITEM) _id = helpers.extract_todo_id(edit_item) todo = itemlist.get_todo(_id)['title'] if task.startswith("eggtimer:"): alarm_time = task.replace("eggtimer:", "") alarm_command = "alarm " + alarm_time + " " + todo config.put(ck.KEY_EDIT_ACTION, 'integration') config.put(ck.KEY_INTEGRATION_COMMAND, alarm_command)
def retrieve_and_store_tag(item): tag = 'default' if helpers.is_tag(item): tag = helpers.extract_tag(item) else: _id = helpers.extract_todo_id(item) todos = get_todo_list() target = [t for t in todos if str(t['id']) == _id] tag = target[0]['group'] config.update_state(command='retrieve_tag', tag='#'+tag)
def retrieve_and_store_tag(item): tag = 'default' if helpers.is_tag(item): tag = helpers.extract_tag(item) else: _id = helpers.extract_todo_id(item) todos = get_todo_list() target = [t for t in todos if str(t['id']) == _id] tag = target[0]['group'] config.update_state(command='retrieve_tag', tag='#' + tag)
def generate_view(query): edit_item = config.get(ck.KEY_EDIT_ITEM) have_tag = helpers.is_tag(edit_item) have_todo = helpers.is_todo(edit_item) if have_todo: _id = helpers.extract_todo_id(edit_item) generate_view_itemedit(_id, query) elif have_tag: generate_view_tagedit(helpers.extract_tag(edit_item), query) else: generate_select_item()
def actionize(query): if len(query) <= 0: return have_tag = helpers.is_tag(query) have_todo = helpers.is_todo(query) if not (have_tag or have_todo): itemlist.save_todo(query) elif have_todo: itemlist.copy_todo_to_clipboard(helpers.extract_todo_id(query)) elif have_tag: config.put('todo.tag.recent', "#"+helpers.extract_tag(query))
def actionize(query): if len(query) <= 0: return have_tag = helpers.is_tag(query) have_todo = helpers.is_todo(query) if not (have_tag or have_todo): itemlist.save_todo(query) elif have_todo: itemlist.copy_todo_to_clipboard(helpers.extract_todo_id(query)) elif have_tag: config.put('todo.tag.recent', "#" + helpers.extract_tag(query))
def process_query(query): if query.startswith("_integration:"): integration_action(query.replace("_integration:", "")) return edit_item = config.get(ck.KEY_EDIT_ITEM) have_tag = helpers.is_tag(edit_item) have_todo = helpers.is_todo(edit_item) if have_todo: _id = helpers.extract_todo_id(edit_item) update_todo(_id, query) elif have_tag: update_tag(helpers.extract_tag(edit_item), query) config.put(ck.KEY_EDIT_ITEM, '')
def main(): (option, query) = alfred.args2() if option == "-c": itemlist.clear_todos() elif option == "-a": actionize(query) elif option == "-q": process_todo_query(query) elif option == "-r": itemlist.remove_item(query) elif option == "-v": itemlist.retrieve_and_store_tag(query) elif option == '-p': if helpers.is_todo(query): itemlist.toggle_pinned(helpers.extract_todo_id(query))
def main(): (option, query) = alfred.args2() if option == "-c": itemlist.clear_todos() elif option == "-a": actionize(query) elif option == "-q": process_todo_query(query) elif option == "-r": itemlist.remove_item(query) elif option == "-v": itemlist.retrieve_and_store_tag(query) elif option == '-p': if helpers.is_todo(query): itemlist.toggle_pinned(helpers.extract_todo_id(query))
def actionize(query): if len(query) <= 0: return have_tag = helpers.is_tag(query) have_todo = helpers.is_todo(query) if not (have_tag or have_todo): itemlist.save_todo(query) elif have_todo: _id = helpers.extract_todo_id(query) # smart content is a bit rudimentary at the moment if smartcontent.smartcontent_enabled(): smartcontent.perform_action(_id) else: itemlist.copy_todo_to_clipboard(_id) elif have_tag: config.put(ck.KEY_TAG_RECENT, "#"+helpers.extract_tag(query))
def remove_item(item): if helpers.is_todo(item): remove_todo(helpers.extract_todo_id(item)) elif helpers.is_tag(item): remove_tag(helpers.extract_tag(item))
def toggle_done(query): if helpers.is_todo(query): itemlist.toggle_done(helpers.extract_todo_id(query))
def toggle_pin(query): if helpers.is_todo(query): itemlist.toggle_pinned(helpers.extract_todo_id(query))
def remove_item(item): if helpers.is_todo(item): remove_todo(helpers.extract_todo_id(item)) elif helpers.is_tag(item): remove_tag(helpers.extract_tag(item))