diff orpg/chat/chatwnd.py @ 118:217fb049bd00 alpha

Traipse Alpha 'OpenRPG' {091028-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: Adds Bookmarks (Alpha) with cool Smiley Star and Plus Symbol images! Changes made to the map for increased portability. SnowDog has changes planned in Core, though. Added an initial push to the BCG. Not much to see, just shows off how it is re-writing Main code. Fix to remote admin commands Minor fix to texted based server, works in /System/ folder Some Core changes to gametree to correctly disply Pretty Print, thanks David! Fix to Splitter Nodes not being created. Added images to Plugin Control panel for Autostart feature Fix to massive amounts of images loading; from Core fix to gsclient so with_statement imports Added 'boot' command to remote admin Prep work in Pass tool for remote admin rankings and different passwords, ei, Server, Admin, Moderator, etc. Remote Admin Commands more organized, more prep work. Added Confirmation window for sent nodes. Minor changes to allow for portability to an OpenSUSE linux OS (hopefully without breaking) {091028} 00: Made changes to gametree to start working with Element Tree, mostly from Core Minor changes to Map to start working with Element Tree, from Core Preliminary changes to map efficiency, from FlexiRPG Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Changes to main.py to start working with Element Tree
author sirebral
date Wed, 28 Oct 2009 14:24:54 -0500
parents bb22f0f1a7ec
children 43ad912b7c17
line wrap: on
line diff
--- a/orpg/chat/chatwnd.py	Mon Oct 12 23:24:10 2009 -0500
+++ b/orpg/chat/chatwnd.py	Wed Oct 28 14:24:54 2009 -0500
@@ -65,14 +65,14 @@
 import cStringIO # for reading inline imagedata as a stream
 from HTMLParser import HTMLParser
 import chat_util
-import traceback
-from wx.lib.expando import EVT_ETC_LAYOUT_NEEDED 
-
-from orpg.tools.validate import validate
-from orpg.tools.orpg_settings import settings
-from orpg.orpgCore import component
-from orpg.tools.orpg_log import logger
-from orpg.tools.decorators import debugging
+import traceback
+from wx.lib.expando import EVT_ETC_LAYOUT_NEEDED 
+
+from orpg.tools.validate import validate
+from orpg.tools.orpg_settings import settings
+from orpg.orpgCore import component
+from orpg.tools.orpg_log import logger
+from orpg.tools.decorators import debugging
 
 NEWCHAT = False
 try:
@@ -84,29 +84,29 @@
 # Global parser for stripping HTML tags:
 # The 'tag stripping' is implicit, because this parser echoes every
 # type of html data *except* the tags.
-class HTMLStripper(HTMLParser):
+class HTMLStripper(HTMLParser):
     @debugging
     def __init__(self):
         self.accum = ""
-        self.special_tags = ['hr', 'br', 'img']
+        self.special_tags = ['hr', 'br', 'img']
     @debugging
     def handle_data(self, data):  # quote cdata literally
-        self.accum += data
+        self.accum += data
     @debugging
     def handle_entityref(self, name): # entities must be preserved exactly
-        self.accum += "&" + name + ";"
+        self.accum += "&" + name + ";"
     @debugging
     def handle_starttag(self, tag, attrs):
         if tag in self.special_tags:
             self.accum += '<' + tag
             for attrib in attrs: self.accum += ' ' + attrib[0] + '="' + attrib[1] + '"'
-            self.accum += '>'
+            self.accum += '>'
     @debugging
     def handle_charref(self, name):  # charrefs too
         self.accum += "&#" + name + ";"
 htmlstripper = HTMLStripper()
 
-# utility function;  see Post().
+# utility function;  see Post().
 @debugging
 def strip_html(string):
     "Return string tripped of html tags."
@@ -114,7 +114,7 @@
     htmlstripper.accum = ""
     htmlstripper.feed(string)
     htmlstripper.close()
-    return htmlstripper.accum
+    return htmlstripper.accum
 
 @debugging
 def log( settings, c, text ):
@@ -150,7 +150,7 @@
     # !id :
     @debugging
     def __init__(self, parent, id):
-        wx.html.HtmlWindow.__init__(self, parent, id, 
+        wx.html.HtmlWindow.__init__(self, parent, id, 
                                     style=wx.SUNKEN_BORDER|wx.html.HW_SCROLLBAR_AUTO|wx.NO_FULL_REPAINT_ON_RESIZE)
         self.parent = parent
         self.build_menu()
@@ -176,11 +176,11 @@
         self.menu.AppendItem(item)
 
     @debugging
-    def OnM_EditCopy(self, evt):
-        wx.TheClipboard.UsePrimarySelection(False)
-        wx.TheClipboard.Open()
-        wx.TheClipboard.SetData(wx.TextDataObject(self.SelectionToText()))
-        wx.TheClipboard.Close()
+    def OnM_EditCopy(self, evt):
+        wx.TheClipboard.UsePrimarySelection(False)
+        wx.TheClipboard.Open()
+        wx.TheClipboard.SetData(wx.TextDataObject(self.SelectionToText()))
+        wx.TheClipboard.Close()
 
     @debugging
     def scroll_down(self):
@@ -233,7 +233,7 @@
            Returns current font settings in a (fontname, fontsize) tuple."""
         self.SetFonts(fontname, "", self.CalculateAllFonts(int(fontsize)))
         return (self.GetFont().GetFaceName(), self.GetFont().GetPointSize())
-
+
 # class chat_html_window - end
 if NEWCHAT:
     class ChatHtmlWindow(wx.webview.WebView):
@@ -266,8 +266,8 @@
 
         @debugging
         def SetDefaultFontAndSize(self, fontname, fontsize):
-            self.__font = wx.Font(int(fontsize), 
-                            wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, 
+            self.__font = wx.Font(int(fontsize), 
+                            wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, 
                             wx.FONTWEIGHT_NORMAL, faceName=fontname)
             try: self.SetPageSource(self.Header() + self.StripHeader())
             except Exception, e: print e
@@ -290,10 +290,10 @@
             wx.CallAfter(self.parent.set_chat_text_focus, None)
 
         @debugging
-        def OnM_EditCopy(self, evt):
-            wx.TheClipboard.UsePrimarySelection(False)
-            wx.TheClipboard.Open()
-            wx.TheClipboard.SetData(wx.TextDataObject(self.SelectionToText()))
+        def OnM_EditCopy(self, evt):
+            wx.TheClipboard.UsePrimarySelection(False)
+            wx.TheClipboard.Open()
+            wx.TheClipboard.SetData(wx.TextDataObject(self.SelectionToText()))
             wx.TheClipboard.Close()
 
         #Cutom Methods
@@ -353,10 +353,10 @@
 #   OnPageChanged(self, event)
 #   set_default_font(self, font, fontsize)
 
-class chat_notebook(orpgTabberWnd):
+class chat_notebook(orpgTabberWnd):
     @debugging
     def __init__(self, parent, size):
-        orpgTabberWnd.__init__(self, parent, True, size=size, 
+        orpgTabberWnd.__init__(self, parent, True, size=size, 
                 style=FNB.FNB_DROPDOWN_TABS_LIST|FNB.FNB_NO_NAV_BUTTONS|FNB.FNB_MOUSE_MIDDLE_CLOSES_TABS)
         self.settings = component.get("settings")
         self.whisper_tabs = []
@@ -385,7 +385,7 @@
         if self.settings.get_setting("GMWhisperTab") == '1':
             self.create_gm_tab()
         self.SetSelection(0)
-
+
     @debugging
     def get_tab_index(self, chatpanel):
         "Return the index of a chatpanel in the wxNotebook."
@@ -393,7 +393,7 @@
         for i in xrange(self.GetPageCount()):
             if (self.GetPage(i) == chatpanel):
                 return i
-
+
     @debugging
     def create_gm_tab(self):
         if self.GMChatPanel == None:
@@ -401,7 +401,7 @@
             self.AddPage(self.GMChatPanel, "GM", False)
             self.SetPageImage(self.GetPageCount()-1, 1)
             self.GMChatPanel.chatwnd.SetDefaultFontAndSize(self.font, self.fontsize)
-
+
     @debugging
     def create_whisper_tab(self, playerid):
         "Add a new chatpanel directly connected to integer 'playerid' via whispering."
@@ -414,7 +414,7 @@
         self.AliasLib = component.get('alias')
         wx.CallAfter(self.AliasLib.RefreshAliases)
         return private_tab
-
+
     @debugging
     def create_group_tab(self, group_name):
         "Add a new chatpanel directly connected to integer 'playerid' via whispering."
@@ -426,7 +426,7 @@
         self.AliasLib = component.get('alias')
         wx.CallAfter(self.AliasLib.RefreshAliases)
         return private_tab
-
+
     @debugging
     def create_null_tab(self, tab_name):
         "Add a new chatpanel directly connected to integer 'playerid' via whispering."
@@ -438,7 +438,7 @@
         self.AliasLib = component.get('alias')
         wx.CallAfter(self.AliasLib.RefreshAliases)
         return private_tab
-
+
     @debugging
     def onCloseTab(self, evt):
         try: tabid = evt.GetSelection()
@@ -467,16 +467,16 @@
         if panel in self.whisper_tabs: self.whisper_tabs.remove(panel)
         elif panel in self.group_tabs: self.group_tabs.remove(panel)
         elif panel in self.null_tabs: self.null_tabs.remove(panel)
-
+
     @debugging
     def newMsg(self, tabid):
         if tabid != self.GetSelection(): self.SetPageImage(tabid, 0)
-
+
     @debugging
     def onPageChanging(self, event):
         """When private chattabs are selected, set the bitmap back to 'normal'."""
         event.Skip()
-
+
     @debugging
     def onPageChanged(self, event):
         """When private chattabs are selected, set the bitmap back to 'normal'."""
@@ -485,7 +485,7 @@
         page = self.GetPage(selected_idx)
         #wx.CallAfter(page.set_chat_text_focus, 0)
         event.Skip()
-
+
 """
  This class defines and builds the Chat Frame for OpenRPG
 
@@ -512,11 +512,11 @@
    ParseNodes(self,s)
    get_sha_checksum(self)
    get_color(self)
-
+
 """
 
 class chat_panel(wx.Panel):
-
+
     """
     This is the initialization subroutine
     
@@ -524,13 +524,13 @@
     !parent : parent that defines the chatframe
     !id :
     !openrpg :
-    !sendtarget:  who gets outbound messages: either 'all' or a playerid
-    """
-
+    !sendtarget:  who gets outbound messages: either 'all' or a playerid
+    """
+
     @debugging
     def __init__(self, parent, id, tab_type, sendtarget):
-        wx.Panel.__init__(self, parent, id)
-        logger._set_log_to_console(False)
+        wx.Panel.__init__(self, parent, id)
+        logger._set_log_to_console(False)
         self.session = component.get('session')
         self.settings = component.get('settings')
         self.activeplugins = component.get('plugins')
@@ -562,8 +562,8 @@
         self.advancedFilter = False
         self.lastSend = 0         #  this is used to help implement the player typing indicator
         self.lastPress = 0        #  this is used to help implement the player typing indicator
-        self.Bind(wx.EVT_SIZE, self.OnSize)
-        self.Bind(EVT_ETC_LAYOUT_NEEDED, self.OnSize) #require to keep text at bottom of chat when text entry expands --SD
+        self.Bind(wx.EVT_SIZE, self.OnSize)
+        self.Bind(EVT_ETC_LAYOUT_NEEDED, self.OnSize) #require to keep text at bottom of chat when text entry expands --SD
         self.build_ctrls()
         StartupFont = self.settings.get_setting("defaultfont")
         StartupFontSize = self.settings.get_setting("defaultfontsize")
@@ -572,11 +572,11 @@
             except: pass
         self.font = self.chatwnd.GetFont().GetFaceName()
         self.fontsize = self.chatwnd.GetFont().GetPointSize()
-        self.scroll_down()
-
+        self.scroll_down()
+
     @debugging
     def set_default_font(self, fontname=None, fontsize=None):
-        """Set all chatpanels to new default fontname/fontsize. 
+        """Set all chatpanels to new default fontname/fontsize. 
         Returns current font settings in a (fontname, fontsize) tuple."""
         if (fontname is not None): newfont = fontname
         else: newfont = self.font
@@ -587,10 +587,10 @@
         self.font = newfont
         self.fontsize = newfontsize
         return (self.font, self.fontsize)
-
+
     @debugging
     def build_menu(self):
-        top_frame = component.get('frame')
+        top_frame = component.get('frame')
         menu = wx.Menu()
         item = wx.MenuItem(menu, wx.ID_ANY, "&Background color", "Background color")
         top_frame.Bind(wx.EVT_MENU, self.OnMB_BackgroundColor, item)
@@ -625,7 +625,7 @@
         tabmenu = wx.Menu()
         toolmenu = wx.Menu()
         item = wx.MenuItem(wndmenu, wx.ID_ANY, "Show Images", "Show Images", wx.ITEM_CHECK)
-        top_frame.Bind(wx.EVT_MENU, self.OnMB_ShowImages, item)
+        top_frame.Bind(wx.EVT_MENU, self.OnMB_ShowImages, item)
 
         wndmenu.AppendItem(item)
         if self.settings.get_setting("Show_Images_In_Chat") == '1': item.Check(True)
@@ -676,57 +676,57 @@
         toolmenu.AppendItem(item)
         if self.settings.get_setting("AliasTool_On") == '1': item.Check(True)
         settingmenu.AppendMenu(wx.ID_ANY, 'Chat Tool Bars', toolmenu)
-        menu.AppendMenu(wx.ID_ANY, 'Chat Settings', settingmenu)
+        menu.AppendMenu(wx.ID_ANY, 'Chat Settings', settingmenu)
         top_frame.mainmenu.Insert(2, menu, '&Chat')
 
-    ## Settings Menu Events
+    ## Settings Menu Events
     @debugging
     def OnMB_ShowImages(self, event):
         if event.IsChecked(): self.settings.set_setting("Show_Images_In_Chat", '1')
         else: self.settings.set_setting("Show_Images_In_Chat", '0')
-
+
     @debugging
     def OnMB_StripHTML(self, event):
         if event.IsChecked(): self.settings.set_setting("Sstriphtml", '1')
         else: self.settings.set_setting("striphtml", '0')
-
+
     @debugging
     def OnMB_ChatTimeIndex(self, event):
         if event.IsChecked(): self.settings.set_setting("Chat_Time_Indexing", '1')
         else: self.settings.set_setting("Chat_Time_Indexing", '0')
-
+
     @debugging
     def OnMB_ChatAutoComplete(self, event):
         if event.IsChecked(): self.settings.set_setting("SuppressChatAutoComplete", '0')
         else: self.settings.set_setting("SuppressChatAutoComplete", '1')
-
+
     @debugging
     def OnMB_ShowIDinChat(self, event):
         if event.IsChecked(): self.settings.set_setting("ShowIDInChat", '1')
         else: self.settings.set_setting("ShowIDInChat", '0')
-
+
     @debugging
     def OnMB_LogTimeIndex(self, event):
         if event.IsChecked(): self.settings.set_setting("TimeStampGameLog", '1')
         else: self.settings.set_setting("TimeStampGameLog", '0')
-
+
     @debugging
     def OnMB_TabbedWhispers(self, event):
         if event.IsChecked(): self.settings.set_setting("tabbedwhispers", '1')
         else: self.settings.set_setting("tabbedwhispers", '0')
-
+
     @debugging
     def OnMB_GMTab(self, event):
         if event.IsChecked():
             self.settings.set_setting("GMWhisperTab", '1')
             self.parent.create_gm_tab()
         else: self.settings.set_setting("GMWhisperTab", '0')
-
+
     @debugging
     def OnMB_GroupWhisperTabs(self, event):
         if event.IsChecked(): self.settings.set_setting("GroupWhisperTab", '1')
         else: self.settings.set_setting("GroupWhisperTab", '0')
-
+
     @debugging
     def OnMB_DiceBar(self, event):
         act = '0'
@@ -740,7 +740,7 @@
         for panel in self.parent.whisper_tabs: panel.toggle_dice(act)
         for panel in self.parent.group_tabs: panel.toggle_dice(act)
         for panel in self.parent.null_tabs: panel.toggle_dice(act)
-
+
     @debugging
     def OnMB_FormatButtons(self, event):
         act = '0'
@@ -755,7 +755,7 @@
         for panel in self.parent.whisper_tabs: panel.toggle_formating(act)
         for panel in self.parent.group_tabs: panel.toggle_formating(act)
         for panel in self.parent.null_tabs: panel.toggle_formating(act)
-
+
     @debugging
     def OnMB_AliasTool(self, event):
         act = '0'
@@ -769,7 +769,7 @@
         for panel in self.parent.whisper_tabs: panel.toggle_alias(act)
         for panel in self.parent.group_tabs: panel.toggle_alias(act)
         for panel in self.parent.null_tabs:panel.toggle_alias(act)
-
+
     @debugging
     def OnMB_BackgroundColor(self, event):
         top_frame = component.get('frame')
@@ -791,7 +791,7 @@
                 top_frame.players.SetForegroundColour('black')
                 top_frame.players.Refresh()
             self.chatwnd.scroll_down()
-
+
     @debugging
     def OnMB_TextColor(self, event):
         top_frame = component.get('frame')
@@ -813,7 +813,7 @@
                 top_frame.players.SetForegroundColour('black')
                 top_frame.players.Refresh()
             self.chatwnd.scroll_down()
-
+
     @debugging
     def get_hot_keys(self):
         # dummy menus for hotkeys
@@ -822,7 +822,7 @@
         entries.append((wx.ACCEL_CTRL, ord('H'), self.setChatFocusMenu.GetId()))
         #entries.append((wx.ACCEL_CTRL, wx.WXK_TAB, SWAP_TABS))
         return entries
-
+
     @debugging
     def forward_tabs(self, evt):
         self.parent.AdvanceSelection()
@@ -832,18 +832,18 @@
 
     # This subroutine builds the controls for the chat frame
     #
-    # !self : instance of self
+    # !self : instance of self
     @debugging
     def build_ctrls(self):
         self.chatwnd = chat_html_window(self,-1)
         self.set_colors()
         wx.CallAfter(self.chatwnd.SetPage, self.chatwnd.Header())
         if (self.sendtarget == "all"):
-            wx.CallAfter(self.Post, self.colorize(self.syscolor, 
+            wx.CallAfter(self.Post, self.colorize(self.syscolor, 
                 "<b>Welcome to <a href='http://www.openrpg.com'>OpenRPG</a> version " + self.version + "...  </b>"))
             #self.chat_cmds.on_help()
-        self.chattxt = orpg.tools.predTextCtrl.predTextCtrl(self, -1, "", 
-                        style=wx.TE_PROCESS_ENTER |wx.TE_PROCESS_TAB|wx.TE_LINEWRAP, 
+        self.chattxt = orpg.tools.predTextCtrl.predTextCtrl(self, -1, "", 
+                        style=wx.TE_PROCESS_ENTER |wx.TE_PROCESS_TAB|wx.TE_LINEWRAP, 
                         keyHook = self.myKeyHook, validator=None )
         self.build_bar()
         self.basesizer = wx.BoxSizer(wx.VERTICAL)
@@ -880,7 +880,7 @@
         self.chattxt.Bind(wx.EVT_CHAR, self.chattxt.OnChar)
         self.chattxt.Bind(wx.EVT_TEXT_COPY, self.chatwnd.OnM_EditCopy)
     # def build_ctrls - end
-
+
     @debugging
     def build_bar(self):
         self.toolbar_sizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -896,19 +896,19 @@
             self.toolbar_sizer.Add(self.scroll_lock,0,wx.EXPAND)
             self.build_formating()
             self.build_colorbutton()
-
+
     @debugging
     def build_scroll(self):
         self.scroll_lock = wx.Button( self, wx.ID_ANY, "Scroll ON",size= wx.Size(80,25))
-
+
     @debugging
     def build_alias(self):
         self.aliasList = wx.Choice(self, wx.ID_ANY, size=(100, 25), choices=[self.defaultAliasName])
-        self.aliasButton = createMaskedButton( self, dir_struct["icon"] + 'player.gif', 
+        self.aliasButton = createMaskedButton( self, dir_struct["icon"] + 'player.gif', 
                                             'Refresh list of aliases from Game Tree', wx.ID_ANY, '#bdbdbd' )
         self.aliasList.SetSelection(0)
         self.filterList = wx.Choice(self, wx.ID_ANY, size=(100, 25), choices=[self.defaultFilterName])
-        self.filterButton = createMaskedButton( self, dir_struct["icon"] + 'add_filter.gif', 
+        self.filterButton = createMaskedButton( self, dir_struct["icon"] + 'add_filter.gif', 
                                              'Refresh list of filters from Game Tree', wx.ID_ANY, '#bdbdbd' )
         self.filterList.SetSelection(0)
         self.toolbar_sizer.Add( self.aliasButton, 0, wx.EXPAND )
@@ -917,7 +917,7 @@
         self.toolbar_sizer.Add( self.filterList,0,wx.EXPAND)
         if self.settings.get_setting('AliasTool_On') == '0': self.toggle_alias('0')
         else: self.toggle_alias('1')
-
+
     @debugging
     def toggle_alias(self, act):
         if act == '0':
@@ -932,11 +932,11 @@
             self.toolbar_sizer.Show(self.aliasButton, True)
             self.toolbar_sizer.Show(self.filterButton, True)
             self.toolbar_sizer.Layout()
-
+
     @debugging
     def build_text(self):
         self.textpop_lock = createMaskedButton(self, dir_struct["icon"]+'note.gif', 'Open Text View Of Chat Session', wx.ID_ANY, '#bdbdbd')
-
+
     @debugging
     def build_dice(self):
         self.numDieText = wx.TextCtrl( self, wx.ID_ANY, "1", size= wx.Size(25, 25), validator=orpg.tools.inputValidator.MathOnlyValidator() )
@@ -959,7 +959,7 @@
         self.toolbar_sizer.Add( self.dieModText, 0, wx.ALIGN_CENTER, 5 )
         if self.settings.get_setting('DiceButtons_On') == '0': self.toggle_dice('0')
         else: self.toggle_dice('1')
-
+
     @debugging
     def toggle_dice(self, act):
         if act == '0':
@@ -984,21 +984,21 @@
             self.toolbar_sizer.Show(self.d100Button, True)
             self.toolbar_sizer.Show(self.dieModText, True)
             self.toolbar_sizer.Layout()
-
+
     @debugging
     def build_formating(self):
-        self.boldButton = createMaskedButton( self, dir_struct["icon"]+'bold.gif', 
+        self.boldButton = createMaskedButton( self, dir_struct["icon"]+'bold.gif', 
                                                             'Make the selected text Bold', wx.ID_ANY, '#bdbdbd')
-        self.italicButton = createMaskedButton( self, dir_struct["icon"]+'italic.gif', 
+        self.italicButton = createMaskedButton( self, dir_struct["icon"]+'italic.gif', 
                                                             'Italicize the selected text', wx.ID_ANY, '#bdbdbd' )
-        self.underlineButton = createMaskedButton( self, dir_struct["icon"]+'underlined.gif', 
+        self.underlineButton = createMaskedButton( self, dir_struct["icon"]+'underlined.gif', 
                                                             'Underline the selected text', wx.ID_ANY, '#bdbdbd' )
         self.toolbar_sizer.Add( self.boldButton, 0, wx.EXPAND )
         self.toolbar_sizer.Add( self.italicButton, 0, wx.EXPAND )
         self.toolbar_sizer.Add( self.underlineButton, 0, wx.EXPAND )
         if self.settings.get_setting('FormattingButtons_On') == '0': self.toggle_formating('0')
         else: self.toggle_formating('1')
-
+
     @debugging
     def toggle_formating(self, act):
         if act == '0':
@@ -1012,20 +1012,20 @@
             self.toolbar_sizer.Show(self.underlineButton, True)
             self.toolbar_sizer.Layout()
 
-    # Heroman - Ideally, we would use static labels...
+    # Heroman - Ideally, we would use static labels...
     @debugging
     def build_colorbutton(self):
-        self.color_button = createMaskedButton(self, dir_struct["icon"]+'textcolor.gif', 
-                                                    'Text Color', wx.ID_ANY, '#bdbdbd', 
-                                                    wx.BITMAP_TYPE_GIF)
+        self.color_button = createMaskedButton(self, dir_struct["icon"]+'textcolor.gif', 
+                                                    'Text Color', wx.ID_ANY, '#bdbdbd', 
+                                                    wx.BITMAP_TYPE_GIF)
 
-        self.saveButton = createMaskedButton(self, dir_struct["icon"]+'save.bmp', 
-                                                    'Save the chatbuffer', wx.ID_ANY, 
-                                                    '#c0c0c0', wx.BITMAP_TYPE_BMP )
+        self.saveButton = createMaskedButton(self, dir_struct["icon"]+'save.bmp', 
+                                                    'Save the chatbuffer', wx.ID_ANY, 
+                                                    '#c0c0c0', wx.BITMAP_TYPE_BMP )
         self.color_button.SetBackgroundColour(self.settings.get_setting('mytextcolor'))
         self.toolbar_sizer.Add(self.color_button, 0, wx.EXPAND)
-        self.toolbar_sizer.Add(self.saveButton, 0, wx.EXPAND)
-
+        self.toolbar_sizer.Add(self.saveButton, 0, wx.EXPAND)
+
     @debugging
     def OnMotion(self, evt):
         contain = self.chatwnd.GetInternalRepresentation()
@@ -1051,7 +1051,7 @@
 
     #
     #  self:  duh
-    #  event:  raw KeyEvent from OnChar()
+    #  event:  raw KeyEvent from OnChar()
     @debugging
     def myKeyHook(self, event):
         if self.session.get_status() == MPLAY_CONNECTED:   #  only do if we're connected
@@ -1071,7 +1071,7 @@
     #  This subroutine gets called once a second by the typing Timer
     #  It checks if we need to send a not_typing message
     #
-    #  self:  duh
+    #  self:  duh
     @debugging
     def typingTimerFunc(self, event):
         #following added by mDuo13
@@ -1093,8 +1093,8 @@
     #  This subroutine actually takes care of sending the messages for typing/not_typing events
     #
     #  self:  duh
-    #  typing:  boolean
-
+    #  typing:  boolean
+
     @debugging
     def sendTyping(self, typing):
         if typing:
@@ -1113,7 +1113,7 @@
     # This subroutine sets the colors of the chat based on the settings in the
     # self instance.
     #
-    # !self : instance of self
+    # !self : instance of self
     @debugging
     def set_colors(self):
         # chat window backround color
@@ -1135,19 +1135,19 @@
     # This subroutine will insert text into the chat window
     #
     # !self : instance of self
-    # !txt : text to be inserted into the chat window
+    # !txt : text to be inserted into the chat window
     @debugging
     def set_chat_text(self, txt):
         self.chattxt.SetValue(txt)
         self.chattxt.SetFocus()
         self.chattxt.SetInsertionPointEnd()
     # def set_chat_text - end
-
+
     @debugging
     def get_chat_text(self):
         return self.chattxt.GetValue()
 
-    # This subroutine sets the focus to the chat window
+    # This subroutine sets the focus to the chat window
     @debugging
     def set_chat_text_focus(self, event):
         wx.CallAfter(self.chattxt.SetFocus)
@@ -1160,7 +1160,7 @@
     # !event :
     #
     # Note:  self.chattxt now handles it's own Key events.  It does, however still
-    #        call it's parent's (self) OnChar to handle "default" behavior.
+    #        call it's parent's (self) OnChar to handle "default" behavior.
     @debugging
     def OnChar(self, event):
         s = self.chattxt.GetValue()
@@ -1174,18 +1174,18 @@
             if self.session.get_status() == MPLAY_CONNECTED:          #  only do if we're connected
                 self.sendTyping(0)                                    #  Send a "not_typing" event on enter key press
         macroText=""
-        recycle_bin = {wx.WXK_F1: 'event.GetKeyCode() == wx.WXK_F1', wx.WXK_F2: 'event.GetKeyCode() == wx.WXK_F2', 
-                    wx.WXK_F3: 'event.GetKeyCode() == wx.WXK_F3', wx.WXK_F4: 'event.GetKeyCode() == wx.WXK_F4', 
-                    wx.WXK_F5: 'event.GetKeyCode() == wx.WXK_F5', wx.WXK_F6: 'event.GetKeyCode() == wx.WXK_F6', 
-                    wx.WXK_F7: 'event.GetKeyCode() == wx.WXK_F7', wx.WXK_F8: 'event.GetKeyCode() == wx.WXK_F8', 
-                    wx.WXK_F9: 'event.GetKeyCode() == wx.WXK_F9', wx.WXK_F10: 'event.GetKeyCode() == wx.WXK_F10', 
-                    wx.WXK_F11: 'event.GetKeyCode() == wx.WXK_F11', wx.WXK_F12: 'event.GetKeyCode() == wx.WXK_F12'}
-
-        bin_event = event.GetKeyCode()
-	if recycle_bin.has_key(bin_event):
-	    logger.debug(lambda bin_event: recycle_bin[bin_event])
-	    macroText = self.settings.get_setting(recycle_bin[bin_event][29:])
-	    recycle_bin = {}; del bin_event
+        recycle_bin = {wx.WXK_F1: 'event.GetKeyCode() == wx.WXK_F1', wx.WXK_F2: 'event.GetKeyCode() == wx.WXK_F2', 
+                    wx.WXK_F3: 'event.GetKeyCode() == wx.WXK_F3', wx.WXK_F4: 'event.GetKeyCode() == wx.WXK_F4', 
+                    wx.WXK_F5: 'event.GetKeyCode() == wx.WXK_F5', wx.WXK_F6: 'event.GetKeyCode() == wx.WXK_F6', 
+                    wx.WXK_F7: 'event.GetKeyCode() == wx.WXK_F7', wx.WXK_F8: 'event.GetKeyCode() == wx.WXK_F8', 
+                    wx.WXK_F9: 'event.GetKeyCode() == wx.WXK_F9', wx.WXK_F10: 'event.GetKeyCode() == wx.WXK_F10', 
+                    wx.WXK_F11: 'event.GetKeyCode() == wx.WXK_F11', wx.WXK_F12: 'event.GetKeyCode() == wx.WXK_F12'}
+
+        bin_event = event.GetKeyCode()
+	if recycle_bin.has_key(bin_event):
+	    logger.debug(lambda bin_event: recycle_bin[bin_event])
+	    macroText = self.settings.get_setting(recycle_bin[bin_event][29:])
+	    recycle_bin = {}; del bin_event
 
         # Append to the existing typed text as needed and make sure the status doesn't change back.
         if len(macroText):
@@ -1301,7 +1301,7 @@
         else: event.Skip()
         logger.debug("Exit chat_panel->OnChar(self, event)")
     # def OnChar - end
-
+
     @debugging
     def onDieRoll(self, evt):
         """Roll the dice based on the button pressed and the die modifiers entered, if any."""
@@ -1322,7 +1322,7 @@
     # FileDialog.
     #
     # !self : instance of self
-    # !evt :
+    # !evt :
     @debugging
     def on_chat_save(self, evt):
         f = wx.FileDialog(self,"Save Chat Buffer",".","","HTM* (*.htm*)|*.htm*|HTML (*.html)|*.html|HTM (*.htm)|*.htm",wx.SAVE)
@@ -1333,19 +1333,19 @@
         f.Destroy()
         os.chdir(dir_struct["home"])
     # def on_chat_save - end
-
+
     @debugging
     def ResetPage(self):
         self.set_colors()
         buffertext = self.chatwnd.Header() + "\n"
-        buffertext += chat_util.strip_body_tags(self.chatwnd.StripHeader()).replace("<br>", 
-                                                                            "<br />").replace('</html>', 
-                                                                            '').replace("<br />", 
+        buffertext += chat_util.strip_body_tags(self.chatwnd.StripHeader()).replace("<br>", 
+                                                                            "<br />").replace('</html>', 
+                                                                            '').replace("<br />", 
                                                                             "<br />\n").replace("\n\n", '')
         return buffertext
 
     # This subroutine sets the color of selected text, or base text color if
-    # nothing is selected
+    # nothing is selected
     @debugging
     def on_text_color(self, event):
         hexcolor = self.r_h.do_hex_color_dlg(self)
@@ -1369,7 +1369,7 @@
     #
     # !self : instance of self
     # !color : color for the text to be set
-    # !text : text string to be included in the html.
+    # !text : text string to be included in the html.
     @debugging
     def colorize(self, color, text):
         """Puts font tags of 'color' around 'text' value, and returns the string"""
@@ -1380,7 +1380,7 @@
     # tags included.
     #
     # !self : instance of self
-    # !event :
+    # !event :
     @debugging
     def on_text_format(self, event):
         id = event.GetId()
@@ -1397,7 +1397,7 @@
         self.chattxt.SetInsertionPointEnd()
         self.chattxt.SetFocus()
     # def on_text_format - end
-
+
     @debugging
     def lock_scroll(self, event):
         if self.lockscroll:
@@ -1414,7 +1414,7 @@
     # This subroutine will popup a text window with the chatbuffer contents
     #
     # !self : instance of self
-    # !event :
+    # !event :
     @debugging
     def pop_textpop(self, event):
         """searchable popup text view of chatbuffer"""
@@ -1425,35 +1425,35 @@
     # This subroutine will change the dimension of the window
     #
     # !self : instance of self
-    # !event :
+    # !event :
     @debugging
     def OnSize(self, event=None):
         event.Skip()
         wx.CallAfter(self.scroll_down)
     # def OnSize - end
-
+
     @debugging
     def scroll_down(self):
         self.Freeze()
         self.chatwnd.scroll_down()
         self.Thaw()
 
-    ###### message helpers ######
+    ###### message helpers ######
     @debugging
     def PurgeChat(self):
         self.set_colors()
         self.chatwnd.SetPage(self.chatwnd.Header())
-
+
     @debugging
     def system_message(self, text):
         self.send_chat_message(text,chat_msg.SYSTEM_MESSAGE)
         self.SystemPost(text)
-
+
     @debugging
     def info_message(self, text):
         self.send_chat_message(text,chat_msg.INFO_MESSAGE)
         self.InfoPost(text)
-
+
     @debugging
     def get_gms(self):
         the_gms = []
@@ -1461,7 +1461,7 @@
             if len(self.session.players[playerid])>7:
                 if self.session.players[playerid][7]=="GM" and self.session.group_id != '0': the_gms += [playerid]
         return the_gms
-
+
     @debugging
     def GetName(self):
         self.AliasLib = component.get('alias')
@@ -1472,7 +1472,7 @@
                 logger.debug("Exit chat_panel->GetName(self)")
                 return [self.chat_display_name([self.AliasLib.alias[0], player[1], player[2]]), self.AliasLib.alias[1]]
         return [self.chat_display_name(player), "Default"]
-
+
     @debugging
     def GetFilteredText(self, text):
         advregex = re.compile('\"(.*?)\"', re.I)
@@ -1487,12 +1487,12 @@
                         newmatch = re.sub(rule[0], rule[1], match)
                         text = text.replace(match, newmatch)
         return text
-
+
     @debugging
     def emote_message(self, text):
         text = self.NormalizeParse(text)
         text = self.colorize(self.emotecolor, text)
-
+
         if self.type == MAIN_TAB and self.sendtarget == 'all': self.send_chat_message(text,chat_msg.EMOTE_MESSAGE)
         elif self.type == MAIN_TAB and self.sendtarget == "gm":
             msg_type = chat_msg.WHISPER_EMOTE_MESSAGE
@@ -1506,7 +1506,7 @@
         name = self.GetName()[0]
         text = "** " + name + " " + text + " **"
         self.EmotePost(text)
-
+
     @debugging
     def whisper_to_players(self, text, player_ids):
         tabbed_whispers_p = self.settings.get_setting("tabbedwhispers")
@@ -1533,7 +1533,7 @@
             id = id.strip()
             if self.session.is_valid_id(id): self.send_chat_message(text,chat_msg.WHISPER_MESSAGE,id)
             else: self.InfoPost(id + " Unknown!")
-
+
     @debugging
     def send_chat_message(self, text, type=chat_msg.CHAT_MESSAGE, player_id="all"):
         #########send_msg()#############
@@ -1558,8 +1558,8 @@
         msg.set_alias(playername)
         if send: self.session.send(msg.toxml(),player_id)
         del msg
-
-    #### incoming chat message handler #####
+
+    #### incoming chat message handler #####
     @debugging
     def post_incoming_msg(self, msg, player):
 
@@ -1683,20 +1683,20 @@
         if sound_file != '':
             component.get('sound').play(sound_file)
     #### Posting helpers #####
-
+
     @debugging
     def InfoPost(self, s):
         self.Post(self.colorize(self.infocolor, s), c='info')
-
+
     @debugging
     def SystemPost(self, s):
         self.Post(self.colorize(self.syscolor, s), c='system')
-
+
     @debugging
     def EmotePost(self, s):
         self.Post(self.colorize(self.emotecolor, s), c='emote')
 
-    #### Standard Post method #####
+    #### Standard Post method #####
     @debugging
     def Post(self, s="", send=False, myself=False, c='post'):
         strip_p = self.settings.get_setting("striphtml")
@@ -1707,7 +1707,7 @@
         s = chat_util.strip_script_tags(s)
         s = chat_util.strip_li_tags(s)
         s = chat_util.strip_body_tags(s) #7-27-05 mDuo13
-        s = chat_util.strip_misalignment_tags(s) #7-27-05 mDuo13
+        s = chat_util.strip_misalignment_tags(s) #7-27-05 mDuo13
         aliasInfo = self.GetName()
         display_name = aliasInfo[0]
         if aliasInfo[1] != 'Default':
@@ -1767,7 +1767,7 @@
                     newline = "<div class='"+c+"'> " + self.TimeIndexString() + name + s2 + "</div>"
                     log( self.settings, c, name+s2 )
             else:
-                newline = "<div class='"+c+"'> " + self.TimeIndexString() + name + s + "</div>"
+                newline = "<div class='"+c+"'> " + self.TimeIndexString() + name + s + "</div>"
                 log( self.settings, c, name+s )
         else: send = False
         newline = component.get('xml').strip_unicode(newline)
@@ -1775,7 +1775,7 @@
             self.chatwnd.AppendToPage(newline)
             self.scroll_down()
         else: self.storedata.append(newline)
-        if send:
+        if send:
             if self.type == MAIN_TAB and self.sendtarget == 'all': self.send_chat_message(s)
             elif self.type == MAIN_TAB and self.sendtarget == "gm":
                 the_gms = self.get_gms()
@@ -1793,7 +1793,7 @@
     # TimeIndexString()
     #
     # time indexing for chat display only (don't log time indexing)
-    # added by Snowdog 4/04
+    # added by Snowdog 4/04
     @debugging
     def TimeIndexString(self):
         try:
@@ -1807,15 +1807,15 @@
             logger.general("EXCEPTION: " + str(e))
             return "[ERROR]"
 
-    ####  Post with parsing dice ####
+    ####  Post with parsing dice ####
     @debugging
     def ParsePost(self, s, send=False, myself=False):
         s = self.NormalizeParse(s)
         self.set_colors()
         self.Post(s,send,myself)
-
+
     @debugging
-    def NormalizeParse(self, s):
+    def NormalizeParse(self, s):
         for plugin_fname in self.activeplugins.keys():
             plugin = self.activeplugins[plugin_fname]
             try: s = plugin.pre_parse(s)
@@ -1829,14 +1829,14 @@
             s = self.ParseFilter(s)
             self.parsed = 1
         return s
-
+
     @debugging
-    def ParseFilter(self, s):
+    def ParseFilter(self, s):
         s = self.GetFilteredText(s)
         return s
-
+
     @debugging
-    def ParseNode(self, s):
+    def ParseNode(self, s):
         """Parses player input for embedded nodes rolls"""
         cur_loc = 0
         #[a-zA-Z0-9 _\-\.]
@@ -1846,14 +1846,14 @@
             newstr = self.ParseNode(self.resolve_nodes(matches[i][1]))
             s = s.replace(matches[i][0], newstr, 1)
         return s
-
+
     @debugging
-    def ParseDice(self, s):
+    def ParseDice(self, s):
         """Parses player input for embedded dice rolls"""
         reg = re.compile("\[([^]]*?)\]")
         matches = reg.findall(s)
         for i in xrange(0,len(matches)):
-            newstr = self.PraseUnknowns(matches[i])
+            newstr = self.PraseUnknowns(matches[i])
             qmode = 0
             newstr1 = newstr
             if newstr[0].lower() == 'q':
@@ -1865,9 +1865,9 @@
                 s = s.replace("[" + matches[i] + "]", "<!-- Official Roll [" + newstr1 + "] => " + newstr + "-->" + newstr, 1)
             else: s = s.replace("[" + matches[i] + "]", "[" + newstr1 + "<!-- Official Roll -->] => " + newstr, 1)
         return s
-
+
     @debugging
-    def PraseUnknowns(self, s):
+    def PraseUnknowns(self, s):
 	# Uses a tuple. Usage: ?Label}dY. If no Label is assigned then use ?}DY
         newstr = "0"
         reg = re.compile("(\?\{*)([a-zA-Z ]*)(\}*)")
@@ -1884,22 +1884,22 @@
             if newstr == '': newstr = '0'
             s = s.replace(matches[i][0], newstr, 1).replace(matches[i][1], '', 1).replace(matches[i][2], '', 1)
             dlg.Destroy()
-        return s
+        return s
 
     # This subroutine builds a chat display name.
-    #
+    #
     @debugging
-    def chat_display_name(self, player):
+    def chat_display_name(self, player):
         if self.settings.get_setting("ShowIDInChat") == "0":
             display_name = player[0]
         else:
             display_name = "("+player[2]+") " + player[0]
         return display_name
-
+
     # This subroutine will get a hex color and return it, or return nothing
-    #
+    #
     @debugging
-    def get_color(self):
+    def get_color(self):
         data = wx.ColourData()
         data.SetChooseFull(True)
         dlg = wx.ColourDialog(self, data)
@@ -1913,7 +1913,7 @@
             dlg.Destroy()
             return None
     # def get_color - end
-
+
     @debugging
     def replace_quotes(self, s):
         in_tag = 0
@@ -1929,14 +1929,14 @@
                 if in_tag:
                     rs = rs[:i] + "'" + rs[i+1:]
             i += 1
-        return rs
+        return rs
 
     @debugging
-    def resolve_loop(self, dom, nodeName, doLoop = False):
-        for node in dom:
+    def resolve_loop(self, dom, nodeName, doLoop = False):
+        for node in dom:
             if node._get_tagName() != 'nodehandler':
                 continue
-            if doLoop and node.getAttribute('class') != 'textctrl_handler' and node.hasChildNodes():
+            if doLoop and node.getAttribute('class') != 'textctrl_handler' and node.hasChildNodes():
                 (found, node) = self.resolve_loop(node.getChildren(), nodeName, doLoop)
                 if not found:
                     continue
@@ -1944,10 +1944,10 @@
                     continue
             foundNode = node
             return (True, foundNode)
-        return (False, '')
+        return (False, '')
 
     @debugging
-    def resolve_nodes(self, s):
+    def resolve_nodes(self, s):
         value = ""
         node_path_list = s.split("::")
         gametree = component.get('tree')
@@ -1974,4 +1974,4 @@
             value = node._get_nodeValue()
         else:
             value = s
-        return value
+        return value