Mercurial > traipse_dev
comparison orpg/pluginhandler.py @ 227:81d0bfd5e800 alpha
Traipse Alpha 'OpenRPG' {100612-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 (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 03:50:37 -0500 |
parents | c54768cffbd4 |
children |
comparison
equal
deleted
inserted
replaced
182:4b2884f29a72 | 227:81d0bfd5e800 |
---|---|
1 from orpg.orpg_wx import * | 1 from orpg.orpg_wx import * |
2 from orpg.orpgCore import component | 2 from orpg.orpgCore import component |
3 from xml.etree.ElementTree import ElementTree, Element, parse | |
4 from xml.etree.ElementTree import fromstring, tostring | |
3 | 5 |
4 class PluginHandler: | 6 class PluginHandler: |
5 # Initialization subroutine. | 7 # Initialization subroutine. |
6 # | 8 # |
7 # !self : instance of self | 9 # !self : instance of self |
80 def plugin_add_setting(self, setting, value, options, help): | 82 def plugin_add_setting(self, setting, value, options, help): |
81 self.settings.add_tab('Plugins', self.name, 'grid') | 83 self.settings.add_tab('Plugins', self.name, 'grid') |
82 self.settings.add_setting(self.name, setting, value, options, help) | 84 self.settings.add_setting(self.name, setting, value, options, help) |
83 | 85 |
84 def plugin_send_msg(self, to, plugin_msg): | 86 def plugin_send_msg(self, to, plugin_msg): |
85 xml_dom = self.xml.parseXml(plugin_msg) | 87 xml_dom = fromstring(plugin_msg) |
86 xml_dom = xml_dom._get_documentElement() | 88 #xml_dom = xml_dom.getroot() |
87 xml_dom.setAttribute('from', str(self.session.id)) | 89 xml_dom.set('from', str(self.session.id)) |
88 xml_dom.setAttribute('to', str(to)) | 90 xml_dom.set('to', str(to)) |
89 xml_dom.setAttribute('group_id', str(self.session.group_id)) | 91 xml_dom.set('group_id', str(self.session.group_id)) |
90 tag_name = xml_dom._get_tagName() | 92 tag_name = xml_dom.tag |
91 if not tag_name in self.session.core_msg_handlers: | 93 if not tag_name in self.session.core_msg_handlers: |
92 xml_msg = '<plugin to="' + str(to) | 94 xml_msg = '<plugin to="' + str(to) |
93 xml_msg += '" from="' + str(self.session.id) | 95 xml_msg += '" from="' + str(self.session.id) |
94 xml_msg += '" group_id="' + str(self.session.group_id) | 96 xml_msg += '" group_id="' + str(self.session.group_id) |
95 xml_msg += '" />' + xml_dom.toxml() | 97 xml_msg += '" />' + tostring(xml_dom) |
96 self.session.outbox.put(xml_msg) | 98 self.session.outbox.put(xml_msg) |
97 else: | 99 else: |
98 #Spoofing attempt | 100 #Spoofing attempt |
99 pass | 101 pass |
100 xml_dom.unlink() | 102 #xml_dom.unlink() |
101 | 103 |
102 def message(self, text): | 104 def message(self, text): |
103 return text | 105 return text |
104 | 106 |
105 def pre_parse(self, text): | 107 def pre_parse(self, text): |