summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/hobwidget.py
diff options
context:
space:
mode:
authorLiming An <limingx.l.an@intel.com>2012-03-20 18:06:13 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-20 15:21:34 +0000
commit74c00988be573a24ef3bcf7ff70d355fe5facada (patch)
tree6863ae46b2195ac3756e9305c263a9ea79b71896 /bitbake/lib/bb/ui/crumbs/hobwidget.py
parent5e0461c0e0233700d5c9f36aee450cc091a1aeec (diff)
downloadpoky-74c00988be573a24ef3bcf7ff70d355fe5facada.tar.gz
Hob: add auto adjust background area function for long issue text
To add auto expand the background area function for long issue text input. (From Poky rev: f1822f0961bd719de0827e361f7e6fa3bf872746) (Bitbake rev: f406b0a11b021f8492ed0b083d9ff89de4a14653) Signed-off-by: Liming An <limingx.l.an@intel.com> Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hobwidget.py')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobwidget.py30
1 files changed, 21 insertions, 9 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 4c4b059267..bc27cd19d1 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -521,26 +521,38 @@ class HobTabBar(gtk.DrawingArea):
521 cr.fill() 521 cr.fill()
522 522
523 def draw_indicator(self, cr, child): 523 def draw_indicator(self, cr, child):
524 text = ("%d" % child["indicator_number"])
525 layout = self.create_pango_layout(text)
526 layout.set_font_description(self.font)
527 textw, texth = layout.get_pixel_size()
528 # draw the back round area
524 tab_x = child["x"] 529 tab_x = child["x"]
525 tab_y = child["y"] 530 tab_y = child["y"]
526 number = child["indicator_number"]
527 dest_w = int(32 * self.tab_w_ratio) 531 dest_w = int(32 * self.tab_w_ratio)
528 dest_h = int(32 * self.tab_h_ratio) 532 dest_h = int(32 * self.tab_h_ratio)
529 if dest_h < self.tab_height: 533 if dest_h < self.tab_height:
530 dest_w = dest_h 534 dest_w = dest_h
531
532 # x position is offset(tab_width*3/4 - icon_width/2) + start_pos(tab_x) 535 # x position is offset(tab_width*3/4 - icon_width/2) + start_pos(tab_x)
533 x = tab_x + self.tab_width * 3/4 - dest_w/2 536 x = tab_x + self.tab_width * 3/4 - dest_w/2
534 y = tab_y + self.tab_height/2 - dest_h/2 537 y = tab_y + self.tab_height/2 - dest_h/2
538
535 r = min(dest_w, dest_h)/2 539 r = min(dest_w, dest_h)/2
536 color = cr.set_source_color(gtk.gdk.color_parse(HobColors.ORANGE)) 540 color = cr.set_source_color(gtk.gdk.color_parse(HobColors.ORANGE))
537 cr.arc(x + r, y + r, r, 0, 2*math.pi) 541 # check round back area can contain the text or not
538 cr.fill() 542 back_round_can_contain_width = float(2 * r * 0.707)
539 543 if float(textw) > back_round_can_contain_width:
540 text = ("%d" % number) 544 xoff = (textw - int(back_round_can_contain_width)) / 2
541 layout = self.create_pango_layout(text) 545 cr.move_to(x + r - xoff, y + r + r)
542 layout.set_font_description(self.font) 546 cr.arc((x + r - xoff), (y + r), r, 0.5*math.pi, 1.5*math.pi)
543 textw, texth = layout.get_pixel_size() 547 cr.fill() # left half round
548 cr.rectangle((x + r - xoff), y, 2 * xoff, 2 * r)
549 cr.fill() # center rectangle
550 cr.arc((x + r + xoff), (y + r), r, 1.5*math.pi, 0.5*math.pi)
551 cr.fill() # right half round
552 else:
553 cr.arc((x + r), (y + r), r, 0, 2*math.pi)
554 cr.fill()
555 # draw the number text
544 x = x + (dest_w/2)-(textw/2) 556 x = x + (dest_w/2)-(textw/2)
545 y = y + (dest_h/2) - (texth/2) 557 y = y + (dest_h/2) - (texth/2)
546 cr.move_to(x, y) 558 cr.move_to(x, y)