@@ -132,9 +132,7 @@ def get_text_width_height(self, s, prop, ismath):
132
132
133
133
layout = self ._get_pango_layout (s , prop )
134
134
inkRect , logicalRect = layout .get_pixel_extents ()
135
- rect = inkRect
136
- #rect = logicalRect
137
- l , b , w , h = rect
135
+ l , b , w , h = inkRect
138
136
return w , h + 1
139
137
140
138
def get_canvas_width_height (self ):
@@ -488,6 +486,14 @@ def rgb_to_gdk_color(self, rgb):
488
486
return color
489
487
490
488
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
+
491
497
def set_clip_rectangle (self , rectangle ):
492
498
GraphicsContextBase .set_clip_rectangle (self , rectangle )
493
499
l ,b ,w ,h = rectangle
@@ -518,7 +524,6 @@ def set_foreground(self, fg, isRGB=False):
518
524
"""
519
525
GraphicsContextBase .set_foreground (self , fg , isRGB )
520
526
self .gdkGC .foreground = self .rgb_to_gdk_color (self .get_rgb ())
521
- #self.gdkGC.foreground = colorManager.get_gdk_color(self.get_rgb())
522
527
523
528
524
529
def set_graylevel (self , frac ):
@@ -527,23 +532,8 @@ def set_graylevel(self, frac):
527
532
"""
528
533
GraphicsContextBase .set_graylevel (self , frac )
529
534
self .gdkGC .foreground = self .rgb_to_gdk_color (self .get_rgb ())
530
- #self.gdkGC.foreground = colorManager.get_gdk_color(self.get_rgb())
531
535
532
536
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
-
547
537
def set_joinstyle (self , js ):
548
538
"""
549
539
Set the join style to be one of ('miter', 'round', 'bevel')
@@ -552,6 +542,12 @@ def set_joinstyle(self, js):
552
542
self .gdkGC .join_style = self ._joind [self ._joinstyle ]
553
543
554
544
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
+
555
551
def error_msg_gtk (msg , parent = None ):
556
552
if parent : # find the toplevel gtk.Window
557
553
parent = parent .get_toplevel ()
0 commit comments