comparison orpg/chat/chatwnd.py @ 79:dd4be4817377 ornery-dev

Chat Window no longer prints excessive debug statements to console. Renamed the Update Manager menu item to Traipse Suite. Added debug console to Traipse Suite. Log now prints an error report and waits for user input so Windows users can see the error being reported.
author sirebral
date Sun, 23 Aug 2009 14:57:06 -0500
parents 449a8900f9ac
children 2fa8bd6785a5
comparison
equal deleted inserted replaced
78:57887ab0df51 79:dd4be4817377
146 # !self : instance of self 146 # !self : instance of self
147 # !parent : 147 # !parent :
148 # !id : 148 # !id :
149 @debugging 149 @debugging
150 def __init__(self, parent, id): 150 def __init__(self, parent, id):
151 wx.html.HtmlWindow.__init__(self, parent, id, style=wx.SUNKEN_BORDER | wx.html.HW_SCROLLBAR_AUTO|wx.NO_FULL_REPAINT_ON_RESIZE) 151 wx.html.HtmlWindow.__init__(self, parent, id,
152 style=wx.SUNKEN_BORDER|wx.html.HW_SCROLLBAR_AUTO|wx.NO_FULL_REPAINT_ON_RESIZE)
152 self.parent = parent 153 self.parent = parent
153 self.build_menu() 154 self.build_menu()
154 self.Bind(wx.EVT_LEFT_UP, self.LeftUp) 155 self.Bind(wx.EVT_LEFT_UP, self.LeftUp)
155 self.Bind(wx.EVT_RIGHT_DOWN, self.onPopup) 156 self.Bind(wx.EVT_RIGHT_DOWN, self.onPopup)
156 if "gtk2" in wx.PlatformInfo: self.SetStandardFonts() 157 if "gtk2" in wx.PlatformInfo: self.SetStandardFonts()
235 if NEWCHAT: 236 if NEWCHAT:
236 class ChatHtmlWindow(wx.webview.WebView): 237 class ChatHtmlWindow(wx.webview.WebView):
237 @debugging 238 @debugging
238 def __init__(self, parent, id): 239 def __init__(self, parent, id):
239 wx.webview.WebView.__init__(self, parent, id) 240 wx.webview.WebView.__init__(self, parent, id)
240
241 self.parent = parent 241 self.parent = parent
242 self.__font = wx.Font(10, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, faceName='Ariel') 242 self.__font = wx.Font(10, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, faceName='Ariel')
243
244 self.build_menu() 243 self.build_menu()
245 self.Bind(wx.EVT_LEFT_UP, self.LeftUp) 244 self.Bind(wx.EVT_LEFT_UP, self.LeftUp)
246 self.Bind(wx.EVT_RIGHT_DOWN, self.onPopup) 245 self.Bind(wx.EVT_RIGHT_DOWN, self.onPopup)
247 self.Bind(wx.webview.EVT_WEBVIEW_BEFORE_LOAD, self.OnLinkClicked) 246 self.Bind(wx.webview.EVT_WEBVIEW_BEFORE_LOAD, self.OnLinkClicked)
248 247
263 def CalculateAllFonts(self, defaultsize): 262 def CalculateAllFonts(self, defaultsize):
264 return 263 return
265 264
266 @debugging 265 @debugging
267 def SetDefaultFontAndSize(self, fontname, fontsize): 266 def SetDefaultFontAndSize(self, fontname, fontsize):
268 self.__font = wx.Font(int(fontsize), wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, faceName=fontname) 267 self.__font = wx.Font(int(fontsize),
268 wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL,
269 wx.FONTWEIGHT_NORMAL, faceName=fontname)
269 try: self.SetPageSource(self.Header() + self.StripHeader()) 270 try: self.SetPageSource(self.Header() + self.StripHeader())
270 except Exception, e: print e 271 except Exception, e: print e
271 return (self.GetFont().GetFaceName(), self.GetFont().GetPointSize()) 272 return (self.GetFont().GetFaceName(), self.GetFont().GetPointSize())
272 273
273 #Events 274 #Events
372 # Hook up event handler for flipping tabs 373 # Hook up event handler for flipping tabs
373 self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.onPageChanged) 374 self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.onPageChanged)
374 self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CHANGING, self.onPageChanging) 375 self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CHANGING, self.onPageChanging)
375 self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.onCloseTab) 376 self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.onCloseTab)
376 # html font/fontsize is global to all the notebook tabs. 377 # html font/fontsize is global to all the notebook tabs.
377 self.font, self.fontsize = self.MainChatPanel.chatwnd.SetDefaultFontAndSize(self.settings.get_setting('defaultfont'), 378 self.font, self.fontsize = self.MainChatPanel.chatwnd.SetDefaultFontAndSize(self.settings.get_setting('defaultfont'), self.settings.get_setting('defaultfontsize'))
378 self.settings.get_setting('defaultfontsize'))
379 self.GMChatPanel = None 379 self.GMChatPanel = None
380 if self.settings.get_setting("GMWhisperTab") == '1': 380 if self.settings.get_setting("GMWhisperTab") == '1':
381 self.create_gm_tab() 381 self.create_gm_tab()
382 self.SetSelection(0) 382 self.SetSelection(0)
383 383
523 """ 523 """
524 524
525 @debugging 525 @debugging
526 def __init__(self, parent, id, tab_type, sendtarget): 526 def __init__(self, parent, id, tab_type, sendtarget):
527 wx.Panel.__init__(self, parent, id) 527 wx.Panel.__init__(self, parent, id)
528 logger._set_log_to_console(False)
528 self.session = component.get('session') 529 self.session = component.get('session')
529 self.settings = component.get('settings') 530 self.settings = component.get('settings')
530 self.activeplugins = component.get('plugins') 531 self.activeplugins = component.get('plugins')
531 self.parent = parent 532 self.parent = parent
532 # who receives outbound messages, either "all" or "playerid" string 533 # who receives outbound messages, either "all" or "playerid" string
570 self.fontsize = self.chatwnd.GetFont().GetPointSize() 571 self.fontsize = self.chatwnd.GetFont().GetPointSize()
571 self.scroll_down() 572 self.scroll_down()
572 573
573 @debugging 574 @debugging
574 def set_default_font(self, fontname=None, fontsize=None): 575 def set_default_font(self, fontname=None, fontsize=None):
575 """Set all chatpanels to new default fontname/fontsize. Returns current font settings in a (fontname, fontsize) tuple.""" 576 """Set all chatpanels to new default fontname/fontsize.
577 Returns current font settings in a (fontname, fontsize) tuple."""
576 if (fontname is not None): newfont = fontname 578 if (fontname is not None): newfont = fontname
577 else: newfont = self.font 579 else: newfont = self.font
578 if (fontsize is not None): newfontsize = int(fontsize) 580 if (fontsize is not None): newfontsize = int(fontsize)
579 else: newfontsize = int(self.fontsize) 581 else: newfontsize = int(self.fontsize)
580 self.chatwnd.SetDefaultFontAndSize(newfont, newfontsize) 582 self.chatwnd.SetDefaultFontAndSize(newfont, newfontsize)
1289 self.lock_scroll(0) 1291 self.lock_scroll(0)
1290 self.chatwnd.ScrollPages(1) 1292 self.chatwnd.ScrollPages(1)
1291 1293
1292 ## END 1294 ## END
1293 elif event.GetKeyCode() == wx.WXK_END: 1295 elif event.GetKeyCode() == wx.WXK_END:
1294 logger.debug("event.GetKeyCode() == wx.WXK_END", ORPG_DEBUG) 1296 logger.debug("event.GetKeyCode() == wx.WXK_END")
1295 if self.lockscroll: 1297 if self.lockscroll:
1296 self.lock_scroll(0) 1298 self.lock_scroll(0)
1297 self.Post() 1299 self.Post()
1298 event.Skip() 1300 event.Skip()
1299 1301
1300 ## NOTHING 1302 ## NOTHING
1301 else: event.Skip() 1303 else: event.Skip()
1302 logger.debug("Exit chat_panel->OnChar(self, event)", ORPG_DEBUG) 1304 logger.debug("Exit chat_panel->OnChar(self, event)")
1303 # def OnChar - end 1305 # def OnChar - end
1304 1306
1305 @debugging 1307 @debugging
1306 def onDieRoll(self, evt): 1308 def onDieRoll(self, evt):
1307 """Roll the dice based on the button pressed and the die modifiers entered, if any.""" 1309 """Roll the dice based on the button pressed and the die modifiers entered, if any."""