diff options
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hig.py')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hig.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py new file mode 100644 index 0000000000..b3b3c7a72e --- /dev/null +++ b/bitbake/lib/bb/ui/crumbs/hig.py | |||
@@ -0,0 +1,61 @@ | |||
1 | # | ||
2 | # BitBake Graphical GTK User Interface | ||
3 | # | ||
4 | # Copyright (C) 2011 Intel Corporation | ||
5 | # | ||
6 | # Authored by Joshua Lock <josh@linux.intel.com> | ||
7 | # | ||
8 | # This program is free software; you can redistribute it and/or modify | ||
9 | # it under the terms of the GNU General Public License version 2 as | ||
10 | # published by the Free Software Foundation. | ||
11 | # | ||
12 | # This program is distributed in the hope that it will be useful, | ||
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | # GNU General Public License for more details. | ||
16 | # | ||
17 | # You should have received a copy of the GNU General Public License along | ||
18 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
20 | |||
21 | import gobject | ||
22 | import gtk | ||
23 | """ | ||
24 | The following are convenience classes for implementing GNOME HIG compliant | ||
25 | BitBake GUI's | ||
26 | In summary: spacing = 12px, border-width = 6px | ||
27 | """ | ||
28 | |||
29 | class CrumbsDialog(gtk.Dialog): | ||
30 | """ | ||
31 | A GNOME HIG compliant dialog widget. | ||
32 | Add buttons with gtk.Dialog.add_button or gtk.Dialog.add_buttons | ||
33 | """ | ||
34 | def __init__(self, parent=None, label="", icon=gtk.STOCK_INFO): | ||
35 | gtk.Dialog.__init__(self, "", parent, gtk.DIALOG_DESTROY_WITH_PARENT) | ||
36 | |||
37 | #self.set_property("has-separator", False) # note: deprecated in 2.22 | ||
38 | |||
39 | self.set_border_width(6) | ||
40 | self.vbox.set_property("spacing", 12) | ||
41 | self.action_area.set_property("spacing", 12) | ||
42 | self.action_area.set_property("border-width", 6) | ||
43 | |||
44 | first_row = gtk.HBox(spacing=12) | ||
45 | first_row.set_property("border-width", 6) | ||
46 | first_row.show() | ||
47 | self.vbox.add(first_row) | ||
48 | |||
49 | self.icon = gtk.Image() | ||
50 | self.icon.set_from_stock(icon, gtk.ICON_SIZE_DIALOG) | ||
51 | self.icon.set_property("yalign", 0.00) | ||
52 | self.icon.show() | ||
53 | first_row.add(self.icon) | ||
54 | |||
55 | self.label = gtk.Label() | ||
56 | self.label.set_use_markup(True) | ||
57 | self.label.set_line_wrap(True) | ||
58 | self.label.set_markup(label) | ||
59 | self.label.set_property("yalign", 0.00) | ||
60 | self.label.show() | ||
61 | first_row.add(self.label) | ||