From 50bf3d59c159a8501bf5edcd7eee9272629362c8 Mon Sep 17 00:00:00 2001 From: Andrei Dinu Date: Wed, 15 May 2013 09:59:26 +0000 Subject: [PATCH] bitbake: propertydialog.py : Scrollable windows for long tooltips In some cases, the length of the description and the brought in by field was too big. That led to the size of the property dialog exceeding Hob's size. For long tooltips we use scrollable windows now. [HOB #4321] (Bitbake rev: 78ecabf19bf01e5a662b6e2b865cd93bf47d962b) Signed-off-by: Andrei Dinu Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/crumbs/hig/propertydialog.py | 63 ++++++++++++++++---------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/bitbake/lib/bb/ui/crumbs/hig/propertydialog.py b/bitbake/lib/bb/ui/crumbs/hig/propertydialog.py index 5bd9f95..bc40741 100644 --- a/bitbake/lib/bb/ui/crumbs/hig/propertydialog.py +++ b/bitbake/lib/bb/ui/crumbs/hig/propertydialog.py @@ -275,24 +275,23 @@ class PropertyDialog(CrumbsDialog): binb_items_count = len(binb.split(',')) binb_items = binb.split(',') - vbox = gtk.VBox(True,spacing = 0) - + vbox = gtk.VBox(False,spacing = 0) + ######################################## SUMMARY LABEL ######################################### if summary != '': self.label_short = gtk.Label() - self.label_short.set_size_request(300,-1) + self.label_short.set_width_chars(37) self.label_short.set_selectable(True) self.label_short.set_line_wrap(True) self.label_short.set_markup("" + summary + "") self.label_short.set_property("xalign", 0) - self.vbox.pack_start(self.label_short, expand=False, fill=False, padding=0) + self.vbox.add(self.label_short) ########################################## NAME ROW + COL ####################################### self.label_short = gtk.Label() - self.label_short.set_size_request(300,-1) self.label_short.set_selectable(True) self.label_short.set_line_wrap(True) self.label_short.set_markup("Name: " + name) @@ -303,7 +302,6 @@ class PropertyDialog(CrumbsDialog): ####################################### VERSION ROW + COL #################################### self.label_short = gtk.Label() - self.label_short.set_size_request(300,-1) self.label_short.set_selectable(True) self.label_short.set_line_wrap(True) self.label_short.set_markup("Version: " + version) @@ -314,7 +312,6 @@ class PropertyDialog(CrumbsDialog): ##################################### REVISION ROW + COL ##################################### self.label_short = gtk.Label() - self.label_short.set_size_request(300,-1) self.label_short.set_line_wrap(True) self.label_short.set_selectable(True) self.label_short.set_markup("Revision: " + revision) @@ -325,7 +322,6 @@ class PropertyDialog(CrumbsDialog): ################################## GROUP ROW + COL ############################################ self.label_short = gtk.Label() - self.label_short.set_size_request(300,-1) self.label_short.set_selectable(True) self.label_short.set_line_wrap(True) self.label_short.set_markup("Group: " + group) @@ -347,7 +343,6 @@ class PropertyDialog(CrumbsDialog): self.label_info.set_property("xalign", 0) self.label_short = gtk.Label() - self.label_short.set_size_request(300,-1) self.label_short.set_selectable(True) self.label_short.set_line_wrap(True) self.label_short.set_markup("Homepage: ") @@ -369,7 +364,6 @@ class PropertyDialog(CrumbsDialog): self.label_info.set_property("xalign", 0) self.label_short = gtk.Label() - self.label_short.set_size_request(300,-1) self.label_short.set_selectable(True) self.label_short.set_line_wrap(True) self.label_short.set_markup("Bugtracker: ") @@ -381,7 +375,6 @@ class PropertyDialog(CrumbsDialog): ################################# LICENSE ROW + COL ############################################ self.label_info = gtk.Label() - self.label_info.set_size_request(300,-1) self.label_info.set_selectable(True) self.label_info.set_line_wrap(True) self.label_info.set_markup(license) @@ -404,16 +397,25 @@ class PropertyDialog(CrumbsDialog): self.label_short.set_line_wrap(True) self.label_short.set_markup("Brought in by: ") self.label_short.set_property("xalign", 0) - + self.vbox.add(self.label_short) self.label_info = gtk.Label() - self.label_info.set_size_request(300,-1) self.label_info.set_selectable(True) - self.label_info.set_markup(binb) - self.label_info.set_property("xalign", 0) - self.label_info.set_line_wrap(True) - - self.vbox.add(self.label_short) - self.vbox.add(self.label_info) + self.label_info.set_width_chars(36) + if len(binb) > 200: + scrolled_window = gtk.ScrolledWindow() + scrolled_window.set_policy(gtk.POLICY_NEVER,gtk.POLICY_ALWAYS) + scrolled_window.set_size_request(100,100) + self.label_info.set_markup(binb) + self.label_info.set_padding(6,6) + self.label_info.set_alignment(0,0) + self.label_info.set_line_wrap(True) + scrolled_window.add_with_viewport(self.label_info) + self.vbox.add(scrolled_window) + else: + self.label_info.set_markup(binb) + self.label_info.set_property("xalign", 0) + self.label_info.set_line_wrap(True) + self.vbox.add(self.label_info) ################################ DESCRIPTION TAG ROW ################################################# @@ -428,11 +430,22 @@ class PropertyDialog(CrumbsDialog): hbox = gtk.HBox(True,spacing = 0) self.label_short = gtk.Label() - self.label_short.set_size_request(300,-1) - self.label_short.set_selectable(True) - self.label_short.set_text(description) - self.label_short.set_line_wrap(True) - self.label_short.set_property("xalign", 0) - self.vbox.add(self.label_short) + self.label_short.set_selectable(True) + self.label_short.set_width_chars(36) + if len(description) > 200: + scrolled_window = gtk.ScrolledWindow() + scrolled_window.set_policy(gtk.POLICY_NEVER,gtk.POLICY_ALWAYS) + scrolled_window.set_size_request(100,100) + self.label_short.set_markup(description) + self.label_short.set_padding(6,6) + self.label_short.set_alignment(0,0) + self.label_short.set_line_wrap(True) + scrolled_window.add_with_viewport(self.label_short) + self.vbox.add(scrolled_window) + else: + self.label_short.set_markup(description) + self.label_short.set_property("xalign", 0) + self.label_short.set_line_wrap(True) + self.vbox.add(self.label_short) self.vbox.show_all() -- 2.7.4