40
40
_DEBUG_lvls = {1 : 'Low ' , 2 : 'Med ' , 3 : 'High' , 4 : 'Error' }
41
41
42
42
43
+ @cbook .deprecated ("3.3" )
43
44
def DEBUG_MSG (string , lvl = 3 , o = None ):
44
45
if lvl >= _DEBUG :
45
46
print (f"{ _DEBUG_lvls [lvl ]} - { string } in { type (o )} " )
@@ -198,7 +199,7 @@ def __init__(self, bitmap, dpi):
198
199
alternative = "wxagg" , addendum = "See the Matplotlib usage FAQ for "
199
200
"more info on backends." )
200
201
RendererBase .__init__ (self )
201
- DEBUG_MSG ( " __init__()" , 1 , self )
202
+ _log . debug ( "%s - __init__()" , type ( self ) )
202
203
self .width = bitmap .GetWidth ()
203
204
self .height = bitmap .GetHeight ()
204
205
self .bitmap = bitmap
@@ -301,7 +302,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
301
302
302
303
if ismath :
303
304
s = cbook .strip_math (s )
304
- DEBUG_MSG ( " draw_text()" , 1 , self )
305
+ _log . debug ( "%s - draw_text()" , type ( self ) )
305
306
gc .select ()
306
307
self .handle_clip_rectangle (gc )
307
308
gfx_ctx = gc .gfx_ctx
@@ -326,7 +327,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
326
327
327
328
def new_gc (self ):
328
329
# docstring inherited
329
- DEBUG_MSG ( ' new_gc()' , 2 , self )
330
+ _log . debug ( "%s - new_gc()" , type ( self ) )
330
331
self .gc = GraphicsContextWx (self .bitmap , self )
331
332
self .gc .select ()
332
333
self .gc .unselect ()
@@ -346,7 +347,7 @@ def get_wx_font(self, s, prop):
346
347
Return a wx font. Cache instances in a font dictionary for
347
348
efficiency
348
349
"""
349
- DEBUG_MSG ( " get_wx_font()" , 1 , self )
350
+ _log . debug ( "%s - get_wx_font()" , type ( self ) )
350
351
351
352
key = hash (prop )
352
353
fontprop = prop
@@ -408,8 +409,7 @@ class GraphicsContextWx(GraphicsContextBase):
408
409
def __init__ (self , bitmap , renderer ):
409
410
GraphicsContextBase .__init__ (self )
410
411
# assert self.Ok(), "wxMemoryDC not OK to use"
411
- DEBUG_MSG ("__init__()" , 1 , self )
412
- DEBUG_MSG ("__init__() 2: %s" % bitmap , 1 , self )
412
+ _log .debug ("%s - __init__(): %s" , type (self ), bitmap )
413
413
414
414
dc , gfx_ctx = self ._cache .get (bitmap , (None , None ))
415
415
if dc is None :
@@ -445,7 +445,7 @@ def set_foreground(self, fg, isRGBA=None):
445
445
# Here we set both to the same colour - if a figure is not to be
446
446
# filled, the renderer will set the brush to be transparent
447
447
# Same goes for text foreground...
448
- DEBUG_MSG ( " set
6D40
_foreground()" , 1 , self )
448
+ _log . debug ( "%s - set_foreground()" , type ( self ) )
449
449
self .select ()
450
450
GraphicsContextBase .set_foreground (self , fg , isRGBA )
451
451
@@ -456,7 +456,7 @@ def set_foreground(self, fg, isRGBA=None):
456
456
def set_linewidth (self , w ):
457
457
# docstring inherited
458
458
w = float (w )
459
- DEBUG_MSG ( " set_linewidth()" , 1 , self )
459
+ _log . debug ( "%s - set_linewidth()" , type ( self ) )
460
460
self .select ()
461
461
if 0 < w < 1 :
462
462
w = 1
@@ -470,7 +470,7 @@ def set_linewidth(self, w):
470
470
471
471
def set_capstyle (self , cs ):
472
472
# docstring inherited
473
- DEBUG_MSG ( " set_capstyle()" , 1 , self )
473
+ _log . debug ( "%s - set_capstyle()" , type ( self ) )
474
474
self .select ()
475
475
GraphicsContextBase .set_capstyle (self , cs )
476
476
self ._pen .SetCap (GraphicsContextWx ._capd [self ._capstyle ])
@@ -479,7 +479,7 @@ def set_capstyle(self, cs):
479
479
480
480
def set_joinstyle (self , js ):
481
481
# docstring inherited
482
- DEBUG_MSG ( " set_joinstyle()" , 1 , self )
482
+ _log . debug ( "%s - set_joinstyle()" , type ( self ) )
483
483
self .select ()
484
484
GraphicsContextBase .set_joinstyle (self , js )
485
485
self ._pen .SetJoin (GraphicsContextWx ._joind [self ._joinstyle ])
@@ -488,7 +488,7 @@ def set_joinstyle(self, js):
488
488
489
489
def get_wxcolour (self , color ):
490
490
"""return a wx.Colour from RGB format"""
491
- DEBUG_MSG ( " get_wx_color()" , 1 , self )
491
+ _log . debug ( "%s - get_wx_color()" , type ( self ) )
492
492
if len (color ) == 3 :
493
493
r , g , b = color
494
494
r *= 255
@@ -600,7 +600,7 @@ def __init__(self, parent, id, figure):
600
600
601
601
# Create the drawing bitmap
602
602
self .bitmap = wx .Bitmap (w , h )
603
- DEBUG_MSG ( " __init__() - bitmap w:%d h:%d" % ( w , h ), 2 , self )
603
+ _log . debug ( "%s - __init__() - bitmap w:%d h:%d", type ( self ), w , h )
604
604
# TODO: Add support for 'point' inspection and plot navigation.
605
605
self ._isDrawn = False
606
606
@@ -642,7 +642,7 @@ def Copy_to_Clipboard(self, event=None):
642
642
643
643
def draw_idle (self ):
644
644
# docstring inherited
645
- DEBUG_MSG ( " draw_idle()" , 1 , self )
645
+ _log . debug ( "%s - draw_idle()" , type ( self ) )
646
646
self ._isDrawn = False # Force redraw
647
647
# Triggering a paint event is all that is needed to defer drawing
648
648
# until later. The platform will send the event when it thinks it is
@@ -702,7 +702,7 @@ def gui_repaint(self, drawDC=None, origin='WX'):
702
702
703
703
The 'WXAgg' backend sets origin accordingly.
704
704
"""
705
- DEBUG_MSG ( " gui_repaint()" , 1 , self )
705
+ _log . debug ( "%s - gui_repaint()" , type ( self ) )
706
706
if self .IsShownOnScreen ():
707
707
if not drawDC :
708
708
# not called from OnPaint use a ClientDC
@@ -740,11 +740,8 @@ def print_figure(self, filename, *args, **kwargs):
740
740
self .draw ()
741
741
742
742
def _onPaint (self , evt ):
743
- """
744
- Called when wxPaintEvt is generated
745
- """
746
-
747
- DEBUG_MSG ("_onPaint()" , 1 , self )
743
+ """Called when wxPaintEvt is generated."""
744
+ _log .debug ("%s - _onPaint()" , type (self ))
748
745
drawDC = wx .PaintDC (self )
749
746
if not self ._isDrawn :
750
747
self .draw (drawDC = drawDC )
@@ -760,7 +757,7 @@ def _onSize(self, evt):
760
757
is better to take the performance hit and redraw the whole window.
761
758
"""
762
759
763
- DEBUG_MSG ( " _onSize()" , 2 , self )
760
+ _log . debug ( "%s - _onSize()" , type ( self ) )
764
10000
code>
761
sz = self .GetParent ().GetSizer ()
765
762
if sz :
766
763
si = sz .GetItem (self )
@@ -920,7 +917,7 @@ def draw(self, drawDC=None):
920
917
Render the figure using RendererWx instance renderer, or using a
921
918
previously defined renderer if none is specified.
922
919
"""
923
- DEBUG_MSG ( " draw()" , 1 , self )
920
+ _log . debug ( "%s - draw()" , type ( self ) )
924
921
self .renderer = RendererWx (self .bitmap , self .figure .dpi )
925
922
self .figure .draw (self .renderer )
926
923
self ._isDrawn = True
@@ -1020,7 +1017,7 @@ def __init__(self, num, fig):
1020
1017
wx .Frame .__init__ (self , parent = None , id = - 1 , pos = pos ,
1021
1018
title = "Figure %d" % num )
1022
1019
# Frame will be sized later by the Fit method
1023
- DEBUG_MSG ( " __init__()" , 1 , self )
1020
+ _log . debug ( "%s - __init__()" , type ( self ) )
1024
1021
self .num = num
1025
1022
_set_frame_icon (self )
1026
1023
@@ -1087,11 +1084,11 @@ def get_canvas(self, fig):
1087
1084
return FigureCanvasWx (self , - 1 , fig )
1088
1085
1089
1086
def get_figure_manager (self ):
1090
- DEBUG_MSG ( " get_figure_manager()" , 1 , self )
1087
+ _log . debug ( "%s - get_figure_manager()" , type ( self ) )
1091
1088
return self .figmgr
1092
1089
1093
1090
def _onClose (self , evt ):
1094
- DEBUG_MSG ( " onClose()" , 1 , self )
1091
+ _log . debug ( "%s - onClose()" , type ( self ) )
1095
1092
self .canvas .close_event ()
1096
1093
self .canvas .stop_event_loop ()
1097
1094
Gcf .destroy (self .num )
@@ -1134,7 +1131,7 @@ class FigureManagerWx(FigureManagerBase):
1134
1131
"""
1135
1132
1136
1133
def __init__ (self , canvas , num , frame ):
1137
- DEBUG_MSG ( " __init__()" , 1 , self )
1134
+ _log . debug ( "%s - __init__()" , type ( self ) )
1138
1135
FigureManagerBase .__init__ (self , canvas , n
F6CC
um )
1139
1136
self .frame = frame
1140
1137
self .window = frame
@@ -1147,7 +1144,7 @@ def show(self):
1147
1144
self .canvas .draw ()
1148
1145
1149
1146
def destroy (self , * args ):
1150
- DEBUG_MSG ( " destroy()" , 1 , self )
1147
+ _log . debug ( "%s - destroy()" , type ( self ) )
1151
1148
self .frame .Destroy ()
1152
1149
wxapp = wx .GetApp ()
1153
1150
if wxapp :
@@ -1322,7 +1319,7 @@ def get_canvas(self, frame, fig):
1322
1319
return type (self .canvas )(frame , - 1 , fig )
1323
1320
1324
1321
def _init_toolbar (self ):
1325
- DEBUG_MSG ( " _init_toolbar" , 1 , self )
1322
+ _log . debug ( "%s - _init_toolbar" , type ( self ) )
1326
1323
1327
1324
self ._parent = self .canvas .GetParent ()
1328
1325
@@ -1384,9 +1381,8 @@ def save_figure(self, *args):
1384
1381
if dlg .ShowModal () == wx .ID_OK :
1385
1382
dirname = dlg .GetDirectory ()
1386
1383
filename = dlg .GetFilename ()
1387
- DEBUG_MSG (
1388
- 'Save file dir:%s name:%s' %
1389
- (dirname , filename ), 3 , self )
1384
+ _log .debug ('%s - Save file dir:%s name:%s' ,
1385
+ self , dirname , filename )
1390
1386
format = exts [dlg .GetFilterIndex ()]
1391
1387
basename , ext = os .path .splitext (filename )
1392
1388
if ext .startswith ('.' ):
0 commit comments