comparison orpg/tools/InterParse.py @ 238:b44dad398833 beta

Traipse Beta 'OpenRPG' {100619-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 (Closing/Closed) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order New to Server GUI, can now clear log Updates: Update to Warhammer PC Sheet. Rollers set as macros. Should work with little maintanence. Update to Browser Server window. Display rooms with ' " & cleaner Update to Server. Handles ' " & cleaner. Fixes: Fix to InterParse that was causing an Infernal Loop with Namespace Internal Fix to XML data, removed old Minidom and switched to Element Tree Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread Fix to metaservers.xml file not being created Fix to Single and Double quotes in Whiteboard text Fix to Background images not showing when using the Image Server Fix to Duplicate chat names appearing Fix to Server GUI's logging output Fix to FNB.COLORFUL_TABS bug Fix to Gametree for XSLT Sheets
author sirebral
date Sat, 19 Jun 2010 10:17:24 -0500
parents 9230a33defd9
children 72e0cce81a47
comparison
equal deleted inserted replaced
237:42f4809ad8a8 238:b44dad398833
46 46
47 def ParseLogic(self, s, node): 47 def ParseLogic(self, s, node):
48 'Nodes now parse through ParsLogic. Easily add new parse rules right here!!' 48 'Nodes now parse through ParsLogic. Easily add new parse rules right here!!'
49 s = self.NameSpaceE(s) 49 s = self.NameSpaceE(s)
50 s = self.NameSpaceI(s, node) 50 s = self.NameSpaceI(s, node)
51 s = self.NodeMap(s, node) 51 #s = self.NodeMap(s, node)
52 s = self.NodeParent(s, node) 52 #s = self.NodeParent(s, node)
53 return s 53 return s
54 54
55 def Normalize(self, s, tab): 55 def Normalize(self, s, tab):
56 for plugin_fname in tab.activeplugins.keys(): 56 for plugin_fname in tab.activeplugins.keys():
57 plugin = tab.activeplugins[plugin_fname] 57 plugin = tab.activeplugins[plugin_fname]
156 """If you found this you found my first easter egg. I was tired of people telling me multiple 156 """If you found this you found my first easter egg. I was tired of people telling me multiple
157 references syntax for the game tree is confusing, so I dropped this in there without telling 157 references syntax for the game tree is confusing, so I dropped this in there without telling
158 anyone. Using !" :: "! will allow you to use an internal namespace from within another internal 158 anyone. Using !" :: "! will allow you to use an internal namespace from within another internal
159 namespace -- TaS, Prof. Ebral""" 159 namespace -- TaS, Prof. Ebral"""
160 reg2 = re.compile("(!=(.*?)=!)") 160 reg2 = re.compile("(!=(.*?)=!)")
161 matches = reg1.findall(s) + reg2.findall(s) 161 """Adding the Parent and Child references to Namespace Internal. Namespace 2.0 is powerful enough it
162 should be able to handle them with no problem. For future reference, if you are paying attention, Namespace
163 will include two methods for Internal and External. !@ :: @! and !& :: @! for External and !" :: "! and != :: =!
164 for Internal. See above Easter Egg for reasoning."""
165 reg3 = re.compile("(!!(.*?)!!)")
166 reg4 = re.compile("(!#(.*?)#!)")
167 matches = reg1.findall(s) + reg2.findall(s) + reg3.findall(s) + reg4.findall(s)
162 try: tree_map = node.get('map') 168 try: tree_map = node.get('map')
163 except: return node 169 except: return node
164 for i in xrange(0,len(matches)): 170 for i in xrange(0,len(matches)):
165 ## Build the new tree_map 171 ## Build the new tree_map
166 new_map = tree_map.split('::') 172 new_map = tree_map.split('::')
167 find = matches[i][1].split('::') 173 find = matches[i][1].split('::')
168 ## Backwards Reference the Parent Children 174 ## Backwards Reference the Parent Children
169 node = self.get_node(new_map) 175 node = self.get_node(new_map)
170 newstr = self.LocationCheck(node, tree_map, new_map, find) 176 newstr = self.LocationCheck(node, tree_map, new_map, find)
171 s = s.replace(matches[i][0], newstr, 1) 177 s = s.replace(matches[i][0], newstr, 1)
172 s = self.NodeMap(s, node) 178 s = s.replace(u'\xa0', ' ')
173 s = self.NodeParent(s, node) 179 #s = self.NodeMap(s, node)
180 #s = self.NodeParent(s, node)
174 return s 181 return s
175 182
176 def NameSpaceE(self, s): 183 def NameSpaceE(self, s):
177 reg = re.compile("(!&(.*?)&!)") 184 reg = re.compile("(!&(.*?)&!)")
178 matches = reg.findall(s) 185 matches = reg.findall(s)
204 else: newstr = 'Invalid Reference!' 211 else: newstr = 'Invalid Reference!'
205 break 212 break
206 else: break 213 else: break
207 if not newstr: newstr = 'Invalid Reference!' 214 if not newstr: newstr = 'Invalid Reference!'
208 s = s.replace(matches[i][0], newstr, 1) 215 s = s.replace(matches[i][0], newstr, 1)
216 s = s.replace(u'\xa0', ' ') #Required for XSLT sheets
209 s = self.ParseLogic(s, node) 217 s = self.ParseLogic(s, node)
210 return s 218 return s
211 219
212 def NameSpaceGrid(self, s, node): 220 def NameSpaceGrid(self, s, node):
213 cell = tuple(s.strip('(').strip(')').split(',')) 221 cell = tuple(s.strip('(').strip(')').split(','))
224 cur_loc = 0 232 cur_loc = 0
225 reg = re.compile("(!!(.*?)!!)") 233 reg = re.compile("(!!(.*?)!!)")
226 matches = reg.findall(s) 234 matches = reg.findall(s)
227 for i in xrange(0,len(matches)): 235 for i in xrange(0,len(matches)):
228 tree_map = node.get('map') 236 tree_map = node.get('map')
229 tree_map = tree_map + '::' + matches[i][1] 237 tree_map = str(tree_map + '::' + matches[i][1])
230 newstr = '!@'+ tree_map +'@!' 238 if tree_map[:2] == '::': tree_map = tree_map[2:]
239 newstr = '!@'+ str(tree_map) +'@!'
231 s = s.replace(matches[i][0], newstr, 1) 240 s = s.replace(matches[i][0], newstr, 1)
232 s = self.Node(s) 241 s = self.Node(s)
233 s = self.NodeParent(s, tree_map) 242 s = self.NodeParent(s, node)
234 return s 243 return s
235 244
236 def NodeParent(self, s, node): 245 def NodeParent(self, s, node):
237 """Parses player input for embedded nodes rolls""" 246 """Parses player input for embedded nodes rolls"""
238 if node == 'Invalid Reference!': return node 247 if node == 'Invalid Reference!': return node