comparison orpg/tools/orpg_log.py @ 122:36919b8a3ef9 alpha

Traipse Alpha 'OpenRPG' {091031-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 Mercurial's hgweb folder is ported to upmana Happy Halloween!
author sirebral
date Sat, 31 Oct 2009 22:07:55 -0500
parents 496dbf12a6cb
children 174658f839c0
comparison
equal deleted inserted replaced
121:496dbf12a6cb 122:36919b8a3ef9
25 # 25 #
26 # Description: classes for orpg log messages 26 # Description: classes for orpg log messages
27 # 27 #
28 28
29 from __future__ import with_statement 29 from __future__ import with_statement
30 import sys, os, os.path, wx, time, traceback 30 import sys, os, os.path, wx, time, traceback, inspect
31 31
32 from orpg.orpgCore import component 32 from orpg.orpgCore import component
33 from orpg.external.terminalwriter import TerminalWriter 33 from orpg.external.terminalwriter import TerminalWriter
34 from orpg.tools.decorators import pending_deprecation 34 from orpg.tools.decorators import pending_deprecation
35 from orpg.dirpath import dir_struct 35 from orpg.dirpath import dir_struct
62 def write(self, text): 62 def write(self, text):
63 #logger.stdout(text) 63 #logger.stdout(text)
64 wx.Yield() 64 wx.Yield()
65 #sys.__stdout__.write(text) 65 #sys.__stdout__.write(text)
66 66
67 class TrueDebug(object):
68 ### Alpha ###
69 """A simple debugger. Add debug() to a function and it prints the function name and any objects included.
70 Adding True to locale prints the file name where the function is. Adding False to log turns the log off.
71 This feature can be modified to trace deeper and find the bugs faster, ending the puzzle box."""
72 def __init__(self, objects=None, locale=False, log=True):
73 if log == False: return
74 current = inspect.currentframe()
75 self.true_debug(current, objects)
76
77 def true_debug(self, current, objects):
78 if objects != None:
79 if locale == True: print inspect.getouterframes(current)[1][3], objects, inspect.getouterframes(current)[1][1]
80 else: print inspect.getouterframes(current)[1][3], objects
81 else:
82 if locale == True: print inspect.getouterframes(current)[1][3], inspect.getouterframes(current)[1][1]
83 else: print inspect.getouterframes(current)[1][3]
84
67 class DebugConsole(wx.Frame): 85 class DebugConsole(wx.Frame):
68 def __init__(self, parent): 86 def __init__(self, parent):
69 super(DebugConsole, self).__init__(parent, -1, "Debug Console") 87 super(DebugConsole, self).__init__(parent, -1, "Debug Console")
70 icon = wx.Icon(dir_struct["icon"]+'note.ico', wx.BITMAP_TYPE_ICO) 88 icon = wx.Icon(dir_struct["icon"]+'note.ico', wx.BITMAP_TYPE_ICO)
71 self.SetIcon(icon) 89 self.SetIcon(icon)
213 log_name = property(_get_log_name, _set_log_name) 231 log_name = property(_get_log_name, _set_log_name)
214 log_to_console = property(_get_log_to_console, _set_log_to_console) 232 log_to_console = property(_get_log_to_console, _set_log_to_console)
215 233
216 logger = orpgLog(dir_struct.get("user") + "runlogs/") 234 logger = orpgLog(dir_struct.get("user") + "runlogs/")
217 crash = sys.excepthook = Crash 235 crash = sys.excepthook = Crash
236 debug = TrueDebug