Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bbad53b

Browse files
author
Steve Chaplin
committed
'SC'
svn path=/trunk/matplotlib/; revision=1554
1 parent 1f7f7da commit bbad53b

2 files changed

Lines changed: 22 additions & 33 deletions

File tree

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
New entries should be added at the top
22

3+
2005-07-22 backend_gdk.py: removed pygtk.require() - SC
4+
35
2005-07-21 backend_svg.py: Remove unused imports. Remove methods doc strings
46
which just duplicate the docs from backend_bases.py. Rename
57
draw_mathtext to _draw_mathtext. - SC

lib/matplotlib/backends/backend_gdk.py

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,41 @@
11
from __future__ import division
22

3-
import math, os, warnings
3+
import math
4+
import os
45
import sys
6+
import warnings
57
def fn_name(): return sys._getframe(1).f_code.co_name
68

7-
import matplotlib
8-
9-
import matplotlib.numerix as numerix
10-
from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
11-
where, transpose, nonzero, indices, ones, nx
12-
13-
from matplotlib._pylab_helpers import Gcf
14-
from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
15-
FigureManagerBase, FigureCanvasBase
16-
from matplotlib.cbook import is_string_like, enumerate
17-
from matplotlib.figure import Figure
18-
from matplotlib.font_manager import fontManager
19-
from matplotlib.mathtext import math_parse_s_ft2font
20-
21-
pygtk_version_required = (2,0,0)
22-
try:
23-
import pygtk
24-
if not matplotlib.FROZEN:
25-
pygtk.require('2.0')
26-
except:
27-
print >> sys.stderr, sys.exc_info()[1]
28-
raise SystemExit('PyGTK version %d.%d.%d or greater is required to run '
29-
'the GTK Matplotlib backends'
30-
% pygtk_version_required)
31-
329
import gobject
3310
import gtk; gdk = gtk.gdk
3411
import pango
35-
12+
pygtk_version_required = (2,0,0)
3613
if gtk.pygtk_version < pygtk_version_required:
3714
raise SystemExit ("PyGTK %d.%d.%d is installed\n"
3815
"PyGTK %d.%d.%d or later is required"
3916
% (gtk.pygtk_version + pygtk_version_required))
40-
backend_version = "%d.%d.%d" % gtk.pygtk_version
4117
del pygtk_version_required
4218

43-
# do after gtk else get "pygtk.require() must be called before importing gtk"
44-
# errors
19+
import matplotlib
20+
from matplotlib._pylab_helpers import Gcf
21+
from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
22+
FigureManagerBase, FigureCanvasBase
23+
from matplotlib.cbook import is_string_like, enumerate
24+
from matplotlib.figure import Figure
25+
from matplotlib.font_manager import fontManager
26+
from matplotlib.mathtext import math_parse_s_ft2font
27+
import matplotlib.numerix as numerix
28+
from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
29+
where, transpose, nonzero, indices, ones, nx
30+
4531
if numerix.which[0] == "numarray":
4632
from matplotlib.backends._na_backend_gdk import pixbuf_get_pixels_array
4733
else:
4834
from matplotlib.backends._nc_backend_gdk import pixbuf_get_pixels_array
4935

5036

51-
DEBUG = False
37+
backend_version = "%d.%d.%d" % gtk.pygtk_version
38+
_debug = False
5239

5340
# Image formats that this backend supports - for FileChooser and print_figure()
5441
IMAGE_FORMAT = ['eps', 'jpg', 'png', 'ps', 'svg'] + ['bmp'] # , 'raw', 'rgb']
@@ -486,7 +473,7 @@ def _render_figure(self, width, height):
486473
- rendering the pixmap to display (pylab.draw)
487474
- rendering the pixmap to save to a file (pylab.savefig)
488475
"""
489-
if DEBUG: print 'FigureCanvasGDK.%s' % fn_name()
476+
if _debug: print 'FigureCanvasGDK.%s' % fn_name()
490477
create_pixmap = False
491478
if width > self._pixmap_width:
492479
# increase the pixmap in 10%+ (rather than 1 pixel) steps
@@ -498,7 +485,7 @@ def _render_figure(self, width, height):
498485
create_pixmap = True
499486

500487
if create_pixmap:
501-
if DEBUG: print 'FigureCanvasGTK.%s new pixmap' % fn_name()
488+
if _debug: print 'FigureCanvasGTK.%s new pixmap' % fn_name()
502489
self._pixmap = gtk.gdk.Pixmap (None, self._pixmap_width,
503490
self._pixmap_height, depth=24)
504491
# gtk backend must use self.window

0 commit comments

Comments
 (0)