4
4
import six
5
5
6
6
import os , sys , warnings
7
- def fn_name (): return sys ._getframe (1 ).f_code .co_name
8
7
9
8
if six .PY3 :
10
9
warnings .warn (
@@ -44,9 +43,6 @@ def fn_name(): return sys._getframe(1).f_code.co_name
44
43
45
44
backend_version = "%d.%d.%d" % gtk .pygtk_version
46
45
47
- _debug = False
48
- #_debug = True
49
-
50
46
# the true dots per inch on the screen; should be display dependent
51
47
# see http://groups.google.com/groups?q=screen+dpi+x11&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=7077.26e81ad5%40swift.cs.tcd.ie&rnum=5 for some info about screen dpi
52
48
PIXELS_PER_INCH = 96
@@ -225,7 +221,6 @@ def __init__(self, figure):
225
221
"See Matplotlib usage FAQ for"
226
222
" more info on backends." ,
227
223
alternative = "GTKAgg" )
228
- if _debug : print ('FigureCanvasGTK.%s' % fn_name ())
229
224
FigureCanvasBase .__init__ (self , figure )
230
225
gtk .DrawingArea .__init__ (self )
231
226
@@ -261,7 +256,6 @@ def destroy(self):
261
256
gobject .source_remove (self ._idle_draw_id )
262
257
263
258
def scroll_event (self , widget , event ):
264
- if _debug : print ('FigureCanvasGTK.%s' % fn_name ())
265
259
x = event .x
266
260
# flipy so y=0 is bottom of canvas
267
261
y = self .allocation .height - event .y
@@ -273,7 +267,6 @@ def scroll_event(self, widget, event):
273
267
return False # finish event propagation?
274
268
275
269
def button_press_event (self , widget , event ):
276
- if _debug : print ('FigureCanvasGTK.%s' % fn_name ())
277
270
x = event .x
278
271
# flipy so y=0 is bottom of canvas
279
272
y = self .allocation .height - event .y
@@ -297,29 +290,23 @@ def button_press_event(self, widget, event):
297
290
return False # finish event propagation?
298
291
299
292
def button_release_event (self , widget , event ):
300
- if _debug : print ('FigureCanvasGTK.%s' % fn_name ())
301
293
x = event .x
302
294
# flipy so y=0 is bottom of canvas
303
295
y = self .allocation .height - event .y
304
296
FigureCanvasBase .button_release_event (self , x , y , event .button , guiEvent = event )
305
297
return False # finish event propagation?
306
298
307
299
def key_press_event (self , widget , event ):
308
- if _debug : print ('FigureCanvasGTK.%s' % fn_name ())
309
300
key = self ._get_key (event )
310
- if _debug : print ("hit" , key )
311
301
FigureCanvasBase .key_press_event (self , key , guiEvent = event )
312
302
return True # stop event propagation
313
303
314
304
def key_release_event (self , widget , event ):
315
- if _debug : print ('FigureCanvasGTK.%s' % fn_name ())
316
305
key = self ._get_key (event )
317
- if _debug : print ("release" , key )
318
306
FigureCanvasBase .key_release_event (self , key , guiEvent = event )
319
307
return True # stop event propagation
320
308
321
309
def motion_notify_event (self , widget , event ):
322
- if _debug : print ('FigureCanvasGTK.%s' % fn_name ())
323
310
if event .is_hint :
324
311
x , y , state = event .window .get_pointer ()
325
312
else :
@@ -355,7 +342,6 @@ def _get_key(self, event):
355
342
return key
356
343
357
344
def configure_event (self , widget , event ):
358
- if _debug : print ('FigureCanvasGTK.%s' % fn_name ())
359
345
if widget .window is None :
360
346
return
361
347
w , h = event .width , event .height
@@ -408,8 +394,6 @@ def _pixmap_prepare(self, width, height):
408
394
Make sure _._pixmap is at least width, height,
409
395
create new pixmap if necessary
410
396
"""
411
- if _debug : print ('FigureCanvasGTK.%s' % fn_name ())
412
-
413
397
create_pixmap = False
414
398
if width > self ._pixmap_width :
415
399
# increase the pixmap in 10%+ (rather than 1 pixel) steps
@@ -438,8 +422,6 @@ def _render_figure(self, pixmap, width, height):
438
422
def expose_event (self , widget , event ):
439
423
"""Expose_event for all GTK backends. Should not be overridden.
440
424
"""
441
- if _debug : print ('FigureCanvasGTK.%s' % fn_name ())
442
-
443
425
if GTK_WIDGET_DRAWABLE (self ):
444
426
if self ._need_redraw :
445
427
x , y , w , h = self .allocation
@@ -556,7 +538,6 @@ class FigureManagerGTK(FigureManagerBase):
556
538
557
539
"""
558
540
def __init__ (self , canvas , num ):
559
- if _debug : print ('FigureManagerGTK.%s' % fn_name ())
560
541
FigureManagerBase .__init__ (self , canvas , num )
561
542
562
543
self .window = gtk .Window ()
@@ -610,7 +591,6 @@ def notify_axes_change(fig):
610
591
self .canvas .grab_focus ()
611
592
612
593
def destroy (self , * args ):
613
- if _debug : print ('FigureManagerGTK.%s' % fn_name ())
614
594
if hasattr (self , 'toolbar' ) and self .toolbar is not None :
615
595
self .toolbar .destroy ()
616
596
if hasattr (self , 'vbox' ):
0 commit comments