comparison orpg/mapper/map_msg.py @ 227:81d0bfd5e800 alpha

Traipse Alpha 'OpenRPG' {100612-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 (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 03:50:37 -0500
parents 06f10429eedc
children
comparison
equal deleted inserted replaced
182:4b2884f29a72 227:81d0bfd5e800
19 # 19 #
20 # File: mapper/map_msg.py 20 # File: mapper/map_msg.py
21 # Author: OpenRPG 21 # Author: OpenRPG
22 # Maintainer: 22 # Maintainer:
23 # Version: 23 # Version:
24 # $Id: map_msg.py,v 1.16 2007/03/09 14:11:55 digitalxero Exp $ 24 # $Id: map_msg.py,v Traipse 'Ornery-Orc' prof.ebral Exp $
25 # 25 #
26 # Description: 26 # Description:
27 # 27 #
28 __version__ = "$Id: map_msg.py,v 1.16 2007/03/09 14:11:55 digitalxero Exp $" 28 __version__ = "$Id: map_msg.py,v Traipse 'Ornery-Orc' prof.ebral Exp $"
29 29
30 #from base import *
31 from base_msg import * 30 from base_msg import *
32 from background_msg import * 31 from background_msg import *
33 from grid_msg import * 32 from grid_msg import *
34 from miniatures_msg import * 33 from miniatures_msg import *
35 from whiteboard_msg import * 34 from whiteboard_msg import *
52 self.tagname = "map" 51 self.tagname = "map"
53 map_element_msg_base.__init__(self,reentrant_lock_object) 52 map_element_msg_base.__init__(self,reentrant_lock_object)
54 53
55 def init_from_dom(self,xml_dom): 54 def init_from_dom(self,xml_dom):
56 self.p_lock.acquire() 55 self.p_lock.acquire()
57 if xml_dom.tagName == self.tagname: 56 if xml_dom.tag == self.tagname:
58 # If this is a map message, look for the "action=new" 57 # If this is a map message, look for the "action=new"
59 # Notice we only do this when the root is a map tag 58 # Notice we only do this when the root is a map tag
60 if self.tagname == "map" and xml_dom.hasAttribute("action") and xml_dom.getAttribute("action") == "new": 59 if self.tagname == "map" and xml_dom.get("action") == "new":
61 self.clear() 60 self.clear()
62 # Process all of the properties in each tag 61 # Process all of the properties in each tag
63 if xml_dom.getAttributeKeys(): 62 if xml_dom.keys():
64 for k in xml_dom.getAttributeKeys(): 63 for k in xml_dom.keys():
65 self.init_prop(k,xml_dom.getAttribute(k)) 64 self.init_prop(k,xml_dom.get(k))
66 for c in xml_dom._get_childNodes(): 65 for c in xml_dom.getchildren():
67 name = c._get_nodeName() 66 name = c.tag
68 if not self.children.has_key(name): 67 if not self.children.has_key(name):
69 if name == "miniatures": self.children[name] = minis_msg(self.p_lock) 68 if name == "miniatures": self.children[name] = minis_msg(self.p_lock)
70 elif name == "grid": self.children[name] = grid_msg(self.p_lock) 69 elif name == "grid": self.children[name] = grid_msg(self.p_lock)
71 elif name == "bg": self.children[name] = bg_msg(self.p_lock) 70 elif name == "bg": self.children[name] = bg_msg(self.p_lock)
72 elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock) 71 elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock)
83 raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element" 82 raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element"
84 self.p_lock.release() 83 self.p_lock.release()
85 84
86 def set_from_dom(self,xml_dom): 85 def set_from_dom(self,xml_dom):
87 self.p_lock.acquire() 86 self.p_lock.acquire()
88 if xml_dom.tagName == self.tagname: 87 if xml_dom.tag == self.tagname:
89 # If this is a map message, look for the "action=new" 88 # If this is a map message, look for the "action=new"
90 # Notice we only do this when the root is a map tag 89 # Notice we only do this when the root is a map tag
91 if self.tagname == "map" and xml_dom.hasAttribute("action") and xml_dom.getAttribute("action") == "new": 90 if self.tagname == "map" and xml_dom.get("action") == "new":
92 self.clear() 91 self.clear()
93 # Process all of the properties in each tag 92 # Process all of the properties in each tag
94 if xml_dom.getAttributeKeys(): 93 if xml_dom.keys():
95 for k in xml_dom.getAttributeKeys(): self.set_prop(k,xml_dom.getAttribute(k)) 94 for k in xml_dom.keys(): self.set_prop(k,xml_dom.get(k))
96 for c in xml_dom._get_childNodes(): 95 for c in xml_dom.getchildren():
97 name = c._get_nodeName() 96 name = c.tag
98 if not self.children.has_key(name): 97 if not self.children.has_key(name):
99 if name == "miniatures": self.children[name] = minis_msg(self.p_lock) 98 if name == "miniatures": self.children[name] = minis_msg(self.p_lock)
100 elif name == "grid": self.children[name] = grid_msg(self.p_lock) 99 elif name == "grid": self.children[name] = grid_msg(self.p_lock)
101 elif name == "bg": self.children[name] = bg_msg(self.p_lock) 100 elif name == "bg": self.children[name] = bg_msg(self.p_lock)
102 elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock) 101 elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock)