Mercurial > traipse_dev
diff orpg/tools/orpg_settings.py @ 90:d1aff41c031b alpha
Traipse Alpha 'OpenRPG' {090919-00}
Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc''s main goal is to offer more advanced features and enhance the productivity of the user.
Update Summary:
00:
Adds menu changes to draw attention to important updates, errors, or other events. (image info coming soon)
Traipse URL is not included in the repos tab and is set as default.
01:
Fixes Copy for Windows and Linux (finally!!) users.
Fixes incomplete update to Grid and List nodes.
Fixes incomplete update to Chat Commands.
02:
Fixes problems with Remote Image Upload.
Fixes Drop and Drag of Minis to Map.
CherryPy can now use any image in the webfiles/ folder and sub-folders.
CherryPy can now Drop and Drag Minis to the Map.
03:
Minor changes to Update Manager's GUI.
Expert recommendation warning added to Revision Update.
Step down compatibility with open_rpg & component added to orpgCore.
19-00:
Better backwards compatibility in orpgCore.
Using majority of 'Grumpy' network folder to correct server lag.
author | sirebral |
---|---|
date | Sat, 19 Sep 2009 06:45:21 -0500 |
parents | c54768cffbd4 |
children | 37d26a98883f |
line wrap: on
line diff
--- a/orpg/tools/orpg_settings.py Thu Sep 17 06:29:32 2009 -0500 +++ b/orpg/tools/orpg_settings.py Sat Sep 19 06:45:21 2009 -0500 @@ -33,41 +33,47 @@ import sys import os from orpg.orpg_xml import xml +from orpg.tools.orpg_log import logger +from orpg.tools.validate import validate +from orpg.orpg_xml import xml class orpgSettings: def __init__(self): - self.validate = component.get("validate") - component.add('xml', xml) self.xml = component.get("xml") - self.orpgLog = component.get("log") self.changes = [] - self.validate.config_file("settings.xml","default_settings.xml") + validate.config_file("settings.xml","default_settings.xml") self.filename = dir_struct["user"] + "settings.xml" temp_file = open(self.filename) txt = temp_file.read() temp_file.close() - self.xml_dom = self.xml.parseXml(txt) + self.xml_dom = xml.parseXml(txt) if self.xml_dom is None: self.rebuildSettings() self.xml_dom = self.xml_dom._get_documentElement() def rebuildSettings(self): - self.orpgLog.log("Settings file has be corrupted, rebuilding settings.", ORPG_INFO, True) + logger.info("Settings file has be corrupted, rebuilding settings.", True) try: os.remove(self.filename) except: pass - self.validate.config_file("settings.xml","default_settings.xml") + validate.config_file("settings.xml","default_settings.xml") temp_file = open(self.filename) txt = temp_file.read() temp_file.close() - self.xml_dom = self.xml.parseXml(txt) + self.xml_dom = xml.parseXml(txt) - def get_setting(self, name): + def get_setting(self, name): ##Depricated + return self.get(name) + + def get(self, name): try: return self.xml_dom.getElementsByTagName(name)[0].getAttribute("value") except: return 0 - def get_setting_keys(self): + def get_setting_keys(self): ##Depricated + return self.get_keys() + + def get_keys(self): keys = [] tabs = self.xml_dom.getElementsByTagName("tab") for i in xrange(0, len(tabs)): @@ -76,13 +82,19 @@ for c in children: keys.append(c._get_tagName()) return keys - def set_setting(self, name, value): + def set_setting(self, name, value): ##Depricated + self.change(name, value) + + def change(self, name, value): self.xml_dom.getElementsByTagName(name)[0].setAttribute("value", value) - def add_setting(self, tab, setting, value, options, help): + def add_setting(self, tab, setting, value, options, help): ##Depricated + return self.add(tab, setting, value, options, help) + + def add(self, tab, setting, value, options, help): if len(self.xml_dom.getElementsByTagName(setting)) > 0: return False tabs = self.xml_dom.getElementsByTagName("tab") - newsetting = self.xml.parseXml('<' + setting + ' value="' + value + '" options="' + + newsetting = xml.parseXml('<' + setting + ' value="' + value + '" options="' + options + '" help="' + help + '" />')._get_documentElement() for i in xrange(0, len(tabs)): if tabs[i].getAttribute("name") == tab and tabs[i].getAttribute("type") == 'grid': @@ -94,7 +106,7 @@ tab_xml = '<tab ' if tabtype == 'text': tab_xml += 'name="' + tabname + '" type="text" />' else: tab_xml += 'name="' + tabname + '" type="' + tabtype + '"></tab>' - newtab = self.xml.parseXml(tab_xml)._get_documentElement() + newtab = xml.parseXml(tab_xml)._get_documentElement() if parent != None: tabs = self.xml_dom.getElementsByTagName("tab") for i in xrange(0, len(tabs)): @@ -117,7 +129,7 @@ temp_file = open(defaultFile) txt = temp_file.read() temp_file.close() - default_dom = self.xml.parseXml(txt)._get_documentElement() + default_dom = xml.parseXml(txt)._get_documentElement() for child in default_dom.getChildren(): if child._get_tagName() == 'tab' and child.hasChildNodes(): self.proccessChildren(child) default_dom.unlink() @@ -136,7 +148,7 @@ def save(self): temp_file = open(self.filename, "w") - temp_file.write(self.xml.toxml(self.xml_dom,1)) + temp_file.write(xml.toxml(self.xml_dom,1)) temp_file.close() class orpgSettingsWnd(wx.Dialog): @@ -145,7 +157,6 @@ wx.DefaultPosition,size = wx.Size(-1,-1), style=wx.RESIZE_BORDER | wx.SYSTEM_MENU | wx.CAPTION) self.Freeze() - self.validate = component.get("validate") self.settings = component.get("settings") self.chat = component.get("chat") self.changes = [] @@ -172,7 +183,7 @@ self.winsizer.SetDimension(0,0,w,h-25) def build_gui(self): - self.validate.config_file("settings.xml","default_settings.xml") + validate.config_file("settings.xml","default_settings.xml") filename = dir_struct["user"] + "settings.xml" temp_file = open(filename) temp_file.close()