summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui
diff options
context:
space:
mode:
authorCristiana Voicu <cristiana.voicu@intel.com>2013-01-21 16:50:40 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-21 19:05:31 +0000
commit4c1ebc7ca73f4ee069dc471a395073ba9a8ce00e (patch)
treec391972b3709b3d551ab46ea677acdfc959de35e /bitbake/lib/bb/ui
parenteb9d31db70161415ad3bbe8e865aafccdebb5a8d (diff)
downloadpoky-4c1ebc7ca73f4ee069dc471a395073ba9a8ce00e.tar.gz
bitbake: hob: progress bar changed to busy cursor when you open log file
-the first implementation for this bug used a progress bar, that is shown during open file process; it revelead that the progress bar stops earlier -now I have implemented using gtk.show_uri() method, that shows itself a busy cursor when it opens a file; -deleted the code for the first implementation [YOCTO #2997] (Bitbake rev: 09d1c4c2db124104b9da460547b20a2c2ff07bb3) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builddetailspage.py16
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig/openinglogdialog.py68
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobthreads.py51
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/imagedetailspage.py16
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/packageselectionpage.py16
5 files changed, 6 insertions, 161 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builddetailspage.py b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
index 64e758d7f4..171a7a68ed 100755
--- a/bitbake/lib/bb/ui/crumbs/builddetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
@@ -30,8 +30,6 @@ from bb.ui.crumbs.runningbuild import RunningBuildTreeView
30from bb.ui.crumbs.runningbuild import BuildFailureTreeView 30from bb.ui.crumbs.runningbuild import BuildFailureTreeView
31from bb.ui.crumbs.hobpages import HobPage 31from bb.ui.crumbs.hobpages import HobPage
32from bb.ui.crumbs.hobcolor import HobColors 32from bb.ui.crumbs.hobcolor import HobColors
33from bb.ui.crumbs.hobthreads import OpeningLogThread
34from bb.ui.crumbs.hig.openinglogdialog import OpeningLogDialog
35 33
36class BuildConfigurationTreeView(gtk.TreeView): 34class BuildConfigurationTreeView(gtk.TreeView):
37 def __init__ (self): 35 def __init__ (self):
@@ -431,18 +429,8 @@ class BuildDetailsPage (HobPage):
431 429
432 def open_log_button_clicked_cb(self, button, log_file): 430 def open_log_button_clicked_cb(self, button, log_file):
433 if log_file: 431 if log_file:
434 self.stop = False 432 log_file = "file:///" + log_file
435 dialog = OpeningLogDialog(title = "Opening Log", 433 gtk.show_uri(screen=button.get_screen(), uri=log_file, timestamp=0)
436 parent = None,
437 flags = gtk.DIALOG_MODAL
438 | gtk.DIALOG_DESTROY_WITH_PARENT
439 | gtk.DIALOG_NO_SEPARATOR)
440 #create a thread to open log file
441 background = OpeningLogThread(dialog, log_file, self)
442 background.start()
443 response = dialog.run()
444 self.stop = True
445 background.join()
446 434
447 def failure_activate_file_bug_link_cb(self, button): 435 def failure_activate_file_bug_link_cb(self, button):
448 button.child.emit('activate-link', "http://bugzilla.yoctoproject.org") 436 button.child.emit('activate-link', "http://bugzilla.yoctoproject.org")
diff --git a/bitbake/lib/bb/ui/crumbs/hig/openinglogdialog.py b/bitbake/lib/bb/ui/crumbs/hig/openinglogdialog.py
deleted file mode 100644
index f1733156a7..0000000000
--- a/bitbake/lib/bb/ui/crumbs/hig/openinglogdialog.py
+++ /dev/null
@@ -1,68 +0,0 @@
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 gtk
24import gobject
25from bb.ui.crumbs.hobwidget import HobAltButton
26from bb.ui.crumbs.progressbar import HobProgressBar
27from bb.ui.crumbs.hig.crumbsdialog import CrumbsDialog
28
29"""
30The following are convenience classes for implementing GNOME HIG compliant
31BitBake GUI's
32In summary: spacing = 12px, border-width = 6px
33"""
34
35class 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()
diff --git a/bitbake/lib/bb/ui/crumbs/hobthreads.py b/bitbake/lib/bb/ui/crumbs/hobthreads.py
deleted file mode 100644
index 64ef91245a..0000000000
--- a/bitbake/lib/bb/ui/crumbs/hobthreads.py
+++ /dev/null
@@ -1,51 +0,0 @@
1#!/usr/bin/env python
2#
3# BitBake Graphical GTK User Interface
4#
5# Copyright (C) 2012 Intel Corporation
6#
7# Authored by Cristiana Voicu <cristiana.voicu@intel.com>
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License version 2 as
11# published by the Free Software Foundation.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License along
19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
22import threading
23import gtk
24import subprocess
25
26#
27# OpeningLogThread
28#
29class OpeningLogThread(threading.Thread):
30 def __init__(self, dialog, log_file, parent):
31 threading.Thread.__init__(self)
32 self.dialog =dialog
33 self.log_file = log_file
34 self.parent = parent
35
36 def run(self):
37 p = subprocess.Popen(['xdg-open',self.log_file])
38 retcode = p.poll()
39 while (retcode == None):
40 if self.parent.stop:
41 try:
42 p.terminate()
43 except OSError, e:
44 if e.errno == 3:
45 pass # no such process
46 else:
47 raise
48 retcode = p.poll()
49
50 self.dialog.destroy()
51
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index 38fbaaaa33..1b60aa8ed5 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -27,8 +27,6 @@ from bb.ui.crumbs.hobwidget import hic, HobViewTable, HobAltButton, HobButton
27from bb.ui.crumbs.hobpages import HobPage 27from bb.ui.crumbs.hobpages import HobPage
28import subprocess 28import subprocess
29from bb.ui.crumbs.hig.crumbsdialog import CrumbsDialog 29from bb.ui.crumbs.hig.crumbsdialog import CrumbsDialog
30from bb.ui.crumbs.hobthreads import OpeningLogThread
31from bb.ui.crumbs.hig.openinglogdialog import OpeningLogDialog
32 30
33# 31#
34# ImageDetailsPage 32# ImageDetailsPage
@@ -407,18 +405,8 @@ class ImageDetailsPage (HobPage):
407 405
408 def open_log_clicked_cb(self, button, log_file): 406 def open_log_clicked_cb(self, button, log_file):
409 if log_file: 407 if log_file:
410 self.stop = False 408 log_file = "file:///" + log_file
411 dialog = OpeningLogDialog(title = "Opening Log", 409 gtk.show_uri(screen=button.get_screen(), uri=log_file, timestamp=0)
412 parent = None,
413 flags = gtk.DIALOG_MODAL
414 | gtk.DIALOG_DESTROY_WITH_PARENT
415 | gtk.DIALOG_NO_SEPARATOR)
416 #create a thread to open log file
417 background = OpeningLogThread(dialog, log_file, self)
418 background.start()
419 response = dialog.run()
420 self.stop = True
421 background.join()
422 410
423 def refresh_package_detail_box(self, image_size): 411 def refresh_package_detail_box(self, image_size):
424 self.package_detail.update_line_widgets("Total image size: ", image_size) 412 self.package_detail.update_line_widgets("Total image size: ", image_size)
diff --git a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
index 2da9277bf9..1868ebeddd 100755
--- a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
+++ b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
@@ -26,8 +26,6 @@ from bb.ui.crumbs.hobcolor import HobColors
26from bb.ui.crumbs.hobwidget import HobViewTable, HobNotebook, HobAltButton, HobButton 26from bb.ui.crumbs.hobwidget import HobViewTable, HobNotebook, HobAltButton, HobButton
27from bb.ui.crumbs.hoblistmodel import PackageListModel 27from bb.ui.crumbs.hoblistmodel import PackageListModel
28from bb.ui.crumbs.hobpages import HobPage 28from bb.ui.crumbs.hobpages import HobPage
29from bb.ui.crumbs.hobthreads import OpeningLogThread
30from bb.ui.crumbs.hig.openinglogdialog import OpeningLogDialog
31 29
32# 30#
33# PackageSelectionPage 31# PackageSelectionPage
@@ -169,18 +167,8 @@ class PackageSelectionPage (HobPage):
169 167
170 def open_log_clicked_cb(self, button, log_file): 168 def open_log_clicked_cb(self, button, log_file):
171 if log_file: 169 if log_file:
172 self.stop = False 170 log_file = "file:///" + log_file
173 dialog = OpeningLogDialog(title = "Opening Log", 171 gtk.show_uri(screen=button.get_screen(), uri=log_file, timestamp=0)
174 parent = None,
175 flags = gtk.DIALOG_MODAL
176 | gtk.DIALOG_DESTROY_WITH_PARENT
177 | gtk.DIALOG_NO_SEPARATOR)
178 #create a thread to open log file
179 background = OpeningLogThread(dialog, log_file, self)
180 background.start()
181 response = dialog.run()
182 self.stop = True
183 background.join()
184 172
185 def show_page(self, log_file): 173 def show_page(self, log_file):
186 children = self.button_box.get_children() or [] 174 children = self.button_box.get_children() or []