summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKang Kai <kai.kang@windriver.com>2012-06-06 17:52:27 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-08 12:13:17 +0100
commit7828e9eee25c74cef6671f69268a4589e9895938 (patch)
treefb4f8cbf4c989968d4c0e9f10378d52634e684a6
parent87ce7bdfd5e2bf1128226ada4dd8f88abbf51230 (diff)
downloadpoky-7828e9eee25c74cef6671f69268a4589e9895938.tar.gz
poky-7828e9eee25c74cef6671f69268a4589e9895938.tar.bz2
poky-7828e9eee25c74cef6671f69268a4589e9895938.zip
hob2: update DeployImageDialog for seperated tool
Part of [Yocto 2388] Update class DeployImageDialog to get ready for a standalone deploy image tool. The standalone tool can be run directly without hob, and add a button to select image file. So adjust the layout of DeployImageDialog. (Bitbake rev: 399cfbaf36ccd4b934e25f915e64b87f32a3eb82) Signed-off-by: Kang Kai <kai.kang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig.py43
1 files changed, 37 insertions, 6 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index 97a3b22f15..3b50f68eed 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -749,21 +749,28 @@ class DeployImageDialog (CrumbsDialog):
__dummy_usb__ = "--select a usb drive--"
- def __init__(self, title, image_path, parent, flags, buttons=None):
+ def __init__(self, title, image_path, parent, flags, buttons=None, standalone=False):
super(DeployImageDialog, self).__init__(title, parent, flags, buttons)
self.image_path = image_path
+ self.standalone = standalone
self.create_visual_elements()
self.connect("response", self.response_cb)
def create_visual_elements(self):
+ self.set_size_request(600, 400)
label = gtk.Label()
label.set_alignment(0.0, 0.5)
markup = "<span font_desc='12'>The image to be written into usb drive:</span>"
label.set_markup(markup)
self.vbox.pack_start(label, expand=False, fill=False, padding=2)
+ table = gtk.Table(2, 10, False)
+ table.set_col_spacings(5)
+ table.set_row_spacings(5)
+ self.vbox.pack_start(table, expand=True, fill=True)
+
scroll = gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
scroll.set_shadow_type(gtk.SHADOW_IN)
@@ -771,11 +778,26 @@ class DeployImageDialog (CrumbsDialog):
tv.set_editable(False)
tv.set_wrap_mode(gtk.WRAP_WORD)
tv.set_cursor_visible(False)
- buf = gtk.TextBuffer()
- buf.set_text(self.image_path)
- tv.set_buffer(buf)
+ self.buf = gtk.TextBuffer()
+ self.buf.set_text(self.image_path)
+ tv.set_buffer(self.buf)
scroll.add(tv)
- self.vbox.pack_start(scroll, expand=True, fill=True)
+ table.attach(scroll, 0, 10, 0, 1)
+
+ if self.standalone:
+ gobject.signal_new("select_image_clicked", self, gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE, ())
+ icon = gtk.Image()
+ pix_buffer = gtk.gdk.pixbuf_new_from_file(hic.ICON_IMAGES_DISPLAY_FILE)
+ icon.set_from_pixbuf(pix_buffer)
+ button = gtk.Button("Select Image")
+ button.set_image(icon)
+ button.set_size_request(140, 50)
+ table.attach(button, 9, 10, 1, 2, gtk.FILL, 0, 0, 0)
+ button.connect("clicked", self.select_image_button_clicked_cb)
+
+ separator = gtk.HSeparator()
+ self.vbox.pack_start(separator, expand=False, fill=False, padding=10)
self.usb_desc = gtk.Label()
self.usb_desc.set_alignment(0.0, 0.5)
@@ -790,7 +812,7 @@ class DeployImageDialog (CrumbsDialog):
for usb in self.find_all_usb_devices():
self.usb_combo.append_text("/dev/" + usb)
self.usb_combo.set_active(0)
- self.vbox.pack_start(self.usb_combo, expand=True, fill=True)
+ self.vbox.pack_start(self.usb_combo, expand=False, fill=False)
self.vbox.pack_start(self.usb_desc, expand=False, fill=False, padding=2)
self.progress_bar = HobProgressBar()
@@ -801,6 +823,12 @@ class DeployImageDialog (CrumbsDialog):
self.vbox.show_all()
self.progress_bar.hide()
+ def set_image_text_buffer(self, image_path):
+ self.buf.set_text(image_path)
+
+ def set_image_path(self, image_path):
+ self.image_path = image_path
+
def popen_read(self, cmd):
tmpout, errors = bb.process.run("%s" % cmd)
return tmpout.strip()
@@ -816,6 +844,9 @@ class DeployImageDialog (CrumbsDialog):
(self.popen_read('cat /sys/class/block/%s/device/vendor' % dev),
self.popen_read('cat /sys/class/block/%s/device/model' % dev))
+ def select_image_button_clicked_cb(self, button):
+ self.emit('select_image_clicked')
+
def usb_combo_changed_cb(self, usb_combo):
combo_item = self.usb_combo.get_active_text()
if not combo_item or combo_item == self.__dummy_usb__: