# HG changeset patch
# User sirebral
# Date 1250595217 18000
# Node ID c54768cffbd4e3bc98b1d6bf4d6e127a949b88f6
# Parent 4840657c23c50e9da8e9901a6b2bd62e48256217
Traipse Dev 'OpenRPG' {090818-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:
*Unstable*
This is the first wave of Code Refinement updates. Includes new material from Core Beta; new debugger material (partially implemented), beginnings of switch to etree, TerminalWriter, and a little more. open_rpg has been renamed to component; functioning now as component.get(), component.add(), component.delete(). This version has known bugs, specifically with the gametree and nodes. I think the XML files where not removed during testing of Core and switching back.
diff -r 4840657c23c5 -r c54768cffbd4 data/SWd20/SWd20classes.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/SWd20/d20armor.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/SWd20/d20feats.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/SWd20/d20weapons.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/d20/d20armor.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/d20/d20classes.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/d20/d20divine.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/d20/d20feats.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/d20/d20powers.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/d20/d20spells.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/d20/d20weapons.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd35/books.txt
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd35/classes.txt
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd35/dnd35armor.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd35/dnd35character.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd35/dnd35classes.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd35/dnd35feats.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd35/dnd35weapons.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd35/feats.txt
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd3e/dnd3earmor.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd3e/dnd3echaracter.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd3e/dnd3eclasses.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd3e/dnd3edivine.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd3e/dnd3efeats.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd3e/dnd3epowers.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd3e/dnd3espells.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd3e/dnd3eweapons.xml
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd3e/feats.txt
diff -r 4840657c23c5 -r c54768cffbd4 data/dnd3e/skills.txt
diff -r 4840657c23c5 -r c54768cffbd4 orpg/chat/__init__.py
--- a/orpg/chat/__init__.py Mon Aug 17 06:56:31 2009 -0500
+++ b/orpg/chat/__init__.py Tue Aug 18 06:33:37 2009 -0500
@@ -0,0 +1,1 @@
+
diff -r 4840657c23c5 -r c54768cffbd4 orpg/chat/chat_msg.py
--- a/orpg/chat/chat_msg.py Mon Aug 17 06:56:31 2009 -0500
+++ b/orpg/chat/chat_msg.py Tue Aug 18 06:33:37 2009 -0500
@@ -29,7 +29,8 @@
__version__ = "$Id: chat_msg.py,v 1.15 2006/11/04 21:24:19 digitalxero Exp $"
-import orpg.orpg_xml
+#import orpg.orpg_xml
+from orpg.orpgCore import *
from chat_version import CHAT_VERSION
CHAT_MESSAGE = 1
@@ -40,19 +41,21 @@
WHISPER_EMOTE_MESSAGE = 6
class chat_msg:
- def __init__(self,xml_text=""):
+ def __init__(self,xml_text=""):
+ self.xml = component.get('xml')
self.chat_dom = None
- self.takexml(xml_text)
+ self.takexml(xml_text)
def __del__(self):
if self.chat_dom:
self.chat_dom.unlink()
def toxml(self):
- return orpg.orpg_xml.toxml(self.chat_dom)
+ return self.xml.toxml(self.chat_dom)
- def takexml(self,xml_text):
- xml_dom = orpg.orpg_xml.parseXml(xml_text)
+ def takexml(self,xml_text):
+ #self.xml = component.get('xml')
+ xml_dom = self.xml.parseXml(xml_text)
node_list = xml_dom.getElementsByTagName("chat")
if len(node_list) < 1:
print "Warning: no elements found in DOM."
@@ -66,10 +69,10 @@
self.text_node = None
self.chat_dom.unlink()
self.chat_dom = xml_dom
- self.text_node = orpg.orpg_xml.safe_get_text_node(self.chat_dom)
+ self.text_node = self.xml.safe_get_text_node(self.chat_dom)
def set_text(self,text):
- text = orpg.orpg_xml.strip_text(text)
+ text = self.xml.strip_text(text)
self.text_node._set_nodeValue(text)
def set_type(self,type):
diff -r 4840657c23c5 -r c54768cffbd4 orpg/chat/chatwnd.py
--- a/orpg/chat/chatwnd.py Mon Aug 17 06:56:31 2009 -0500
+++ b/orpg/chat/chatwnd.py Tue Aug 18 06:33:37 2009 -0500
@@ -45,11 +45,11 @@
##
from orpg.orpg_windows import *
from orpg.player_list import WG_LIST
-import orpg.dirpath
+from orpg.dirpath import dir_struct
import orpg.tools.rgbhex
import orpg.tools.inputValidator
-from orpg.tools.metamenus import MenuEx
-from orpg.orpgCore import open_rpg
+#from orpg.tools.metamenus import MenuEx #Needed?
+from orpg.orpgCore import component
import webbrowser
from string import *
from orpg.orpg_version import VERSION
@@ -65,7 +65,8 @@
import cStringIO # for reading inline imagedata as a stream
from HTMLParser import HTMLParser
import chat_util
-import traceback
+import traceback
+from orpg.tools.decorators import debugging
NEWCHAT = False
try:
import wx.webview
@@ -111,11 +112,11 @@
header = '[%s] : ' % ( timestamp );
if settings.get_setting('TimeStampGameLog') != '1': header = ''
try:
- f = open( orpg.dirpath.dir_struct["user"] + filename, 'a' )
+ f = open( dir_struct["user"] + filename, 'a' )
f.write( '
%s%s
\n' % ( header, text ) )
f.close()
except:
- print "could not open " + orpg.dirpath.dir_struct["user"] + filename + ", ignoring..."
+ print "could not open " + dir_struct["user"] + filename + ", ignoring..."
pass
# This class displayes the chat information in html?
@@ -306,19 +307,19 @@
# OnPageChanged(self, event)
# set_default_font(self, font, fontsize)
-class chat_notebook(orpgTabberWnd):
+class chat_notebook(orpgTabberWnd):
+ @debugging
def __init__(self, parent, size):
- self.log = open_rpg.get_component("log")
- self.log.log("Enter chat_notebook", ORPG_DEBUG)
- 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 = open_rpg.get_component("settings")
+ 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 = []
self.group_tabs = []
self.null_tabs = []
self.il = wx.ImageList(16, 16)
- bmp = wx.Bitmap(orpg.dirpath.dir_struct["icon"]+'player.gif')
+ bmp = wx.Bitmap(dir_struct["icon"]+'player.gif')
self.il.Add(bmp)
- bmp = wx.Bitmap(orpg.dirpath.dir_struct["icon"]+'clear.gif')
+ bmp = wx.Bitmap(dir_struct["icon"]+'clear.gif')
self.il.Add(bmp)
self.SetImageList(self.il)
# Create "main" chatpanel tab, undeletable, connected to 'public' room.
@@ -333,73 +334,68 @@
self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CHANGING, self.onPageChanging)
self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.onCloseTab)
# html font/fontsize is global to all the notebook tabs.
- self.font, self.fontsize = self.MainChatPanel.chatwnd.SetDefaultFontAndSize(self.settings.get_setting('defaultfont'), self.settings.get_setting('defaultfontsize'))
+ self.font, self.fontsize = self.MainChatPanel.chatwnd.SetDefaultFontAndSize(self.settings.get_setting('defaultfont'),
+ self.settings.get_setting('defaultfontsize'))
self.GMChatPanel = None
if self.settings.get_setting("GMWhisperTab") == '1':
self.create_gm_tab()
self.SetSelection(0)
- self.log.log("Exit chat_notebook", ORPG_DEBUG)
-
+
+ @debugging
def get_tab_index(self, chatpanel):
"Return the index of a chatpanel in the wxNotebook."
- self.log.log("Enter chat_notebook->get_tab_index(self, chatpanel)", ORPG_DEBUG)
for i in xrange(self.GetPageCount()):
if (self.GetPage(i) == chatpanel):
- self.log.log("Exit chat_notebook->get_tab_index(self, chatpanel)", ORPG_DEBUG)
return i
-
+
+ @debugging
def create_gm_tab(self):
- self.log.log("Enter chat_notebook->create_gm_tab(self)", ORPG_DEBUG)
if self.GMChatPanel == None:
self.GMChatPanel = chat_panel(self, -1, MAIN_TAB, 'gm')
self.AddPage(self.GMChatPanel, "GM", False)
self.SetPageImage(self.GetPageCount()-1, 1)
self.GMChatPanel.chatwnd.SetDefaultFontAndSize(self.font, self.fontsize)
- self.log.log("Exit chat_notebook->create_gm_tab(self)", ORPG_DEBUG)
-
+
+ @debugging
def create_whisper_tab(self, playerid):
"Add a new chatpanel directly connected to integer 'playerid' via whispering."
- self.log.log("Enter chat_notebook->create_whisper_tab(self," + str(playerid) +")", ORPG_DEBUG)
private_tab = chat_panel(self, -1, WHISPER_TAB, playerid)
playername = strip_html(self.MainChatPanel.session.get_player_by_player_id(playerid)[0])
self.AddPage(private_tab, playername, False)
private_tab.chatwnd.SetDefaultFontAndSize(self.font, self.fontsize)
self.whisper_tabs.append(private_tab)
self.newMsg(self.GetPageCount()-1)
- self.AliasLib = open_rpg.get_component('alias')
+ self.AliasLib = component.get('alias')
wx.CallAfter(self.AliasLib.RefreshAliases)
- self.log.log("Exit chat_notebook->create_whisper_tab(self, playerid)", ORPG_DEBUG)
return private_tab
-
+
+ @debugging
def create_group_tab(self, group_name):
"Add a new chatpanel directly connected to integer 'playerid' via whispering."
- self.log.log("Enter chat_notebook->create_group_tab(self, group_name)", ORPG_DEBUG)
private_tab = chat_panel(self, -1, GROUP_TAB, group_name)
self.AddPage(private_tab, group_name, False)
private_tab.chatwnd.SetDefaultFontAndSize(self.font, self.fontsize)
self.group_tabs.append(private_tab)
self.newMsg(self.GetPageCount()-1)
- self.AliasLib = open_rpg.get_component('alias')
+ self.AliasLib = component.get('alias')
wx.CallAfter(self.AliasLib.RefreshAliases)
- self.log.log("Exit chat_notebook->create_group_tab(self, group_name)", ORPG_DEBUG)
return private_tab
-
+
+ @debugging
def create_null_tab(self, tab_name):
"Add a new chatpanel directly connected to integer 'playerid' via whispering."
- self.log.log("Enter chat_notebook->create_null_tab(self, tab_name)", ORPG_DEBUG)
private_tab = chat_panel(self, -1, NULL_TAB, tab_name)
self.AddPage(private_tab, tab_name, False)
private_tab.chatwnd.SetDefaultFontAndSize(self.font, self.fontsize)
self.null_tabs.append(private_tab)
self.newMsg(self.GetPageCount()-1)
- self.AliasLib = open_rpg.get_component('alias')
+ self.AliasLib = component.get('alias')
wx.CallAfter(self.AliasLib.RefreshAliases)
- self.log.log("Exit chat_notebook->create_null_tab(self, tab_name)", ORPG_DEBUG)
return private_tab
-
+
+ @debugging
def onCloseTab(self, evt):
- self.log.log("Enter chat_notebook->onCloseTab(self, evt)", ORPG_DEBUG)
try: tabid = evt.GetSelection()
except: tabid = self.GetSelection()
@@ -426,28 +422,24 @@
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)
- self.log.log("Exit chat_notebook->onCloseTab(self, evt)", ORPG_DEBUG)
-
+
+ @debugging
def newMsg(self, tabid):
- self.log.log("Enter chat_notebook->newMsg(self, tabid)", ORPG_DEBUG)
if tabid != self.GetSelection(): self.SetPageImage(tabid, 0)
- self.log.log("Exit chat_notebook->newMsg(self, tabid)", ORPG_DEBUG)
-
+
+ @debugging
def onPageChanging(self, event):
"""When private chattabs are selected, set the bitmap back to 'normal'."""
- self.log.log("Enter chat_notebook->onPageChanging(self, event)", ORPG_DEBUG)
event.Skip()
- self.log.log("Exit chat_notebook->onPageChanging(self, event)", ORPG_DEBUG)
-
+
+ @debugging
def onPageChanged(self, event):
"""When private chattabs are selected, set the bitmap back to 'normal'."""
- self.log.log("Enter chat_notebook->onPageChanged(self, event)", ORPG_DEBUG)
selected_idx = event.GetSelection()
self.SetPageImage(selected_idx, 1)
page = self.GetPage(selected_idx)
#wx.CallAfter(page.set_chat_text_focus, 0)
event.Skip()
- self.log.log("Exit chat_notebook->onPageChanged(self, event)", ORPG_DEBUG)
"""
This class defines and builds the Chat Frame for OpenRPG
@@ -489,21 +481,20 @@
!openrpg :
!sendtarget: who gets outbound messages: either 'all' or a playerid
"""
-
+
+ @debugging
def __init__(self, parent, id, tab_type, sendtarget):
- self.log = open_rpg.get_component("log")
- self.log.log("Enter chat_panel", ORPG_DEBUG)
wx.Panel.__init__(self, parent, id)
- self.session = open_rpg.get_component('session')
- self.settings = open_rpg.get_component('settings')
- self.activeplugins = open_rpg.get_component('plugins')
+ self.session = component.get('session')
+ self.settings = component.get('settings')
+ self.activeplugins = component.get('plugins')
self.parent = parent
# who receives outbound messages, either "all" or "playerid" string
self.sendtarget = sendtarget
self.type = tab_type
- self.sound_player = open_rpg.get_component('sound')
+ self.sound_player = component.get('sound')
# create die roller manager
- self.DiceManager = open_rpg.get_component('DiceManager')
+ self.DiceManager = component.get('DiceManager')
# create rpghex tool
self.r_h = orpg.tools.rgbhex.RGBHex()
self.h = 0
@@ -528,7 +519,7 @@
self.Bind(wx.EVT_SIZE, self.OnSize)
self.build_ctrls()
#openrpg dir
- self.root_dir = orpg.dirpath.dir_struct["home"]
+ self.root_dir = dir_struct["home"]
# html font/fontsize is global to all the notebook tabs.
StartupFont = self.settings.get_setting("defaultfont")
StartupFontSize = self.settings.get_setting("defaultfontsize")
@@ -538,11 +529,10 @@
self.font = self.chatwnd.GetFont().GetFaceName()
self.fontsize = self.chatwnd.GetFont().GetPointSize()
self.scroll_down()
- self.log.log("Exit chat_panel", ORPG_DEBUG)
-
+
+ @debugging
def set_default_font(self, fontname=None, fontsize=None):
"""Set all chatpanels to new default fontname/fontsize. Returns current font settings in a (fontname, fontsize) tuple."""
- self.log.log("Enter chat_panel->set_default_font(self, fontname=None, fontsize=None)", ORPG_DEBUG)
if (fontname is not None): newfont = fontname
else: newfont = self.font
if (fontsize is not None): newfontsize = int(fontsize)
@@ -551,12 +541,11 @@
self.InfoPost("Font is now " + newfont + " point size " + `newfontsize`)
self.font = newfont
self.fontsize = newfontsize
- self.log.log("Exit chat_panel->set_default_font(self, fontname=None, fontsize=None)", ORPG_DEBUG)
return (self.font, self.fontsize)
-
+
+ @debugging
def build_menu(self):
- self.log.log("Enter chat_panel->build_menu(self)", ORPG_DEBUG)
- top_frame = open_rpg.get_component('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)
@@ -591,7 +580,8 @@
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)
item = wx.MenuItem(wndmenu, wx.ID_ANY, "Strip HTML", "Strip HTML", wx.ITEM_CHECK)
@@ -641,70 +631,59 @@
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')
- self.log.log("Exit chat_panel->build_menu(self)", ORPG_DEBUG)
- ## Settings Menu Events
+ ## Settings Menu Events
+ @debugging
def OnMB_ShowImages(self, event):
- self.log.log("Enter chat_panel->OnMB_ShowImages(self, event)", ORPG_DEBUG)
if event.IsChecked(): self.settings.set_setting("Show_Images_In_Chat", '1')
else: self.settings.set_setting("Show_Images_In_Chat", '0')
- self.log.log("Exit chat_panel->OnMB_ShowImages(self, event)", ORPG_DEBUG)
-
+
+ @debugging
def OnMB_StripHTML(self, event):
- self.log.log("Enter chat_panel->OnMB_StripHTML(self, event)", ORPG_DEBUG)
if event.IsChecked(): self.settings.set_setting("Sstriphtml", '1')
else: self.settings.set_setting("striphtml", '0')
- self.log.log("Exit chat_panel->OnMB_StripHTML(self, event)", ORPG_DEBUG)
-
+
+ @debugging
def OnMB_ChatTimeIndex(self, event):
- self.log.log("Enter chat_panel->OnMB_ChatTimeIndex(self, event)", ORPG_DEBUG)
if event.IsChecked(): self.settings.set_setting("Chat_Time_Indexing", '1')
else: self.settings.set_setting("Chat_Time_Indexing", '0')
- self.log.log("Exit chat_panel->OnMB_ChatTimeIndex(self, event)", ORPG_DEBUG)
-
+
+ @debugging
def OnMB_ChatAutoComplete(self, event):
- self.log.log("Enter chat_panel->OnMB_ChatAutoComplete(self, event)", ORPG_DEBUG)
if event.IsChecked(): self.settings.set_setting("SuppressChatAutoComplete", '0')
else: self.settings.set_setting("SuppressChatAutoComplete", '1')
- self.log.log("Exit chat_panel->OnMB_ChatAutoComplete(self, event)", ORPG_DEBUG)
-
+
+ @debugging
def OnMB_ShowIDinChat(self, event):
- self.log.log("Enter chat_panel->OnMB_ShowIDinChat(self, event)", ORPG_DEBUG)
if event.IsChecked(): self.settings.set_setting("ShowIDInChat", '1')
else: self.settings.set_setting("ShowIDInChat", '0')
- self.log.log("Exit chat_panel->OnMB_ShowIDinChat(self, event)", ORPG_DEBUG)
-
+
+ @debugging
def OnMB_LogTimeIndex(self, event):
- self.log.log("Enter chat_panel->OnMB_LogTimeIndex(self, event)", ORPG_DEBUG)
if event.IsChecked(): self.settings.set_setting("TimeStampGameLog", '1')
else: self.settings.set_setting("TimeStampGameLog", '0')
- self.log.log("Exit chat_panel->OnMB_LogTimeIndex(self, event)", ORPG_DEBUG)
-
+
+ @debugging
def OnMB_TabbedWhispers(self, event):
- self.log.log("Enter chat_panel->OnMB_TabbedWhispers(self, event)", ORPG_DEBUG)
if event.IsChecked(): self.settings.set_setting("tabbedwhispers", '1')
else: self.settings.set_setting("tabbedwhispers", '0')
- self.log.log("Exit chat_panel->OnMB_TabbedWhispers(self, event)", ORPG_DEBUG)
-
+
+ @debugging
def OnMB_GMTab(self, event):
- self.log.log("Enter chat_panel->OnMB_GMTab(self, event)", ORPG_DEBUG)
if event.IsChecked():
self.settings.set_setting("GMWhisperTab", '1')
self.parent.create_gm_tab()
else: self.settings.set_setting("GMWhisperTab", '0')
- self.log.log("Exit chat_panel->OnMB_GMTab(self, event)", ORPG_DEBUG)
-
+
+ @debugging
def OnMB_GroupWhisperTabs(self, event):
- self.log.log("Enter chat_panel->OnMB_GroupWhisperTabs(self, event)", ORPG_DEBUG)
if event.IsChecked(): self.settings.set_setting("GroupWhisperTab", '1')
else: self.settings.set_setting("GroupWhisperTab", '0')
- self.log.log("Exit chat_panel->OnMB_GroupWhisperTabs(self, event)", ORPG_DEBUG)
-
-
+
+ @debugging
def OnMB_DiceBar(self, event):
- self.log.log("Enter chat_panel->OnMB_DiceBar(self, event)", ORPG_DEBUG)
act = '0'
if event.IsChecked():
self.settings.set_setting("DiceButtons_On", '1')
@@ -716,10 +695,9 @@
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)
- self.log.log("Exit chat_panel->OnMB_DiceBar(self, event)", ORPG_DEBUG)
-
+
+ @debugging
def OnMB_FormatButtons(self, event):
- self.log.log("Enter chat_panel->OnMB_FormatButtons(self, event)", ORPG_DEBUG)
act = '0'
if event.IsChecked():
self.settings.set_setting("FormattingButtons_On", '1')
@@ -732,10 +710,9 @@
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)
- self.log.log("Exit chat_panel->OnMB_FormatButtons(self, event)", ORPG_DEBUG)
-
+
+ @debugging
def OnMB_AliasTool(self, event):
- self.log.log("Enter chat_panel->OnMB_AliasTool(self, event)", ORPG_DEBUG)
act = '0'
if event.IsChecked():
self.settings.set_setting("AliasTool_On", '1')
@@ -747,11 +724,10 @@
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)
- self.log.log("Exit chat_panel->OnMB_AliasTool(self, event)", ORPG_DEBUG)
-
+
+ @debugging
def OnMB_BackgroundColor(self, event):
- self.log.log("Enter chat_panel->OnMB_BackgroundColor(self, event)", ORPG_DEBUG)
- top_frame = open_rpg.get_component('frame')
+ top_frame = component.get('frame')
hexcolor = self.get_color()
if hexcolor != None:
self.bgcolor = hexcolor
@@ -770,11 +746,10 @@
top_frame.players.SetForegroundColour('black')
top_frame.players.Refresh()
self.chatwnd.scroll_down()
- self.log.log("Exit chat_panel->OnMB_BackgroundColor(self, event)", ORPG_DEBUG)
-
+
+ @debugging
def OnMB_TextColor(self, event):
- self.log.log("Enter chat_panel->OnMB_TextColor(self, event)", ORPG_DEBUG)
- top_frame = open_rpg.get_component('frame')
+ top_frame = component.get('frame')
hexcolor = self.get_color()
if hexcolor != None:
self.textcolor = hexcolor
@@ -793,41 +768,38 @@
top_frame.players.SetForegroundColour('black')
top_frame.players.Refresh()
self.chatwnd.scroll_down()
- self.log.log("Exit chat_panel->OnMB_TextColor(self, event)", ORPG_DEBUG)
-
-
+
+ @debugging
def get_hot_keys(self):
- self.log.log("Enter chat_panel->get_hot_keys(self)", ORPG_DEBUG)
# dummy menus for hotkeys
self.build_menu()
entries = []
entries.append((wx.ACCEL_CTRL, ord('H'), self.setChatFocusMenu.GetId()))
#entries.append((wx.ACCEL_CTRL, wx.WXK_TAB, SWAP_TABS))
- self.log.log("Enter chat_panel->get_hot_keys(self)", ORPG_DEBUG)
return entries
-
+
+ @debugging
def forward_tabs(self, evt):
- self.log.log("Enter chat_panel->swap_tabs(self, evt)", ORPG_DEBUG)
self.parent.AdvanceSelection()
- self.log.log("Exit chat_panel->swap_tabs(self, evt)", ORPG_DEBUG)
def back_tabs(self, evt):
- self.log.log("Enter chat_panel->swap_tabs(self, evt)", ORPG_DEBUG)
self.parent.AdvanceSelection(False)
- self.log.log("Exit chat_panel->swap_tabs(self, evt)", ORPG_DEBUG)
# This subroutine builds the controls for the chat frame
#
- # !self : instance of self
+ # !self : instance of self
+ @debugging
def build_ctrls(self):
- self.log.log("Enter chat_panel->build_ctrls(self)", ORPG_DEBUG)
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, "Welcome to OpenRPG version " + self.version + "... "))
+ wx.CallAfter(self.Post, self.colorize(self.syscolor,
+ "Welcome to OpenRPG version " + self.version + "... "))
#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, keyHook = self.myKeyHook, validator=None )
+ 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)
self.basesizer.Add( self.chatwnd, 1, wx.EXPAND )
@@ -862,15 +834,15 @@
self.chattxt.Bind(wx.EVT_MOUSEWHEEL, self.chatwnd.mouse_wheel)
self.chattxt.Bind(wx.EVT_CHAR, self.chattxt.OnChar)
self.chattxt.Bind(wx.EVT_TEXT_COPY, self.textCopy)
- self.log.log("Exit chat_panel->build_ctrls(self)", ORPG_DEBUG)
# def build_ctrls - end
-
+
+ @debugging
def textCopy(self, event):
if self.chattxt.GetStringSelection() == '': self.chatwnd.OnM_EditCopy(None)
else: self.chatwnd.Copy()
-
+
+ @debugging
def build_bar(self):
- self.log.log("Enter chat_panel->build_bar(self)", ORPG_DEBUG)
self.toolbar_sizer = wx.BoxSizer(wx.HORIZONTAL)
self.scroll_lock = None
self.numDieText = None
@@ -884,20 +856,20 @@
self.toolbar_sizer.Add(self.scroll_lock,0,wx.EXPAND)
self.build_formating()
self.build_colorbutton()
- self.log.log("Exit chat_panel->build_bar(self)", ORPG_DEBUG)
-
+
+ @debugging
def build_scroll(self):
- self.log.log("Enter chat_panel->build_scroll(self)", ORPG_DEBUG)
self.scroll_lock = wx.Button( self, wx.ID_ANY, "Scroll ON",size= wx.Size(80,25))
- self.log.log("Exit chat_panel->build_scroll(self)", ORPG_DEBUG)
-
+
+ @debugging
def build_alias(self):
- self.log.log("Enter chat_panel->build_alias(self)", ORPG_DEBUG)
self.aliasList = wx.Choice(self, wx.ID_ANY, size=(100, 25), choices=[self.defaultAliasName])
- self.aliasButton = createMaskedButton( self, orpg.dirpath.dir_struct["icon"] + 'player.gif', 'Refresh list of aliases from Game Tree', wx.ID_ANY, '#bdbdbd' )
+ 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, orpg.dirpath.dir_struct["icon"] + 'add_filter.gif', 'Refresh list of filters from Game Tree', wx.ID_ANY, '#bdbdbd' )
+ 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)
@@ -905,10 +877,9 @@
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')
- self.log.log("Exit chat_panel->build_alias(self)", ORPG_DEBUG)
-
+
+ @debugging
def toggle_alias(self, act):
- self.log.log("Enter chat_panel->toggle_alias(self, " + str(act) + ")", ORPG_DEBUG)
if act == '0':
self.toolbar_sizer.Show(self.aliasList, False)
self.toolbar_sizer.Show(self.filterList, False)
@@ -921,24 +892,22 @@
self.toolbar_sizer.Show(self.aliasButton, True)
self.toolbar_sizer.Show(self.filterButton, True)
self.toolbar_sizer.Layout()
- self.log.log("Exit chat_panel->toggle_alias(self, act)", ORPG_DEBUG)
-
+
+ @debugging
def build_text(self):
- self.log.log("Enter chat_panel->build_text(self)", ORPG_DEBUG)
- self.textpop_lock = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'note.gif', 'Open Text View Of Chat Session', wx.ID_ANY, '#bdbdbd')
- self.log.log("Exit chat_panel->build_text(self)", ORPG_DEBUG)
-
+ 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.log.log("Enter chat_panel->build_dice(self)", ORPG_DEBUG)
self.numDieText = wx.TextCtrl( self, wx.ID_ANY, "1", size= wx.Size(25, 25), validator=orpg.tools.inputValidator.MathOnlyValidator() )
self.dieModText = wx.TextCtrl( self, wx.ID_ANY, "", size= wx.Size(50, 25), validator=orpg.tools.inputValidator.MathOnlyValidator() )
- self.d4Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d4.gif', 'Roll d4', wx.ID_ANY)
- self.d6Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d6.gif', 'Roll d6', wx.ID_ANY)
- self.d8Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d8.gif', 'Roll d8', wx.ID_ANY)
- self.d10Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d10.gif', 'Roll d10', wx.ID_ANY)
- self.d12Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d12.gif', 'Roll d12', wx.ID_ANY)
- self.d20Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d20.gif', 'Roll d20', wx.ID_ANY)
- self.d100Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d100.gif', 'Roll d100', wx.ID_ANY)
+ self.d4Button = createMaskedButton(self, dir_struct["icon"]+'b_d4.gif', 'Roll d4', wx.ID_ANY)
+ self.d6Button = createMaskedButton(self, dir_struct["icon"]+'b_d6.gif', 'Roll d6', wx.ID_ANY)
+ self.d8Button = createMaskedButton(self, dir_struct["icon"]+'b_d8.gif', 'Roll d8', wx.ID_ANY)
+ self.d10Button = createMaskedButton(self, dir_struct["icon"]+'b_d10.gif', 'Roll d10', wx.ID_ANY)
+ self.d12Button = createMaskedButton(self, dir_struct["icon"]+'b_d12.gif', 'Roll d12', wx.ID_ANY)
+ self.d20Button = createMaskedButton(self, dir_struct["icon"]+'b_d20.gif', 'Roll d20', wx.ID_ANY)
+ self.d100Button = createMaskedButton(self, dir_struct["icon"]+'b_d100.gif', 'Roll d100', wx.ID_ANY)
self.toolbar_sizer.Add( self.numDieText, 0, wx.ALIGN_CENTER | wx.EXPAND)
self.toolbar_sizer.Add( self.d4Button, 0 ,wx.EXPAND)
self.toolbar_sizer.Add( self.d6Button, 0 ,wx.EXPAND)
@@ -950,10 +919,9 @@
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')
- self.log.log("Exit chat_panel->build_dice(self)", ORPG_DEBUG)
-
+
+ @debugging
def toggle_dice(self, act):
- self.log.log("Enter chat_panel->toggle_dice(self, "+ str(act) + ")", ORPG_DEBUG)
if act == '0':
self.toolbar_sizer.Show(self.numDieText, False)
self.toolbar_sizer.Show(self.d4Button, False)
@@ -976,22 +944,23 @@
self.toolbar_sizer.Show(self.d100Button, True)
self.toolbar_sizer.Show(self.dieModText, True)
self.toolbar_sizer.Layout()
- self.log.log("Exit chat_panel->toggle_dice(self, "+ str(act) + ")", ORPG_DEBUG)
-
+
+ @debugging
def build_formating(self):
- self.log.log("Enter chat_panel->build_formating(self)", ORPG_DEBUG)
- self.boldButton = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'bold.gif', 'Make the selected text Bold', wx.ID_ANY, '#bdbdbd')
- self.italicButton = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'italic.gif', 'Italicize the selected text', wx.ID_ANY, '#bdbdbd' )
- self.underlineButton = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'underlined.gif', 'Underline the selected text', wx.ID_ANY, '#bdbdbd' )
+ 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',
+ 'Italicize the selected text', wx.ID_ANY, '#bdbdbd' )
+ 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')
- self.log.log("Exit chat_panel->build_formating(self)", ORPG_DEBUG)
-
+
+ @debugging
def toggle_formating(self, act):
- self.log.log("Enter chat_panel->toggle_formating(self, " + str(act) + ")", ORPG_DEBUG)
if act == '0':
self.toolbar_sizer.Show(self.boldButton, False)
self.toolbar_sizer.Show(self.italicButton, False)
@@ -1002,25 +971,23 @@
self.toolbar_sizer.Show(self.italicButton, True)
self.toolbar_sizer.Show(self.underlineButton, True)
self.toolbar_sizer.Layout()
- self.log.log("Exit chat_panel->toggle_formating(self, " + str(act) + ")", ORPG_DEBUG)
- # Heroman - Ideally, we would use static labels...
+ # Heroman - Ideally, we would use static labels...
+ @debugging
def build_colorbutton(self):
- self.log.log("Enter chat_panel->build_colorbutton(self)", ORPG_DEBUG)
- self.color_button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'textcolor.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, orpg.dirpath.dir_struct["icon"]+'save.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.log.log("Exit chat_panel->build_colorbutton(self)", ORPG_DEBUG)
-
+
+ @debugging
def OnMotion(self, evt):
- self.log.log("Enter chat_panel->OnMotion(self, evt)", ORPG_DEBUG)
contain = self.chatwnd.GetInternalRepresentation()
if contain:
sx = sy = 0
@@ -1036,18 +1003,17 @@
link = lnk.GetHref()
self.session.set_status_url(link)
except: pass
- else: self.log.log("Error, self.chatwnd.GetInternalRepresentation() return None", ORPG_GENERAL)
+ else: logger.general("Error, self.chatwnd.GetInternalRepresentation() return None")
evt.Skip()
- self.log.log("Exit chat_panel->OnMotion(self, evt)", ORPG_DEBUG)
# This subroutine is registered with predTextCtrl to be run for every OnChar event
# It checks if we need to send a typing message
#
# self: duh
- # event: raw KeyEvent from OnChar()
+ # event: raw KeyEvent from OnChar()
+ @debugging
def myKeyHook(self, event):
- self.log.log("Enter chat_panel->myKeyHook(self, event)", ORPG_DEBUG)
if self.session.get_status() == MPLAY_CONNECTED: # only do if we're connected
thisPress = time.time() # thisPress is local temp variable
if (thisPress - self.lastSend) > 4: # Check to see if it's been 5 seconds since our last notice
@@ -1056,16 +1022,17 @@
self.lastPress = thisPress # either way, record the time of this keystroke for use in
# self.typingTimerFunc()
if self.settings.get_setting('SuppressChatAutoComplete') == '1':
- self.log.log("Exit chat_panel->myKeyHook(self, event) return 1", ORPG_DEBUG)
+ logger.debug("Exit chat_panel->myKeyHook(self, event) return 1")
return 1
else:
- self.log.log("Exit chat_panel->myKeyHook(self, event) return 0", ORPG_DEBUG)
+ loger.debug("Exit chat_panel->myKeyHook(self, event) return 0")
return 0
# 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
##############refresh_counter()##############
@@ -1074,8 +1041,8 @@
try: plugin.refresh_counter()
except Exception, e:
if str(e) != "'module' object has no attribute 'refresh_counter'":
- self.log.log(traceback.format_exc(), ORPG_GENERAL)
- self.log.log("EXCEPTION: " + str(e), ORPG_GENERAL)
+ logger.general(traceback.format_exc())
+ logger.general("EXCEPTION: " + str(e))
#end mDuo13 added code
if self.lastSend: # This will be zero when not typing, so equiv to if is_typing
thisTime = time.time() # thisTime is a local temp variable
@@ -1086,9 +1053,10 @@
# 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):
- self.log.log("Enter chat_panel->sendTyping(self, typing)", ORPG_DEBUG)
if typing:
self.lastSend = time.time() # remember our send time for use in myKeyHook()
#I think this is cleaner
@@ -1101,14 +1069,13 @@
status_text = self.settings.get_setting('IdleStatusAlias')
if status_text == "" or status_text == None: status_text = "Idle"
self.session.set_text_status(status_text)
- self.log.log("Exit chat_panel->sendTyping(self, typing)", ORPG_DEBUG)
# 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):
- self.log.log("Enter chat_panel->set_colors(self)", ORPG_DEBUG)
# chat window backround color
self.bgcolor = self.settings.get_setting('bgcolor')
# chat window normal text color
@@ -1123,31 +1090,27 @@
self.emotecolor = self.settings.get_setting('emotecolor')
# color of whispers
self.whispercolor = self.settings.get_setting('whispercolor')
- self.log.log("Exit chat_panel->set_colors(self)", ORPG_DEBUG)
# def set_colors - end
# 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.log.log("Enter chat_panel->set_chat_text(self, txt)", ORPG_DEBUG)
self.chattxt.SetValue(txt)
self.chattxt.SetFocus()
self.chattxt.SetInsertionPointEnd()
- self.log.log("Exit chat_panel->set_chat_text(self, txt)", ORPG_DEBUG)
# def set_chat_text - end
-
+
+ @debugging
def get_chat_text(self):
- self.log.log("Enter chat_panel->get_chat_text(self)", ORPG_DEBUG)
- self.log.log("Enter chat_panel->get_chat_text(self)", ORPG_DEBUG)
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):
- self.log.log("Enter chat_panel->set_chat_text_focus(self, event)", ORPG_DEBUG)
wx.CallAfter(self.chattxt.SetFocus)
- self.log.log("Exit chat_panel->set_chat_text_focus(self, event)", ORPG_DEBUG)
# def set_chat_text_focus - end
# This subrtouine grabs the user input and make the special keys and
@@ -1157,27 +1120,30 @@
# !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):
- self.log.log("Enter chat_panel->OnChar(self, event)", ORPG_DEBUG)
s = self.chattxt.GetValue()
#self.histlen = len(self.history) - 1
## RETURN KEY (no matter if there is text in chattxt)
# This section is run even if there is nothing in the chattxt (as opposed to the next wx.WXK_RETURN handler
if event.GetKeyCode() == wx.WXK_RETURN:
- self.log.log("event.GetKeyCode() == wx.WXK_RETURN", ORPG_DEBUG)
+ logger.debug("event.GetKeyCode() == wx.WXK_RETURN")
self.set_colors()
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'}
-
- 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'}
-# Recycle Bin and Lambda should reduce this whole IF ELIF statement block.
bin_event = event.GetKeyCode()
if recycle_bin.has_key(bin_event):
- self.log.log(lambda bin_event: recycle_bin[bin_event], ORPG_DEBUG)
+ logger.debug(lambda bin_event: recycle_bin[bin_event])
macroText = self.settings.get_setting(recycle_bin[bin_event][29:])
recycle_bin = {}; del bin_event
@@ -1188,7 +1154,7 @@
## RETURN KEY (and not text in control)
if (event.GetKeyCode() == wx.WXK_RETURN and len(s)) or len(macroText):
- self.log.log("(event.GetKeyCode() == wx.WXK_RETURN and len(s)) or len(macroText)", ORPG_DEBUG)
+ logger.debug("(event.GetKeyCode() == wx.WXK_RETURN and len(s)) or len(macroText)")
self.histidx = -1
self.temptext = ""
self.history = [s] + self.history#prepended instead of appended now, so higher index = greater age
@@ -1202,7 +1168,7 @@
## UP KEY
elif event.GetKeyCode() == wx.WXK_UP:
- self.log.log("event.GetKeyCode() == wx.WXK_UP", ORPG_DEBUG)
+ logger.debug("event.GetKeyCode() == wx.WXK_UP")
if self.histidx < len(self.history)-1:
#text that's not in history but also hasn't been sent to chat gets stored in self.temptext
#this way if someone presses the up key, they don't lose their current message permanently
@@ -1218,7 +1184,7 @@
## DOWN KEY
elif event.GetKeyCode() == wx.WXK_DOWN:
- self.log.log("event.GetKeyCode() == wx.WXK_DOWN", ORPG_DEBUG)
+ logger.debug("event.GetKeyCode() == wx.WXK_DOWN")
#histidx of -1 indicates currently viewing text that's not in self.history
if self.histidx > -1:
self.histidx -= 1
@@ -1232,7 +1198,7 @@
## TAB KEY
elif event.GetKeyCode() == wx.WXK_TAB:
- self.log.log("event.GetKeyCode() == wx.WXK_TAB", ORPG_DEBUG)
+ logger.debug("event.GetKeyCode() == wx.WXK_TAB")
if s !="":
found = 0
nicks = []
@@ -1271,13 +1237,13 @@
## PAGE UP
elif event.GetKeyCode() in (wx.WXK_PRIOR, wx.WXK_PAGEUP):
- self.log.log("event.GetKeyCode() in (wx.WXK_PRIOR, wx.WXK_PAGEUP)", ORPG_DEBUG)
+ logger.debug("event.GetKeyCode() in (wx.WXK_PRIOR, wx.WXK_PAGEUP)")
self.chatwnd.ScrollPages(-1)
if not self.lockscroll: self.lock_scroll(0)
## PAGE DOWN
elif event.GetKeyCode() in (wx.WXK_NEXT, wx.WXK_PAGEDOWN):
- self.log.log("event.GetKeyCode() in (wx.WXK_NEXT, wx.WXK_PAGEDOWN)", ORPG_DEBUG)
+ logger.debug("event.GetKeyCode() in (wx.WXK_NEXT, wx.WXK_PAGEDOWN)")
if not self.lockscroll: self.lock_scroll(0)
if ((self.chatwnd.GetScrollRange(1)-self.chatwnd.GetScrollPos(1)-self.chatwnd.GetScrollThumb(1) < 30) and self.lockscroll):
self.lock_scroll(0)
@@ -1285,7 +1251,7 @@
## END
elif event.GetKeyCode() == wx.WXK_END:
- self.log.log("event.GetKeyCode() == wx.WXK_END", ORPG_DEBUG)
+ logger.debug("event.GetKeyCode() == wx.WXK_END", ORPG_DEBUG)
if self.lockscroll:
self.lock_scroll(0)
self.Post()
@@ -1293,12 +1259,12 @@
## NOTHING
else: event.Skip()
- self.log.log("Exit chat_panel->OnChar(self, event)", ORPG_DEBUG)
+ logger.debug("Exit chat_panel->OnChar(self, event)", ORPG_DEBUG)
# def OnChar - end
-
+
+ @debugging
def onDieRoll(self, evt):
"""Roll the dice based on the button pressed and the die modifiers entered, if any."""
- self.log.log("Enter chat_panel->onDieRoll(self, evt)", ORPG_DEBUG)
# Get any die modifiers if they have been entered
numDie = self.numDieText.GetValue()
dieMod = self.dieModText.GetValue()
@@ -1311,15 +1277,14 @@
dieText = "[" + dieText + "]"
self.ParsePost(dieText, 1, 1)
self.chattxt.SetFocus()
- self.log.log("Exit chat_panel->onDieRoll(self, evt)", ORPG_DEBUG)
# This subroutine saves a chat buffer as html to a file chosen via a
# FileDialog.
#
# !self : instance of self
- # !evt :
+ # !evt :
+ @debugging
def on_chat_save(self, evt):
- self.log.log("Enter chat_panel->on_chat_save(self, evt)", ORPG_DEBUG)
f = wx.FileDialog(self,"Save Chat Buffer",".","","HTM* (*.htm*)|*.htm*|HTML (*.html)|*.html|HTM (*.htm)|*.htm",wx.SAVE)
if f.ShowModal() == wx.ID_OK:
file = open(f.GetPath(), "w")
@@ -1327,19 +1292,22 @@
file.close()
f.Destroy()
os.chdir(self.root_dir)
- self.log.log("Exit chat_panel->on_chat_save(self, evt)", ORPG_DEBUG)
# 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("
", "
").replace('