Mercurial > parpg-core
annotate src/parpg/mainmenuview.py @ 6:dd4ed4945411
Ported binary launcher to Windows.
* Reorganized the parpg executable source so that it now compiles with the MSVC compiler (tested with MSVC Express 2010).
* Cleaned up the launcher source by adding a bunch of const statements and removing the superfluous NULL_TERMINATE macro.
* Fixed a few memory leaks in the launcher source by freeing malloced/calloced pointers;
* Added a new SubstfileEscape builder to the SConstruct script used to escape certain sequences when substituting a template file. This is used to escape backslashes ("\") in c strings in the bin/parpg.c.in template for Windows paths.
* Fixed the PY_LIB_DIR_DEFAULT for Windows so that it now correctly points to the default Python installation path.
* Modified the SConstruct script to support compiling the launcher executable with debugging symbols in Windows with the DEBUG flag.
author | M. George Hansen |
---|---|
date | Sun, 22 May 2011 00:53:59 -0700 |
parents | 1fd2201f5c36 |
children | d60f1dab8469 |
rev | line source |
---|---|
0
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
1 # This file is part of PARPG. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
2 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
3 # PARPG is free software: you can redistribute it and/or modify |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
4 # it under the terms of the GNU General Public License as published by |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
5 # the Free Software Foundation, either version 3 of the License, or |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
6 # (at your option) any later version. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
7 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
8 # PARPG is distributed in the hope that it will be useful, |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
11 # GNU General Public License for more details. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
12 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
13 # You should have received a copy of the GNU General Public License |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
14 # along with PARPG. If not, see <http://www.gnu.org/licenses/ |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
15 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
16 import os |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
17 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
18 from fife.extensions import pychan |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
19 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
20 from viewbase import ViewBase |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
21 from parpg.gui.filebrowser import FileBrowser |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
22 from parpg.gui.menus import SettingsMenu |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
23 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
24 class MainMenuView(ViewBase): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
25 """View that is used to display the main menu""" |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
26 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
27 def __init__(self, engine, model): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
28 """Constructor for MainMenuView |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
29 @param engine: A fife.Engine instance |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
30 @type engine: fife.Engine |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
31 @param model: a script.GameModel instance |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
32 @type model: script.GameModel |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
33 """ |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
34 ViewBase.__init__(self, engine, model) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
35 self.quit_window = None |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
36 self.new_game_callback = None |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
37 self.load_game_callback = None |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
38 self.quit_callback = None |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
39 self.main_menu = None |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
40 self.character_screen = None |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
41 self.gui_path = os.path.join(self.model.settings.system_path, |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
42 self.model.settings.parpg.GuiPath) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
43 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
44 def showMenu(self): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
45 """"Shows the main menu""" |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
46 self.main_menu_background.show() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
47 self.main_menu.show() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
48 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
49 def hideMenu(self): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
50 """"Hides the main menu""" |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
51 self.main_menu.hide() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
52 self.main_menu_background.hide() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
53 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
54 def initalizeMainMenu(self, new_game, load_game, quit_game): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
55 """Initialized the main menu and sets the callbacks""" |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
56 # Set a simple background to display the main screen. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
57 self.main_menu_background = pychan.loadXML(os.path.join(self.gui_path, |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
58 'main_menu_background.xml')) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
59 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
60 # Initialize the main menu screen. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
61 screen_mode = self.engine.getRenderBackend().getCurrentScreenMode() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
62 self.main_menu_background.width = screen_mode.getWidth() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
63 self.main_menu_background.height = screen_mode.getHeight() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
64 self.main_menu = pychan.loadXML(os.path.join(self.gui_path, |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
65 'main_menu.xml')) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
66 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
67 # Setup images for variables widgets |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
68 self.main_menu.background_image = os.path.join(self.gui_path, |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
69 'notebook', |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
70 'notebook_background.png') |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
71 quit_button = self.main_menu.findChild(name='quitButton') |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
72 quit_button.up_image = os.path.join(self.gui_path, 'notebook', 'tabs', |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
73 'tab2_bg_dark_bottom.png') |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
74 quit_button.hover_image = os.path.join(self.gui_path, 'notebook', |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
75 'tabs', |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
76 'tab2_bg_normal_bottom.png') |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
77 quit_button.down_image = os.path.join(self.gui_path, 'notebook', |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
78 'tabs', |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
79 'tab2_bg_normal_bottom.png') |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
80 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
81 self.main_menu.adaptLayout() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
82 self.new_game_callback = new_game |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
83 self.load_game_callback = load_game |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
84 self.quit_callback = quit_game |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
85 menu_events = {} |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
86 menu_events["newButton"] = self.newGame |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
87 menu_events["loadButton"] = self.loadGame |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
88 menu_events["settingsButton"] = self.displaySettings |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
89 menu_events["quitButton"] = self.quitGame |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
90 self.main_menu.mapEvents(menu_events) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
91 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
92 self.initializeQuitDialog() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
93 self.initializeSettingsMenu() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
94 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
95 def newGame(self): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
96 """Called when user request to start a new game. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
97 @return: None""" |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
98 self.new_game_callback() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
99 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
100 def loadGame(self): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
101 """ Called when the user wants to load a game. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
102 @return: None""" |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
103 load_browser = FileBrowser(self.engine, |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
104 self.model.settings, |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
105 self.load_game_callback, |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
106 gui_xml_path=os.path.join(self.gui_path, |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
107 'loadbrowser.xml'), |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
108 save_file=False, |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
109 extensions=('.dat')) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
110 load_browser.showBrowser() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
111 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
112 def initializeQuitDialog(self): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
113 """Creates the quit confirmation dialog |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
114 @return: None""" |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
115 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
116 self.quit_window = pychan.widgets.Window(title=unicode("Quit?"), \ |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
117 min_size=(200,0)) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
118 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
119 hbox = pychan.widgets.HBox() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
120 are_you_sure = "Are you sure you want to quit?" |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
121 label = pychan.widgets.Label(text=unicode(are_you_sure)) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
122 yes_button = pychan.widgets.Button(name="yes_button", |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
123 text=unicode("Yes"), |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
124 min_size=(90,20), |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
125 max_size=(90,20)) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
126 no_button = pychan.widgets.Button(name="no_button", |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
127 text=unicode("No"), |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
128 min_size=(90,20), |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
129 max_size=(90,20)) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
130 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
131 self.quit_window.addChild(label) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
132 hbox.addChild(yes_button) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
133 hbox.addChild(no_button) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
134 self.quit_window.addChild(hbox) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
135 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
136 events_to_map = { "yes_button": self.quit_callback, |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
137 "no_button": self.quit_window.hide } |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
138 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
139 self.quit_window.mapEvents(events_to_map) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
140 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
141 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
142 def quitGame(self): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
143 """Called when user requests to quit game. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
144 @return: None""" |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
145 self.quit_window.show() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
146 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
147 def initializeSettingsMenu(self): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
148 self.settings_menu = SettingsMenu(self.engine, self.model.settings) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
149 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
150 def displaySettings(self): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
151 self.settings_menu.show() |