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 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 perform_action(_id): content = itemlist.get_todo(_id)['title'] (action, content) = analyse_content(content) smartcontent_actions = { 'copy_to_clipboard': lambda _id, content: itemlist.copy_todo_to_clipboard(_id), 'open_url': lambda _id, content: open_url(content), 'open_file': lambda _id, content: open_url(content), 'open_dir': lambda _id, content: open_url(content) } smartcontent_actions[action](_id, content)