changeset 540:efe1b61aad08

Start of help and an exit button.
author Simon Cross <hodgestar@gmail.com>
date Sun, 18 Sep 2011 01:37:03 +0200
parents c798ba211b6e
children 2d8e1bf94277
files mamba/habitats/editor.py
diffstat 1 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mamba/habitats/editor.py	Sun Sep 18 01:36:44 2011 +0200
+++ b/mamba/habitats/editor.py	Sun Sep 18 01:37:03 2011 +0200
@@ -169,11 +169,16 @@
                                   'Things')
         thing_button.add_callback('clicked', self.change_toolbar, 'Things')
         sprite_button = TextButton((button_left,
-                                    button_height + thing_button.rect.height +
+                                    thing_button.rect.bottom +
                                     button_padding),
                                    'Sprites')
         sprite_button.add_callback('clicked', self.change_toolbar,
                                    'Sprites')
+        help_button = TextButton((sprite_button.rect.right + button_padding,
+                                  thing_button.rect.bottom + button_padding),
+                                 'Help')
+        help_button.add_callback('clicked', self.show_help)
+
         if self.mode == "Tiles":
             tile_button.disable()
         elif self.mode == "Things":
@@ -183,6 +188,7 @@
         self.container.add(tile_button)
         self.container.add(thing_button)
         self.container.add(sprite_button)
+        self.container.add(help_button)
 
         button_height = LOAD_SAVE_HEIGHT
 
@@ -190,6 +196,11 @@
         upload.add_callback('clicked', self.upload)
         self.container.add(upload)
 
+        mainmenu = TextButton((upload.rect.right + button_padding,
+                               button_height), 'Exit')
+        mainmenu.add_callback('clicked', self.go_mainmenu)
+        self.container.add(mainmenu)
+
         button_height = upload.rect.bottom + button_padding
 
         new = TextButton((button_left, button_height), "New")
@@ -212,6 +223,15 @@
         self.current_tool.prepare()
         return True
 
+    def show_help(self, ev, widget):
+        print "Help!"
+        return True
+
+    def go_mainmenu(self, ev, widget):
+        from mamba.habitats.mainmenu import MainMenu
+        NewHabitatEvent.post(MainMenu())
+        return True
+
     def check_level(self):
         message = None
         if not self.level.level_name: