diff options
author | Joshua Lock <josh@linux.intel.com> | 2012-03-02 15:41:21 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-12 02:26:12 +0000 |
commit | 26ff0faabd56e84df41eee507b860e75be3f8870 (patch) | |
tree | a51c194bb57b7a6d9f70d1010f4bd7b7aaa23e3e /bitbake | |
parent | 9781b0905d9897693e408223c2bf1dce2f82de8f (diff) | |
download | poky-26ff0faabd56e84df41eee507b860e75be3f8870.tar.gz |
ui/crumbs/hobwidget: implement HobInfoButton per Hob interaction design
This button-like widget will display a persistent tooltip with the
supplied Pango Markup when it is clicked by the user. This widget features
prominently in the interaction design to offer help in a more prominent
manner.
(Bitbake rev: 43f33dcd6b7d1a08651cdf0715c2c2a9d488b103)
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobwidget.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py index 9afbfdbe96..f4ff1dc881 100644 --- a/bitbake/lib/bb/ui/crumbs/hobwidget.py +++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py | |||
@@ -23,6 +23,7 @@ import gobject | |||
23 | import os | 23 | import os |
24 | import os.path | 24 | import os.path |
25 | from bb.ui.crumbs.hobcolor import HobColors | 25 | from bb.ui.crumbs.hobcolor import HobColors |
26 | from bb.ui.crumbs.persistenttooltip import PersistentTooltip | ||
26 | 27 | ||
27 | class hwc: | 28 | class hwc: |
28 | 29 | ||
@@ -311,3 +312,51 @@ class HobXpmLabelButtonBox(gtk.EventBox): | |||
311 | """ Hide items - first time """ | 312 | """ Hide items - first time """ |
312 | pass | 313 | pass |
313 | 314 | ||
315 | class HobInfoButton(gtk.EventBox): | ||
316 | """ | ||
317 | This class implements a button-like widget per the Hob visual and UX designs | ||
318 | which will display a persistent tooltip, with the contents of tip_markup, when | ||
319 | clicked. | ||
320 | |||
321 | tip_markup: the Pango Markup to be displayed in the persistent tooltip | ||
322 | """ | ||
323 | def __init__(self, tip_markup, parent=None): | ||
324 | gtk.EventBox.__init__(self) | ||
325 | self.image = gtk.Image() | ||
326 | self.image.set_from_file(hic.ICON_INFO_DISPLAY_FILE) | ||
327 | self.image.show() | ||
328 | self.add(self.image) | ||
329 | |||
330 | self.set_events(gtk.gdk.BUTTON_RELEASE | | ||
331 | gtk.gdk.ENTER_NOTIFY_MASK | | ||
332 | gtk.gdk.LEAVE_NOTIFY_MASK) | ||
333 | |||
334 | self.ptip = PersistentTooltip(tip_markup) | ||
335 | |||
336 | if parent: | ||
337 | self.ptip.set_parent(parent) | ||
338 | self.ptip.set_transient_for(parent) | ||
339 | self.ptip.set_destroy_with_parent(True) | ||
340 | |||
341 | self.connect("button-release-event", self.button_release_cb) | ||
342 | self.connect("enter-notify-event", self.mouse_in_cb) | ||
343 | self.connect("leave-notify-event", self.mouse_out_cb) | ||
344 | |||
345 | """ | ||
346 | When the mouse click is released emulate a button-click and show the associated | ||
347 | PersistentTooltip | ||
348 | """ | ||
349 | def button_release_cb(self, widget, event): | ||
350 | self.ptip.show() | ||
351 | |||
352 | """ | ||
353 | Change to the prelight image when the mouse enters the widget | ||
354 | """ | ||
355 | def mouse_in_cb(self, widget, event): | ||
356 | self.image.set_from_file(hic.ICON_INFO_HOVER_FILE) | ||
357 | |||
358 | """ | ||
359 | Change to the stock image when the mouse enters the widget | ||
360 | """ | ||
361 | def mouse_out_cb(self, widget, event): | ||
362 | self.image.set_from_file(hic.ICON_INFO_DISPLAY_FILE) | ||