diff orpg/chat/chatwnd.py @ 133:37d26a98883f alpha

Traipse Alpha 'OpenRPG' {091010-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 (Cleaning up for Beta) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log (See documentation for usage) Mercurial's hgweb folder is ported to upmana **Pretty important update that can help remove thousands of dead children from your gametree. **Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and look for dead children!! **New Gamtree Recusion method, mapping, and context sensitivity. !!Alpha - Watch out for infinite loops!! Dead Node Children, now that's a O O -v-v- Happy Halloween!
author sirebral
date Tue, 10 Nov 2009 12:11:13 -0600
parents fe4dc5817d5e
children b4e02e8cd314
line wrap: on
line diff
--- a/orpg/chat/chatwnd.py	Thu Nov 05 12:15:19 2009 -0600
+++ b/orpg/chat/chatwnd.py	Tue Nov 10 12:11:13 2009 -0600
@@ -42,39 +42,30 @@
 
 ##
 ## Module Loading
-##
+##
+import os, time, re, sys, traceback, webbrowser, commands, chat_msg, chat_util
+
+from orpg.orpg_version import VERSION
 from orpg.orpg_windows import *
 from orpg.player_list import WG_LIST
 from orpg.dirpath import dir_struct
+#from orpg.tools.metamenus import MenuEx #Needed?
+from string import *
+
+import cStringIO # for reading inline imagedata as a stream
+from HTMLParser import HTMLParser
+from wx.lib.expando import EVT_ETC_LAYOUT_NEEDED 
+
 import orpg.tools.rgbhex
 import orpg.tools.inputValidator
-#from orpg.tools.metamenus import MenuEx #Needed?
-
-import webbrowser
-from string import *
-from orpg.orpg_version import VERSION
-import commands
-import chat_msg
-import time
+from orpg.tools.validate import validate
+from orpg.tools.orpg_settings import settings
 import orpg.tools.predTextCtrl
+from orpg.tools.orpg_log import logger, debug
+from orpg.orpgCore import component
+from xml.etree.ElementTree import tostring
+
 from orpg.networking.mplay_client import MPLAY_CONNECTED  # needed to only send typing/not_typing messages while connected
-import os
-import time
-import re
-import sys
-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, debug
-from orpg.tools.decorators import debugging
-
-from xml.etree.ElementTree import tostring
 
 NEWCHAT = False
 try:
@@ -894,8 +885,8 @@
             self.build_dice()
             self.build_scroll()
             self.build_text()
-            self.toolbar_sizer.Add( self.textpop_lock, 0, wx.EXPAND )
-            self.toolbar_sizer.Add(self.scroll_lock,0,wx.EXPAND)
+            self.toolbar_sizer.Add(self.textpop_lock, 0, wx.EXPAND)
+            self.toolbar_sizer.Add(self.scroll_lock, 0, wx.EXPAND)
             self.build_formating()
             self.build_colorbutton()
 
@@ -904,7 +895,8 @@
         self.scroll_lock = wx.Button( self, wx.ID_ANY, "Scroll ON",size= wx.Size(80,25))
 
     
-    def build_alias(self):
+    def build_alias(self):
+        self.aliasSizer = wx.BoxSizer(wx.HORIZONTAL) ## Future ## Add these to a sizer, then turn the toolbar_sizer into a grid so these can adjust to the frame.
         self.aliasList = wx.Choice(self, wx.ID_ANY, size=(100, 25), choices=[self.defaultAliasName])
         self.aliasButton = createMaskedButton( self, dir_struct["icon"] + 'player.gif', 
                                             'Refresh list of aliases from Game Tree', wx.ID_ANY, '#bdbdbd' )
@@ -912,29 +904,23 @@
         self.filterList = wx.Choice(self, wx.ID_ANY, size=(100, 25), choices=[self.defaultFilterName])
         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 )
-        self.toolbar_sizer.Add( self.aliasList,0,wx.EXPAND)
-        self.toolbar_sizer.Add( self.filterButton, 0, wx.EXPAND )
-        self.toolbar_sizer.Add( self.filterList,0,wx.EXPAND)
+        self.filterList.SetSelection(0)
+
+        self.aliasSizer.Add( self.aliasButton, 0, wx.EXPAND )
+        self.aliasSizer.Add( self.aliasList,0,wx.EXPAND)
+        self.aliasSizer.Add( self.filterButton, 0, wx.EXPAND )
+        self.aliasSizer.Add( self.filterList,0,wx.EXPAND)
+
+        self.toolbar_sizer.Add(self.aliasSizer, 0, wx.EXPAND)
+
         if self.settings.get_setting('AliasTool_On') == '0': self.toggle_alias('0')
         else: self.toggle_alias('1')
 
     
-    def toggle_alias(self, act):
-        if act == '0':
-            self.toolbar_sizer.Show(self.aliasList, False)
-            self.toolbar_sizer.Show(self.filterList, False)
-            self.toolbar_sizer.Show(self.aliasButton, False)
-            self.toolbar_sizer.Show(self.filterButton, False)
-            self.toolbar_sizer.Layout()
-        else:
-            self.toolbar_sizer.Show(self.aliasList, True)
-            self.toolbar_sizer.Show(self.filterList, True)
-            self.toolbar_sizer.Show(self.aliasButton, True)
-            self.toolbar_sizer.Show(self.filterButton, True)
-            self.toolbar_sizer.Layout()
-
+    def toggle_alias(self, act):
+        if act == '0': self.toolbar_sizer.Show(self.aliasSizer, False)
+        else: self.toolbar_sizer.Show(self.aliasSizer, True)
+        self.toolbar_sizer.Layout()
     
     def build_text(self):
         self.textpop_lock = createMaskedButton(self, dir_struct["icon"]+'note.gif', 'Open Text View Of Chat Session', wx.ID_ANY, '#bdbdbd')
@@ -1184,7 +1170,7 @@
                     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):
+        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
@@ -1777,7 +1763,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()
@@ -1841,7 +1827,6 @@
         """Parses player input for embedded nodes rolls"""
         cur_loc = 0
         #[a-zA-Z0-9 _\-\.]
-        debug(s)
         reg = re.compile("(!@(.*?)@!)")
         matches = reg.findall(s)
         for i in xrange(0,len(matches)):
@@ -1934,22 +1919,18 @@
         return rs
 
     def resolve_loop(self, node, path, step, depth):
-        debug((node.get('name'), step, depth))
         if step == depth:
             self.resolution(node)
         else:
             child_list = node.findall('nodehandler')
-            debug(child_list)
             for child in child_list:
                 if step == depth: break
                 if child.get('name') == path[step]:
-                    debug(('Step', child.get('name'), step, path, path[step]))
                     node = child
                     step += 1
                     self.resolve_loop(node, path, step, depth)
 
     def resolution(self, node):
-        debug((node))
         if self.passed == False:
             self.passed = True
             if node.get('class') == 'textctrl_handler': self.data = str(node.find('text').text)
@@ -1980,7 +1961,6 @@
         self.gametree = component.get('tree')
         dom = self.gametree.xml_root.getchildren()
         for node in dom:
-            debug((node.get('name'), path[0]))
             if node.get('name') == path[0]:
                 self.resolve_loop(node, path, 1, len(path))
         return self.data