comparison plugins/xxstdnamespace.py @ 228:24769389a7ba alpha

Traipse Alpha 'OpenRPG' {100612-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 (Preparing to close updates) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order 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
author sirebral
date Sat, 12 Jun 2010 04:38:29 -0500
parents d5ff505a2a16
children
comparison
equal deleted inserted replaced
225:2c6db2043764 228:24769389a7ba
19 self.help += 'the Standard Namespace syntax of !@ :: @!\n\n' 19 self.help += 'the Standard Namespace syntax of !@ :: @!\n\n'
20 self.help += 'This plugin modifies the External method, so context sensivity\n' 20 self.help += 'This plugin modifies the External method, so context sensivity\n'
21 self.help += 'is not calculated when using the Standard syntax. References must ' 21 self.help += 'is not calculated when using the Standard syntax. References must '
22 self.help += 'have a unique name.' 22 self.help += 'have a unique name.'
23 23
24 self.parseMethods = {'Traipse': Parse.NameSpaceE, 'Standard': self.NameSpaceS} 24 self.NameSpaceE = Parse.NameSpaceE
25 self.parseMethods = {'Traipse': self.NameSpaceE, 'Standard': self.NameSpaceS}
25 26
26 def NameSpaceS(self, s): ## Re define NameSpace External 27 def NameSpaceS(self, s): ## Re define NameSpace External
27 reg1 = re.compile("(!@(.*?)@!)") ## Inlcude 'Standard' method 28 reg1 = re.compile("(!@(.*?)@!)") ## Include 'Standard' method
28 reg2 = re.compile("(!&(.*?)&!)") 29 reg2 = re.compile("(!&(.*?)&!)")
30 ## Before anyone rags on me about how this is a useless plugin, or that two methods are confusing,
31 ## consider that this will be fully integrated later. Then consider that you can now create a reference
32 ## with a reference. !@ :: !& :: &! :: @!
29 matches = reg1.findall(s) + reg2.findall(s) 33 matches = reg1.findall(s) + reg2.findall(s)
30 newstr = False 34 newstr = False
31 nodeable = ['rpg_grid_handler', 'container_handler', 35 nodeable = ['rpg_grid_handler', 'container_handler',
32 'group_handler', 'tabber_handler', 36 'group_handler', 'tabber_handler',
33 'splitter_handler', 'form_handler', 'textctrl_handler'] 37 'splitter_handler', 'form_handler', 'textctrl_handler']
34 for i in xrange(0,len(matches)): 38 for i in xrange(0,len(matches)):
35 find = matches[i][1].split('::') 39 find = matches[i][1].split('::')
36 node = component.get('tree').xml_root 40 node = component.get('tree').xml_root
37 if not iselement(node): 41 if not iselement(node):
38 s = s.replace(matches[i][0], 'Invalid Reference!', 1); 42 s = s.replace(matches[i][0], 'Invalid Reference!', 1);
39 s = Parse.NameSpaceE(s) 43 s = self.NameSpaceS(s)
40 return s 44 return s
41 for x in xrange(0, len(find)): 45 for x in xrange(0, len(find)):
42 namespace = node.getiterator('nodehandler') 46 namespace = node.getiterator('nodehandler')
43 for node in namespace: 47 for node in namespace:
44 if find[x] == node.get('name'): 48 if find[x] == node.get('name'):
45 if node.get('class') not in nodeable: continue 49 if node.get('class') not in nodeable: continue
46 if node.get('class') == 'rpg_grid_handler': 50 if node.get('class') == 'rpg_grid_handler':
47 try: newstr = self.NameSpaceGrid(find[x+1], node); break 51 try: newstr = Parse.NameSpaceGrid(find[x+1], node); break
48 except: newstr = 'Invalid Grid Reference!' 52 except: newstr = 'Invalid Grid Reference!'
49 try: 53 try:
50 if Parse.FutureCheck(node, find[x+1]): break 54 if Parse.FutureCheck(node, find[x+1]): break
51 else: continue 55 else: continue
52 except: 56 except:
67 self.topframe.Bind(wx.EVT_MENU, self.plugin_toggle, self.toggle) 71 self.topframe.Bind(wx.EVT_MENU, self.plugin_toggle, self.toggle)
68 self.toggle.Check(True) 72 self.toggle.Check(True)
69 73
70 def plugin_toggle(self, evt): 74 def plugin_toggle(self, evt):
71 if self.toggle.IsChecked() == True: 75 if self.toggle.IsChecked() == True:
72 Parse.NameSpaceI = self.parseMethods['Standard'] 76 Parse.NameSpaceE = self.parseMethods['Standard']
73 self.plugindb.SetString('xxstdnamespace', 'Standard', 'True') 77 self.plugindb.SetString('xxstdnamespace', 'Standard', 'True')
74 if self.toggle.IsChecked() == False: 78 if self.toggle.IsChecked() == False:
75 Parse.NameSpaceI = self.parseMethods['Traipse'] 79 Parse.NameSpaceE = self.parseMethods['Traipse']
76 self.plugindb.SetString('xxstdnamespace', 'Standard', 'False') 80 self.plugindb.SetString('xxstdnamespace', 'Standard', 'False')
77 pass 81 pass
78 82
79 def plugin_enabled(self): 83 def plugin_enabled(self):
80 self.onoroff = self.plugindb.GetString('xxstdnamespace', 'Standard', '') or 'False' 84 self.onoroff = self.plugindb.GetString('xxstdnamespace', 'Standard', '') or 'False'