Mercurial > traipse_dev
comparison orpg/mapper/base_msg.py @ 135:dcf4fbe09b70 beta
Traipse Beta 'OpenRPG' {091010-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 (Beta)
Added Bookmarks
Fix to Remote Admin Commands
Minor fix to text based Server
Fix to Pretty Print, from Core
Fix to Splitter Nodes not being created
Fix to massive amounts of images loading, from Core
Added 'boot' command to remote admin
Added confirmation window for sent nodes
Minor changes to allow for portability to an OpenSUSE linux OS
Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG
Zoom Mouse plugin added
Images added to Plugin UI
Switching to Element Tree
Map efficiency, from FlexiRPG
Added Status Bar to Update Manager
default_manifest.xml renamed to default_upmana.xml
Cleaner clode for saved repositories
New TrueDebug Class in orpg_log (See documentation for usage)
Mercurial's hgweb folder is ported to upmana
**Pretty important update that can help remove thousands of dead children from your gametree.
**Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and
look for dead children!!
**New Gamtree Recusion method, mapping, and context sensitivity. !!Alpha - Watch out for infinite loops!!
author | sirebral |
---|---|
date | Tue, 10 Nov 2009 14:11:28 -0600 |
parents | 072ffc1d466f |
children | e842a5f1b775 |
comparison
equal
deleted
inserted
replaced
101:394ebb3b6a0f | 135:dcf4fbe09b70 |
---|---|
28 __version__ = "$Id: base_msg.py,v 1.9 2007/03/09 14:11:55 digitalxero Exp $" | 28 __version__ = "$Id: base_msg.py,v 1.9 2007/03/09 14:11:55 digitalxero Exp $" |
29 | 29 |
30 from threading import RLock | 30 from threading import RLock |
31 from orpg.networking.mplay_client import * | 31 from orpg.networking.mplay_client import * |
32 | 32 |
33 from xml.etree.ElementTree import XML, fromstring, parse | |
34 | |
33 class map_element_msg_base: | 35 class map_element_msg_base: |
34 # This is a base class | 36 # This is a base class |
35 | 37 |
36 def __init__(self,reentrant_lock_object = None): | 38 def __init__(self,reentrant_lock_object = None): |
37 | 39 |
38 if not hasattr(self,"tagname"): | 40 if not self.tagname: |
39 raise Exception, "This is a virtual class that cannot be directly instantiated. Set self.tagname in derived class." | 41 raise Exception, "This is a virtual class that cannot be directly instantiated. Set self.tagname in derived class."; exit() |
40 | 42 |
41 self._props = {} | 43 self._props = {} |
42 # This is a dictionary that holds (value,changed) 2-tuples, indexed by attribute | 44 # This is a dictionary that holds (value,changed) 2-tuples, indexed by attribute |
43 # Avoid manipulating these values directly. Instead, use the provided accessor methods. | 45 # Avoid manipulating these values directly. Instead, use the provided accessor methods. |
44 # If there is not one that suits your needs, please add one to this class and | 46 # If there is not one that suits your needs, please add one to this class and |
193 ######################################### | 195 ######################################### |
194 | 196 |
195 ######################################### | 197 ######################################### |
196 # XML importers begin | 198 # XML importers begin |
197 | 199 |
198 def _from_dom(self,xml_dom,prop_func): | 200 def _from_dom(self,xml,prop_func): |
199 self.p_lock.acquire() | 201 self.p_lock.acquire() |
200 if xml_dom.tagName == self.tagname: | 202 if xml.tag == self.tagname: |
201 if xml_dom.getAttributeKeys(): | 203 if xml.keys(): |
202 for k in xml_dom.getAttributeKeys(): | 204 for k in xml.keys(): |
203 prop_func(k,xml_dom.getAttribute(k)) | 205 prop_func(k, xml.get(k)) |
204 else: | 206 else: |
205 self.p_lock.release() | 207 self.p_lock.release() |
206 raise Exception, "Error attempting to modify a " + self.tagname + " from a non-<" + self.tagname + "/> element" | 208 raise Exception, "Error attempting to modify a " + self.tagname + " from a non-<" + self.tagname + "/> element" |
207 self.p_lock.release() | 209 self.p_lock.release() |
208 | 210 |
209 def init_from_dom(self,xml_dom): | 211 def init_from_dom(self, xml): |
210 # xml_dom must be pointing to an empty tag. Override in a derived class for <map/> and other similar tags. | 212 # xml must be pointing to an empty tag. Override in a derived class for <map/> and other similar tags. |
211 self._from_dom(xml_dom,self.init_prop) | 213 self._from_dom(xml,self.init_prop) |
212 | 214 |
213 def set_from_dom(self,xml_dom): | 215 def set_from_dom(self, xml): |
214 # xml_dom must be pointing to an empty tag. Override in a derived class for <map/> and other similar tags | 216 # xml must be pointing to an empty tag. Override in a derived class for <map/> and other similar tags |
215 self._from_dom(xml_dom,self.set_prop) | 217 self._from_dom(xml, self.set_prop) |
216 | 218 |
217 def init_from_xml(self,xml): | 219 def init_from_xml(self, tree): |
218 xml_dom = parseXml(xml) | 220 #tree = XML(xmlString) |
219 node_list = xml_dom.getElementsByTagName(self.tagname) | 221 node_list = tree.findall(self.tagname) |
220 if len(node_list) < 1: print "Warning: no <" + self.tagname + "/> elements found in DOM." | 222 if len(node_list) < 1: print "Warning: no <" + self.tagname + "/> elements found in DOM." |
221 else: | 223 else: |
222 while len(node_list): self.init_from_dom(node_list.pop()) | 224 while len(node_list): |
223 if xml_dom: xml_dom.unlink() | 225 self.init_from_dom(node_list.pop()) |
224 | 226 |
225 def set_from_xml(self,xml): | 227 def set_from_xml(self, tree): |
226 xml_dom = parseXml(xml) | 228 #tree = XML(xmlString) |
227 node_list = xml_dom.getElementsByTagName(self.tagname) | 229 node_list = tree.findall(self.tagname) |
228 if len(node_list) < 1: print "Warning: no <" + self.tagname + "/> elements found in DOM." | 230 if len(node_list) < 1: print "Warning: no <" + self.tagname + "/> elements found in DOM." |
229 else: | 231 else: |
230 while len(node_list): self.set_from_dom(node_list.pop()) | 232 while len(node_list): self.set_from_dom(node_list.pop()) |
231 if xml_dom: xml_dom.unlink() | |
232 | |
233 # XML importers end | 233 # XML importers end |
234 ######################################### | 234 ######################################### |