Changeset 32 for trunk/demo/run.py


Ignore:
Timestamp:
04/09/09 12:31:29 (11 years ago)
Author:
tie_parpg
Message:
  • Enabled game closing via the window decoration button
  • Moved the 'magic path code' atrocity to scripts/common/utils.py
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/demo/run.py

    r30 r32  
    1616import sys, os, shutil 
    1717 
    18 # magic code to make swig work ;-) 
    19 def _jp(path): 
    20     return os.path.sep.join(path.split('/')) 
     18from scripts.common import utils 
     19utils.add_paths ('../../engine/swigwrappers/python', '../../engine/extensions') 
     20 #magic code to make swig work ;-) 
     21#def _jp(path): 
     22    #return os.path.sep.join(path.split('/')) 
    2123 
    22 _paths = ('../../engine/swigwrappers/python', '../../engine/extensions') 
    23 for p in _paths: 
    24     if p not in sys.path: 
    25         sys.path.append(_jp(p)) 
     24#_paths = ('../../engine/swigwrappers/python', '../../engine/extensions') 
     25#for p in _paths: 
     26    #if p not in sys.path: 
     27        #sys.path.append(_jp(p)) 
    2628 
    2729import fife_compat 
     
    3739    def __init__(self, engine, world): 
    3840        super(ApplicationListener, self).__init__(engine, 
    39             regKeys=True,regCmd=True, regMouse=False,  
    40             regConsole=True, regWidget=True) 
     41                                                  regKeys=True,regCmd=True, regMouse=False,  
     42                                                  regConsole=True, regWidget=True) 
    4143        self.engine = engine 
    4244        self.world = world 
     
    4749    def keyPressed(self, evt): 
    4850        """Function to deal with keypress events 
    49            
    5051           @param evt: The event that was captured""" 
    5152        keyval = evt.getKey().getValue() 
     
    5354            self.quit = True 
    5455        evt.consume() 
     56           
     57    def onCommand(self, command): 
     58        """Enables the game to be closed via the 'X' button on the window frame""" 
     59        self.quit = (command.getCommandType() == fife.CMD_QUIT_GAME) 
     60        if self.quit: 
     61            command.consume() 
    5562 
    5663class PARPG(ApplicationBase): 
     
    6976 
    7077        eSet = self.engine.getSettings() 
    71         eSet.setDefaultFontGlyphs(str( 
    72         TDS.readSetting("FontGlyphs",strip=False))) 
     78        eSet.setDefaultFontGlyphs(str(TDS.readSetting("FontGlyphs",strip=False))) 
    7379        eSet.setDefaultFontPath(str(TDS.readSetting("Font"))) 
    7480        eSet.setBitsPerPixel(int(TDS.readSetting("BitsPerPixel"))) 
     
    9399        LogModules = TDS.readSetting("LogModules",type='list') 
    94100        self.log = fifelog.LogManager(self.engine, 
    95         int(TDS.readSetting("LogToPrompt")), 
    96         int(TDS.readSetting("LogToFile"))) 
     101                                      int(TDS.readSetting("LogToPrompt")), 
     102                                      int(TDS.readSetting("LogToFile"))) 
    97103        if LogModules: 
    98104            self.log.setVisibleModules(*LogModules) 
Note: See TracChangeset for help on using the changeset viewer.