summaryrefslogtreecommitdiffstats
path: root/bitbake
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
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')
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builddetailspage.py6
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobwidget.py24
-rw-r--r--bitbake/lib/bb/ui/crumbs/runningbuild.py7
3 files changed, 31 insertions, 6 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builddetailspage.py b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
index 3605ee1a6b..92ca176190 100755
--- a/bitbake/lib/bb/ui/crumbs/builddetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
@@ -58,7 +58,7 @@ class BuildDetailsPage (HobPage):
58 self.config_model = self.builder.handler.build.model.config_model() 58 self.config_model = self.builder.handler.build.model.config_model()
59 self.config_tv.set_model(self.config_model) 59 self.config_tv.set_model(self.config_model)
60 self.scrolled_view_config = gtk.ScrolledWindow () 60 self.scrolled_view_config = gtk.ScrolledWindow ()
61 self.scrolled_view_config.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) 61 self.scrolled_view_config.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
62 self.scrolled_view_config.add(self.config_tv) 62 self.scrolled_view_config.add(self.config_tv)
63 self.notebook.append_page(self.scrolled_view_config, gtk.Label("Build Configuration")) 63 self.notebook.append_page(self.scrolled_view_config, gtk.Label("Build Configuration"))
64 64
@@ -66,14 +66,14 @@ class BuildDetailsPage (HobPage):
66 self.failure_model = self.builder.handler.build.model.failure_model() 66 self.failure_model = self.builder.handler.build.model.failure_model()
67 self.failure_tv.set_model(self.failure_model) 67 self.failure_tv.set_model(self.failure_model)
68 self.scrolled_view_failure = gtk.ScrolledWindow () 68 self.scrolled_view_failure = gtk.ScrolledWindow ()
69 self.scrolled_view_failure.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) 69 self.scrolled_view_failure.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
70 self.scrolled_view_failure.add(self.failure_tv) 70 self.scrolled_view_failure.add(self.failure_tv)
71 self.notebook.append_page(self.scrolled_view_failure, gtk.Label("Issues")) 71 self.notebook.append_page(self.scrolled_view_failure, gtk.Label("Issues"))
72 72
73 self.build_tv = RunningBuildTreeView(readonly=True) 73 self.build_tv = RunningBuildTreeView(readonly=True)
74 self.build_tv.set_model(self.builder.handler.build.model) 74 self.build_tv.set_model(self.builder.handler.build.model)
75 self.scrolled_view_build = gtk.ScrolledWindow () 75 self.scrolled_view_build = gtk.ScrolledWindow ()
76 self.scrolled_view_build.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) 76 self.scrolled_view_build.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
77 self.scrolled_view_build.add(self.build_tv) 77 self.scrolled_view_build.add(self.build_tv)
78 self.notebook.append_page(self.scrolled_view_build, gtk.Label("Log")) 78 self.notebook.append_page(self.scrolled_view_build, gtk.Label("Log"))
79 79
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)
diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py
index 4c3fe2cedc..f202a9098e 100644
--- a/bitbake/lib/bb/ui/crumbs/runningbuild.py
+++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py
@@ -27,6 +27,7 @@ import urllib
27import urllib2 27import urllib2
28import pango 28import pango
29from bb.ui.crumbs.hobcolor import HobColors 29from bb.ui.crumbs.hobcolor import HobColors
30from bb.ui.crumbs.hobwidget import HobWarpCellRendererText
30 31
31class RunningBuildModel (gtk.TreeStore): 32class RunningBuildModel (gtk.TreeStore):
32 (COL_LOG, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON, COL_COLOR, COL_NUM_ACTIVE) = range(7) 33 (COL_LOG, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON, COL_COLOR, COL_NUM_ACTIVE) = range(7)
@@ -350,7 +351,7 @@ class RunningBuildTreeView (gtk.TreeView):
350 self.append_column (col) 351 self.append_column (col)
351 352
352 # The message of the build. 353 # The message of the build.
353 self.message_renderer = gtk.CellRendererText () 354 self.message_renderer = HobWarpCellRendererText (col_number=1)
354 self.message_column = gtk.TreeViewColumn ("Message", self.message_renderer, text=3) 355 self.message_column = gtk.TreeViewColumn ("Message", self.message_renderer, text=3)
355 self.message_column.add_attribute(self.message_renderer, 'background', 5) 356 self.message_column.add_attribute(self.message_renderer, 'background', 5)
356 self.message_renderer.set_property('editable', (not self.readonly)) 357 self.message_renderer.set_property('editable', (not self.readonly))
@@ -419,7 +420,7 @@ class BuildConfigurationTreeView(gtk.TreeView):
419 self.get_selection().set_mode(gtk.SELECTION_SINGLE) 420 self.get_selection().set_mode(gtk.SELECTION_SINGLE)
420 421
421 # The message of the build. 422 # The message of the build.
422 self.message_renderer = gtk.CellRendererText () 423 self.message_renderer = HobWarpCellRendererText (col_number=0)
423 self.message_column = gtk.TreeViewColumn ("Message", self.message_renderer, text=RunningBuildModel.COL_MESSAGE, background=RunningBuildModel.COL_COLOR) 424 self.message_column = gtk.TreeViewColumn ("Message", self.message_renderer, text=RunningBuildModel.COL_MESSAGE, background=RunningBuildModel.COL_COLOR)
424 font = self.get_style().font_desc 425 font = self.get_style().font_desc
425 font.set_size(pango.SCALE * 13) 426 font.set_size(pango.SCALE * 13)
@@ -442,6 +443,6 @@ class BuildFailureTreeView(gtk.TreeView):
442 self.append_column (col) 443 self.append_column (col)
443 444
444 # The message of the build. 445 # The message of the build.
445 self.message_renderer = gtk.CellRendererText () 446 self.message_renderer = HobWarpCellRendererText (col_number=1)
446 self.message_column = gtk.TreeViewColumn ("Message", self.message_renderer, text=RunningBuildModel.COL_MESSAGE, background=RunningBuildModel.COL_COLOR) 447 self.message_column = gtk.TreeViewColumn ("Message", self.message_renderer, text=RunningBuildModel.COL_MESSAGE, background=RunningBuildModel.COL_COLOR)
447 self.append_column (self.message_column) 448 self.append_column (self.message_column)