Skip to content

Commit 0d16c5c

Browse files
author
Steve Chaplin
committed
SC
svn path=/trunk/matplotlib/; revision=1531
1 parent aa68d15 commit 0d16c5c

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

CHANGELOG

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
New entries should be added at the top
22

3-
2005-09-30 setupext.py: added numarray_inc_dirs for building against
3+
2005-07-04 backend_gtk.py: require PyGTK version 2.0.0 or higher - SC
4+
5+
2005-06-30 setupext.py: added numarray_inc_dirs for building against
46
numarray when not installed in standard location - ADS
57

68
2005-06-27 backend_svg.py: write figure width, height as int, not float.

lib/matplotlib/backends/backend_gdk.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,21 @@ def fn_name(): return sys._getframe(1).f_code.co_name
1818
from matplotlib.font_manager import fontManager
1919
from matplotlib.mathtext import math_parse_s_ft2font
2020

21-
pygtk_version_required = (1,99,16)
21+
pygtk_version_required = (2,0,0)
2222
try:
2323
import pygtk
2424
if not matplotlib.FROZEN:
2525
pygtk.require('2.0')
2626
except:
2727
print >> sys.stderr, sys.exc_info()[1]
28-
raise SystemExit('PyGTK version %d.%d.%d or greater is required to run the GTK Matplotlib backends'
28+
raise SystemExit('PyGTK version %d.%d.%d or greater is required to run '
29+
'the GTK Matplotlib backends'
2930
% pygtk_version_required)
3031

31-
import gtk, pango
32-
from gtk import gdk
32+
import gobject
33+
import gtk; gdk = gtk.gdk
34+
import pango
35+
3336
if gtk.pygtk_version < pygtk_version_required:
3437
raise SystemExit ("PyGTK %d.%d.%d is installed\n"
3538
"PyGTK %d.%d.%d or later is required"
@@ -149,7 +152,7 @@ def draw_line(self, gc, x1, y1, x2, y2):
149152
int(x2), self.height-int(y2))
150153

151154

152-
def draw_lines(self, gc, x, y):
155+
def draw_lines(self, gc, x, y, transform=None):
153156
x = x.astype(nx.Int16)
154157
y = self.height - y.astype(nx.Int16)
155158
self.gdkDrawable.draw_lines(gc.gdkGC, zip(x,y))

lib/matplotlib/backends/backend_gtk.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def fn_name(): return sys._getframe(1).f_code.co_name
2020

2121
from backend_gdk import RendererGDK
2222

23-
pygtk_version_required = (1,99,16)
23+
pygtk_version_required = (2,0,0)
2424
try:
2525
import pygtk
2626
if not matplotlib.FROZEN:
@@ -31,8 +31,9 @@ def fn_name(): return sys._getframe(1).f_code.co_name
3131
'the GTK Matplotlib backends'
3232
% pygtk_version_required)
3333

34-
import gtk, gobject, pango
35-
from gtk import gdk
34+
import gobject
35+
import gtk; gdk = gtk.gdk
36+
import pango
3637

3738
if gtk.pygtk_version < pygtk_version_required:
3839
raise SystemExit ("PyGTK %d.%d.%d is installed\n"
@@ -285,14 +286,14 @@ def expose_event(self, widget, event):
285286
return False
286287

287288
if self._draw_pixmap:
288-
width, height = self.allocation.width, self.allocation.height
289-
self._render_figure(width, height)
289+
x, y, w, h = self.allocation
290+
self._render_figure(w, h)
290291
self.window.set_back_pixmap (self._pixmap, False)
291292
self.window.clear() # draw pixmap as the gdk.Window's bg
292293
self._draw_pixmap = False
293294
else: # workaround pygtk 2.6 problem - bg not being redrawn
294-
self.window.clear_area (event.area.x, event.area.y,
295-
event.area.width, event.area.height)
295+
x, y, w, h = event.area
296+
self.window.clear_area (x, y, w, h)
296297

297298
return False # allow signal to propagate further
298299

0 commit comments

Comments
 (0)