Changeset 475


Ignore:
Timestamp:
02/02/10 14:05:17 (10 years ago)
Author:
maximinus_parpg
Message:

Cleaned up run.py and settings.py.
settings.py was very ugly, almost unchanged from rio_de_hola.
Some unused code removed.

Location:
trunk/game
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/run.py

    r473 r475  
    7777        @return: result 
    7878        """ 
    79  
    8079        return self.console.handleConsoleCommand(command) 
    8180 
  • trunk/game/settings.py

    r283 r475  
    1616#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
    1717 
    18 import shutil 
    19  
    2018try: 
    2119    import xml.etree.cElementTree as ET 
     
    2422 
    2523class Setting(object): 
    26     def setDefaults(self): 
    27         shutil.copyfile('settings-dist.xml', 'settings.xml') 
    28         self.isSetToDefault = True 
    29         self.changesRequireRestart = True 
     24    def __init__(self): 
     25        self.root_element = None 
    3026 
    3127    def readSetting(self, name, type='int', strip=True, text=False, default=None): 
    3228        if not hasattr(self, 'tree'): 
    33             self.tree = ET.parse('settings.xml') 
    34             self.root_element = self.tree.getroot() 
     29            tree = ET.parse('settings.xml') 
     30            self.root_element = tree.getroot() 
    3531        element = self.root_element.find(name) 
    3632        if element is not None: 
     
    5955        else: 
    6056            print 'Setting,', name, 'does not exist!' 
    61  
    6257        return default 
    6358 
     
    6964        else: 
    7065            print 'Setting,', name, 'does not exist!' 
    71  
Note: See TracChangeset for help on using the changeset viewer.