]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/tools/dbg.py
simplifying alpha, adding commented part for high-res screens
[wxWidgets.git] / wxPython / wx / tools / dbg.py
index 5556098d1ca7235d4ecebfe4f7f044f756409f26..e58be4cd05297ca4e8c356ab0203011ba19711a2 100644 (file)
@@ -7,6 +7,10 @@
 # Copyright:    (c) 2002 by Will Sadkin, 2002
 # License:      wxWindows license
 #----------------------------------------------------------------------------
 # Copyright:    (c) 2002 by Will Sadkin, 2002
 # License:      wxWindows license
 #----------------------------------------------------------------------------
+# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+#
+# o V2.5 compatability update 
+#
 
 """
 This module provides a useful debugging framework that supports
 
 """
 This module provides a useful debugging framework that supports
@@ -71,7 +75,8 @@ stream
     changing it will result in no action being taken.
 
 You can also call the log function implicitly on the Logger
     changing it will result in no action being taken.
 
 You can also call the log function implicitly on the Logger
-instance, ie. you can type:
+instance, ie. you can type::
+
     from wxPython.tools.dbg import Logger
     dbg = Logger()
     dbg('something to print')
     from wxPython.tools.dbg import Logger
     dbg = Logger()
     dbg('something to print')
@@ -143,8 +148,14 @@ class Logger:
             return
 
         if self._dbg and len(args) and not self._suspend:
             return
 
         if self._dbg and len(args) and not self._suspend:
-            # (emulate print functionality)
-            strs = [str(arg) for arg in args]
+            # (emulate print functionality; handle unicode as best as possible:)
+            strs = []
+            for arg in args:
+                try:
+                    strs.append(str(arg))
+                except:
+                    strs.append(repr(arg))
+
             output = ' '.join(strs)
             if self.name: output = self.name+': ' + output
             output = ' ' * 3 * self._indent + output
             output = ' '.join(strs)
             if self.name: output = self.name+': ' + output
             output = ' ' * 3 * self._indent + output
@@ -217,20 +228,22 @@ class Logger:
 #------------------------------------------------------------
 
 if __name__ == "__main__":
 #------------------------------------------------------------
 
 if __name__ == "__main__":
-    from wxPython.wx import *
-    wxLog_SetActiveTarget( wxLogStderr() )
+    import  sys
+    import  wx
+    
+    wx.Log_SetActiveTarget( wx.LogStderr() )
     logger = Logger('module')
     dbg = logger.dbg
     dbg(enable=1)
     logger('test __call__ interface')
     dbg('testing wxLog output to stderr:', wxlog=1, indent=1)
     dbg('1,2,3...')
     logger = Logger('module')
     dbg = logger.dbg
     dbg(enable=1)
     logger('test __call__ interface')
     dbg('testing wxLog output to stderr:', wxlog=1, indent=1)
     dbg('1,2,3...')
-    dbg('testing wxLogNull:')
-    devnull = wxLogNull()
+    dbg('testing wx.LogNull:')
+    devnull = wx.LogNull()
     dbg('4,5,6...') # shouldn't print, according to doc...
     del devnull
     dbg('4,5,6...') # shouldn't print, according to doc...
     del devnull
-    dbg('(resuming to wxLogStdErr)', '7,8,9...', indent=0)
-    dbg('disabling wxLog output, switching to stderr:')
+    dbg('(resuming to wx.LogStdErr)', '7,8,9...', indent=0)
+    dbg('disabling wx.Log output, switching to stderr:')
     dbg(wxlog=0, stream=sys.stderr)
     dbg(logger._outstream, 'switching back to stdout:')
     dbg(stream=None)
     dbg(wxlog=0, stream=sys.stderr)
     dbg(logger._outstream, 'switching back to stdout:')
     dbg(stream=None)