Mercurial > parpg-core
changeset 39:8b3890f17f94
FifeManager no longer subclasses ApplicationBase
PARPGApplication stores an instance of tbe manager instead
author | KarstenBock@gmx.net |
---|---|
date | Wed, 03 Aug 2011 22:57:52 +0200 |
parents | bd1e3b743518 |
children | be9a0e9e3ac2 |
files | src/parpg/application.py src/parpg/charactercreationcontroller.py src/parpg/dialoguecontroller.py src/parpg/mainmenucontroller.py src/parpg/mode.py src/parpg/objects/action.py |
diffstat | 6 files changed, 14 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parpg/application.py Mon Aug 01 08:44:31 2011 +0200 +++ b/src/parpg/application.py Wed Aug 03 22:57:52 2011 +0200 @@ -19,6 +19,7 @@ from fife import fife from fife.extensions import pychan from fife.extensions.serializers.xmlanimation import XMLAnimationLoader +from fife.extensions.basicapplication import ApplicationBase from parpg import console, vfs from parpg.font import PARPGFont @@ -103,7 +104,7 @@ self.quit = True command.consume() -class PARPGApplication(FifeManager): +class PARPGApplication(ApplicationBase): """Main Application class We use an MVC model model self.gamesceneview is our view,self.model is our model @@ -112,8 +113,8 @@ def __init__(self, setting): """Initialise the instance. @return: None""" - self.modes = [] self._setting = setting + self.manager = FifeManager() self.engine = fife.Engine() self.loadSettings() self.engine.init() @@ -146,7 +147,7 @@ controller = MainMenuController(self.engine, self.view, self.model, self) #controller.initHud() - self.push_mode(controller) + self.manager.push_mode(controller) self.listener = ApplicationListener(self.event_listener, self.engine, self.view, @@ -211,4 +212,4 @@ if self.listener.quit: self.breakRequested = True #pylint: disable-msg=C0103 else: - FifeManager._pump(self) + self.manager._pump()
--- a/src/parpg/charactercreationcontroller.py Mon Aug 01 08:44:31 2011 +0200 +++ b/src/parpg/charactercreationcontroller.py Wed Aug 03 22:57:52 2011 +0200 @@ -144,7 +144,7 @@ controller = GameSceneController(self.engine, view, self.model, self.application) self.application.view = view - self.application.swap_modes(controller) + self.application.manager.swap_modes(controller) start_map = self.settings.parpg.Map self.model.changeMap(start_map) @@ -159,7 +159,7 @@ controller = MainMenuController(self.engine, view, self.model, self.application) self.application.view = view - self.application.activate_mode(controller) + self.application.manager.activate_mode(controller) def on_deactivate(self): """Called when the controller is removed from the list.
--- a/src/parpg/dialoguecontroller.py Mon Aug 01 08:44:31 2011 +0200 +++ b/src/parpg/dialoguecontroller.py Wed Aug 03 22:57:52 2011 +0200 @@ -54,7 +54,7 @@ def pump(self, dt): ControllerBase.pump(self, dt) if self.dialogue and not self.dialogue.active: - self.application.pop_mode() + self.application.manager.pop_mode() self.model.pause(False) self.view.hud.enabled = True
--- a/src/parpg/mainmenucontroller.py Mon Aug 01 08:44:31 2011 +0200 +++ b/src/parpg/mainmenucontroller.py Wed Aug 03 22:57:52 2011 +0200 @@ -55,7 +55,7 @@ controller = CharacterCreationController(self.engine, view, self.model, self.application) self.application.view = view - self.application.swap_modes(controller) + self.application.manager.swap_modes(controller) # def newGame(self): # """Starts a new game""" @@ -66,7 +66,7 @@ # self.model, # self.application) # self.application.view = view -# self.application.swap_modes(controller) +# self.application.manager.swap_modes(controller) # start_map = self.model.settings.get("PARPG", "Map") # self.model.changeMap(start_map) @@ -81,7 +81,7 @@ self.model, self.application) self.application.view = view - self.application.swap_modes(controller) + self.application.manager.swap_modes(controller) controller.loadGame(*args, **kwargs) def on_deactivate(self):
--- a/src/parpg/mode.py Mon Aug 01 08:44:31 2011 +0200 +++ b/src/parpg/mode.py Wed Aug 03 22:57:52 2011 +0200 @@ -1,12 +1,10 @@ from parpg.grease.mode import * -from fife.extensions.basicapplication import ApplicationBase import abc -class FifeManager(BaseManager, ApplicationBase): +class FifeManager(BaseManager): - def __init__(self, TDS): - ApplicationBase.__init__(self, TDS) + def __init__(self): self.modes = [] def _pump(self):
--- a/src/parpg/objects/action.py Mon Aug 01 08:44:31 2011 +0200 +++ b/src/parpg/objects/action.py Wed Aug 03 22:57:52 2011 +0200 @@ -315,7 +315,7 @@ self.view, self.model, self.controller.application) - self.controller.application.push_mode(dialogue_controller) + self.controller.application.manager.push_mode(dialogue_controller) dialogue_controller.startTalk(self.npc) else: self.npc.behaviour.agent.say("Leave me alone!", 1000)