# HG changeset patch # User Neil Muller # Date 1259430328 0 # Node ID 7963fc09fac20a36936f97d96c4dc9948953edf8 # Parent 11c4cebfe4c51f124660a9d48719b5667da6832f Make checkdialog take strings to show as input. Add possiblity of 3rd button on dialog diff -r 11c4cebfe4c5 -r 7963fc09fac2 gamelib/gameboard.py --- a/gamelib/gameboard.py Sat Nov 28 17:37:13 2009 +0000 +++ b/gamelib/gameboard.py Sat Nov 28 17:45:28 2009 +0000 @@ -832,7 +832,9 @@ if val: import engine pygame.event.post(engine.GO_GAME_OVER) - dialog = misc.CheckDialog(sure) + dialog = misc.CheckDialog(sure, + "Do you REALLY want to exit this game?", + "Yes, Quit", "No, Don't Quit", None) self.disp.open(dialog) return True elif e.type == KEYDOWN and e.key == K_n and self.day: diff -r 11c4cebfe4c5 -r 7963fc09fac2 gamelib/misc.py --- a/gamelib/misc.py Sat Nov 28 17:37:13 2009 +0000 +++ b/gamelib/misc.py Sat Nov 28 17:45:28 2009 +0000 @@ -82,20 +82,27 @@ roll -= weight class CheckDialog(gui.Dialog): - def __init__(self, sure_func, **params): + def __init__(self, sure_func, message, yes_choice, no_choice, + maybe_choice, **params): self._sure_func = sure_func title = gui.Label('Are You Sure?') tbl = gui.Table() tbl.tr() - tbl.td(gui.Label("Do you REALLY want to exit this game?"), colspan=2) + tbl.td(gui.Label(message), colspan=3) tbl.tr() - tbl.td(gui.Spacer(0, 15), colspan=2) + tbl.td(gui.Spacer(0, 15), colspan=3) tbl.tr() - yes_button = gui.Button('Yes') - yes_button.connect(gui.CLICK, self.clicked, True) - no_button = gui.Button('No') - no_button.connect(gui.CLICK, self.clicked, False) + no_button = gui.Button(no_choice) + no_button.connect(gui.CLICK, self.clicked, 0) tbl.td(no_button, align=-1) + if maybe_choice: + maybe_button = gui.Button(maybe_choice) + maybe_button.connect(gui.CLICK, self.clicked, 2) + tbl.td(maybe_button, align=1) + else: + tbl.td(gui.Spacer(0, 15)) + yes_button = gui.Button(yes_choice) + yes_button.connect(gui.CLICK, self.clicked, 1) tbl.td(yes_button, align=1) gui.Dialog.__init__(self, title, tbl, **params)