diff options
| author | Kang Kai <kai.kang@windriver.com> | 2012-06-06 17:52:26 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-06-08 12:13:17 +0100 |
| commit | 87ce7bdfd5e2bf1128226ada4dd8f88abbf51230 (patch) | |
| tree | e0cad2c2bcc26fad3d00326da600537008ba3123 /bitbake/lib | |
| parent | 0c9927865c4fd6b98daeb4b050baff9c9ca978e1 (diff) | |
| download | poky-87ce7bdfd5e2bf1128226ada4dd8f88abbf51230.tar.gz | |
ui/crumbs/hig.py: check deploy process return value
Update function response_cb of DeployImageDialog to get deploy process
return value. According the return value tell user that deploy image
successfully or not.
(Bitbake rev: f78f6d43a68e0f1dc4d3e4164eed453fcb9c22a8)
Signed-off-by: Kang Kai <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
| -rw-r--r-- | bitbake/lib/bb/ui/crumbs/hig.py | 32 |
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) |
