comparison orpg/mapper/map_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 449a8900f9ac
children e842a5f1b775
comparison
equal deleted inserted replaced
101:394ebb3b6a0f 135:dcf4fbe09b70
32 from background_msg import * 32 from background_msg import *
33 from grid_msg import * 33 from grid_msg import *
34 from miniatures_msg import * 34 from miniatures_msg import *
35 from whiteboard_msg import * 35 from whiteboard_msg import *
36 from fog_msg import * 36 from fog_msg import *
37 import traceback
38 from orpg.dirpath import dir_struct
39
40 from xml.etree.ElementTree import ElementTree, Element, iselement
41 from xml.etree.ElementTree import fromstring, tostring, parse
37 42
38 """ 43 """
39 <map name=? id=? > 44 <map name=? id=? >
40 <bg type=? file=? color=? /> 45 <bg type=? file=? color=? />
41 <grid size=? snap=? /> 46 <grid size=? snap=? />
44 </miniatures> 49 </miniatures>
45 </map> 50 </map>
46 51
47 """ 52 """
48 53
54 def Crash(type, value, crash):
55 crash_report = open(dir_struct["home"] + 'crash-report.txt', "w")
56 traceback.print_exception(type, value, crash, file=crash_report)
57 crash_report.close()
58 msg = ''
59 crash_report = open(dir_struct["home"] + 'crash-report.txt', "r")
60 for line in crash_report: msg += line
61 print msg
62 crash_report.close()
63
49 class map_msg(map_element_msg_base): 64 class map_msg(map_element_msg_base):
50 65
51 def __init__(self,reentrant_lock_object = None): 66 def __init__(self,reentrant_lock_object = None):
67 print 'class map_msg'
52 self.tagname = "map" 68 self.tagname = "map"
53 map_element_msg_base.__init__(self,reentrant_lock_object) 69 map_element_msg_base.__init__(self, reentrant_lock_object)
54 70
55 def init_from_dom(self,xml_dom): 71 def init_from_dom(self, xml_dom):
72 print 'init_from_dom', self.tagname
56 self.p_lock.acquire() 73 self.p_lock.acquire()
57 if xml_dom.tagName == self.tagname: 74 if xml_dom.tag == self.tagname:
58 # If this is a map message, look for the "action=new" 75 # If this is a map message, look for the "action=new"
59 # Notice we only do this when the root is a map tag 76 # 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": 77 if self.tagname == "map" and xml_dom.get("action") == "new":
61 self.clear() 78 self.clear()
62 # Process all of the properties in each tag 79 # Process all of the properties in each tag
63 if xml_dom.getAttributeKeys(): 80 if xml_dom.keys():
64 for k in xml_dom.getAttributeKeys(): 81 for k in xml_dom.keys():
65 self.init_prop(k,xml_dom.getAttribute(k)) 82 self.init_prop(k, xml_dom.get(k))
66 for c in xml_dom._get_childNodes(): 83 for c in xml_dom.getchildren():
67 name = c._get_nodeName() 84 name = c.tag
68 if not self.children.has_key(name): 85 if not self.children.has_key(name):
69 if name == "miniatures": self.children[name] = minis_msg(self.p_lock) 86 if name == "miniatures": self.children[name] = minis_msg(self.p_lock)
70 elif name == "grid": self.children[name] = grid_msg(self.p_lock) 87 elif name == "grid": self.children[name] = grid_msg(self.p_lock)
71 elif name == "bg": self.children[name] = bg_msg(self.p_lock) 88 elif name == "bg": self.children[name] = bg_msg(self.p_lock)
72 elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock) 89 elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock)
82 self.p_lock.release() 99 self.p_lock.release()
83 raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element" 100 raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element"
84 self.p_lock.release() 101 self.p_lock.release()
85 102
86 def set_from_dom(self,xml_dom): 103 def set_from_dom(self,xml_dom):
104 print 'set_from_dom'
87 self.p_lock.acquire() 105 self.p_lock.acquire()
88 if xml_dom.tagName == self.tagname: 106 if xml_dom.tag == self.tagname:
89 # If this is a map message, look for the "action=new" 107 # If this is a map message, look for the "action=new"
90 # Notice we only do this when the root is a map tag 108 # 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": 109 if self.tagname == "map" and xml_dom.get("action") == "new":
92 self.clear() 110 self.clear()
93 # Process all of the properties in each tag 111 # Process all of the properties in each tag
94 if xml_dom.getAttributeKeys(): 112 if xml_dom.keys():
95 for k in xml_dom.getAttributeKeys(): 113 for k in xml_dom.keys():
96 self.set_prop(k,xml_dom.getAttribute(k)) 114 self.set_prop(k,xml_dom.get(k))
97 for c in xml_dom._get_childNodes(): 115 for c in xml_dom.getchildren():
98 name = c._get_nodeName() 116 name = c.tag
99 if not self.children.has_key(name): 117 if not self.children.has_key(name):
100 if name == "miniatures": self.children[name] = minis_msg(self.p_lock) 118 if name == "miniatures": self.children[name] = minis_msg(self.p_lock)
101 elif name == "grid": self.children[name] = grid_msg(self.p_lock) 119 elif name == "grid": self.children[name] = grid_msg(self.p_lock)
102 elif name == "bg": self.children[name] = bg_msg(self.p_lock) 120 elif name == "bg": self.children[name] = bg_msg(self.p_lock)
103 elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock) 121 elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock)
117 def get_all_xml(self, action="new", output_action=1): 135 def get_all_xml(self, action="new", output_action=1):
118 return map_element_msg_base.get_all_xml(self, action, output_action) 136 return map_element_msg_base.get_all_xml(self, action, output_action)
119 137
120 def get_changed_xml(self, action="update", output_action=1): 138 def get_changed_xml(self, action="update", output_action=1):
121 return map_element_msg_base.get_changed_xml(self, action, output_action) 139 return map_element_msg_base.get_changed_xml(self, action, output_action)
140 crash = sys.excepthook = Crash