summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig.py32
1 files changed, 29 insertions, 3 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index cf73145442..97a3b22f15 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -827,12 +827,38 @@ class DeployImageDialog (CrumbsDialog):
827 827
828 def response_cb(self, dialog, response_id): 828 def response_cb(self, dialog, response_id):
829 if response_id == gtk.RESPONSE_YES: 829 if response_id == gtk.RESPONSE_YES:
830 lbl = ''
830 combo_item = self.usb_combo.get_active_text() 831 combo_item = self.usb_combo.get_active_text()
831 if combo_item and combo_item != self.__dummy_usb__: 832 if combo_item and combo_item != self.__dummy_usb__ and self.image_path:
832 cmdline = bb.ui.crumbs.utils.which_terminal() 833 cmdline = bb.ui.crumbs.utils.which_terminal()
833 if cmdline: 834 if cmdline:
834 cmdline += "\"sudo dd if=" + self.image_path + " of=" + combo_item + "\"" 835 tmpname = os.tmpnam()
835 bb.process.Popen(shlex.split(cmdline)) 836 cmdline += "\"sudo dd if=" + self.image_path + \
837 " of=" + combo_item + "; echo $? > " + tmpname + "\""
838 deploy_process = bb.process.Popen(shlex.split(cmdline))
839 deploy_process.wait()
840
841 # if file tmpname not exists, that means there is something wrong with xterm
842 # user can get the error message from xterm so no more warning need.
843 if os.path.exists(tmpname):
844 tmpfile = open(tmpname)
845 if int(tmpfile.readline().strip()) == 0:
846 lbl = "<b>Deploy image successfully</b>"
847 else:
848 lbl = "<b>Deploy image failed</b>\nPlease try again."
849 tmpfile.close()
850 os.remove(tmpname)
851 else:
852 if not self.image_path:
853 lbl = "<b>No selection made</b>\nYou have not selected an image to deploy"
854 else:
855 lbl = "<b>No selection made</b>\nYou have not selected USB device"
856 if len(lbl):
857 crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
858 button = crumbs_dialog.add_button("Close", gtk.RESPONSE_OK)
859 HobButton.style_button(button)
860 crumbs_dialog.run()
861 crumbs_dialog.destroy()
836 862
837 def update_progress_bar(self, title, fraction, status=None): 863 def update_progress_bar(self, title, fraction, status=None):
838 self.progress_bar.update(fraction) 864 self.progress_bar.update(fraction)