summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/hobwidget.py
diff options
context:
space:
mode:
authorLiming An <limingx.l.an@intel.com>2012-03-22 19:03:35 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-23 16:10:24 +0000
commitf427bfa0e438ea618d0baf4ebfe4f8404eb4840e (patch)
tree48cde2457876a3c8418adca803ddee3866b0bb06 /bitbake/lib/bb/ui/crumbs/hobwidget.py
parent63648b9f1d2b6fc8928fccc9c7e1601be0ec529a (diff)
downloadpoky-f427bfa0e438ea618d0baf4ebfe4f8404eb4840e.tar.gz
Hob: reset the policy to forbid the horizontal scrolling for building log
This patch is not to show the horizontal scroll bar for building log, and add CellRendererText class to wrap the text. [Yocto #2091] (Bitbake rev: 7c5e1297c1af2edd46315e3dec4516f850d5e222) 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.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 9d144c906b..020c5e232d 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -732,3 +732,27 @@ class HobNotebook(gtk.VBox):
732 def set_search_entry_clear_cb(self, search, icon_pos, event): 732 def set_search_entry_clear_cb(self, search, icon_pos, event):
733 self.reset_entry(search) 733 self.reset_entry(search)
734 734
735class HobWarpCellRendererText(gtk.CellRendererText):
736 def __init__(self, col_number):
737 gtk.CellRendererText.__init__(self)
738 self.set_property("wrap-mode", pango.WRAP_WORD_CHAR)
739 self.set_property("wrap-width", 300) # default value wrap width is 300
740 self.col_n = col_number
741
742 def do_render(self, window, widget, background_area, cell_area, expose_area, flags):
743 if widget:
744 self.props.wrap_width = self.get_resized_wrap_width(widget, widget.get_column(self.col_n))
745 return gtk.CellRendererText.do_render(self, window, widget, background_area, cell_area, expose_area, flags)
746
747 def get_resized_wrap_width(self, treeview, column):
748 otherCols = []
749 for col in treeview.get_columns():
750 if col != column:
751 otherCols.append(col)
752 adjwidth = treeview.allocation.width - sum(c.get_width() for c in otherCols)
753 adjwidth -= treeview.style_get_property("horizontal-separator") * 4
754 if self.props.wrap_width == adjwidth or adjwidth <= 0:
755 adjwidth = self.props.wrap_width
756 return adjwidth
757
758gobject.type_register(HobWarpCellRendererText)