All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Hob: bug-fixes
@ 2012-05-08 11:48 Liming An
  2012-05-08 11:48 ` [PATCH 1/4] Hob: change the refresh icon speed to make it view clear Liming An
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Liming An @ 2012-05-08 11:48 UTC (permalink / raw)
  To: bitbake-devel

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(-)

-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] Hob: change the refresh icon speed to make it view clear
  2012-05-08 11:48 [PATCH 0/4] Hob: bug-fixes Liming An
@ 2012-05-08 11:48 ` Liming An
  2012-05-08 11:48 ` [PATCH 2/4] Hob: add original url show function with the tooltip hyperlink for user Liming An
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Liming An @ 2012-05-08 11:48 UTC (permalink / raw)
  To: bitbake-devel

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

[YOCTO #2335]

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

diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 751b3e0..6cf73b0 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -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)
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] Hob: add original url show function with the tooltip hyperlink for user
  2012-05-08 11:48 [PATCH 0/4] Hob: bug-fixes Liming An
  2012-05-08 11:48 ` [PATCH 1/4] Hob: change the refresh icon speed to make it view clear Liming An
@ 2012-05-08 11:48 ` Liming An
  2012-05-08 11:48 ` [PATCH 3/4] Hob: add group number show and 'bold' visible effect for Package view Liming An
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Liming An @ 2012-05-08 11:48 UTC (permalink / raw)
  To: bitbake-devel

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]

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

diff --git a/bitbake/lib/bb/ui/crumbs/persistenttooltip.py b/bitbake/lib/bb/ui/crumbs/persistenttooltip.py
index b43d297..927c194 100644
--- a/bitbake/lib/bb/ui/crumbs/persistenttooltip.py
+++ b/bitbake/lib/bb/ui/crumbs/persistenttooltip.py
@@ -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
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] Hob: add group number show and 'bold' visible effect for Package view
  2012-05-08 11:48 [PATCH 0/4] Hob: bug-fixes Liming An
  2012-05-08 11:48 ` [PATCH 1/4] Hob: change the refresh icon speed to make it view clear Liming An
  2012-05-08 11:48 ` [PATCH 2/4] Hob: add original url show function with the tooltip hyperlink for user Liming An
@ 2012-05-08 11:48 ` Liming An
  2012-05-08 11:48 ` [PATCH 4/4] Hob: change the workflow about click 'Run Image' to run directly after builded a qemu image Liming An
  2012-05-09 20:57 ` [PATCH 0/4] Hob: bug-fixes Richard Purdie
  4 siblings, 0 replies; 6+ messages in thread
From: Liming An @ 2012-05-08 11:48 UTC (permalink / raw)
  To: bitbake-devel

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

[YOCTO #2195]

Signed-off-by: Liming An <limingx.l.an@intel.com>
---
 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(-)

diff --git a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
index 3f53432..0b54f91 100644
--- a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
+++ b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
@@ -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
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 6cf73b0..3942827 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -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
diff --git a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
index 104d49d..238e2f9 100755
--- a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
+++ b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
@@ -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)
+
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] Hob: change the workflow about click 'Run Image' to run directly after builded a qemu image
  2012-05-08 11:48 [PATCH 0/4] Hob: bug-fixes Liming An
                   ` (2 preceding siblings ...)
  2012-05-08 11:48 ` [PATCH 3/4] Hob: add group number show and 'bold' visible effect for Package view Liming An
@ 2012-05-08 11:48 ` Liming An
  2012-05-09 20:57 ` [PATCH 0/4] Hob: bug-fixes Richard Purdie
  4 siblings, 0 replies; 6+ messages in thread
From: Liming An @ 2012-05-08 11:48 UTC (permalink / raw)
  To: bitbake-devel

[YOCTO #2155]

Signed-off-by: Liming An <limingx.l.an@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builder.py          |   52 +++++++---
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py |  139 +++++++++++++------------
 2 files changed, 109 insertions(+), 82 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 4b274a7..42d0f2c 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -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")
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index ac631b6..1cfef80 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -32,6 +32,12 @@ from bb.ui.crumbs.hobpages import HobPage
 class ImageDetailsPage (HobPage):
 
     __columns__ = [{
+            'col_name' : 'Selected',
+            'col_id'   : 2,
+            'col_style': 'radio toggle',
+            'col_min'  : 100,
+            'col_max'  : 100
+        },{
             'col_name' : 'Image name',
             'col_id'   : 0,
             'col_style': 'text',
@@ -43,13 +49,7 @@ class ImageDetailsPage (HobPage):
             'col_style': 'text',
             'col_min'  : 100,
             'col_max'  : 100
-        }, {
-            'col_name' : 'Select',
-            'col_id'   : 2,
-            'col_style': 'radio toggle',
-            'col_min'  : 100,
-            'col_max'  : 100
-    }]
+        }]
 
     class DetailBox (gtk.EventBox):
         def __init__(self, widget = None, varlist = None, vallist = None, icon = None, button = None, color = HobColors.LIGHT_GRAY):
@@ -64,27 +64,31 @@ class ImageDetailsPage (HobPage):
             self.hbox.set_border_width(15)
             self.add(self.hbox)
 
+            total_rows = 0
             if widget:
-                row = 1
-            elif varlist and vallist:
+                total_rows = 10
+            if varlist and vallist:
                 # pack the icon and the text on the left
-                row = len(varlist)
-            self.table = gtk.Table(row, 20, True)
+                total_rows += len(varlist)
+            self.table = gtk.Table(total_rows, 20, True)
+            self.table.set_row_spacings(6)
             self.table.set_size_request(100, -1)
             self.hbox.pack_start(self.table, expand=True, fill=True, padding=15)
 
             colid = 0
+            rowid = 0
             self.line_widgets = {}
             if icon:
                 self.table.attach(icon, colid, colid + 2, 0, 1)
                 colid = colid + 2
             if widget:
-                self.table.attach(widget, colid, 20, 0, 1)
-            elif varlist and vallist:
-                for line in range(0, row):
-                    self.line_widgets[varlist[line]] = self.text2label(varlist[line], vallist[line])
-                    self.table.attach(self.line_widgets[varlist[line]], colid, 20, line, line + 1)
-
+                self.table.attach(widget, colid, 20, 0, 10)
+                rowid = 10
+            if varlist and vallist:
+                for row in range(rowid, total_rows):
+                    index = row - rowid
+                    self.line_widgets[varlist[index]] = self.text2label(varlist[index], vallist[index])
+                    self.table.attach(self.line_widgets[varlist[index]], colid, 20, row, row + 1)
             # pack the button on the right
             if button:
                 self.hbox.pack_end(button, expand=False, fill=False)
@@ -172,6 +176,7 @@ class ImageDetailsPage (HobPage):
         for button_id, button in self.button_ids.items():
             button.disconnect(button_id)
         self._remove_all_widget()
+
         # repack
         self.pack_start(self.details_top_buttons, expand=False, fill=False)
         self.pack_start(self.group_align, expand=True, fill=True)
@@ -196,6 +201,9 @@ class ImageDetailsPage (HobPage):
             self.buttonlist = ["Build new image", "Run image", "Deploy image"]
 
         # Name
+        varlist = [""]
+        vallist = ["Listed generated image and package files."]
+        t = ''
         self.image_store.clear()
         default_toggled = False
         default_image_size = 0
@@ -211,16 +219,33 @@ class ImageDetailsPage (HobPage):
                 if default_toggled:
                     default_image_size = image_size
                     self.create_bottom_buttons(self.buttonlist, image_name)
+                    if 'qemu' in image_name:
+                        t = ' (Selected QEMU items to be as runnable image)'
+                    else:
+                        t = ' (Selected Targeted item to be deploy)'
             else:
                 self.image_store.set(self.image_store.append(), 0, image_name, 1, image_size, 2, False)
             i = i + 1
-        image_table = HobViewTable(self.__columns__)
-        image_table.set_model(self.image_store)
-        image_table.connect("toggled", self.toggled_cb)
+
+        if build_succeeded:
+            varlist = ["Name: ", "Directory: ", ". "]
+            vallist = []
+            vallist.append(image_name.split('.')[0])
+            vallist.append(image_addr)
+            vallist.append(t)
+            image_table = None
+        else:
+            image_table = HobViewTable(self.__columns__)
+            image_table.set_model(self.image_store)
+            image_table.connect("row-activated", self.row_activated_cb)
+            if default_image_size and ('qemu' in image_name):
+                t = '\n(Selected QEMU items to be as runnable image, so you need to select prompted kernel to run)'
+            vallist[0] += t
+
         view_files_button = HobAltButton("View files")
         view_files_button.connect("clicked", self.view_files_clicked_cb, image_addr)
         view_files_button.set_tooltip_text("Open the directory containing the image files")
-        self.image_detail = self.DetailBox(widget=image_table, button=view_files_button)
+        self.image_detail = self.DetailBox(widget=image_table, varlist=varlist, vallist=vallist, button=view_files_button)
         self.box_group_area.pack_start(self.image_detail, expand=True, fill=True)
 
         # Machine, Base image and Layers
@@ -252,7 +277,7 @@ class ImageDetailsPage (HobPage):
             edit_config_button.set_tooltip_text("Edit machine, base image and recipes")
             edit_config_button.connect("clicked", self.edit_config_button_clicked_cb)
             self.setting_detail = self.DetailBox(varlist=varlist, vallist=vallist, button=edit_config_button)
-            self.box_group_area.pack_start(self.setting_detail, expand=False, fill=False)
+            self.box_group_area.pack_start(self.setting_detail, expand=True, fill=True)
 
         # Packages included, and Total image size
         varlist = ["Packages included: ", "Total image size: "]
@@ -303,37 +328,14 @@ class ImageDetailsPage (HobPage):
                 break
         return deployable
 
-    def toggled_cb(self, table, cell, path, columnid, tree):
-        model = tree.get_model()
+    def row_activated_cb(self, table, model, path):
         if not model:
             return
-        iter = model.get_iter_first()
-        while iter:
-            rowpath = model.get_path(iter)
-            model[rowpath][columnid] = False
-            iter = model.iter_next(iter)
-
-        model[path][columnid] = True
-        self.refresh_package_detail_box(model[path][1])
-
+        iter = model.get_iter(path)
         image_name = model[path][0]
-
-        # remove
-        for button_id, button in self.button_ids.items():
-            button.disconnect(button_id)
-        self._remove_all_widget()
-        # repack
-        self.pack_start(self.details_top_buttons, expand=False, fill=False)
-        self.pack_start(self.group_align, expand=True, fill=True)
-        if self.build_result:
-            self.box_group_area.pack_start(self.build_result, expand=False, fill=False)
-        self.box_group_area.pack_start(self.image_detail, expand=True, fill=True)
-        if self.setting_detail:
-            self.box_group_area.pack_start(self.setting_detail, expand=False, fill=False)
-        self.box_group_area.pack_start(self.package_detail, expand=False, fill=False)
-        self.create_bottom_buttons(self.buttonlist, image_name)
-        self.box_group_area.pack_end(self.details_bottom_buttons, expand=False, fill=False)
-        self.show_all()
+        if iter and model[path][2] == 'runnable':
+            kernel_name, kernel_number = self.get_kernel_file_name(image_name)
+            self.builder.runqemu_image(image_name, kernel_name, kernel_number)
 
     def create_bottom_buttons(self, buttonlist, image_name):
         # Create the buttons at the bottom
@@ -348,7 +350,7 @@ class ImageDetailsPage (HobPage):
             deploy_button.set_size_request(205, 49)
             deploy_button.set_tooltip_text("Burn a live image to a USB drive or flash memory")
             deploy_button.set_flags(gtk.CAN_DEFAULT)
-            button_id = deploy_button.connect("clicked", self.deploy_button_clicked_cb)
+            button_id = deploy_button.connect("clicked", self.deploy_button_clicked_cb, image_name)
             self.button_ids[button_id] = deploy_button
             self.details_bottom_buttons.pack_end(deploy_button, expand=False, fill=False)
             created = True
@@ -370,7 +372,7 @@ class ImageDetailsPage (HobPage):
                 run_button.set_flags(gtk.CAN_DEFAULT)
                 packed = True
             run_button.set_tooltip_text("Start up an image with qemu emulator")
-            button_id = run_button.connect("clicked", self.run_button_clicked_cb)
+            button_id = run_button.connect("clicked", self.run_button_clicked_cb, image_name)
             self.button_ids[button_id] = run_button
             self.details_bottom_buttons.pack_end(run_button, expand=False, fill=False)
             created = True
@@ -408,27 +410,30 @@ class ImageDetailsPage (HobPage):
             self.button_ids[button_id] = build_new_button
             self.details_bottom_buttons.pack_start(build_new_button, expand=False, fill=False)
 
-    def _get_selected_image(self):
-        image_name = ""
-        iter = self.image_store.get_iter_first()
-        while iter:
-            path = self.image_store.get_path(iter)
-            if self.image_store[path][2]:
-                image_name = self.image_store[path][0]
-                break
-            iter = self.image_store.iter_next(iter)
-
-        return image_name
+    def get_kernel_file_name(self, image_name):
+        name_list = []
+        kernel_name = ""
+        if image_name:
+            image_path = os.path.join(self.builder.parameters.image_addr)
+            files = [f for f in os.listdir(image_path) if f[0] <> '.']
+            for check_file in files:
+                if check_file.endswith(".bin"):
+                    if  self.test_mach_runnable(check_file):
+                        selected_machine = self.builder.configuration.curr_mach
+                        if selected_machine in check_file:
+                            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 save_button_clicked_cb(self, button):
         self.builder.show_save_template_dialog()
 
-    def deploy_button_clicked_cb(self, button):
-        image_name = self._get_selected_image()
+    def deploy_button_clicked_cb(self, button, image_name):
         self.builder.deploy_image(image_name)
 
-    def run_button_clicked_cb(self, button):
-        image_name = self._get_selected_image()
+    def run_button_clicked_cb(self, button, image_name):
         self.builder.runqemu_image(image_name)
 
     def build_new_button_clicked_cb(self, button):
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] Hob: bug-fixes
  2012-05-08 11:48 [PATCH 0/4] Hob: bug-fixes Liming An
                   ` (3 preceding siblings ...)
  2012-05-08 11:48 ` [PATCH 4/4] Hob: change the workflow about click 'Run Image' to run directly after builded a qemu image Liming An
@ 2012-05-09 20:57 ` Richard Purdie
  4 siblings, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2012-05-09 20:57 UTC (permalink / raw)
  To: Liming An; +Cc: bitbake-devel

On Tue, 2012-05-08 at 19:48 +0800, Liming An wrote:
> 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

Merged to master, thanks.

Richard




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-05-09 21:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-08 11:48 [PATCH 0/4] Hob: bug-fixes Liming An
2012-05-08 11:48 ` [PATCH 1/4] Hob: change the refresh icon speed to make it view clear Liming An
2012-05-08 11:48 ` [PATCH 2/4] Hob: add original url show function with the tooltip hyperlink for user Liming An
2012-05-08 11:48 ` [PATCH 3/4] Hob: add group number show and 'bold' visible effect for Package view Liming An
2012-05-08 11:48 ` [PATCH 4/4] Hob: change the workflow about click 'Run Image' to run directly after builded a qemu image Liming An
2012-05-09 20:57 ` [PATCH 0/4] Hob: bug-fixes Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.