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

Skip to content

Commit 9c1cd9f

Browse files
author
Steve Chaplin
committed
SC 09/12/2004
svn path=/trunk/matplotlib/; revision=741
1 parent 3d4ed62 commit 9c1cd9f

6 files changed

Lines changed: 645 additions & 453 deletions

File tree

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
New entries should be added at the top
2+
2004-12-09 backend_gtk.py: split into two parts
3+
- backend_gdk.py - an image backend
4+
- backend_gtk.py - A GUI backend that uses GDK
5+
26
2004-12-08 backend_gtk.py: remove quit_after_print_xvfb(*args), show_xvfb(),
37
Dialog_MeasureTool(gtk.Dialog) one month after sending mail to
48
matplotlib-users asking if anyone still uses these functions - SC

lib/matplotlib/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -758,9 +758,9 @@ def rcdefaults():
758758
# flag)
759759

760760
_knownBackends = {
761-
'PS':1, 'GTK':1, 'Template':1, 'GD':1,
762-
'WX':1, 'Paint':1, 'Agg':1, 'GTKAgg':1, 'SVG':1,
763-
'TkAgg':1, 'WXAgg':1, 'FltkAgg':1, 'Cairo':1, 'GTKCairo':1,}
761+
'Agg':1, 'Cairo':1, 'FltkAgg':1, 'GD':1, 'GDK':1, 'GTK':1, 'GTKAgg':1,
762+
'GTKCairo':1, 'Paint':1, 'PS':1, 'SVG':1, 'Template':1, 'TkAgg':1, 'WX':1,
763+
'WXAgg':1, }
764764

765765
if hasattr(sys,'argv'): # mod_python doesn't have argv attr
766766
known = _knownBackends.keys()

lib/matplotlib/backends/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
__all__ = ['backend','show','draw_if_interactive','error_msg',
66
'new_figure_manager', 'backend_version']
77

8-
interactive_bk = ['GTK','GTKAgg','FltkAgg','TkAgg','WX','WXAgg','GTKCairo']
9-
non_interactive_bk = ['Template', 'PS','GD','Agg','SVG', 'Paint', 'Cairo']
8+
interactive_bk = ['GTK','GTKAgg','GTKCairo','FltkAgg','TkAgg','WX','WXAgg',]
9+
non_interactive_bk = ['Agg','Cairo','GD','GDK','Paint','PS','SVG','Template']
1010
all_backends = interactive_bk + non_interactive_bk
1111

1212
backend = matplotlib.get_backend()

lib/matplotlib/backends/backend_cairo.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -103,36 +103,6 @@ def _set_width_height(self, width, height):
103103
self.width = width
104104
self.height = height
105105

106-
def get_canvas_width_height(self):
107-
if DEBUG: print 'backend_cairo.RendererCairo.%s()' % _fn_name()
108-
return self.width, self.height
109-
110-
111-
def get_text_width_height(self, s, prop, ismath):
112-
if DEBUG: print 'backend_cairo.RendererCairo.%s()' % _fn_name()
113-
if ismath:
114-
print 'ismath get_text_width_height() not implemented yet'
115-
return 1, 1
116-
else:
117-
ctx = self.text_ctx
118-
ctx.save()
119-
ctx.select_font (prop.get_name(),
120-
self.fontangles [prop.get_style()],
121-
self.fontweights[prop.get_weight()])
122-
123-
# 1.4 scales font to a similar size to GTK / GTKAgg backends
124-
size = prop.get_size_in_points() * self.dpi.get() / PIXELS_PER_INCH * 1.4
125-
# problem - scale remembers last setting and font can become
126-
# enormous causing program to crash
127-
# save/restore prevents the problem
128-
ctx.scale_font (size)
129-
130-
w, h = ctx.text_extents (s)[2:4]
131-
ctx.restore()
132-
133-
return w, h
134-
135-
136106
def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2):
137107
if DEBUG: print 'backend_cairo.RendererCairo.%s()' % _fn_name()
138108
# cairo draws circular arcs (width=height)
@@ -280,6 +250,36 @@ def flipy(self):
280250
return True
281251

282252

253+
def get_canvas_width_height(self):
254+
if DEBUG: print 'backend_cairo.RendererCairo.%s()' % _fn_name()
255+
return self.width, self.height
256+
257+
258+
def get_text_width_height(self, s, prop, ismath):
259+
if DEBUG: print 'backend_cairo.RendererCairo.%s()' % _fn_name()
260+
if ismath:
261+
print 'ismath get_text_width_height() not implemented yet'
262+
return 1, 1
263+
else:
264+
ctx = self.text_ctx
265+
ctx.save()
266+
ctx.select_font (prop.get_name(),
267+
self.fontangles [prop.get_style()],
268+
self.fontweights[prop.get_weight()])
269+
270+
# 1.4 scales font to a similar size to GTK / GTKAgg backends
271+
size = prop.get_size_in_points() * self.dpi.get() / PIXELS_PER_INCH * 1.4
272+
# problem - scale remembers last setting and font can become
273+
# enormous causing program to crash
274+
# save/restore prevents the problem
275+
ctx.scale_font (size)
276+
277+
w, h = ctx.text_extents (s)[2:4]
278+
ctx.restore()
279+
280+
return w, h
281+
282+
283283
def new_gc(self):
284284
if DEBUG: print 'backend_cairo.RendererCairo.%s()' % _fn_name()
285285
gc = GraphicsContextCairo (renderer=self)

0 commit comments

Comments
 (0)