示例#1
0
def ask_about_reading(responses):
    print colours.colour_text("Have you read this?", "red")
    key = get_a_key()
    if key in " yY":
        return "read"
    if key in responses:
        return key
示例#2
0
def confirm_boring():
    print colours.colour_text("Have you read this?", "red")
    reply = get_reply(" yb")
    if not reply:
        return None
    if reply in " y":
        return "read"
    if reply == "b":
        return "boring"
示例#3
0
def show_some(text):
    lines = text.splitlines()
    shown_lines = 0
    max_shown_lines = 24
    for line in lines:
        if is_signature(line) or shown_lines > max_shown_lines:
            print colours.colour_text("-- (strip signature)", "gray")
            break
        if line.strip():
            print line
            shown_lines += 1
    print
示例#4
0
def main(args):
    # pudb.set_trace()
    account_methods = [employee_account, main_personal_account, second_personal_account, second_employee_account]
    for account_method in account_methods:
        if args:
            if "all" in args or account_method.func_name in args:
                show_account_header(account_method.func_name)
                read_account(account_method, [])
            if account_method.func_name in args:
                return 0
        if not args:
            show_account_header(account_method.func_name)
            print colours.colour_text("Read?", "red")
            if not get_yes():
                continue
            read_account(account_method, args)
    return 0
示例#5
0
def coloured_text(key, value):
    key_colours = {
        "date": "yellow",
        "subject": "green",
        "commit": "light green",
        "from": "magenta",
        "to": "red",
        "cc": "light red",
        "bcc": "light red",
        heading_prefix(): "light cyan",
    }
    colour = key_colours.get(key.lower(), "gray")
    if key == heading_prefix():
        text = colours.colour_text(heading_prefix(), colour)
        return "%s %s %s" % (text, value, text)
    else:
        text = "%s:" % key
        text = colours.colour_text(text, colour)
        return "%s %s" % (text, value)
示例#6
0
def show_html(html):
    if html:
        message = "    See also %s" % personal.url_in_localhost(mail_html())
        print colours.colour_text(message, "cyan")
        print
示例#7
0
def confirm_forwarding():
    print colours.colour_text("Forward it?", "red")
    return get_yes()
示例#8
0
def confirm_reading():
    print colours.colour_text("Have you read this?", "red")
    if get_yes():
        return "read"
示例#9
0
def show_account_header(account_name):
    clear_screen()
    print "*" * 80
    print colours.colour_text("Account:", "red"), account_name
    print
示例#10
0
def show_todo_item(item):
    """Show the item on screen, coloured by it's priority"""
    colour = priority_colour(item.priority)
    print colours.colour_text(item.text, colour)