comparison orpg/tools/InterParse.py @ 198:e221cd12b820 alpha

Traipse Alpha 'OpenRPG' {100426-01} 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 Daily: Fix I had to push this again because I got a little amitions with getiterator, breaking Internal
author sirebral
date Mon, 26 Apr 2010 16:15:50 -0500
parents fcd6aafbe232
children 0ccfb8836b81
comparison
equal deleted inserted replaced
197:fcd6aafbe232 198:e221cd12b820
128 return s 128 return s
129 129
130 def LocationCheck(self, x, roots, root_list, tree_map): 130 def LocationCheck(self, x, roots, root_list, tree_map):
131 roots.append(tree_map[x]) 131 roots.append(tree_map[x])
132 root_list.append(self.get_node(roots)) 132 root_list.append(self.get_node(roots))
133 namespace = root_list[x].getiterator('nodehandler') 133 node = root_list[x]
134 return namespace 134 return node, roots, root_list
135 135
136 def FutureCheck(self, node, next): 136 def FutureCheck(self, node, next):
137 future = node.getiterator('nodehandler') 137 future = node.getiterator('nodehandler')
138 for advance in future: 138 for advance in future:
139 if next == advance.get('name'): return True 139 if next == advance.get('name'): return True
141 141
142 def NameSpaceI(self, s, node): 142 def NameSpaceI(self, s, node):
143 reg = re.compile("(!=(.*?)=!)") 143 reg = re.compile("(!=(.*?)=!)")
144 matches = reg.findall(s) 144 matches = reg.findall(s)
145 newstr = False 145 newstr = False
146 nodeable = ['rpg_grid_handler', 'container_handler',
147 'group_handler', 'tabber_handler',
148 'splitter_handler', 'form_handler', 'textctrl_handler']
146 for i in xrange(0,len(matches)): 149 for i in xrange(0,len(matches)):
147 tree_map = node.get('map').split('::') 150 tree_map = node.get('map').split('::')
148 roots = []; root_list = [] 151 roots = []; root_list = []
149 find = matches[i][1].split('::') 152 find = matches[i][1].split('::')
150 node = self.get_node([tree_map[0]]) 153 node = self.get_node([tree_map[0]])
151 for x in xrange(0, len(tree_map)): 154 for x in xrange(0, len(tree_map)):
152 namespace = self.LocationCheck(x, roots, root_list, tree_map) 155 (node, roots, root_list) = self.LocationCheck(x, roots, root_list, tree_map)
153 for x in xrange(0, len(find)): 156 for x in xrange(0, len(find)):
154 namespace = node.getiterator('nodehandler') 157 namespace = node.getiterator('nodehandler')
155 for node in namespace: 158 for node in namespace:
156 if find[x] == node.get('name'): 159 if find[x] == node.get('name'):
160 if node.get('class') not in nodeable: continue
157 if node.get('class') == 'rpg_grid_handler': 161 if node.get('class') == 'rpg_grid_handler':
158 newstr = self.NameSpaceGrid(find[x+1], node); break 162 newstr = self.NameSpaceGrid(find[x+1], node); break
159 try: 163 try:
160 if self.FutureCheck(node, find[x+1]): break 164 if self.FutureCheck(node, find[x+1]): break
161 else: continue 165 else: continue
169 173
170 def NameSpaceE(self, s): 174 def NameSpaceE(self, s):
171 reg = re.compile("(!&(.*?)&!)") 175 reg = re.compile("(!&(.*?)&!)")
172 matches = reg.findall(s) 176 matches = reg.findall(s)
173 newstr = False 177 newstr = False
178 nodeable = ['rpg_grid_handler', 'container_handler',
179 'group_handler', 'tabber_handler',
180 'splitter_handler', 'form_handler', 'textctrl_handler']
174 for i in xrange(0,len(matches)): 181 for i in xrange(0,len(matches)):
175 find = matches[i][1].split('::') 182 find = matches[i][1].split('::')
176 node = component.get('tree').xml_root 183 node = component.get('tree').xml_root
177 if not iselement(node): 184 if not iselement(node):
178 s = s.replace(matches[i][0], 'Invalid Reference!', 1); 185 s = s.replace(matches[i][0], 'Invalid Reference!', 1);
180 return s 187 return s
181 for x in xrange(0, len(find)): 188 for x in xrange(0, len(find)):
182 namespace = node.getiterator('nodehandler') 189 namespace = node.getiterator('nodehandler')
183 for node in namespace: 190 for node in namespace:
184 if find[x] == node.get('name'): 191 if find[x] == node.get('name'):
192 if node.get('class') not in nodeable: continue
185 if node.get('class') == 'rpg_grid_handler': 193 if node.get('class') == 'rpg_grid_handler':
186 newstr = self.NameSpaceGrid(find[x+1], node); break 194 newstr = self.NameSpaceGrid(find[x+1], node); break
187 try: 195 try:
188 if self.FutureCheck(node, find[x+1]): break 196 if self.FutureCheck(node, find[x+1]): break
189 else: continue 197 else: continue
262 return return_node 270 return return_node
263 271
264 def resolve_get_loop(self, node, path, step, depth): 272 def resolve_get_loop(self, node, path, step, depth):
265 if step == depth: return node 273 if step == depth: return node
266 else: 274 else:
267 child_list = node.getiterator('nodehandler') 275 child_list = node.getchildren()
268 for child in child_list: 276 for child in child_list:
269 if step == depth: break 277 if step == depth: break
270 if child.get('name') == path[step]: 278 if child.get('name') == path[step]:
271 node = self.resolve_get_loop(child, path, step+1, depth) 279 node = self.resolve_get_loop(child, path, step+1, depth)
272 return node 280 return node