comparison orpg/mapper/whiteboard_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 54446a995007 e842a5f1b775
comparison
equal deleted inserted replaced
101:394ebb3b6a0f 135:dcf4fbe09b70
27 # utilities in the orpg project. 27 # utilities in the orpg project.
28 # 28 #
29 __version__ = "$Id: whiteboard_msg.py,v 1.12 2007/03/09 14:11:56 digitalxero Exp $" 29 __version__ = "$Id: whiteboard_msg.py,v 1.12 2007/03/09 14:11:56 digitalxero Exp $"
30 30
31 from base_msg import * 31 from base_msg import *
32 from xml.etree.ElementTree import ElementTree
32 33
33 class item_msg(map_element_msg_base): 34 class item_msg(map_element_msg_base):
34 35
35 def __init__(self,reentrant_lock_object = None, tagname = "line"): 36 def __init__(self,reentrant_lock_object = None, tagname = "line"):
36 self.tagname = tagname # set this to be for items. Tagname gets used in some base class functions. 37 self.tagname = tagname # set this to be for items. Tagname gets used in some base class functions.
78 self.tagname = "whiteboard" 79 self.tagname = "whiteboard"
79 map_element_msg_base.__init__(self,reentrant_lock_object) 80 map_element_msg_base.__init__(self,reentrant_lock_object)
80 81
81 def init_from_dom(self,xml_dom): 82 def init_from_dom(self,xml_dom):
82 self.p_lock.acquire() 83 self.p_lock.acquire()
83 if xml_dom.tagName == self.tagname: 84 if xml_dom.tag == self.tagname:
84 if xml_dom.getAttributeKeys(): 85 if xml_dom.keys():
85 for k in xml_dom.getAttributeKeys(): 86 for k in xml_dom.keys():
86 self.init_prop(k,xml_dom.getAttribute(k)) 87 self.init_prop(k,xml_dom.get(k))
87 for c in xml_dom._get_childNodes(): 88 for c in xml_dom.getchildren():
88 item = item_msg(self.p_lock,c._get_nodeName()) 89 item = item_msg(self.p_lock, c.tag)
89 try: item.init_from_dom(c) 90 try: item.init_from_dom(c)
90 except Exception, e: 91 except Exception, e:
91 print e 92 print e
92 continue 93 continue
93 id = item.get_prop("id") 94 id = item.get_prop("id")
104 raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element in whiteboard" 105 raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element in whiteboard"
105 self.p_lock.release() 106 self.p_lock.release()
106 107
107 def set_from_dom(self,xml_dom): 108 def set_from_dom(self,xml_dom):
108 self.p_lock.acquire() 109 self.p_lock.acquire()
109 if xml_dom.tagName == self.tagname: 110 if xml_dom.tag == self.tagname:
110 if xml_dom.getAttributeKeys(): 111 if xml_dom.keys():
111 for k in xml_dom.getAttributeKeys(): 112 for k in xml_dom.keys():
112 self.set_prop(k,xml_dom.getAttribute(k)) 113 self.set_prop(k, xml_dom.get(k))
113 for c in xml_dom._get_childNodes(): 114 for c in xml_dom.getchildren():
114 item = item_msg(self.p_lock, c._get_nodeName()) 115 item = item_msg(self.p_lock, c.tag)
115 try: item.set_from_dom(c) 116 try: item.set_from_dom(c)
116 except Exception, e: 117 except Exception, e:
117 print e 118 print e
118 continue 119 continue
119 id = item.get_prop("id") 120 id = item.get_prop("id")