From: Joshua Lock <josh@linux.intel.com>
To: "Xu, Dongxiao" <dongxiao.xu@intel.com>
Cc: bitbake-devel@lists.openembedded.org, Giulia Piu <giulia@closertag.com>
Subject: Re: [PATCH 6/6] ui/crumbs/hig: make the layer selection dialogue more closely match design
Date: Tue, 20 Mar 2012 08:25:25 -0700 [thread overview]
Message-ID: <4F68A165.4060303@linux.intel.com> (raw)
In-Reply-To: <1332223731.1848.22.camel@dongxiao-osel>
On 19/03/12 23:08, Xu, Dongxiao wrote:
> On Mon, 2012-03-19 at 17:18 -0700, Joshua Lock wrote:
>> The layer dialogue design includes in-line remove/delete widgets next to
>> the layer path in the tree view for all layers other than the meta layer as
>> well as an in-line notice that the meta layer cannot be removed.
>>
>> This is achieved in this patch through the use of custom cell_data_func's
>> for the treeview to render the meta layer differently and a custom
>> CellRenderer implementation, CellRendererPixbufActivatable, which renders a
>> pixbuf and emits a clicked signal when the user clicks on it.
>>
>> Signed-off-by: Joshua Lock<josh@linux.intel.com>
>> ---
>> lib/bb/ui/crumbs/hig.py | 96 ++++++++++++++++++++++++++++++++++++-----------
>> 1 files changed, 74 insertions(+), 22 deletions(-)
>>
>> diff --git a/lib/bb/ui/crumbs/hig.py b/lib/bb/ui/crumbs/hig.py
>> index 849d7c9..5b0cfc9 100644
>> --- a/lib/bb/ui/crumbs/hig.py
>> +++ b/lib/bb/ui/crumbs/hig.py
>> @@ -789,6 +789,26 @@ class DeployImageDialog (CrumbsDialog):
>> os.close(f_from)
>> os.close(f_to)
>> self.progress_bar.hide()
>> +
>> +class CellRendererPixbufActivatable(gtk.CellRendererPixbuf):
>> + """
>> + A custom CellRenderer implementation which is activatable
>> + so that we can handle user clicks
>> + """
>> + __gsignals__ = { 'clicked' : (gobject.SIGNAL_RUN_LAST,
>> + gobject.TYPE_NONE,
>> + (gobject.TYPE_STRING,)), }
>> +
>> + def __init__(self):
>> + gtk.CellRendererPixbuf.__init__(self)
>> + self.set_property('mode', gtk.CELL_RENDERER_MODE_ACTIVATABLE)
>> +
>> + """
>> + Respond to a user click on a cell
>> + """
>> + def do_activate(self, even, widget, path, background_area, cell_area, flags):
>> + self.emit('clicked', path)
>> +
>> #
>> # LayerSelectionDialog
>> #
>> @@ -855,13 +875,13 @@ class LayerSelectionDialog (CrumbsDialog):
>> layer_tv.set_rules_hint(True)
>> layer_tv.set_headers_visible(False)
>> tree_selection = layer_tv.get_selection()
>> - tree_selection.set_mode(gtk.SELECTION_SINGLE)
>> + tree_selection.set_mode(gtk.SELECTION_NONE)
>>
>> col0= gtk.TreeViewColumn('Path')
>> cell0 = gtk.CellRendererText()
>> cell0.set_padding(5,2)
>> col0.pack_start(cell0, True)
>> - col0.set_attributes(cell0, text=0)
>> + col0.set_cell_data_func(cell0, self.draw_layer_path_cb)
>> layer_tv.append_column(col0)
>>
>> scroll = gtk.ScrolledWindow()
>> @@ -897,18 +917,19 @@ class LayerSelectionDialog (CrumbsDialog):
>> for layer in layers:
>> layer_store.set(layer_store.append(), 0, layer)
>>
>> - image = gtk.Image()
>> - image.set_from_stock(gtk.STOCK_ADD,gtk.ICON_SIZE_MENU)
>> + col1 = gtk.TreeViewColumn('Enabled')
>> + layer_tv.append_column(col1)
>> +
>> + cell1 = CellRendererPixbufActivatable()
>> + cell1.connect("clicked", self.del_cell_clicked_cb, layer_store)
>> + col1.pack_start(cell1, True)
>> + col1.set_cell_data_func(cell1, self.draw_delete_button_cb, layer_tv)
>> +
>> add_button = gtk.Button()
>> - add_button.set_image(image)
>> + add_button.set_label("_Add layer")
>> + add_button.set_use_underline(True)
>> add_button.connect("clicked", self.layer_widget_add_clicked_cb, layer_store, window)
>> - table_layer.attach(add_button, 0, 5, 1, 2, gtk.EXPAND | gtk.FILL, 0, 0, 6)
>> - image = gtk.Image()
>> - image.set_from_stock(gtk.STOCK_REMOVE,gtk.ICON_SIZE_MENU)
>> - del_button = gtk.Button()
>> - del_button.set_image(image)
>> - del_button.connect("clicked", self.layer_widget_del_clicked_cb, tree_selection, layer_store)
>> - table_layer.attach(del_button, 5, 10, 1, 2, gtk.EXPAND | gtk.FILL, 0, 0, 6)
>> + table_layer.attach(add_button, 0, 10, 1, 2, gtk.EXPAND | gtk.FILL, 0, 0, 6)
>> layer_tv.set_model(layer_store)
>>
>> hbox.show_all()
>> @@ -936,24 +957,16 @@ class LayerSelectionDialog (CrumbsDialog):
>> hbox_top = gtk.HBox()
>> self.vbox.pack_start(hbox_top, expand=False, fill=False)
>>
>> - if self.split_model:
>> - label = self.gen_label_widget("<b>Select Layers:</b>\n(Available layers under '${COREBASE}/layers/' directory)")
>> - else:
>> - label = self.gen_label_widget("<b>Select Layers:</b>")
>> + label = self.gen_label_widget("<b>Select Layers:</b>")
>> hbox_top.pack_start(label, expand=False, fill=False)
>> -
>> tooltip = "Layer is a collection of bb files and conf files"
>> info = HobInfoButton(tooltip, self)
>> hbox_top.pack_end(info, expand=False, fill=False)
>>
>> layer_widget, self.layer_store = self.gen_layer_widget(self.split_model, self.layers, self.all_layers, self, None)
>> - layer_widget.set_size_request(-1, 180)
>> + layer_widget.set_size_request(450, 250)
>> self.vbox.pack_start(layer_widget, expand=True, fill=True)
>>
>> - label = self.gen_label_widget("<b>Note:</b> '<i>meta</i>' is the Core layer for Yocto images please do not remove it.")
>> - label.show()
>> - self.vbox.pack_end(label, expand=False, fill=False)
>> -
>> self.show_all()
>>
>> def response_cb(self, dialog, response_id):
>> @@ -972,6 +985,45 @@ class LayerSelectionDialog (CrumbsDialog):
>> self.layers_changed = (self.layers != layers)
>> self.layers = layers
>>
>> + """
>> + A custom cell_data_func to draw a delete 'button' in the TreeView for layers
>> + other than the meta layer. The deletion of which is prevented so that the
>> + user can't shoot themselves in the foot too badly.
>> + """
>> + def draw_delete_button_cb(self, col, cell, model, it, tv):
>> + path = model.get_value(it, 0)
>> + # Trailing slashes are uncommon in bblayers.conf but confuse os.path.basename
>> + path.rstrip('/')
>> + name = os.path.basename(path)
>> + if name == "meta":
>> + cell.set_sensitive(False)
>> + cell.set_property('pixbuf', None)
>> + cell.set_property('mode', gtk.CELL_RENDERER_MODE_INERT)
>> + else:
>> + pix = tv.render_icon(gtk.STOCK_DELETE, gtk.ICON_SIZE_DND, None)
>
> Could Belen and Giulia provide an designed icon for this delete button?
> Since the default gtk.STOCK_DELETE may appear different from OS
> distributions.
I agree. I asked about this and a couple of other issues on the bug report:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=2083
> Besides, I think it is better if this button can have the effect of
> hover/un-hover, because from first eye on the button, users may not know
> it is click-able.
That's a good call. I'll look at implementing that.
Thanks for the feedback,
Joshua
--
Joshua '贾詡' Lock
Yocto Project "Johannes factotum"
Intel Open Source Technology Centre
next prev parent reply other threads:[~2012-03-20 15:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-20 0:18 [PATCH 0/6] Hob tweaks Joshua Lock
2012-03-20 0:18 ` [PATCH 1/6] ui/crumbs/hig: use close rather than OK for dismis button Joshua Lock
2012-03-20 5:33 ` Xu, Dongxiao
2012-03-20 0:18 ` [PATCH 2/6] ui/crumbs: remove unused return value from append_toolbar_button Joshua Lock
2012-03-20 5:30 ` Xu, Dongxiao
2012-03-20 0:18 ` [PATCH 3/6] ui/crumbs/hobpage: no need to force a Toolbar button type Joshua Lock
2012-03-20 5:49 ` Xu, Dongxiao
2012-03-20 0:18 ` [PATCH 4/6] ui/crumbs/persistenttooltip: try to reflect WM close button position Joshua Lock
2012-03-20 5:59 ` Xu, Dongxiao
2012-03-20 0:18 ` [PATCH 5/6] ui/crumbs/builder: remove OK/Cancel buttons on Layer dialog. Use Close Joshua Lock
2012-03-20 6:04 ` Xu, Dongxiao
2012-03-20 17:29 ` Joshua Lock
2012-03-20 0:18 ` [PATCH 6/6] ui/crumbs/hig: make the layer selection dialogue more closely match design Joshua Lock
2012-03-20 6:08 ` Xu, Dongxiao
2012-03-20 15:25 ` Joshua Lock [this message]
2012-03-20 14:34 ` [PATCH 0/6] Hob tweaks Richard Purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F68A165.4060303@linux.intel.com \
--to=josh@linux.intel.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=dongxiao.xu@intel.com \
--cc=giulia@closertag.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox