示例#1
0
文件: helpers.py 项目: gotoc/todo
def create_title(t):
    if smartcontent.smartcontent_enabled():
        smartcontent_type = itemlist.feature(t, "smartcontent_type")
        smartcontent_info = itemlist.feature(t, "smartcontent_info")
        if len(smartcontent_type) > 0:
            if smartcontent_type == "File" or smartcontent_type == "Directory":
                return smartcontent_info
            elif smartcontent_type == "Application":
                return smartcontent_info.replace(".app", "")
            elif smartcontent_type == "Web":
                if len(smartcontent_info) > 0:
                    return smartcontent_info
    return t["title"]
示例#2
0
文件: todo.py 项目: BenziAhamed/todo
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))
示例#3
0
文件: helpers.py 项目: gotoc/todo
def create_icon(t):
    pinned = itemlist.feature(t, "pinned")
    if pinned:
        return "todo_pin.png"

    due = itemlist.feature(t, "due")
    if due and due <= date.today():
        return "todo_old.png"

    if smartcontent.smartcontent_enabled():
        smartcontent_type = itemlist.feature(t, "smartcontent_type")
        icon_types = {
            "Web": "todo_web.png",
            "File": "todo_file.png",
            "Directory": "todo_folder.png",
            "Application": "todo_app.png",
        }
        if smartcontent_type in icon_types:
            return icon_types[smartcontent_type]

    return "icon.png"
示例#4
0
文件: helpers.py 项目: gotoc/todo
def create_subtitle(t):
    # option 1 - simple and clean
    subtitle = ""
    if itemlist.feature(t, "due"):
        subtitle = due_date_text(t["due"])
    if t["group"] != "default":
        subtitle = subtitle + " #" + t["group"]

    if smartcontent.smartcontent_enabled():
        smartcontent_type = itemlist.feature(t, "smartcontent_type")
        smartcontent_info = itemlist.feature(t, "smartcontent_info")
        if len(smartcontent_type) > 0:
            subtitle = subtitle + " " + t["title"]
            # if smartcontent_type == "Web":
            #     if len(smartcontent_info) > 0:
            #         subtitle = subtitle + " Web: " + t["title"]
            #     else:
            #         subtitle = subtitle + " Web"
            # else:
            #     subtitle = subtitle + " " + smartcontent_type + ": " + t['title']

    return subtitle.strip()