comparison orpg/main.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 fdcca00696ea
children bdbeafcb2ef4 68c7bd272f27
comparison
equal deleted inserted replaced
78:57887ab0df51 79:dd4be4817377
55 from orpg.dirpath import dir_struct 55 from orpg.dirpath import dir_struct
56 from orpg.dieroller.utils import DiceManager 56 from orpg.dieroller.utils import DiceManager
57 from orpg.tools.orpg_settings import settings 57 from orpg.tools.orpg_settings import settings
58 from orpg.tools.validate import validate 58 from orpg.tools.validate import validate
59 from orpg.tools.passtool import PassTool 59 from orpg.tools.passtool import PassTool
60 from orpg.tools.orpg_log import logger 60 from orpg.tools.orpg_log import logger, crash
61 from orpg.tools.decorators import debugging 61 from orpg.tools.decorators import debugging
62 from orpg.tools.metamenus import MenuBarEx 62 from orpg.tools.metamenus import MenuBarEx
63 63
64 #from xml.etree.ElementTree import ElementTree, Element 64 #from xml.etree.ElementTree import ElementTree, Element
65 #from xml.etree.ElementTree import fromstring, tostring 65 #from xml.etree.ElementTree import fromstring, tostring
133 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) 133 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
134 134
135 #Load Update Manager 135 #Load Update Manager
136 component.add('updatemana', self.updateMana) 136 component.add('updatemana', self.updateMana)
137 logger.debug("update manager reloaded") 137 logger.debug("update manager reloaded")
138 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
139
140 #Load Update Manager
141 component.add('debugconsole', self.debugger)
142 logger.debug("debugger window")
138 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) 143 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
139 144
140 @debugging 145 @debugging
141 def post_show_init(self): 146 def post_show_init(self):
142 """Some Actions need to be done after the main fram is drawn""" 147 """Some Actions need to be done after the main fram is drawn"""
253 258
254 self.pluginMenu.AppendItem(item) 259 self.pluginMenu.AppendItem(item)
255 self.pluginMenu.AppendSeparator() 260 self.pluginMenu.AppendSeparator()
256 self.mainmenu.Insert(2, self.pluginMenu, "&Plugins") 261 self.mainmenu.Insert(2, self.pluginMenu, "&Plugins")
257 262
258 self.updateMana = wx.Menu() 263 # Traipse Suite of Additions.
259 mana = wx.MenuItem(self.updateMana, wx.ID_ANY, "Update Manager", "Update Manager") 264 self.traipseSuite = wx.Menu()
265 self.mainmenu.Insert(5, self.traipseSuite, "&Traipse Suite")
266
267 mana = wx.MenuItem(self.traipseSuite, wx.ID_ANY, "Update Manager", "Update Manager")
260 self.Bind(wx.EVT_MENU, self.OnMB_UpdateManagerPanel, mana) 268 self.Bind(wx.EVT_MENU, self.OnMB_UpdateManagerPanel, mana)
261 269 self.traipseSuite.AppendItem(mana)
262 self.updateMana.AppendItem(mana) 270
263 self.mainmenu.Insert(5, self.updateMana, "&Update Manager") 271 debugger = wx.MenuItem(self.traipseSuite, -1, "Debug Console", "Debug Console")
272 self.Bind(wx.EVT_MENU, self.OnMB_DebugConsole, debugger)
273 self.traipseSuite.AppendItem(debugger)
264 274
265 275
266 ################################# 276 #################################
267 ## All Menu Events 277 ## All Menu Events
268 ################################# 278 #################################
461 def OnMB_UpdateManagerPanel(self, evt): 471 def OnMB_UpdateManagerPanel(self, evt):
462 if self.updateMana.IsShown() == True: self.updateMana.Hide() 472 if self.updateMana.IsShown() == True: self.updateMana.Hide()
463 else: self.updateMana.Show() 473 else: self.updateMana.Show()
464 474
465 @debugging 475 @debugging
476 def OnMB_DebugConsole(self, evt):
477 if self.debugger.IsShown() == True: self.debugger.Hide()
478 else: self.debugger.Show()
479
480 @debugging
466 def OnMB_ToolsLoggingLevelDebug(self): 481 def OnMB_ToolsLoggingLevelDebug(self):
467 lvl = logger.log_level 482 lvl = logger.log_level
468 if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): lvl |= ORPG_DEBUG 483 if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): lvl |= ORPG_DEBUG
469 else: lvl &= ~ORPG_DEBUG 484 else: lvl &= ~ORPG_DEBUG
470 logger.log_level = lvl 485 logger.log_level = lvl
629 644
630 #Update Manager 645 #Update Manager
631 self.manifest = manifest.ManifestChanges() 646 self.manifest = manifest.ManifestChanges()
632 self.updateMana = upmana.updatemana.updaterFrame(self, 647 self.updateMana = upmana.updatemana.updaterFrame(self,
633 "OpenRPG Update Manager Beta 0.7.2", component, self.manifest, True) 648 "OpenRPG Update Manager Beta 0.7.2", component, self.manifest, True)
649 logger.debug("Menu Created")
650 h = int(xml_dom.getAttribute("height"))
651 w = int(xml_dom.getAttribute("width"))
652 posx = int(xml_dom.getAttribute("posx"))
653 posy = int(xml_dom.getAttribute("posy"))
654 maximized = int(xml_dom.getAttribute("maximized"))
655 self.SetDimensions(posx, posy, w, h)
656 logger.debug("Dimensions Set")
657
658 #Update Manager
659 self.manifest = manifest.ManifestChanges()
660 self.debugger = orpg.tools.orpg_log.DebugConsole(self)
634 logger.debug("Menu Created") 661 logger.debug("Menu Created")
635 h = int(xml_dom.getAttribute("height")) 662 h = int(xml_dom.getAttribute("height"))
636 w = int(xml_dom.getAttribute("width")) 663 w = int(xml_dom.getAttribute("width"))
637 posx = int(xml_dom.getAttribute("posx")) 664 posx = int(xml_dom.getAttribute("posx"))
638 posy = int(xml_dom.getAttribute("posy")) 665 posy = int(xml_dom.getAttribute("posy"))