Пример #1
0
def generate_view(query):
	if len(query) == 0  and config.get('todo.command.last') == 'quick_create':
		add_query = config.get('todo.user.query')
		add_tag = config.get('todo.tag.recent')
		itemlist.save_todo(add_query,silent=True)
		config.update_state(command='', query='')

	info = parser.parse(query)
	tag = info['tag']
	q = info['task']
	
	todos = itemlist.get_todo_list()

	# view for pinned items
	# pinned items should have unique uuid and different logo
	pinned = [t for t in todos if itemlist.feature(t,'pinned') == True]
	pinned = [t for t in pinned if (tag is None or t['group'] == tag)]
	pinned = [t for t in pinned if (q is None or t['title'].lower().find(q.lower()) >= 0)] 
	pinned = pinned[::-1]
	# view for non-pinned items
	normal = [t for t in todos if itemlist.feature(t,'pinned') == False]
	normal = [t for t in normal if (tag is None or t['group'] == tag)]
	normal = [t for t in normal if (q is None or t['title'].lower().find(q.lower()) >= 0)] 
	normal = normal[::-1]

	feedback_items = []
	if len(normal) == 0 and len(pinned) == 0:
		feedback_items.append( generate_add_feedbackitem(query, info) )
	else:
		pinned = map(lambda x: generate_pinned_feedbackitem(x), pinned)
		normal = map(lambda x: generate_todo_feedbackitem(x), normal)
		feedback_items = pinned + normal
	
	alfred.write(alfred.xml(feedback_items))
Пример #2
0
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))
Пример #3
0
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))
Пример #4
0
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))