# HG changeset patch # User Neil Muller # Date 1378576068 -7200 # Node ID 1b1bd4f39e5cdc936df82b136ee2583b27627125 # Parent 04066416fcec312e6efac03fc399fe9709b7a2ca Ask before quitting the level editor diff -r 04066416fcec -r 1b1bd4f39e5c tools/area_editor.py --- a/tools/area_editor.py Sat Sep 07 19:44:31 2013 +0200 +++ b/tools/area_editor.py Sat Sep 07 19:47:48 2013 +0200 @@ -24,7 +24,7 @@ from albow.root import RootWidget from albow.widget import Widget from albow.controls import Button, Label, CheckBox -from albow.dialogs import alert, Dialog +from albow.dialogs import alert, Dialog, ask from albow.layout import Row from albow.fields import TextField from albow.table_view import TableView, TableColumn @@ -1074,7 +1074,7 @@ widgets.append(zoom_in) y = SCREEN[1] - MENU_BUTTON_HEIGHT - MENU_PAD - quit_but = Button('Quit', action=self.quit) + quit_but = Button('Quit', action=self.do_quit) quit_but.rect = BUTTON_RECT.copy() quit_but.rect.move_ip(MENU_LEFT, y) widgets.append(quit_but) @@ -1167,7 +1167,7 @@ y += MENU_BUTTON_HEIGHT + MENU_PAD y = SCREEN[1] - MENU_BUTTON_HEIGHT - MENU_PAD - quit_but = Button('Quit', action=self.quit) + quit_but = Button('Quit', action=self.do_quit) quit_but.rect = BUTTON_RECT.copy() quit_but.rect.move_ip(MENU_LEFT, y) widgets.append(quit_but) @@ -1176,12 +1176,17 @@ def key_down(self, ev): if ev.key == pgl.K_ESCAPE: - self.quit() + self.do_quit() elif ev.key == pgl.K_s: self.save() else: self.level_widget.key_down(ev) + def do_quit(self): + res = ask("Really Quit?") + if res == "OK": + self.quit() + def save(self): closed, messages = self.level.all_closed() if closed: