view pyntnclick/tools/utils.py @ 691:60bf20849231 pyntnclick

Fix detail loading in rect_drawer. Improve error reporting when loading fails
author Neil Muller <neil@dip.sun.ac.za>
date Tue, 14 Feb 2012 13:05:10 +0200
parents 4a933444c99b
children f4853f817a7a
line wrap: on
line source

# Misc utils I don't know where else to put


def list_scenes(get_initial_state):
    """List the scenes in the state"""
    state = get_initial_state()
    print 'Available scenes are : '
    for scene in state.scenes:
        print '    ', scene
    print 'Available details are : '
    for detail in state.detail_views:
        print '    ', detail


def draw_rect_image(surface, color, rect, thickness):
    """Draw a rectangle with lines thickness wide"""
    # top
    surface.fill(color, (rect.left, rect.top, rect.width, thickness))
    # bottom
    surface.fill(color, (rect.left, rect.bottom - thickness, rect.width,
        thickness))
    # left
    surface.fill(color, (rect.left, rect.top, thickness, rect.height))
    # right
    surface.fill(color, (rect.right - thickness, rect.top, thickness,
        rect.height))