comparison orpg/tools/InterParse.py @ 197:fcd6aafbe232 alpha

Traipse Alpha 'OpenRPG' {100426-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 (Patch-2) New Features: New Namespace method with two new syntaxes New Namespace Internal is context sensitive, always! New Namespace External is 'as narrow as you make it' New Namespace FutureCheck helps ensure you don't receive an incorrect node New PluginDB access for URL2Link plugin New to Forms, they now show their content in Design Mode Fixes: Fix to Server GUI startup errors Fix to Server GUI Rooms tab updating Fix to Chat and Settings if non existant die roller is picked Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated Fix to Alias Lib's Export to Tree, Open, Save features Fix to alias node, now works properly Fix to Splitter node, minor GUI cleanup Fix to Backgrounds not loading through remote loader Fix to Node name errors Fix to rolling dice in chat Whispers Fix to Splitters Sizing issues
author sirebral
date Mon, 26 Apr 2010 14:30:16 -0500
parents 0bc44a57ae6c
children e221cd12b820
comparison
equal deleted inserted replaced
196:0bc44a57ae6c 197:fcd6aafbe232
125 if newstr == '': newstr = '0' 125 if newstr == '': newstr = '0'
126 s = s.replace(matches[i][0], newstr, 1).replace(matches[i][1], '', 1).replace(matches[i][2], '', 1) 126 s = s.replace(matches[i][0], newstr, 1).replace(matches[i][1], '', 1).replace(matches[i][2], '', 1)
127 dlg.Destroy() 127 dlg.Destroy()
128 return s 128 return s
129 129
130 def LocationCheck(self, x, roots, root_list, tree_map):
131 roots.append(tree_map[x])
132 root_list.append(self.get_node(roots))
133 namespace = root_list[x].getiterator('nodehandler')
134 return namespace
135
136 def FutureCheck(self, node, next):
137 future = node.getiterator('nodehandler')
138 for advance in future:
139 if next == advance.get('name'): return True
140 return False
141
130 def NameSpaceI(self, s, node): 142 def NameSpaceI(self, s, node):
131 reg = re.compile("(!=(.*?)=!)") 143 reg = re.compile("(!=(.*?)=!)")
132 matches = reg.findall(s) 144 matches = reg.findall(s)
133 newstr = False 145 newstr = False
134 for i in xrange(0,len(matches)): 146 for i in xrange(0,len(matches)):
135 tree_map = node.get('map').split('::') 147 tree_map = node.get('map').split('::')
136 roots = []; root_list = [] 148 roots = []; root_list = []
137 find = matches[i][1].split('::') 149 find = matches[i][1].split('::')
150 node = self.get_node([tree_map[0]])
138 for x in xrange(0, len(tree_map)): 151 for x in xrange(0, len(tree_map)):
139 roots.append(tree_map[x]) 152 namespace = self.LocationCheck(x, roots, root_list, tree_map)
140 root_list.append(self.get_node(roots)) 153 for x in xrange(0, len(find)):
141 namespace = root_list[x].getiterator('nodehandler') 154 namespace = node.getiterator('nodehandler')
142 for node in namespace: 155 for node in namespace:
143 if find[0] == node.get('name'): 156 if find[x] == node.get('name'):
144 if node.get('class') == 'rpg_grid_handler': 157 if node.get('class') == 'rpg_grid_handler':
145 newstr = self.NameSpaceGrid(find[1], node); break 158 newstr = self.NameSpaceGrid(find[x+1], node); break
146 else: 159 try:
147 newstr = str(node.find('text').text); break 160 if self.FutureCheck(node, find[x+1]): break
148 if not newstr: newstr = 'Invalid Reference!'; break 161 else: continue
162 except:
163 if x == len(find)-1: newstr = str(node.find('text').text); break
164 else: break
165 if not newstr: newstr = 'Invalid Reference!'; break
149 s = s.replace(matches[i][0], newstr, 1) 166 s = s.replace(matches[i][0], newstr, 1)
150 s = self.ParseLogic(s, node) 167 s = self.ParseLogic(s, node)
151 return s 168 return s
152 169
153 def NameSpaceE(self, s): 170 def NameSpaceE(self, s):
154 reg = re.compile("(!&(.*?)&!)") 171 reg = re.compile("(!&(.*?)&!)")
155 matches = reg.findall(s) 172 matches = reg.findall(s)
156 newstr = 'False'; x = 0 173 newstr = False
157 for i in xrange(0,len(matches)): 174 for i in xrange(0,len(matches)):
158 find = matches[i][1].split('::') 175 find = matches[i][1].split('::')
159 node = self.get_node([find[0]]) 176 node = component.get('tree').xml_root
160 last = find[len(find)-1]
161 if not iselement(node): 177 if not iselement(node):
162 s = s.replace(matches[i][0], 'Invalid Reference!', 1); 178 s = s.replace(matches[i][0], 'Invalid Reference!', 1);
163 s = self.NameSpaceE(s) 179 s = self.NameSpaceE(s)
164 return s 180 return s
165 while newstr == 'False': 181 for x in xrange(0, len(find)):
166 namespace = node.getiterator('nodehandler'); x += 1 182 namespace = node.getiterator('nodehandler')
167 for node in namespace: 183 for node in namespace:
168 if find[x] == node.get('name'): 184 if find[x] == node.get('name'):
169 if node.get('class') == 'map_miniature_handler': continue 185 if node.get('class') == 'rpg_grid_handler':
170 elif node.get('class') == 'rpg_grid_handler': 186 newstr = self.NameSpaceGrid(find[x+1], node); break
171 newstr = self.NameSpaceGrid(last, node); break 187 try:
172 elif x == len(find)-1: newstr = str(node.find('text').text); break 188 if self.FutureCheck(node, find[x+1]): break
173 else: break 189 else: continue
174 else: newstr = 'Invalid Reference!'; break 190 except:
191 if x == len(find)-1: newstr = str(node.find('text').text); break
192 else: break
193 if not newstr: newstr = 'Invalid Reference!'
175 s = s.replace(matches[i][0], newstr, 1) 194 s = s.replace(matches[i][0], newstr, 1)
176 s = self.ParseLogic(s, node) 195 s = self.ParseLogic(s, node)
177 return s 196 return s
178 197
179 def NameSpaceGrid(self, s, node): 198 def NameSpaceGrid(self, s, node):