diff application.py @ 167:b3b82c2aebee

Using fife settings module again instead of our own.
author Beliar <KarstenBock@gmx.net>
date Mon, 20 Feb 2012 16:50:10 +0100
parents 76041ed90a5d
children bfd3a4ef7f2b
line wrap: on
line diff
--- a/application.py	Thu Jan 12 18:42:48 2012 +0100
+++ b/application.py	Mon Feb 20 16:50:10 2012 +0100
@@ -112,14 +112,12 @@
     def __init__(self, setting):
         """Initialise the instance.
            @return: None"""
-        self._setting = setting
+        ApplicationBase.__init__(self, setting)
         self.manager = FifeManager()
-        self.engine = fife.Engine()
-        self.loadSettings()
-        self.engine.init()
         # KLUDGE M. George Hansen 2011-06-04: See parpg/vfs.py.
         vfs.VFS = self.engine.getVFS()
-        vfs.VFS.addNewSource(setting.parpg.DataPath)
+        print(vfs.VFS)
+        vfs.VFS.addNewSource(setting.get("parpg","DataPath"))
 
         pychan.init(self.engine, debug = True)
         pychan.setupModalExecution(self.mainLoop,self.breakFromMainLoop)
@@ -136,7 +134,7 @@
         self.model.getDialogues()
         # KLUDGE M. George Hansen 2011-06-04: Hack to allow loaded PyChan XML
         #     scripts to locate their resources.
-        os.chdir(setting.parpg.DataPath)
+        os.chdir(setting.get("parpg","DataPath"))
         self.view = MainMenuView(self.engine, self.model)
         self.loadFonts()
         self.event_listener = EventListener(self.engine)
@@ -148,12 +146,10 @@
                                             self.engine, 
                                             self.view, 
                                             self.model)
-        #start_map = self._setting.fife.get("PARPG", "Map")
-        #self.model.changeMap(start_map)
 
     def loadFonts(self):
         # add the fonts path to the system path to import font definitons
-        sys.path.insert(0, os.path.join(self._setting.parpg.DataPath, 'fonts'))
+        sys.path.insert(0, os.path.join(self._setting.get("parpg", "DataPath"), 'fonts'))
         from oldtypewriter import fontdefs
 
         for fontdef in fontdefs:
@@ -161,47 +157,6 @@
                                                             self._setting))
 
 
-    def loadSettings(self):
-        """
-        Load the settings from a python file and load them into the engine.
-        Called in the ApplicationBase constructor.
-        """
-
-        engineSetting = self.engine.getSettings()
-        assert(isinstance(engineSetting, fife.EngineSettings))
-        engineSetting.setDefaultFontGlyphs(self._setting.fife.FontGlyphs)
-        engineSetting.setDefaultFontPath(
-            '{0}/fonts/{1}'.format(self._setting.parpg.DataPath,
-                                   self._setting.fife.Font)
-        )
-        engineSetting.setDefaultFontSize(self._setting.fife.DefaultFontSize)
-        engineSetting.setBitsPerPixel(self._setting.fife.BitsPerPixel)
-        engineSetting.setInitialVolume(self._setting.fife.InitialVolume)
-        engineSetting.setSDLRemoveFakeAlpha(
-            self._setting.fife.SDLRemoveFakeAlpha
-        )
-        engineSetting.setGLUseFramebuffer(self._setting.fife.GLUseFramebuffer)
-        engineSetting.setGLUseNPOT(self._setting.fife.GLUseNPOT)
-        engineSetting.setScreenWidth(self._setting.fife.ScreenWidth)
-        engineSetting.setScreenHeight(self._setting.fife.ScreenHeight)
-        engineSetting.setRenderBackend(self._setting.fife.RenderBackend)
-        engineSetting.setFullScreen(self._setting.fife.FullScreen)
-        engineSetting.setVideoDriver(self._setting.fife.VideoDriver)
-        engineSetting.setLightingModel(self._setting.fife.Lighting)
-        engineSetting.setColorKeyEnabled(self._setting.fife.ColorKeyEnabled)
-        engineSetting.setMouseSensitivity(self._setting.fife.MouseSensitivity)
-        engineSetting.setMouseAcceleration(
-            self._setting.fife.MouseAcceleration
-        )
-        
-        engineSetting.setColorKey(*[int(digit) 
-                                    for digit in self._setting.fife.ColorKey])
-
-        engineSetting.setWindowTitle(self._setting.fife.WindowTitle)
-        engineSetting.setWindowIcon(
-            '/'.join(['gui/icons', self._setting.fife.WindowIcon])
-        )
-
     def createListener(self):
         """ __init__ takes care of creating an event listener, so
             basicapplication's createListener is harmful. Without 
@@ -217,4 +172,4 @@
         if self.listener.quit:
             self.breakRequested = True #pylint: disable-msg=C0103
         else:
-            self.manager._pump()
\ No newline at end of file
+            self.manager._pump()