Mercurial > rinkhals
comparison gamelib/savegame.py @ 547:1456bf2ff02e
Allow cancelling of save game dialog with ESC.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sat, 28 Nov 2009 11:12:45 +0000 |
parents | 882b582da618 |
children | a8dde729000a |
comparison
equal
deleted
inserted
replaced
546:e57a0cf38cc7 | 547:1456bf2ff02e |
---|---|
7 import zlib | 7 import zlib |
8 import datetime | 8 import datetime |
9 | 9 |
10 from pgu import gui | 10 from pgu import gui |
11 import pygame | 11 import pygame |
12 from pygame.locals import KEYDOWN, K_ESCAPE | |
12 | 13 |
13 import config | 14 import config |
14 import version | 15 import version |
15 import gameboard | 16 import gameboard |
16 import serializer | 17 import serializer |
205 def _click_cancel(self): | 206 def _click_cancel(self): |
206 self.value = None | 207 self.value = None |
207 self.send(gui.CHANGE) | 208 self.send(gui.CHANGE) |
208 self.close() | 209 self.close() |
209 | 210 |
211 def event(self, e): | |
212 if e.type == KEYDOWN and e.key == K_ESCAPE: | |
213 self._click_cancel() | |
214 return True | |
215 return gui.Dialog.event(self, e) | |
210 | 216 |
211 class SaveDialog(BaseSaveRestoreDialog): | 217 class SaveDialog(BaseSaveRestoreDialog): |
212 """Save game dialog.""" | 218 """Save game dialog.""" |
213 | 219 |
214 def __init__(self, gameboard): | 220 def __init__(self, gameboard): |