diff gamelib/state.py @ 201:9531a22721d1

Add support for lists of results
author Neil Muller <neil@dip.sun.ac.za>
date Thu, 26 Aug 2010 10:54:25 +0200
parents 738608e90e9c
children eb101b6fb3dd
line wrap: on
line diff
--- a/gamelib/state.py	Thu Aug 26 09:48:49 2010 +0200
+++ b/gamelib/state.py	Thu Aug 26 10:54:25 2010 +0200
@@ -34,6 +34,16 @@
         if self.detail_view:
             scene_widget.show_detail(self.detail_view)
 
+
+def handle_result(result, scene_widget):
+    """Handle dealing with result or result sequences"""
+    if result:
+        if hasattr(result, 'process'):
+            result.process(scene_widget)
+        else:
+            for res in result:
+                res.process(scene_widget)
+
 def initial_state():
     """Load the initial state."""
     state = State()