From: Darren Hart <dvhart@linux.intel.com>
To: Kang Kai <kai.kang@windriver.com>
Cc: bitbake-devel@lists.openembedded.org, zhenfeng.zhao@windriver.com
Subject: Re: [PATCH 4/6] ui/crumbs/hig.py: check deploy process return value
Date: Fri, 08 Jun 2012 07:56:40 -0700 [thread overview]
Message-ID: <4FD212A8.6080401@linux.intel.com> (raw)
In-Reply-To: <bda43415c8822a6a47f955a7df6b382db29f7b33.1338976258.git.kai.kang@windriver.com>
Hi Kang,
A couple comments below...
On 06/06/2012 02:52 AM, Kang Kai wrote:
> Update function response_cb of DeployImageDialog to get deploy process
> return value. According the return value tell user that deploy image
> successfully or not.
>
> Signed-off-by: Kang Kai <kai.kang@windriver.com>
> ---
> 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 cf73145..97a3b22 100644
> --- a/bitbake/lib/bb/ui/crumbs/hig.py
> +++ b/bitbake/lib/bb/ui/crumbs/hig.py
> @@ -827,12 +827,38 @@ class DeployImageDialog (CrumbsDialog):
>
> def response_cb(self, dialog, response_id):
> if response_id == gtk.RESPONSE_YES:
> + lbl = ''
> combo_item = self.usb_combo.get_active_text()
> - if combo_item and combo_item != self.__dummy_usb__:
> + if combo_item and combo_item != self.__dummy_usb__ and self.image_path:
> cmdline = bb.ui.crumbs.utils.which_terminal()
> if cmdline:
> - cmdline += "\"sudo dd if=" + self.image_path + " of=" + combo_item + "\""
> - bb.process.Popen(shlex.split(cmdline))
This should be subprocess.call()
http://docs.python.org/library/subprocess.html
> + tmpname = os.tmpnam()
> + cmdline += "\"sudo dd if=" + self.image_path + \
> + " of=" + combo_item + "; echo $? > " + tmpname + "\""
> + deploy_process = bb.process.Popen(shlex.split(cmdline))
> + deploy_process.wait()
> +
> + # if file tmpname not exists, that means there is something wrong with xterm
> + # user can get the error message from xterm so no more warning need.
> + if os.path.exists(tmpname):
> + tmpfile = open(tmpname)
> + if int(tmpfile.readline().strip()) == 0:
> + lbl = "<b>Deploy image successfully</b>"
"<b>Deployed image successfully.</b>"
> + else:
> + lbl = "<b>Deploy image failed</b>\nPlease try again."
"<b>Failed to deploy image.</b>"
As to "Please try again." Why would the user have any expectation of a
different result? Is there something we can tell them about the reason
for the failure?
> + tmpfile.close()
> + os.remove(tmpname)
> + else:
> + if not self.image_path:
> + lbl = "<b>No selection made</b>\nYou have not selected an image to deploy"
Missing periods.
> + else:
> + lbl = "<b>No selection made</b>\nYou have not selected USB device"
Missing periods. Missing article:
"<b>No selection made.</b>\nYou have not selected a USB device."
> + if len(lbl):
> + crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
> + button = crumbs_dialog.add_button("Close", gtk.RESPONSE_OK)
> + HobButton.style_button(button)
> + crumbs_dialog.run()
> + crumbs_dialog.destroy()
>
> def update_progress_bar(self, title, fraction, status=None):
> self.progress_bar.update(fraction)
--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
next prev parent reply other threads:[~2012-06-08 15:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-06 9:52 [PATCH 0/6] V2 hob2: some tweak and add a standalone deploy image tool Kang Kai
2012-06-06 9:52 ` [PATCH 1/6] ui/crumbs/utils.py: import module bb Kang Kai
2012-06-06 9:52 ` [PATCH 2/6] ui/crumbs/hig.py: fix run time error Kang Kai
2012-06-06 9:52 ` [PATCH 3/6] ui/crumbs/hig.py: remove extra spaces Kang Kai
2012-06-06 9:52 ` [PATCH 4/6] ui/crumbs/hig.py: check deploy process return value Kang Kai
2012-06-08 14:56 ` Darren Hart [this message]
2012-06-06 9:52 ` [PATCH 5/6] hob2: update DeployImageDialog for seperated tool Kang Kai
2012-06-08 15:00 ` Darren Hart
2012-06-06 9:52 ` [PATCH 6/6] hob2: create a standalone deploy image tool Kang Kai
2012-06-08 15:03 ` Darren Hart
2012-06-08 11:14 ` [PATCH 0/6] V2 hob2: some tweak and add " Richard Purdie
2012-06-08 15:05 ` Darren Hart
2012-06-13 1:25 ` Kang Kai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FD212A8.6080401@linux.intel.com \
--to=dvhart@linux.intel.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=kai.kang@windriver.com \
--cc=zhenfeng.zhao@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox