[bitbake-devel,8/8] Hob: add auto scroll to rows which be new appended in hob building log page

Submitted by Shane Wang on March 22, 2012, 3:38 p.m.

Details

Message ID 7d3e77fcd31137d24e3c9782f0cfcc30ebc80a01.1332430442.git.shane.wang@intel.com
State New
Headers show

Commit Message

Shane Wang March 22, 2012, 3:38 p.m.
From: Liming An <limingx.l.an@intel.com>

For make the building screen to provide clear information about task in progress by request, so add this function.

At the beginning of building, the vertical scroll bar will go to the active area automatically.
Once the user moves the scroll bar in the middle, the automatic move of the bar is disabled.
However, once the user moves it to the bottom again, it will be kept to the bottom even though more logs come.

[Yocto #2098]

Signed-off-by: Liming An <limingx.l.an@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builddetailspage.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/bitbake/lib/bb/ui/crumbs/builddetailspage.py b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
index 92ca176..5f1524f 100755
--- a/bitbake/lib/bb/ui/crumbs/builddetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
@@ -38,7 +38,7 @@  class BuildDetailsPage (HobPage):
         super(BuildDetailsPage, self).__init__(builder, "Building ...")
 
         self.num_of_issues = 0
-
+        self.endpath = (0,)
         # create visual elements
         self.create_visual_elements()
 
@@ -77,6 +77,8 @@  class BuildDetailsPage (HobPage):
         self.scrolled_view_build.add(self.build_tv)
         self.notebook.append_page(self.scrolled_view_build, gtk.Label("Log"))
 
+        self.builder.handler.build.model.connect_after("row-changed", self.scroll_to_present_row, self.scrolled_view_build.get_vadjustment(), self.build_tv)
+
         self.button_box = gtk.HBox(False, 6)
         self.back_button = HobAltButton("Back to image configuration")
         self.back_button.connect("clicked", self.back_button_clicked_cb)
@@ -138,3 +140,10 @@  class BuildDetailsPage (HobPage):
 
     def hide_stop_button(self):
         self.stop_button.hide()
+
+    def scroll_to_present_row(self, model, path, iter, v_adj, treeview):
+        if treeview and v_adj:
+            if path[0] > self.endpath[0]: # check the event is a new row append or not
+                self.endpath = path
+                if v_adj.value == (v_adj.upper - v_adj.page_size): # check the gtk.adjustment position is at end boundary or not
+                    treeview.scroll_to_cell(path)