summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py70
1 files changed, 70 insertions, 0 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py
new file mode 100644
index 0000000000..3b998e4637
--- /dev/null
+++ b/bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py
@@ -0,0 +1,70 @@
1#
2# BitBake Graphical GTK User Interface
3#
4# Copyright (C) 2011-2012 Intel Corporation
5#
6# Authored by Joshua Lock <josh@linux.intel.com>
7# Authored by Dongxiao Xu <dongxiao.xu@intel.com>
8# Authored by Shane Wang <shane.wang@intel.com>
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License version 2 as
12# published by the Free Software Foundation.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License along
20# with this program; if not, write to the Free Software Foundation, Inc.,
21# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
23import glib
24import gtk
25from bb.ui.crumbs.hobwidget import HobIconChecker
26from bb.ui.crumbs.hig.crumbsdialog import CrumbsDialog
27
28"""
29The following are convenience classes for implementing GNOME HIG compliant
30BitBake GUI's
31In summary: spacing = 12px, border-width = 6px
32"""
33
34class CrumbsMessageDialog(gtk.MessageDialog):
35 """
36 A GNOME HIG compliant dialog widget.
37 Add buttons with gtk.Dialog.add_button or gtk.Dialog.add_buttons
38 """
39 def __init__(self, parent = None, label="", dialog_type = gtk.MESSAGE_QUESTION, msg=""):
40 super(CrumbsMessageDialog, self).__init__(None,
41 gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
42 dialog_type,
43 gtk.BUTTONS_NONE,
44 None)
45
46 self.set_skip_taskbar_hint(False)
47
48 self.set_markup(label)
49
50 if 0 <= len(msg) < 300:
51 self.format_secondary_markup(msg)
52 else:
53 vbox = self.get_message_area()
54 vbox.set_border_width(1)
55 vbox.set_property("spacing", 12)
56 self.textWindow = gtk.ScrolledWindow()
57 self.textWindow.set_shadow_type(gtk.SHADOW_IN)
58 self.textWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
59 self.msgView = gtk.TextView()
60 self.msgView.set_editable(False)
61 self.msgView.set_wrap_mode(gtk.WRAP_WORD)
62 self.msgView.set_cursor_visible(False)
63 self.msgView.set_size_request(300, 300)
64 self.buf = gtk.TextBuffer()
65 self.buf.set_text(msg)
66 self.msgView.set_buffer(self.buf)
67 self.textWindow.add(self.msgView)
68 self.msgView.show()
69 vbox.add(self.textWindow)
70 self.textWindow.show()