All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Lock <josh@linux.intel.com>
To: "Wang, Shane" <shane.wang@intel.com>
Cc: "bitbake-devel@lists.openembedded.org"
	<bitbake-devel@lists.openembedded.org>
Subject: Re: [PATCH 1/6] crumbs/persistenttooltip: a new Gtk+ widget for use in Hob
Date: Wed, 07 Mar 2012 15:54:53 -0800	[thread overview]
Message-ID: <4F57F54D.10504@linux.intel.com> (raw)
In-Reply-To: <3AB6CE7F274E534CAFD089D127A8A1FC23AE1B57@SHSMSX102.ccr.corp.intel.com>

On 05/03/12 14:29, Wang, Shane wrote:
> ACK the rest except one comment below.
>
> --
> Shane
>
>> -----Original Message-----
>> From: bitbake-devel-bounces@lists.openembedded.org
>> [mailto:bitbake-devel-bounces@lists.openembedded.org] On Behalf Of
>> Joshua Lock
>> Sent: Friday, March 02, 2012 4:39 PM
>> To: bitbake-devel@lists.openembedded.org
>> Subject: [bitbake-devel] [PATCH 1/6] crumbs/persistenttooltip: a new Gtk+
>> widget for use in Hob
>>
>> The Hob interaction design calls for a top level widget which shows a
>> persistent tooltip. This tooltip will not disappear until the user
>> explicitly closes it.
>>
>> This allows us to provide clickable hyperlinks, longer instructions and
>> deeper information in the tooltips.
>>
>> Note: by design the tooltip should dismiss when the user clicks off it,
>> this implementation does include that functionality. It's a to do item.
>>
>> Signed-off-by: Joshua Lock<josh@linux.intel.com>
>> ---
>>   lib/bb/ui/crumbs/persistenttooltip.py |  127
>> +++++++++++++++++++++++++++++++++
>>   1 files changed, 127 insertions(+), 0 deletions(-)
>>   create mode 100644 lib/bb/ui/crumbs/persistenttooltip.py
>>
>> diff --git a/lib/bb/ui/crumbs/persistenttooltip.py
>> b/lib/bb/ui/crumbs/persistenttooltip.py
>> new file mode 100644
>> index 0000000..f3f55b1
>> --- /dev/null
>> +++ b/lib/bb/ui/crumbs/persistenttooltip.py
>> @@ -0,0 +1,127 @@
>> +#
>> +# BitBake Graphical GTK User Interface
>> +#
>> +# Copyright (C) 2012   Intel Corporation
>> +#
>> +# Authored by Joshua Lock<josh@linux.intel.com>
>> +#
>> +# This program is free software; you can redistribute it and/or modify
>> +# it under the terms of the GNU General Public License version 2 as
>> +# published by the Free Software Foundation.
>> +#
>> +# This program is distributed in the hope that it will be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +# GNU General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU General Public License along
>> +# with this program; if not, write to the Free Software Foundation, Inc.,
>> +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
>> +
>> +import gobject
>> +import gtk
>> +
>> +class PersistentTooltip(gtk.Window):
>> +	"""
>> +	A tooltip which persists once shown until the user dismisses it with the
>> Esc
>> +	key or by clicking the close button.
>> +
>> +	# FIXME: the PersistentTooltip should be disabled when the user clicks
>> anywhere off
>> +	# it. We can't do this with focus-out-event becuase modal ensures we
>> have focus?
>> +
>> +	markup: some Pango text markup to display in the tooltip
>> +	"""
>> +	def __init__(self, markup):
>> +		gtk.Window.__init__(self, gtk.WINDOW_POPUP)
>> +
>> +		# We need to ensure we're only shown once
>> +		self.shown = False
>> +
>> +		# We don't want any WM decorations
>> +		self.set_decorated(False)
>> +		# We don't want to show in the taskbar or window switcher
>> +		self.set_skip_pager_hint(True)
>> +		self.set_skip_taskbar_hint(True)
>> +		# We must be modal to ensure we grab focus when presented from
>> a gtk.Dialog
>> +		self.set_modal(True)
>> +
>> +		self.set_border_width(6)
>> +		self.set_position(gtk.WIN_POS_MOUSE)
>> +		self.set_opacity(0.95)
>> +
>> +		# Draw our label and close buttons
>> +		hbox = gtk.HBox(False, 0)
>> +		hbox.show()
>> +		vbox = gtk.VBox(False, 0)
>> +		vbox.show()
>> +		vbox.pack_start(hbox, True, True, 0)
>> +
>> +		img = gtk.Image()
>> +		img.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_BUTTON)
>> +
>> +		self.button = gtk.Button()
>> +		self.button.set_image(img)
>> +		self.button.connect("clicked", self._dismiss_cb)
>> +		self.button.set_can_default(True)
>> +		self.button.grab_focus()
>> +		self.button.show()
>> +		hbox.pack_end(self.button, False, False, 0)
>> +
>> +		self.set_default(self.button)
>> +
>> +		self.label = gtk.Label()
>> +		self.label.set_markup(markup)
>> +		self.label.show()
>> +		vbox.pack_end(self.label, True, True, 6)
>> +
>> +		self.connect("key-press-event", self._catch_esc_cb)
>> +
>> +		# Inherit the system theme for a tooltip
>> +		style = gtk.rc_get_style_by_paths(gtk.settings_get_default(),
>> +			'gtk-tooltip', 'gtk-tooltip', gobject.TYPE_NONE)
>> +		self.set_style(style)
>> +
>> +		self.add(vbox)
>> +
>> +	"""
>> +	Modify the displayed message once the PersistentTooltip has been
>> created.
>> +
>> +	markup: the Pango Markup of the new message
>> +	"""
>> +	def set_tooltip(self, markup):
>> +		self.label.set_markup(markup)
> I haven't seen this is used. Can we remove it?

Good catch. I've removed this method in the bitbake and poky branches.

Cheers,
Joshua
-- 
Joshua Lock
         Yocto Project "Johannes factotum"
         Intel Open Source Technology Centre



  reply	other threads:[~2012-03-08  0:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-03  0:39 [PATCH 0/6] Hob GUI add persistent tooltips and use custom info icon consistently Joshua Lock
2012-03-03  0:39 ` [PATCH 1/6] crumbs/persistenttooltip: a new Gtk+ widget for use in Hob Joshua Lock
2012-03-05 22:29   ` Wang, Shane
2012-03-07 23:54     ` Joshua Lock [this message]
2012-03-03  0:39 ` [PATCH 2/6] ui/icons: crop the info icons Joshua Lock
2012-03-03  0:39 ` [PATCH 3/6] ui/crumbs/hobwidget: implement HobInfoButton per Hob interaction design Joshua Lock
2012-03-05 22:31   ` Wang, Shane
2012-03-03  0:39 ` [PATCH 4/6] ui/crumbs/imageconfigurationpage: make use of the HobInfoButton Joshua Lock
2012-03-05 22:32   ` Wang, Shane
2012-03-03  0:39 ` [PATCH 5/6] ui/crumbs/hig: use HobInfoButton in place of gtk.Image with tooltip Joshua Lock
2012-03-05 22:36   ` Wang, Shane
2012-03-03  0:39 ` [PATCH 6/6] ui/crumbs/hig: special case stock info icons in CrumbsMesssageDialog Joshua Lock
2012-03-05 22:39   ` Wang, Shane
2012-03-03  0:46 ` [PATCH 0/6] Hob GUI add persistent tooltips and use custom info icon consistently Joshua Lock
2012-03-16  6:38   ` Wang, Shane
2012-03-16  6:41   ` Wang, Shane
2012-03-16 19:34     ` Joshua Lock
2012-03-03  0:51 ` Joshua Lock
2012-03-12  2:17 ` 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=4F57F54D.10504@linux.intel.com \
    --to=josh@linux.intel.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=shane.wang@intel.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 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.