comparison application.py @ 23:979fffc5af49

Fixed inconsistent indentation.
author KarstenBock@gmx.net
date Fri, 02 Sep 2011 12:29:55 +0200
parents 7b31de1dc964
children 80672955ab70
comparison
equal deleted inserted replaced
22:d8c17766895b 23:979fffc5af49
35 from parpg.mode import FifeManager 35 from parpg.mode import FifeManager
36 36
37 class KeyFilter(fife.IKeyFilter): 37 class KeyFilter(fife.IKeyFilter):
38 """ 38 """
39 This is the implementation of the fife.IKeyFilter class. 39 This is the implementation of the fife.IKeyFilter class.
40 40
41 Prevents any filtered keys from being consumed by guichan. 41 Prevents any filtered keys from being consumed by guichan.
42 """ 42 """
43 def __init__(self, keys): 43 def __init__(self, keys):
44 fife.IKeyFilter.__init__(self) 44 fife.IKeyFilter.__init__(self)
45 self._keys = keys 45 self._keys = keys
47 def isFiltered(self, event): 47 def isFiltered(self, event):
48 """Checks if an key is filtered""" 48 """Checks if an key is filtered"""
49 return event.getKey().getValue() in self._keys 49 return event.getKey().getValue() in self._keys
50 50
51 class ApplicationListener(KeyListener, 51 class ApplicationListener(KeyListener,
52 MouseListener, 52 MouseListener,
53 ConsoleExecuter, 53 ConsoleExecuter,
54 CommandListener, 54 CommandListener,
55 WidgetListener): 55 WidgetListener):
56 """Basic listener for PARPG""" 56 """Basic listener for PARPG"""
57 57
58 def __init__(self, event_listener, engine, view, model): 58 def __init__(self, event_listener, engine, view, model):
59 """Initialize the instance. 59 """Initialize the instance.
60 @type engine: fife.engine 60 @type engine: fife.engine
61 @param engine: ??? 61 @param engine: ???
62 @type view: viewbase.ViewBase 62 @type view: viewbase.ViewBase
72 self.engine = engine 72 self.engine = engine
73 self.view = view 73 self.view = view
74 self.model = model 74 self.model = model
75 keyfilter = KeyFilter([fife.Key.ESCAPE]) 75 keyfilter = KeyFilter([fife.Key.ESCAPE])
76 keyfilter.__disown__() 76 keyfilter.__disown__()
77 77
78 engine.getEventManager().setKeyFilter(keyfilter) 78 engine.getEventManager().setKeyFilter(keyfilter)
79 self.quit = False 79 self.quit = False
80 self.about_window = None 80 self.about_window = None
81 self.console = console.Console(self) 81 self.console = console.Console(self)
82 82
107 class PARPGApplication(ApplicationBase): 107 class PARPGApplication(ApplicationBase):
108 """Main Application class 108 """Main Application class
109 We use an MVC model model 109 We use an MVC model model
110 self.gamesceneview is our view,self.model is our model 110 self.gamesceneview is our view,self.model is our model
111 self.controller is the controller""" 111 self.controller is the controller"""
112 112
113 def __init__(self, setting): 113 def __init__(self, setting):
114 """Initialise the instance. 114 """Initialise the instance.
115 @return: None""" 115 @return: None"""
116 self._setting = setting 116 self._setting = setting
117 self.manager = FifeManager() 117 self.manager = FifeManager()
118 self.engine = fife.Engine() 118 self.engine = fife.Engine()
119 self.loadSettings() 119 self.loadSettings()
120 self.engine.init() 120 self.engine.init()
121 # KLUDGE M. George Hansen 2011-06-04: See parpg/vfs.py. 121 # KLUDGE M. George Hansen 2011-06-04: See parpg/vfs.py.
122 vfs.VFS = self.engine.getVFS() 122 vfs.VFS = self.engine.getVFS()
161 from oldtypewriter import fontdefs 161 from oldtypewriter import fontdefs
162 162
163 for fontdef in fontdefs: 163 for fontdef in fontdefs:
164 pychan.internal.get_manager().addFont(PARPGFont(fontdef, 164 pychan.internal.get_manager().addFont(PARPGFont(fontdef,
165 self._setting)) 165 self._setting))
166 166
167 167
168 def loadSettings(self): 168 def loadSettings(self):
169 """ 169 """
170 Load the settings from a python file and load them into the engine. 170 Load the settings from a python file and load them into the engine.
171 Called in the ApplicationBase constructor. 171 Called in the ApplicationBase constructor.