diff options
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hig/openinglogdialog.py')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hig/openinglogdialog.py | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig/openinglogdialog.py b/bitbake/lib/bb/ui/crumbs/hig/openinglogdialog.py new file mode 100644 index 0000000000..f1733156a7 --- /dev/null +++ b/bitbake/lib/bb/ui/crumbs/hig/openinglogdialog.py | |||
@@ -0,0 +1,68 @@ | |||
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 | |||
23 | import gtk | ||
24 | import gobject | ||
25 | from bb.ui.crumbs.hobwidget import HobAltButton | ||
26 | from bb.ui.crumbs.progressbar import HobProgressBar | ||
27 | from bb.ui.crumbs.hig.crumbsdialog import CrumbsDialog | ||
28 | |||
29 | """ | ||
30 | The following are convenience classes for implementing GNOME HIG compliant | ||
31 | BitBake GUI's | ||
32 | In summary: spacing = 12px, border-width = 6px | ||
33 | """ | ||
34 | |||
35 | class OpeningLogDialog (CrumbsDialog): | ||
36 | |||
37 | def __init__(self, title, parent, flags, buttons=None): | ||
38 | super(OpeningLogDialog, self).__init__(title, parent, flags, buttons) | ||
39 | |||
40 | self.running = False | ||
41 | # create visual elements on the dialog | ||
42 | self.create_visual_elements() | ||
43 | |||
44 | def start(self): | ||
45 | if not self.running: | ||
46 | self.running = True | ||
47 | gobject.timeout_add(100, self.pulse) | ||
48 | |||
49 | def pulse(self): | ||
50 | self.progress_bar.pulse() | ||
51 | return self.running | ||
52 | |||
53 | def create_visual_elements(self): | ||
54 | hbox = gtk.HBox(False, 12) | ||
55 | self.user_label = gtk.Label("The log will open in a text editor") | ||
56 | hbox.pack_start(self.user_label, expand=False, fill=False) | ||
57 | self.vbox.pack_start(hbox, expand=False, fill=False) | ||
58 | |||
59 | hbox = gtk.HBox(False, 12) | ||
60 | # Progress bar | ||
61 | self.progress_bar = HobProgressBar() | ||
62 | hbox.pack_start(self.progress_bar) | ||
63 | self.start() | ||
64 | self.vbox.pack_start(hbox, expand=False, fill=False) | ||
65 | |||
66 | button = self.add_button("Cancel", gtk.RESPONSE_CANCEL) | ||
67 | HobAltButton.style_button(button) | ||
68 | self.show_all() | ||