Mercurial > fife-parpg
annotate engine/python/fife/extensions/fife_settings.py @ 497:559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Wed, 12 May 2010 22:03:32 +0000 |
parents | |
children | 3dff106b945b |
rev | line source |
---|---|
497
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
2 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
3 # #################################################################### |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
4 # Copyright (C) 2005-2010 by the FIFE team |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
5 # http://www.fifengine.net |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
6 # This file is part of FIFE. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
7 # |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
8 # FIFE is free software; you can redistribute it and/or |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
9 # modify it under the terms of the GNU Lesser General Public |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
10 # License as published by the Free Software Foundation; either |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
11 # version 2.1 of the License, or (at your option) any later version. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
12 # |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
13 # This library is distributed in the hope that it will be useful, |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
16 # Lesser General Public License for more details. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
17 # |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
18 # You should have received a copy of the GNU Lesser General Public |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
19 # License along with this library; if not, write to the |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
20 # Free Software Foundation, Inc., |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
22 # #################################################################### |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
23 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
24 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
25 Settings |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
26 ================================== |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
27 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
28 This module provides a nice framework for loading and saving game settings. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
29 It is by no means complete but it does provide a good starting point. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
30 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
31 @note: Please note that you MUST provide a default settings-dist.xml file |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
32 in the root directory of your project for this module to function correctly. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
33 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
34 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
35 import shutil |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
36 import os |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
37 from StringIO import StringIO |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
38 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
39 from fife.extensions import pychan |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
40 from fife.extensions.fife_utils import getUserDataDirectory |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
41 try: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
42 import xml.etree.cElementTree as ET |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
43 except: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
44 import xml.etree.ElementTree as ET |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
45 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
46 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
47 SETTINGS_GUI_XML="""\ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
48 <Window name="Settings" title="Settings"> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
49 <Label text="Settings menu!" /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
50 <HBox> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
51 <VBox> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
52 <Label text="Resolution:" /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
53 <Label text="Renderer:" /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
54 </VBox> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
55 <VBox min_size="120,60"> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
56 <DropDown name="screen_resolution" min_size="120,0" /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
57 <DropDown name="render_backend" min_size="120,0" /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
58 </VBox> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
59 </HBox> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
60 <CheckBox name="enable_fullscreen" text="Use the full screen mode" /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
61 <CheckBox name="enable_sound" text="Enable sound" /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
62 <HBox> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
63 <Spacer /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
64 <Button name="cancelButton" text="Cancel" /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
65 <Button name="okButton" text="Ok" /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
66 <Button name="defaultButton" text="Defaults" /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
67 </HBox> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
68 </Window> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
69 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
70 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
71 CHANGES_REQUIRE_RESTART="""\ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
72 <Window title="Changes require restart"> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
73 <Label text="Some of your changes require you to restart." /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
74 <HBox> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
75 <Spacer /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
76 <Button name="closeButton" text="Ok" /> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
77 </HBox> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
78 </Window> |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
79 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
80 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
81 class Setting(object): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
82 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
83 This class manages loading and saving of game settings. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
84 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
85 Usage:: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
86 from fife.extensions.fife_settings import Setting |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
87 settings = Setting(app_name="myapp") |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
88 screen_width = settings.readSetting("ScreenWidth") |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
89 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
90 def __init__(self, app_name="", settings_file="", settings_gui_xml=""): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
91 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
92 Initializes the Setting object. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
93 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
94 @param app_name: The applications name. If this parameter is provided |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
95 alone it will try to read the settings file from the users home directory. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
96 In windows this will be something like: C:\Documents and Settings\user\Application Data\fife |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
97 @type app_name: C{string} |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
98 @param settings_file: The name of the settings file. If this parameter is |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
99 provided it will look for the setting file as you specify it, first looking |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
100 in the working directory. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
101 @type settings_file: C{string} |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
102 @param settings_gui_xml: If you specify this parameter you can customize the look |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
103 of the settings dialog box. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
104 @note: As of now you MUST have all the elements of the default settings dialog box. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
105 At some point we may make it customizable. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
106 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
107 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
108 self._app_name = app_name |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
109 self._settings_file = settings_file |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
110 self._settings_gui_xml = settings_gui_xml |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
111 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
112 if self._settings_file == "": |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
113 self._settings_file = "settings.xml" |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
114 self._appdata = getUserDataDirectory("fife", self._app_name) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
115 else: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
116 self._appdata = os.path.dirname(self._settings_file) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
117 self._settings_file = os.path.basename(self._settings_file) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
118 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
119 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
120 if self._settings_gui_xml == "": |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
121 self.settings_gui_xml = SETTINGS_GUI_XML |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
122 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
123 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
124 if not os.path.exists(os.path.join(self._appdata, self._settings_file)): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
125 shutil.copyfile('settings-dist.xml', os.path.join(self._appdata, self._settings_file)) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
126 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
127 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
128 def onOptionsPress(self): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
129 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
130 Opends the options dialog box. Usually you would bind this to a button. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
131 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
132 self.changesRequireRestart = False |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
133 self.isSetToDefault = False |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
134 self.Resolutions = ['640x480', '800x600', '1024x768', '1280x800', '1440x900'] |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
135 if not hasattr(self, 'OptionsDlg'): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
136 self.OptionsDlg = None |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
137 if not self.OptionsDlg: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
138 self.OptionsDlg = pychan.loadXML(StringIO(SETTINGS_GUI_XML)) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
139 self.OptionsDlg.distributeInitialData({ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
140 'screen_resolution' : self.Resolutions, |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
141 'render_backend' : ['OpenGL', 'SDL'] |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
142 }) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
143 self.OptionsDlg.distributeData({ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
144 'screen_resolution' : self.Resolutions.index(str(self.readSetting("ScreenWidth")) + 'x' + str(self.readSetting("ScreenHeight"))), |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
145 'render_backend' : 0 if str(self.readSetting("RenderBackend")) == "OpenGL" else 1, |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
146 'enable_fullscreen' : int(self.readSetting("FullScreen")), |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
147 'enable_sound' : int(self.readSetting("PlaySounds")) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
148 }) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
149 self.OptionsDlg.mapEvents({ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
150 'okButton' : self.saveSettings, |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
151 'cancelButton' : self.OptionsDlg.hide, |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
152 'defaultButton' : self.setDefaults |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
153 }) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
154 self.OptionsDlg.show() |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
155 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
156 def setDefaults(self): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
157 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
158 Overwrites the setting file with the default settings-dist.xml file. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
159 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
160 shutil.copyfile('settings-dist.xml', os.path.join(self._appdata, self._settings_file)) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
161 self.isSetToDefault = True |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
162 self.changesRequireRestart = True |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
163 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
164 def readSetting(self, name, type='int', strip=True, text=False): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
165 if not hasattr(self, 'tree'): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
166 self.tree = ET.parse(os.path.join(self._appdata, self._settings_file)) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
167 self.root_element = self.tree.getroot() |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
168 element = self.root_element.find(name) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
169 if element is not None: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
170 element_value = element.text |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
171 if element_value is None: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
172 if type == 'int': |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
173 return 0 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
174 elif type == 'list': |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
175 list = [] |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
176 return list |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
177 else: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
178 if type == 'int': |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
179 return element_value.strip() if strip else element_value |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
180 elif type == 'list': |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
181 list = [] |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
182 list_s = [] |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
183 list = str(element_value.strip()).split(";") |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
184 for item in list: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
185 item = item.strip() |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
186 if text: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
187 item = item.replace('\\n', '\n') |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
188 list_s.append(item) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
189 return list_s |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
190 elif type == 'bool': |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
191 return False if element_value.strip() == 'False' else True |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
192 else: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
193 print 'Setting,', name, 'does not exist!' |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
194 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
195 def setSetting(self, name, value): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
196 element = self.root_element.find(name) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
197 if element is not None: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
198 if value is not element.text: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
199 element.text = str(value) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
200 else: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
201 print 'Setting,', name, 'does not exist!' |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
202 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
203 def saveSettings(self): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
204 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
205 Writes the settings file. If a change requires a restart of the engine |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
206 it notifies you with a small dialog box. |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
207 """ |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
208 screen_resolution, render_backend, enable_fullscreen, enable_sound = self.OptionsDlg.collectData('screen_resolution', 'render_backend', 'enable_fullscreen', 'enable_sound') |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
209 render_backend = 'OpenGL' if render_backend is 0 else 'SDL' |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
210 if render_backend != str(self.readSetting("RenderBackend")): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
211 self.setSetting('RenderBackend', render_backend) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
212 self.changesRequireRestart = True |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
213 if int(enable_fullscreen) != int(self.readSetting("FullScreen")): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
214 self.setSetting('FullScreen', int(enable_fullscreen)) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
215 self.changesRequireRestart = True |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
216 if int(enable_sound) != int(self.readSetting("PlaySounds")): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
217 self.setSetting('PlaySounds', int(enable_sound)) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
218 self.changesRequireRestart = True |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
219 if screen_resolution != self.Resolutions.index(str(self.readSetting("ScreenWidth")) + 'x' + str(self.readSetting("ScreenHeight"))): |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
220 self.setSetting('ScreenWidth', int(self.Resolutions[screen_resolution].partition('x')[0])) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
221 self.setSetting('ScreenHeight', int(self.Resolutions[screen_resolution].partition('x')[2])) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
222 self.changesRequireRestart = True |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
223 |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
224 if not self.isSetToDefault: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
225 self.tree.write(os.path.join(self._appdata, self._settings_file)) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
226 self.OptionsDlg.hide() |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
227 if self.changesRequireRestart: |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
228 RestartDlg = pychan.loadXML(StringIO(CHANGES_REQUIRE_RESTART)) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
229 RestartDlg.mapEvents({ 'closeButton' : RestartDlg.hide }) |
559a26347730
Forgot to add fife_settings.py in my last commit. Adding it now.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
230 RestartDlg.show() |