Mercurial > fife-parpg
comparison engine/extensions/pychan/__init__.py @ 188:06dddc96ce54
* Fixed some space and tab mixing
* Fixed a small bug in manager.py, thanks to phoku for the pointer.
author | nihathrael@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 26 Feb 2009 11:26:01 +0000 |
parents | 3fe0e68f4269 |
children | 54bfd1015b35 |
comparison
equal
deleted
inserted
replaced
187:644bf7ca1e0a | 188:06dddc96ce54 |
---|---|
161 pychan.init( fifeEngine ) | 161 pychan.init( fifeEngine ) |
162 pychan.loadFonts( "content/fonts/console.fontdef" ) | 162 pychan.loadFonts( "content/fonts/console.fontdef" ) |
163 | 163 |
164 The font definition files are in the following format:: | 164 The font definition files are in the following format:: |
165 [Font/FIRST_FONT_NAME] | 165 [Font/FIRST_FONT_NAME] |
166 | 166 |
167 type: truetype | 167 type: truetype |
168 source: path/to/font.ttf | 168 source: path/to/font.ttf |
169 # The font size in point | 169 # The font size in point |
170 size: 30 | 170 size: 30 |
171 | 171 |
172 [Font/SECOND_FONT_NAME] | 172 [Font/SECOND_FONT_NAME] |
173 | 173 |
174 type: truetype | 174 type: truetype |
175 source: content/fonts/samanata.ttf | 175 source: content/fonts/samanata.ttf |
176 size: 8 | 176 size: 8 |
177 | 177 |
178 # And so on. | 178 # And so on. |
179 | 179 |
180 I hope the example is clear enough ... Other options you can set: | 180 I hope the example is clear enough ... Other options you can set: |
181 | 181 |
182 - color: A list of comma separated integers from 0 to 255. White (255,255,255) by default. | 182 - color: A list of comma separated integers from 0 to 255. White (255,255,255) by default. |
239 manager = None | 239 manager = None |
240 def init(engine,debug=False): | 240 def init(engine,debug=False): |
241 """ | 241 """ |
242 This has to be called before any other pychan methods can be used. | 242 This has to be called before any other pychan methods can be used. |
243 It sets up a manager object which is available under pychan.manager. | 243 It sets up a manager object which is available under pychan.manager. |
244 | 244 |
245 @param engine: The FIFE engine object. | 245 @param engine: The FIFE engine object. |
246 """ | 246 """ |
247 from manager import Manager | 247 from manager import Manager |
248 global manager | 248 global manager |
249 manager = Manager(engine,debug) | 249 manager = Manager(engine,debug) |
290 return cls | 290 return cls |
291 | 291 |
292 def _setAttr(self,obj,name,value): | 292 def _setAttr(self,obj,name,value): |
293 if not hasattr(obj.__class__,'ATTRIBUTES'): | 293 if not hasattr(obj.__class__,'ATTRIBUTES'): |
294 raise PyChanException("The registered widget/spacer class %s does not supply an 'ATTRIBUTES'." | 294 raise PyChanException("The registered widget/spacer class %s does not supply an 'ATTRIBUTES'." |
295 % repr(obj)) | 295 % repr(obj)) |
296 try: | 296 try: |
297 for attr in obj.ATTRIBUTES: | 297 for attr in obj.ATTRIBUTES: |
298 if attr.name == name: | 298 if attr.name == name: |
299 attr.set(obj,value) | 299 attr.set(obj,value) |
300 return | 300 return |