comparison orpg/mapper/map_msg.py @ 140:e842a5f1b775 beta

Traipse Beta 'OpenRPG' {091123-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 Gametree Recursion method, mapping, and context sensitivity. !Infinite Loops return error instead of freezing the software! New Syntax added for custom PC sheets Tip of the Day added, from Core and community Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix.
author sirebral
date Mon, 23 Nov 2009 03:36:26 -0600
parents dcf4fbe09b70
children 6081bdc2b8d5
comparison
equal deleted inserted replaced
135:dcf4fbe09b70 140:e842a5f1b775
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
42 37
43 """ 38 """
44 <map name=? id=? > 39 <map name=? id=? >
45 <bg type=? file=? color=? /> 40 <bg type=? file=? color=? />
46 <grid size=? snap=? /> 41 <grid size=? snap=? />
49 </miniatures> 44 </miniatures>
50 </map> 45 </map>
51 46
52 """ 47 """
53 48
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
64 class map_msg(map_element_msg_base): 49 class map_msg(map_element_msg_base):
65 50
66 def __init__(self,reentrant_lock_object = None): 51 def __init__(self,reentrant_lock_object = None):
67 print 'class map_msg'
68 self.tagname = "map" 52 self.tagname = "map"
69 map_element_msg_base.__init__(self, reentrant_lock_object) 53 map_element_msg_base.__init__(self,reentrant_lock_object)
70 54
71 def init_from_dom(self, xml_dom): 55 def init_from_dom(self,xml_dom):
72 print 'init_from_dom', self.tagname
73 self.p_lock.acquire() 56 self.p_lock.acquire()
74 if xml_dom.tag == self.tagname: 57 if xml_dom.tagName == self.tagname:
75 # If this is a map message, look for the "action=new" 58 # If this is a map message, look for the "action=new"
76 # Notice we only do this when the root is a map tag 59 # Notice we only do this when the root is a map tag
77 if self.tagname == "map" and xml_dom.get("action") == "new": 60 if self.tagname == "map" and xml_dom.hasAttribute("action") and xml_dom.getAttribute("action") == "new":
78 self.clear() 61 self.clear()
79 # Process all of the properties in each tag 62 # Process all of the properties in each tag
80 if xml_dom.keys(): 63 if xml_dom.getAttributeKeys():
81 for k in xml_dom.keys(): 64 for k in xml_dom.getAttributeKeys():
82 self.init_prop(k, xml_dom.get(k)) 65 self.init_prop(k,xml_dom.getAttribute(k))
83 for c in xml_dom.getchildren(): 66 for c in xml_dom._get_childNodes():
84 name = c.tag 67 name = c._get_nodeName()
85 if not self.children.has_key(name): 68 if not self.children.has_key(name):
86 if name == "miniatures": self.children[name] = minis_msg(self.p_lock) 69 if name == "miniatures": self.children[name] = minis_msg(self.p_lock)
87 elif name == "grid": self.children[name] = grid_msg(self.p_lock) 70 elif name == "grid": self.children[name] = grid_msg(self.p_lock)
88 elif name == "bg": self.children[name] = bg_msg(self.p_lock) 71 elif name == "bg": self.children[name] = bg_msg(self.p_lock)
89 elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock) 72 elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock)
99 self.p_lock.release() 82 self.p_lock.release()
100 raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element" 83 raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element"
101 self.p_lock.release() 84 self.p_lock.release()
102 85
103 def set_from_dom(self,xml_dom): 86 def set_from_dom(self,xml_dom):
104 print 'set_from_dom'
105 self.p_lock.acquire() 87 self.p_lock.acquire()
106 if xml_dom.tag == self.tagname: 88 if xml_dom.tagName == self.tagname:
107 # If this is a map message, look for the "action=new" 89 # If this is a map message, look for the "action=new"
108 # Notice we only do this when the root is a map tag 90 # Notice we only do this when the root is a map tag
109 if self.tagname == "map" and xml_dom.get("action") == "new": 91 if self.tagname == "map" and xml_dom.hasAttribute("action") and xml_dom.getAttribute("action") == "new":
110 self.clear() 92 self.clear()
111 # Process all of the properties in each tag 93 # Process all of the properties in each tag
112 if xml_dom.keys(): 94 if xml_dom.getAttributeKeys():
113 for k in xml_dom.keys(): 95 for k in xml_dom.getAttributeKeys():
114 self.set_prop(k,xml_dom.get(k)) 96 self.set_prop(k,xml_dom.getAttribute(k))
115 for c in xml_dom.getchildren(): 97 for c in xml_dom._get_childNodes():
116 name = c.tag 98 name = c._get_nodeName()
117 if not self.children.has_key(name): 99 if not self.children.has_key(name):
118 if name == "miniatures": self.children[name] = minis_msg(self.p_lock) 100 if name == "miniatures": self.children[name] = minis_msg(self.p_lock)
119 elif name == "grid": self.children[name] = grid_msg(self.p_lock) 101 elif name == "grid": self.children[name] = grid_msg(self.p_lock)
120 elif name == "bg": self.children[name] = bg_msg(self.p_lock) 102 elif name == "bg": self.children[name] = bg_msg(self.p_lock)
121 elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock) 103 elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock)
135 def get_all_xml(self, action="new", output_action=1): 117 def get_all_xml(self, action="new", output_action=1):
136 return map_element_msg_base.get_all_xml(self, action, output_action) 118 return map_element_msg_base.get_all_xml(self, action, output_action)
137 119
138 def get_changed_xml(self, action="update", output_action=1): 120 def get_changed_xml(self, action="update", output_action=1):
139 return map_element_msg_base.get_changed_xml(self, action, output_action) 121 return map_element_msg_base.get_changed_xml(self, action, output_action)
140 crash = sys.excepthook = Crash