Mercurial > boomslang
diff pyntnclick/tools/utils.py @ 758:f4853f817a7a pyntnclick
Refactor scene listing, to avoid having to create a window
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sat, 26 Jan 2013 12:56:21 +0200 |
parents | 60bf20849231 |
children |
line wrap: on
line diff
--- a/pyntnclick/tools/utils.py Sat Jan 26 12:30:17 2013 +0200 +++ b/pyntnclick/tools/utils.py Sat Jan 26 12:56:21 2013 +0200 @@ -1,15 +1,18 @@ # Misc utils I don't know where else to put -def list_scenes(get_initial_state): +def list_scenes(scene_module, scene_list): """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 + print "Available scenes and details:" + for scene in scene_list: + scenemod = __import__('%s.%s' % (scene_module, scene), + fromlist=[scene]) + if scenemod.SCENES: + print " * %s" % scene + else: + print " * %s (details only)" % scene + for detailcls in getattr(scenemod, 'DETAIL_VIEWS', []): + print " - %s" % detailcls.NAME def draw_rect_image(surface, color, rect, thickness):