Skip to contentSkip to conversation

Hob: bug-fixes

PATCH Applied Liming An 2 participants 6 messages May 8, 2012 – May 9, 2012 Arm STM32

lore
Share & tools
lore

Liming An

author
#0 lore raw

cover Hob: bug-fixes

The following changes since commit 38da655788361e949d605bebfab45cf5830df613:

glib-2.0: Fix issues with libelf dependency creeping in (2012-05-07 16:42:48 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib limx/hob-bug-fixes-continue
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=limx/hob-bug-fixes-continue

Liming An (4):
Hob: change the refresh icon speed to make it view clear
Hob: add original url show function with the tooltip hyperlink for
user
Hob: add group number show and 'bold' visible effect for Package view
Hob: change the workflow about click 'Run Image' to run directly
after builded a qemu image

 bitbake/lib/bb/ui/crumbs/builder.py              |   52 ++++++---
 bitbake/lib/bb/ui/crumbs/hoblistmodel.py         |    7 +-
 bitbake/lib/bb/ui/crumbs/hobwidget.py            |   41 ++++++-
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py     |  139 +++++++++++-----------
 bitbake/lib/bb/ui/crumbs/packageselectionpage.py |   26 ++++
 bitbake/lib/bb/ui/crumbs/persistenttooltip.py    |   19 +++
 6 files changed, 194 insertions(+), 90 deletions(-)
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH 1/4 Hob: change the refresh icon speed to make it view clear

Because the arrow icon refresh so fast as the go backward by illusion, so adjust it slow.

[YOCTO #2335]

---
 bitbake/lib/bb/ui/crumbs/hobwidget.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
bitbake/lib/bb/ui/crumbs/hobwidget.py +1 -1
index 751b3e0..6cf73b0 100644
@@ -1057,7 +1057,7 @@ class HobCellRendererPixbuf(gtk.CellRendererPixbuf):
             if self.control.is_active():
                 self.control.on_draw_pixbuf_cb(pix, window.cairo_create(), x, y, w, h, True)
             else:
-                self.control.start_run(200, 0, 0, 1000, 200, tree)
+                self.control.start_run(200, 0, 0, 1000, 150, tree)
         else:
             self.control.remove_running_cell_area(cell_area)
             self.control.on_draw_pixbuf_cb(pix, window.cairo_create(), x, y, w, h, False)
Signature · 1 line
1.7.5.4
author
#2 lore raw

PATCH 2/4 Hob: add original url show function with the tooltip hyperlink for user

When case about No browser, such as running in 'Build Appliance', user can't open the hyper link, so add this work around for user. (Checking the browser is avaiable or not is hard by different system and browser type)

[CTO #2340]

---
 bitbake/lib/bb/ui/crumbs/persistenttooltip.py |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
bitbake/lib/bb/ui/crumbs/persistenttooltip.py +19 -0
index b43d297..927c194 100644
@@ -125,11 +125,17 @@ class PersistentTooltip(gtk.Window):
                 style.fg[gtk.STATE_NORMAL] = gtk.gdk.color_parse(val)
                 self.label.set_style(style)
                 break # we only care for the tooltip_fg_color
+
         self.label.set_markup(markup)
         self.label.show()
         bin.add(self.label)
         hbox.pack_end(bin, True, True, 6)
 
+        # add the original URL display for user reference
+        if 'a href' in markup:
+            hbox.set_tooltip_text(self.get_markup_url(markup))
+        hbox.show()
+
         self.connect("key-press-event", self._catch_esc_cb)
 
     """
@@ -165,3 +171,16 @@ class PersistentTooltip(gtk.Window):
     def hide(self):
         self.shown = False
         gtk.Window.hide(self)
+
+    """
+    Called to get the hyperlink URL from markup text.
+    """
+    def get_markup_url(self, markup):
+        url = "http:"
+        if markup and type(markup) == str:
+            s = markup
+            if 'http:' in s:
+                import re
+                url = re.search('(http:[^,\\ "]+)', s).group(0)
+
+        return url
Signature · 1 line
1.7.5.4
author
#3 lore raw

PATCH 3/4 Hob: add group number show and 'bold' visible effect for Package view

In reply to Liming An

as ui design, add number of packages for each group, and make the text font to 'bold' when row be selected

[YOCTO #2195]

---
 bitbake/lib/bb/ui/crumbs/hoblistmodel.py         |    7 ++--
 bitbake/lib/bb/ui/crumbs/hobwidget.py            |   39 +++++++++++++++++++--
 bitbake/lib/bb/ui/crumbs/packageselectionpage.py |   26 ++++++++++++++
 3 files changed, 65 insertions(+), 7 deletions(-)
bitbake/lib/bb/ui/crumbs/hoblistmodel.py +4 -3
index 3f53432..0b54f91 100644
@@ -34,7 +34,7 @@ class PackageListModel(gtk.TreeStore):
     providing convenience functions to access gtk.TreeModel subclasses which
     provide filtered views of the data.
     """
-    (COL_NAME, COL_VER, COL_REV, COL_RNM, COL_SEC, COL_SUM, COL_RDEP, COL_RPROV, COL_SIZE, COL_BINB, COL_INC, COL_FADE_INC) = range(12)
+    (COL_NAME, COL_VER, COL_REV, COL_RNM, COL_SEC, COL_SUM, COL_RDEP, COL_RPROV, COL_SIZE, COL_BINB, COL_INC, COL_FADE_INC, COL_FONT) = range(13)
 
     __gsignals__ = {
         "package-selection-changed" : (gobject.SIGNAL_RUN_LAST,
@@ -65,7 +65,8 @@ class PackageListModel(gtk.TreeStore):
                                 gobject.TYPE_STRING,
                                 gobject.TYPE_STRING,
                                 gobject.TYPE_BOOLEAN,
-                                gobject.TYPE_BOOLEAN)
+                                gobject.TYPE_BOOLEAN,
+                                gobject.TYPE_STRING)
 
 
     """
@@ -189,7 +190,7 @@ class PackageListModel(gtk.TreeStore):
                      self.COL_SEC, section, self.COL_SUM, summary,
                      self.COL_RDEP, rdep + ' ' + rrec,
                      self.COL_RPROV, rprov, self.COL_SIZE, size,
-                     self.COL_BINB, "", self.COL_INC, False)
+                     self.COL_BINB, "", self.COL_INC, False, self.COL_FONT, '10')
 
     """
     Check whether the item at item_path is included or not
bitbake/lib/bb/ui/crumbs/hobwidget.py +35 -4
index 6cf73b0..3942827 100644
@@ -119,6 +119,7 @@ class HobViewTable (gtk.VBox):
         self.table_tree.set_headers_clickable(True)
         self.table_tree.set_enable_search(True)
         self.table_tree.set_rules_hint(True)
+        self.table_tree.set_enable_tree_lines(True)
         self.table_tree.get_selection().set_mode(gtk.SELECTION_SINGLE)
         self.toggle_columns = []
         self.table_tree.connect("row-activated", self.row_activated_cb)
@@ -140,6 +141,8 @@ class HobViewTable (gtk.VBox):
                 cell = gtk.CellRendererText()
                 col.pack_start(cell, True)
                 col.set_attributes(cell, text=column['col_id'])
+                if 'col_t_id' in column.keys():
+                    col.add_attribute(cell, 'font', column['col_t_id'])
             elif column['col_style'] == 'check toggle':
                 cell = HobCellRendererToggle()
                 cell.set_property('activatable', True)
@@ -149,6 +152,8 @@ class HobViewTable (gtk.VBox):
                 col.pack_end(cell, True)
                 col.set_attributes(cell, active=column['col_id'])
                 self.toggle_columns.append(column['col_name'])
+                if 'col_group' in column.keys():
+                    col.set_cell_data_func(cell, self.set_group_number_cb)
             elif column['col_style'] == 'radio toggle':
                 cell = gtk.CellRendererToggle()
                 cell.set_property('activatable', True)
@@ -162,6 +167,8 @@ class HobViewTable (gtk.VBox):
                 cell = gtk.CellRendererText()
                 col.pack_start(cell, True)
                 col.set_cell_data_func(cell, self.display_binb_cb, column['col_id'])
+                if 'col_t_id' in column.keys():
+                    col.add_attribute(cell, 'font', column['col_t_id'])
 
         scroll = gtk.ScrolledWindow()
         scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
@@ -204,6 +211,15 @@ class HobViewTable (gtk.VBox):
     def stop_cell_fadeinout_cb(self, ctrl, cell, tree):
         self.emit("cell-fadeinout-stopped", ctrl, cell, tree)
 
+    def set_group_number_cb(self, col, cell, model, iter):
+        if model and (model.iter_parent(iter) == None):
+            cell.cell_attr["number_of_children"] = model.iter_n_children(iter)
+        else:
+            cell.cell_attr["number_of_children"] = 0
+
+    def connect_group_selection(self, cb_func):
+        self.table_tree.get_selection().connect("changed", cb_func)
+
 """
 A method to calculate a softened value for the colour of widget when in the
 provided state.
@@ -1084,11 +1100,17 @@ class HobCellRendererToggle(gtk.CellRendererToggle):
         gtk.CellRendererToggle.__init__(self)
         self.ctrl = HobCellRendererController(is_draw_row=True)
         self.ctrl.running_mode = self.ctrl.MODE_ONE_SHORT
-        self.cell_attr = {"fadeout": False}
+        self.cell_attr = {"fadeout": False, "number_of_children": 0}
 
     def do_render(self, window, widget, background_area, cell_area, expose_area, flags):
         if (not self.ctrl) or (not widget):
             return
+
+        if flags & gtk.CELL_RENDERER_SELECTED:
+            state = gtk.STATE_SELECTED
+        else:
+            state = gtk.STATE_NORMAL
+
         if self.ctrl.is_active():
             path = widget.get_path_at_pos(cell_area.x + cell_area.width/2, cell_area.y + cell_area.height/2)
             # sometimes the parameters of cell_area will be a negative number,such as pull up down the scroll bar
@@ -1097,14 +1119,23 @@ class HobCellRendererToggle(gtk.CellRendererToggle):
             path = path[0]
             if path in self.ctrl.running_cell_areas:
                 cr = window.cairo_create()
-                color = gtk.gdk.Color(HobColors.WHITE)
+                color = widget.get_style().base[state]
 
                 row_x, _, row_width, _ = widget.get_visible_rect()
                 border_y = self.get_property("ypad")
                 self.ctrl.on_draw_fadeinout_cb(cr, color, row_x, cell_area.y - border_y, row_width, \
                                                cell_area.height + border_y * 2, self.cell_attr["fadeout"])
-
-        return gtk.CellRendererToggle.do_render(self, window, widget, background_area, cell_area, expose_area, flags)
+        # draw number of a group
+        if self.cell_attr["number_of_children"]:
+            text = "%d pkg" % self.cell_attr["number_of_children"]
+            pangolayout = widget.create_pango_layout(text)
+            textw, texth = pangolayout.get_pixel_size()
+            x = cell_area.x + (cell_area.width/2) - (textw/2)
+            y = cell_area.y + (cell_area.height/2) - (texth/2)
+
+            widget.style.paint_layout(window, state, True, cell_area, widget, "checkbox", x, y, pangolayout)
+        else:
+            return gtk.CellRendererToggle.do_render(self, window, widget, background_area, cell_area, expose_area, flags)
 
     '''delay: normally delay time is 1000ms
        cell_list: whilch cells need to be render
bitbake/lib/bb/ui/crumbs/packageselectionpage.py +26 -0
index 104d49d..238e2f9 100755
@@ -39,6 +39,7 @@ class PackageSelectionPage (HobPage):
          'columns' : [{
                        'col_name' : 'Package name',
                        'col_id'   : PackageListModel.COL_NAME,
+                       'col_t_id' : PackageListModel.COL_FONT,
                        'col_style': 'text',
                        'col_min'  : 100,
                        'col_max'  : 300,
@@ -46,6 +47,7 @@ class PackageSelectionPage (HobPage):
                       }, {
                        'col_name' : 'Brought in by',
                        'col_id'   : PackageListModel.COL_BINB,
+                       'col_t_id' : PackageListModel.COL_FONT,
                        'col_style': 'binb',
                        'col_min'  : 100,
                        'col_max'  : 350,
@@ -53,6 +55,7 @@ class PackageSelectionPage (HobPage):
                       }, {
                        'col_name' : 'Size',
                        'col_id'   : PackageListModel.COL_SIZE,
+                       'col_t_id' : PackageListModel.COL_FONT,
                        'col_style': 'text',
                        'col_min'  : 100,
                        'col_max'  : 300,
@@ -60,7 +63,9 @@ class PackageSelectionPage (HobPage):
                       }, {
                        'col_name' : 'Included',
                        'col_id'   : PackageListModel.COL_INC,
+                       'col_t_id' : PackageListModel.COL_FONT,
                        'col_style': 'check toggle',
+                       'col_group': 'tree store group',
                        'col_min'  : 100,
                        'col_max'  : 100
                      }]
@@ -70,6 +75,7 @@ class PackageSelectionPage (HobPage):
          'columns' : [{
                        'col_name' : 'Package name',
                        'col_id'   : PackageListModel.COL_NAME,
+                       'col_t_id' : PackageListModel.COL_FONT,
                        'col_style': 'text',
                        'col_min'  : 100,
                        'col_max'  : 400,
@@ -77,6 +83,7 @@ class PackageSelectionPage (HobPage):
                       }, {
                        'col_name' : 'Size',
                        'col_id'   : PackageListModel.COL_SIZE,
+                       'col_t_id' : PackageListModel.COL_FONT,
                        'col_style': 'text',
                        'col_min'  : 100,
                        'col_max'  : 500,
@@ -85,6 +92,7 @@ class PackageSelectionPage (HobPage):
                        'col_name' : 'Included',
                        'col_id'   : PackageListModel.COL_INC,
                        'col_style': 'check toggle',
+                       'col_group': 'tree store group',
                        'col_min'  : 100,
                        'col_max'  : 100
                       }]
@@ -117,6 +125,7 @@ class PackageSelectionPage (HobPage):
             filter = page['filter']
             tab.set_model(self.package_model.tree_model(filter))
             tab.connect("toggled", self.table_toggled_cb, page['name'])
+            tab.connect_group_selection(self.table_selected_cb)
             if page['name'] == "Included":
                 tab.connect("button-release-event", self.button_click_cb)
                 tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
@@ -247,3 +256,20 @@ class PackageSelectionPage (HobPage):
     def after_fadeout_checkin_include(self, table, ctrl, cell, tree):
         tree.set_model(self.package_model.tree_model(self.pages[0]['filter']))
         tree.expand_all()
+
+    def foreach_cell_change_font(self, model, path, iter, paths=None):
+        # Changed the font for a group cells
+        if path and iter and path[0] == paths[0]:
+            self.package_model.set(iter, self.package_model.COL_FONT, "bold")
+        else:
+            if iter and model.iter_parent(iter) == None:
+                self.package_model.set(iter, self.package_model.COL_FONT, '11')
+            else:
+                self.package_model.set(iter, self.package_model.COL_FONT, '10')
+
+    def table_selected_cb(self, selection):
+        model, paths = selection.get_selected_rows()
+        if paths:
+            child_path = self.package_model.convert_vpath_to_path(model, paths[0])
+            self.package_model.foreach(self.foreach_cell_change_font, child_path)
+
Signature · 1 line
1.7.5.4
author
#4 lore raw

PATCH 4/4 Hob: change the workflow about click 'Run Image' to run directly after builded a qemu image

In reply to Liming An

[YOCTO #2155]

---
 bitbake/lib/bb/ui/crumbs/builder.py          |   52 +++++++---
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py |  139 +++++++++++++------------
 2 files changed, 109 insertions(+), 82 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +37 -15
index 4b274a7..42d0f2c 100755
@@ -1047,6 +1047,21 @@ class Builder(gtk.Window):
         response = dialog.run()
         dialog.destroy()
 
+    def get_kernel_file_name(self, image_path):
+        name_list = []
+        kernel_name = ""
+        if image_path:
+            files = [f for f in os.listdir(image_path) if f[0] <> '.']
+            for check_file in files:
+                if check_file.endswith(".bin"):
+                    name_splits = check_file.split(".")[0]
+                    if self.configuration.curr_mach in name_splits.split("-"):
+                        kernel_name = check_file
+                    if not os.path.islink(os.path.join(image_path, check_file)):
+                        name_list.append(check_file)
+
+        return kernel_name, len(name_list)
+
     def runqemu_image(self, image_name):
         if not image_name:
             lbl = "<b>Please select an image to launch in QEMU.</b>"
@@ -1057,24 +1072,31 @@ class Builder(gtk.Window):
             dialog.destroy()
             return
 
-        dialog = gtk.FileChooserDialog("Load Kernel Files", self,
-                                       gtk.FILE_CHOOSER_ACTION_SAVE)
-        button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
-        HobAltButton.style_button(button)
-        button = dialog.add_button("Open", gtk.RESPONSE_YES)
-        HobButton.style_button(button)
-        filter = gtk.FileFilter()
-        filter.set_name("Kernel Files")
-        filter.add_pattern("*.bin")
-        dialog.add_filter(filter)
+        kernel_name, kernels_number = self.get_kernel_file_name(self.parameters.image_addr)
+        if not kernel_name or kernels_number > 1:
+            dialog = gtk.FileChooserDialog("Load Kernel Files", self,
+                                           gtk.FILE_CHOOSER_ACTION_SAVE)
+            button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
+            HobAltButton.style_button(button)
+            button = dialog.add_button("Open", gtk.RESPONSE_YES)
+            HobButton.style_button(button)
+            filter = gtk.FileFilter()
+            filter.set_name("Kernel Files")
+            filter.add_pattern("*.bin")
+            dialog.add_filter(filter)
 
-        dialog.set_current_folder(self.parameters.image_addr)
+            dialog.set_current_folder(self.parameters.image_addr)
 
-        response = dialog.run()
-        if response == gtk.RESPONSE_YES:
-            kernel_path = dialog.get_filename()
+            response = dialog.run()
+            if response == gtk.RESPONSE_YES:
+                kernel_path = dialog.get_filename()
+                image_path = os.path.join(self.parameters.image_addr, image_name)
+            dialog.destroy()
+
+        elif kernel_name:
+            kernel_path = os.path.join(self.parameters.image_addr, kernel_name)
             image_path = os.path.join(self.parameters.image_addr, image_name)
-        dialog.destroy()
+            response = gtk.RESPONSE_YES
 
         if response == gtk.RESPONSE_YES:
             source_env_path = os.path.join(self.parameters.core_base, "oe-init-build-env")
bitbake/lib/bb/ui/crumbs/imagedetailspage.py +72 -67

231 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#5 lore raw
In reply to Liming An
Quoted 8 lines · Liming An

The following changes since commit 38da655788361e949d605bebfab45cf5830df613:

glib-2.0: Fix issues with libelf dependency creeping in (2012-05-07 16:42:48 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib limx/hob-bug-fixes-continue
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=limx/hob-bug-fixes-continue

Quoted 7 lines

Liming An (4):
Hob: change the refresh icon speed to make it view clear
Hob: add original url show function with the tooltip hyperlink for
user
Hob: add group number show and 'bold' visible effect for Package view
Hob: change the workflow about click 'Run Image' to run directly
after builded a qemu image

Merged to master, thanks.

Richard