diff orpg/gametree/nodehandlers/chatmacro.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 0bc44a57ae6c
children
line wrap: on
line diff
--- a/orpg/gametree/nodehandlers/chatmacro.py	Mon May 03 03:28:29 2010 -0500
+++ b/orpg/gametree/nodehandlers/chatmacro.py	Sat Jun 12 04:38:29 2010 -0500
@@ -42,15 +42,12 @@
     def __init__(self,xml,tree_node):
         node_handler.__init__(self,xml,tree_node)
         self.xml = xml
-        self.text_elem = self.xml.find('text')
-        self.text = self.text_elem.text
 
-    def set_text(self,txt):
-        self.text = txt
+    def set_text(self, txt):
+        self.xml.find('text').text = txt
 
     def on_use(self,evt):
-        txt = self.text
-        actionlist = txt.split("\n")
+        actionlist = self.xml.find('text').text.split("\n")
         for line in actionlist:
             if(line != ""):
                 if line[0] != "/": ## it's not a slash command
@@ -65,8 +62,7 @@
 
     def tohtml(self):
         title = self.xml.get("name")
-        txt = self.text
-        txt = string.replace(txt,'\n',"<br />")
+        txt = string.replace(self.xml.find('text').text,'\n',"<br />")
         return "<P><b>"+title+":</b><br />"+txt
 
 P_TITLE = wx.NewId()
@@ -80,7 +76,7 @@
         sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Chat Macro"), wx.VERTICAL)
         self.text = {}
         self.text[P_TITLE] = wx.TextCtrl(self, P_TITLE, handler.xml.get('name'))
-        self.text[P_BODY] = wx.TextCtrl(self, P_BODY, handler.text, style=wx.TE_MULTILINE)
+        self.text[P_BODY] = wx.TextCtrl(self, P_BODY, handler.xml.find('text').text, style=wx.TE_MULTILINE)
         sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND)
         sizer.Add(self.text[P_TITLE], 0, wx.EXPAND)
         sizer.Add(wx.StaticText(self, -1, "Text Body:"), 0, wx.EXPAND)