Mercurial > fife-parpg
comparison tools/editor/scripts/editor.py @ 505:ee65aa323457
Updated the ApplicationBase settings to use the new and improved fife_setting extension. I was able to remove all the setting related functions from the demos and editor so that the ApplicationBase now takes care of all the FIFE related settings.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Tue, 18 May 2010 19:37:31 +0000 |
parents | 3dff106b945b |
children | e34b44afd428 |
comparison
equal
deleted
inserted
replaced
504:0196c83c7270 | 505:ee65aa323457 |
---|---|
57 from gui.menubar import Menu, MenuBar | 57 from gui.menubar import Menu, MenuBar |
58 from gui.error import ErrorDialog | 58 from gui.error import ErrorDialog |
59 from mapview import MapView | 59 from mapview import MapView |
60 from fife.extensions.fife_settings import Setting | 60 from fife.extensions.fife_settings import Setting |
61 | 61 |
62 TDS = Setting(app_name="editor") | |
63 | |
62 def getEditor(): | 64 def getEditor(): |
63 """ Returns the Global editor instance """ | 65 """ Returns the Global editor instance """ |
64 if Editor.editor is None: | 66 if Editor.editor is None: |
65 Editor(None) | 67 Editor(None) |
66 return Editor.editor | 68 return Editor.editor |
93 self._tools_menu = None | 95 self._tools_menu = None |
94 self._help_menu = None | 96 self._help_menu = None |
95 | 97 |
96 self._change_map = -1 | 98 self._change_map = -1 |
97 | 99 |
98 self._settings = None | 100 self._settings = TDS |
99 | 101 |
100 self._help_dialog = None | 102 self._help_dialog = None |
101 | 103 |
102 ApplicationBase.__init__(self, *args, **kwargs) | 104 ApplicationBase.__init__(self, TDS, *args, **kwargs) |
103 MainWindow.__init__(self, *args, **kwargs) | 105 MainWindow.__init__(self, *args, **kwargs) |
104 pychan.init(self.engine, debug=False) | 106 pychan.init(self.engine, debug=False) |
105 | |
106 | |
107 def loadSettings(self): | |
108 """ | |
109 Load the settings from a python file and load them into the engine. | |
110 Called in the ApplicationBase constructor. | |
111 """ | |
112 self._settings = Setting(app_name="editor") | |
113 TDS = self._settings | |
114 | |
115 glyphDft = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&`'*#=[]\\\"" | |
116 engineSetting = self.engine.getSettings() | |
117 engineSetting.setDefaultFontGlyphs(TDS.get("FIFE", "FontGlyphs", glyphDft)) | |
118 engineSetting.setDefaultFontPath(TDS.get("FIFE", "Font", "fonts/FreeSans.ttf")) | |
119 engineSetting.setDefaultFontSize(12) | |
120 engineSetting.setBitsPerPixel(TDS.get("FIFE", "BitsPerPixel", 0)) | |
121 engineSetting.setInitialVolume(TDS.get("FIFE", "InitialVolume", 5.0)) | |
122 engineSetting.setSDLRemoveFakeAlpha(TDS.get("FIFE", "SDLRemoveFakeAlpha", 1)) | |
123 engineSetting.setScreenWidth(TDS.get("FIFE", "ScreenWidth", 1024)) | |
124 engineSetting.setScreenHeight(TDS.get("FIFE", "ScreenHeight", 768)) | |
125 engineSetting.setRenderBackend(TDS.get("FIFE", "RenderBackend", "OpenGL")) | |
126 engineSetting.setFullScreen(TDS.get("FIFE", "FullScreen", 0)) | |
127 | |
128 engineSetting.setWindowTitle(TDS.get("FIFE", "WindowTitle", "No window title set")) | |
129 engineSetting.setWindowIcon(TDS.get("FIFE", "WindowIcon", "")) | |
130 engineSetting.setImageChunkingSize(TDS.get("FIFE", "ImageChunkSize", 256)) | |
131 | |
132 def initLogging(self): | |
133 """ | |
134 Initialize the LogManager. | |
135 """ | |
136 from fife.extensions import fifelog | |
137 | |
138 logModules = self._settings.get("FIFE", "LogModules") | |
139 self.log = fifelog.LogManager(self.engine, self._settings.get("FIFE", "LogToPrompt"), self._settings.get("FIFE", "LogToFile")) | |
140 if logModules: | |
141 self.log.setVisibleModules(*logModules) | |
142 | 107 |
143 def _initTools(self): | 108 def _initTools(self): |
144 """ Initializes tools """ | 109 """ Initializes tools """ |
145 self._pluginmanager = plugin.PluginManager(self.getSettings()) | 110 self._pluginmanager = plugin.PluginManager(self.getSettings()) |
146 | 111 |