comparison orpg/tools/orpg_log.py @ 123:174658f839c0 alpha

Traipse Alpha 'OpenRPG' {091001-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 (Completed, see documentation for usage) Mercurial's hgweb folder is ported to upmana Happy Halloween!
author sirebral
date Sun, 01 Nov 2009 01:12:50 -0600
parents 36919b8a3ef9
children 8827271fbe1b
comparison
equal deleted inserted replaced
122:36919b8a3ef9 123:174658f839c0
67 class TrueDebug(object): 67 class TrueDebug(object):
68 ### Alpha ### 68 ### Alpha ###
69 """A simple debugger. Add debug() to a function and it prints the function name and any objects included. 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. 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.""" 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): 72 def __init__(self, objects=None, locale=False, log=True, parents=False):
73 if log == False: return 73 if log == False: return
74 current = inspect.currentframe() 74 current = inspect.currentframe()
75 self.true_debug(current, objects) 75 if parents: self.get_parents(current)
76 76 self.true_debug(current, objects, locale)
77 def true_debug(self, current, objects): 77
78 if objects != None: 78 def true_debug(self, current, objects, locale):
79 if locale == True: print inspect.getouterframes(current)[1][3], objects, inspect.getouterframes(current)[1][1] 79 debug_string = 'Function: ' + str(inspect.getouterframes(current)[1][3])
80 else: print inspect.getouterframes(current)[1][3], objects 80 #if locale == 'all': print inspect.getouterframes(current)[4]; return
81 else: 81 if objects != None: debug_string += ' Objects: ' + str(objects)
82 if locale == True: print inspect.getouterframes(current)[1][3], inspect.getouterframes(current)[1][1] 82 if locale: debug_string += ' File: ' + str(inspect.getouterframes(current)[1][1])
83 else: print inspect.getouterframes(current)[1][3] 83 print debug_string
84 return
85
86 def get_parents(self, current):
87 debug_string = 'Function: ' + str(inspect.getouterframes(current)[1][3]) + ' Parents:'
88 family = list(inspect.getouterframes(current))
89 for parent in family:
90 debug_string += ' ' + str(parent[4])
91 print debug_string
92 return
84 93
85 class DebugConsole(wx.Frame): 94 class DebugConsole(wx.Frame):
86 def __init__(self, parent): 95 def __init__(self, parent):
87 super(DebugConsole, self).__init__(parent, -1, "Debug Console") 96 super(DebugConsole, self).__init__(parent, -1, "Debug Console")
88 icon = wx.Icon(dir_struct["icon"]+'note.ico', wx.BITMAP_TYPE_ICO) 97 icon = wx.Icon(dir_struct["icon"]+'note.ico', wx.BITMAP_TYPE_ICO)
101 self.SetSize((450, 175)) 110 self.SetSize((450, 175))
102 self.Bind(wx.EVT_CLOSE, self.Min) 111 self.Bind(wx.EVT_CLOSE, self.Min)
103 self.Bind(wx.EVT_BUTTON, self.clear, self.bt_clear) 112 self.Bind(wx.EVT_BUTTON, self.clear, self.bt_clear)
104 self.Bind(wx.EVT_BUTTON, self.bug_report, self.report) 113 self.Bind(wx.EVT_BUTTON, self.bug_report, self.report)
105 self.Min(None) 114 self.Min(None)
106 sys.stdout = Term2Win() 115 #sys.stdout = Term2Win()
107 component.add('debugger', self.console) 116 component.add('debugger', self.console)
108 117
109 def Min(self, evt): 118 def Min(self, evt):
110 self.Hide() 119 self.Hide()
111 120