summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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):
749 749
750 __dummy_usb__ = "--select a usb drive--" 750 __dummy_usb__ = "--select a usb drive--"
751 751
752 def __init__(self, title, image_path, parent, flags, buttons=None): 752 def __init__(self, title, image_path, parent, flags, buttons=None, standalone=False):
753 super(DeployImageDialog, self).__init__(title, parent, flags, buttons) 753 super(DeployImageDialog, self).__init__(title, parent, flags, buttons)
754 754
755 self.image_path = image_path 755 self.image_path = image_path
756 self.standalone = standalone
756 757
757 self.create_visual_elements() 758 self.create_visual_elements()
758 self.connect("response", self.response_cb) 759 self.connect("response", self.response_cb)
759 760
760 def create_visual_elements(self): 761 def create_visual_elements(self):
762 self.set_size_request(600, 400)
761 label = gtk.Label() 763 label = gtk.Label()
762 label.set_alignment(0.0, 0.5) 764 label.set_alignment(0.0, 0.5)
763 markup = "<span font_desc='12'>The image to be written into usb drive:</span>" 765 markup = "<span font_desc='12'>The image to be written into usb drive:</span>"
764 label.set_markup(markup) 766 label.set_markup(markup)
765 self.vbox.pack_start(label, expand=False, fill=False, padding=2) 767 self.vbox.pack_start(label, expand=False, fill=False, padding=2)
766 768
769 table = gtk.Table(2, 10, False)
770 table.set_col_spacings(5)
771 table.set_row_spacings(5)
772 self.vbox.pack_start(table, expand=True, fill=True)
773
767 scroll = gtk.ScrolledWindow() 774 scroll = gtk.ScrolledWindow()
768 scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) 775 scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
769 scroll.set_shadow_type(gtk.SHADOW_IN) 776 scroll.set_shadow_type(gtk.SHADOW_IN)
@@ -771,11 +778,26 @@ class DeployImageDialog (CrumbsDialog):
771 tv.set_editable(False) 778 tv.set_editable(False)
772 tv.set_wrap_mode(gtk.WRAP_WORD) 779 tv.set_wrap_mode(gtk.WRAP_WORD)
773 tv.set_cursor_visible(False) 780 tv.set_cursor_visible(False)
774 buf = gtk.TextBuffer() 781 self.buf = gtk.TextBuffer()
775 buf.set_text(self.image_path) 782 self.buf.set_text(self.image_path)
776 tv.set_buffer(buf) 783 tv.set_buffer(self.buf)
777 scroll.add(tv) 784 scroll.add(tv)
778 self.vbox.pack_start(scroll, expand=True, fill=True) 785 table.attach(scroll, 0, 10, 0, 1)
786
787 if self.standalone:
788 gobject.signal_new("select_image_clicked", self, gobject.SIGNAL_RUN_FIRST,
789 gobject.TYPE_NONE, ())
790 icon = gtk.Image()
791 pix_buffer = gtk.gdk.pixbuf_new_from_file(hic.ICON_IMAGES_DISPLAY_FILE)
792 icon.set_from_pixbuf(pix_buffer)
793 button = gtk.Button("Select Image")
794 button.set_image(icon)
795 button.set_size_request(140, 50)
796 table.attach(button, 9, 10, 1, 2, gtk.FILL, 0, 0, 0)
797 button.connect("clicked", self.select_image_button_clicked_cb)
798
799 separator = gtk.HSeparator()
800 self.vbox.pack_start(separator, expand=False, fill=False, padding=10)
779 801
780 self.usb_desc = gtk.Label() 802 self.usb_desc = gtk.Label()
781 self.usb_desc.set_alignment(0.0, 0.5) 803 self.usb_desc.set_alignment(0.0, 0.5)
@@ -790,7 +812,7 @@ class DeployImageDialog (CrumbsDialog):
790 for usb in self.find_all_usb_devices(): 812 for usb in self.find_all_usb_devices():
791 self.usb_combo.append_text("/dev/" + usb) 813 self.usb_combo.append_text("/dev/" + usb)
792 self.usb_combo.set_active(0) 814 self.usb_combo.set_active(0)
793 self.vbox.pack_start(self.usb_combo, expand=True, fill=True) 815 self.vbox.pack_start(self.usb_combo, expand=False, fill=False)
794 self.vbox.pack_start(self.usb_desc, expand=False, fill=False, padding=2) 816 self.vbox.pack_start(self.usb_desc, expand=False, fill=False, padding=2)
795 817
796 self.progress_bar = HobProgressBar() 818 self.progress_bar = HobProgressBar()
@@ -801,6 +823,12 @@ class DeployImageDialog (CrumbsDialog):
801 self.vbox.show_all() 823 self.vbox.show_all()
802 self.progress_bar.hide() 824 self.progress_bar.hide()
803 825
826 def set_image_text_buffer(self, image_path):
827 self.buf.set_text(image_path)
828
829 def set_image_path(self, image_path):
830 self.image_path = image_path
831
804 def popen_read(self, cmd): 832 def popen_read(self, cmd):
805 tmpout, errors = bb.process.run("%s" % cmd) 833 tmpout, errors = bb.process.run("%s" % cmd)
806 return tmpout.strip() 834 return tmpout.strip()
@@ -816,6 +844,9 @@ class DeployImageDialog (CrumbsDialog):
816 (self.popen_read('cat /sys/class/block/%s/device/vendor' % dev), 844 (self.popen_read('cat /sys/class/block/%s/device/vendor' % dev),
817 self.popen_read('cat /sys/class/block/%s/device/model' % dev)) 845 self.popen_read('cat /sys/class/block/%s/device/model' % dev))
818 846
847 def select_image_button_clicked_cb(self, button):
848 self.emit('select_image_clicked')
849
819 def usb_combo_changed_cb(self, usb_combo): 850 def usb_combo_changed_cb(self, usb_combo):
820 combo_item = self.usb_combo.get_active_text() 851 combo_item = self.usb_combo.get_active_text()
821 if not combo_item or combo_item == self.__dummy_usb__: 852 if not combo_item or combo_item == self.__dummy_usb__: