diff orpg/tools/orpg_settings.py @ 228:24769389a7ba alpha

Traipse Alpha 'OpenRPG' {100612-01} 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 (Preparing to close updates) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order Fixes: Fix to InterParse that was causing an Infernal Loop with Namespace Internal Fix to XML data, removed old Minidom and switched to Element Tree Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread Fix to metaservers.xml file not being created
author sirebral
date Sat, 12 Jun 2010 04:38:29 -0500
parents b633f4c64aae
children
line wrap: on
line diff
--- a/orpg/tools/orpg_settings.py	Mon May 03 03:28:29 2010 -0500
+++ b/orpg/tools/orpg_settings.py	Sat Jun 12 04:38:29 2010 -0500
@@ -33,7 +33,8 @@
 
 from orpg.tools.orpg_log import logger
 from orpg.tools.validate import validate
-from orpg.orpg_xml import xml
+from xml.etree.ElementTree import ElementTree, Element, parse
+from xml.etree.ElementTree import fromstring, tostring
 from orpg.tools.settings import settings
 
 class orpgSettingsWnd(wx.Dialog):
@@ -70,29 +71,28 @@
     def build_gui(self):
         validate.config_file("settings.xml","default_settings.xml")
         filename = dir_struct["user"] + "settings.xml"
-        temp_file = open(filename)
-        temp_file.close()
-        children = self.settings.xml_dom._get_childNodes()
-        for c in children: self.build_window(c,self.tabber)
+        temp_file = parse(filename)
+        children = self.settings.xml_dom.getchildren()
+        for c in children: self.build_window(c, self.tabber)
 
     def build_window(self, xml_dom, parent_wnd):
-        name = xml_dom._get_nodeName()
+        name = xml_dom.tag
         #container = 0
         if name=="tab": temp_wnd = self.do_tab_window(xml_dom,parent_wnd)
         return temp_wnd
 
     def do_tab_window(self, xml_dom, parent_wnd):
-        type = xml_dom.getAttribute("type")
-        name = xml_dom.getAttribute("name")
+        type = xml_dom.get("type")
+        name = xml_dom.get("name")
 
         if type == "grid":
             temp_wnd = self.do_grid_tab(xml_dom, parent_wnd)
             parent_wnd.AddPage(temp_wnd, name, False)
         elif type == "tab":
             temp_wnd = orpgTabberWnd(parent_wnd, style=FNB.FNB_NO_X_BUTTON)
-            children = xml_dom._get_childNodes()
+            children = xml_dom.getchildren()
             for c in children:
-                if c._get_nodeName() == "tab": self.do_tab_window(c, temp_wnd)
+                if c.tag == "tab": self.do_tab_window(c, temp_wnd)
             temp_wnd.SetSelection(0)
             parent_wnd.AddPage(temp_wnd, name, False)
         elif type == "text":
@@ -103,12 +103,12 @@
 
     def do_grid_tab(self, xml_dom, parent_wnd):
         settings = []
-        children = xml_dom._get_childNodes()
+        children = xml_dom.getchildren()
         for c in children:
-            name = c._get_nodeName()
-            value = c.getAttribute("value")
-            help = c.getAttribute("help")
-            options = c.getAttribute("options")
+            name = c.tag
+            value = c.get("value")
+            help = c.get("help")
+            options = c.get("options")
             settings.append([name, value, options, help])
         temp_wnd = settings_grid(parent_wnd, settings, self.changes)
         return temp_wnd
@@ -309,4 +309,3 @@
         for i in range(0,cols): self.SetColSize(i,col_w)
         self.Refresh()
 
-#settings = orpg.tools.settings.Settings()