Mercurial > fife-parpg
comparison engine/extensions/pychan/__init__.py @ 255:51cc05d862f2
Merged editor_rewrite branch to trunk.
This contains changes that may break compatibility against existing clients.
For a list of changes that may affect your client, see: http://wiki.fifengine.de/Changes_to_pychan_and_FIFE_in_editor_rewrite_branch
author | cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 08 Jun 2009 16:00:02 +0000 |
parents | 92c7ce181881 |
children | 48c99636453e |
comparison
equal
deleted
inserted
replaced
254:10b5f7f36dd4 | 255:51cc05d862f2 |
---|---|
251 from fonts import loadFonts | 251 from fonts import loadFonts |
252 | 252 |
253 ### Initialisation ### | 253 ### Initialisation ### |
254 | 254 |
255 manager = None | 255 manager = None |
256 def init(engine,debug=False): | 256 def init(engine,debug=False, compat_layout=False): |
257 """ | 257 """ |
258 This has to be called before any other pychan methods can be used. | 258 This has to be called before any other pychan methods can be used. |
259 It sets up a manager object which is available under pychan.manager. | 259 It sets up a manager object which is available under pychan.manager. |
260 | 260 |
261 @param engine: The FIFE engine object. | 261 @param engine: The FIFE engine object. |
262 @param debug: bool - Enables and disables debugging output. Default is False. | |
263 @param compat_layout: bool - Enables and disables compat layout. Default is False. | |
262 """ | 264 """ |
263 from compat import _munge_engine_hook | 265 from compat import _munge_engine_hook |
264 from internal import Manager | 266 from internal import Manager |
265 global manager | 267 global manager |
266 | 268 |
267 manager = Manager(_munge_engine_hook(engine),debug) | 269 manager = Manager(_munge_engine_hook(engine),debug,compat_layout) |
268 | 270 |
269 # XML Loader | 271 # XML Loader |
270 | 272 |
271 from xml.sax import saxutils, handler | 273 from xml.sax import saxutils, handler |
272 from traceback import print_exc | 274 from traceback import print_exc |
355 | 357 |
356 def endElement(self, name): | 358 def endElement(self, name): |
357 self.indent = self.indent[:-4] | 359 self.indent = self.indent[:-4] |
358 if manager.debug: print self.indent + "</%s>" % name | 360 if manager.debug: print self.indent + "</%s>" % name |
359 if self.stack.pop() in ('gui_element','spacer'): | 361 if self.stack.pop() in ('gui_element','spacer'): |
360 self.root = self.root._parent or self.root | 362 self.root = self.root.parent or self.root |
361 | 363 |
362 def loadXML(filename_or_stream): | 364 def loadXML(filename_or_stream): |
363 """ | 365 """ |
364 Loads a PyChan XML file and generates a widget from it. | 366 Loads a PyChan XML file and generates a widget from it. |
365 | 367 |