diff gamelib/misc.py @ 548:27c09c58d89d

Remove gameboard and dialog event flow hacks.
author Simon Cross <hodgestar@gmail.com>
date Sat, 28 Nov 2009 11:25:56 +0000
parents d16ed2a8a33e
children 7963fc09fac2
line wrap: on
line diff
--- a/gamelib/misc.py	Sat Nov 28 11:12:45 2009 +0000
+++ b/gamelib/misc.py	Sat Nov 28 11:25:56 2009 +0000
@@ -82,10 +82,9 @@
             roll -= weight
 
 class CheckDialog(gui.Dialog):
-    def __init__(self, **params):
+    def __init__(self, sure_func, **params):
+        self._sure_func = sure_func
         title = gui.Label('Are You Sure?')
-        self.do_quit = False
-        self.running = True
         tbl = gui.Table()
         tbl.tr()
         tbl.td(gui.Label("Do you REALLY want to exit this game?"), colspan=2)
@@ -101,8 +100,7 @@
         gui.Dialog.__init__(self, title, tbl, **params)
 
     def clicked(self, val):
-        self.do_quit = val
-        self.running = False
+        self._sure_func(val)
         self.close()
 
     def event(self, e):
@@ -111,10 +109,6 @@
             return True
         return gui.Dialog.event(self, e)
 
-def check_exit():
-    dialog = CheckDialog()
-    dialog.open()
-    return dialog
 
 # Utility layout functions