def print_console(level,message):
    if (DEBUG_MODE == False):
        return
    try:
        if Color.can_use_colors():
            # Set black background.
            Color.bk_black()
            if (level==SUCCESS_LEVEL):
                Color.green()
                Color.light()                
            elif (level==ERROR_LEVEL):
                Color.red()
                Color.light()
            else:
                Color.white()
        print message
    except:
        print message
    finally:
        Color.reset()
Example #2
0
def print_console(level, message):
    if (DEBUG_MODE == False):
        return
    try:
        if Color.can_use_colors():
            # Set black background.
            Color.bk_black()
            if (level == SUCCESS_LEVEL):
                Color.green()
                Color.light()
            elif (level == ERROR_LEVEL):
                Color.red()
                Color.light()
            else:
                Color.white()
        print message
    except:
        print message
    finally:
        Color.reset()
Example #3
0
        # Set black text.
        Color.black()

        # For each color...
        for color in ("red", "green", "blue", "cyan", "magenta", "yellow",
                      "white"):

            # Set the background color.
            function = getattr(Color, "bk_" + color)
            function()

            # For each intensity...
            for intensity in ("light", "dark"):

                # Set the background intensity.
                function = getattr(Color, "bk_" + intensity)
                function()

                # Print a message.
                print "This is black text on %s %s background." % (intensity,
                                                                   color)

    # Reset the console colors and quit.
    finally:
        Color.reset()

# No colors available!
else:
    print "Can't use colors! Are you redirecting the output to a file?"
Example #4
0
                # Print a message.
                print "This is %s %s text on black background." % ( intensity, color )

        # Set black text.
        Color.black()

        # For each color...
        for color in ( "red", "green", "blue", "cyan", "magenta", "yellow", "white" ):

            # Set the background color.
            function = getattr( Color, "bk_" + color )
            function()

            # For each intensity...
            for intensity in ( "light", "dark" ):

                # Set the background intensity.
                function = getattr( Color, "bk_" + intensity )
                function()

                # Print a message.
                print "This is black text on %s %s background." % ( intensity, color )

    # Reset the console colors and quit.
    finally:
        Color.reset()

# No colors available!
else:
    print "Can't use colors! Are you redirecting the output to a file?"