Skip to content

Commit c6244e3

Browse files
author
Steve Chaplin
committed
SC 20/11/2004
svn path=/trunk/matplotlib/; revision=703
1 parent 3c5a73d commit c6244e3

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

lib/matplotlib/backends/backend_gtk.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ def get_text_width_height(self, s, prop, ismath):
132132

133133
layout = self._get_pango_layout(s, prop)
134134
inkRect, logicalRect = layout.get_pixel_extents()
135-
rect = inkRect
136-
#rect = logicalRect
137-
l, b, w, h = rect
135+
l, b, w, h = inkRect
138136
return w, h+1
139137

140138
def get_canvas_width_height(self):
@@ -488,6 +486,14 @@ def rgb_to_gdk_color(self, rgb):
488486
return color
489487

490488

489+
def set_capstyle(self, cs):
490+
"""
491+
Set the capstyle as a string in ('butt', 'round', 'projecting')
492+
"""
493+
GraphicsContextBase.set_capstyle(self, cs)
494+
self.gdkGC.cap_style = self._capd[self._capstyle]
495+
496+
491497
def set_clip_rectangle(self, rectangle):
492498
GraphicsContextBase.set_clip_rectangle(self, rectangle)
493499
l,b,w,h = rectangle
@@ -518,7 +524,6 @@ def set_foreground(self, fg, isRGB=False):
518524
"""
519525
GraphicsContextBase.set_foreground(self, fg, isRGB)
520526
self.gdkGC.foreground = self.rgb_to_gdk_color(self.get_rgb())
521-
#self.gdkGC.foreground = colorManager.get_gdk_color(self.get_rgb())
522527

523528

524529
def set_graylevel(self, frac):
@@ -527,23 +532,8 @@ def set_graylevel(self, frac):
527532
"""
528533
GraphicsContextBase.set_graylevel(self, frac)
529534
self.gdkGC.foreground = self.rgb_to_gdk_color(self.get_rgb())
530-
#self.gdkGC.foreground = colorManager.get_gdk_color(self.get_rgb())
531535

532536

533-
def set_linewidth(self, w):
534-
GraphicsContextBase.set_linewidth(self, w)
535-
pixels = self.renderer.points_to_pixels(w)
536-
self.gdkGC.line_width = max(1, int(round(pixels)))
537-
538-
539-
def set_capstyle(self, cs):
540-
"""
541-
Set the capstyle as a string in ('butt', 'round', 'projecting')
542-
"""
543-
GraphicsContextBase.set_capstyle(self, cs)
544-
self.gdkGC.cap_style = self._capd[self._capstyle]
545-
546-
547537
def set_joinstyle(self, js):
548538
"""
549539
Set the join style to be one of ('miter', 'round', 'bevel')
@@ -552,6 +542,12 @@ def set_joinstyle(self, js):
552542
self.gdkGC.join_style = self._joind[self._joinstyle]
553543

554544

545+
def set_linewidth(self, w):
546+
GraphicsContextBase.set_linewidth(self, w)
547+
pixels = self.renderer.points_to_pixels(w)
548+
self.gdkGC.line_width = max(1, int(round(pixels)))
549+
550+
555551
def error_msg_gtk(msg, parent=None):
556552
if parent: # find the toplevel gtk.Window
557553
parent = parent.get_toplevel()

0 commit comments

Comments
 (0)