* [PATCH 1/3] ui/crumbs/hig.py: tweak strings
2012-06-14 10:10 [PATCH 0/3] Update for Yocto 2388 Kang Kai
@ 2012-06-14 10:10 ` Kang Kai
2012-06-14 10:10 ` [PATCH 2/3] ui/crumbs/hig.py: simplify subprocess call Kang Kai
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Kang Kai @ 2012-06-14 10:10 UTC (permalink / raw)
To: bitbake-devel; +Cc: Zhenfeng.Zhao
Add comments for DeployImageDialog 'standalone' part of codes to make it
easy to read.
And tweak some strings.
Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
bitbake/lib/bb/ui/crumbs/hig.py | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index 3b50f68..0c3f56c 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -784,6 +784,11 @@ class DeployImageDialog (CrumbsDialog):
scroll.add(tv)
table.attach(scroll, 0, 10, 0, 1)
+ # There are 2 ways to use DeployImageDialog
+ # One way is that called by HOB when the 'Deploy Image' button is clicked
+ # The other way is that called by a standalone script.
+ # Following block of codes handles the latter way. It adds a 'Select Image' button and
+ # emit a signal when the button is clicked.
if self.standalone:
gobject.signal_new("select_image_clicked", self, gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, ())
@@ -874,16 +879,16 @@ class DeployImageDialog (CrumbsDialog):
if os.path.exists(tmpname):
tmpfile = open(tmpname)
if int(tmpfile.readline().strip()) == 0:
- lbl = "<b>Deploy image successfully</b>"
+ lbl = "<b>Deploy image successfully.</b>"
else:
- lbl = "<b>Deploy image failed</b>\nPlease try again."
+ lbl = "<b>Failed to deploy image.</b>\nPlease check image <b>%s</b> exists and USB device <b>%s</b> is writable." % (self.image_path, combo_item)
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"
+ lbl = "<b>No selection made.</b>\nYou have not selected an image to deploy."
else:
- lbl = "<b>No selection made</b>\nYou have not selected USB device"
+ lbl = "<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)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] ui/crumbs/hig.py: simplify subprocess call
2012-06-14 10:10 [PATCH 0/3] Update for Yocto 2388 Kang Kai
2012-06-14 10:10 ` [PATCH 1/3] ui/crumbs/hig.py: tweak strings Kang Kai
@ 2012-06-14 10:10 ` Kang Kai
2012-06-14 10:10 ` [PATCH 3/3] image-writer: tweak some strings Kang Kai
2012-06-14 12:55 ` [PATCH 0/3] Update for Yocto 2388 Richard Purdie
3 siblings, 0 replies; 5+ messages in thread
From: Kang Kai @ 2012-06-14 10:10 UTC (permalink / raw)
To: bitbake-devel; +Cc: Zhenfeng.Zhao
According to Darren's suggestion, subprocess.call() will wait until the
subprocess complete. So simplify the code, use subprocess.call() to wait
command complete.
Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
bitbake/lib/bb/ui/crumbs/hig.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index 0c3f56c..b586b6c 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -27,6 +27,7 @@ import hashlib
import os
import re
import shlex
+import subprocess
from bb.ui.crumbs.hobcolor import HobColors
from bb.ui.crumbs.hobwidget import hcc, hic, HobViewTable, HobInfoButton, HobButton, HobAltButton, HobIconChecker
from bb.ui.crumbs.progressbar import HobProgressBar
@@ -871,8 +872,7 @@ class DeployImageDialog (CrumbsDialog):
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()
+ subprocess.call(shlex.split(cmdline))
# 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.
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] image-writer: tweak some strings
2012-06-14 10:10 [PATCH 0/3] Update for Yocto 2388 Kang Kai
2012-06-14 10:10 ` [PATCH 1/3] ui/crumbs/hig.py: tweak strings Kang Kai
2012-06-14 10:10 ` [PATCH 2/3] ui/crumbs/hig.py: simplify subprocess call Kang Kai
@ 2012-06-14 10:10 ` Kang Kai
2012-06-14 12:55 ` [PATCH 0/3] Update for Yocto 2388 Richard Purdie
3 siblings, 0 replies; 5+ messages in thread
From: Kang Kai @ 2012-06-14 10:10 UTC (permalink / raw)
To: bitbake-devel; +Cc: Zhenfeng.Zhao
Tweak some strings in accord with the script name 'image writer', and
remove extra noun 'button'.
Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
bitbake/bin/image-writer | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/bitbake/bin/image-writer b/bitbake/bin/image-writer
index 3f9f5c1..0b9e450 100755
--- a/bitbake/bin/image-writer
+++ b/bitbake/bin/image-writer
@@ -33,7 +33,7 @@ from bb.ui.crumbs.hobwidget import HobAltButton, HobButton
# I put all the fs bitbake supported here. Need more test.
DEPLOYABLE_IMAGE_TYPES = ["jffs2", "cramfs", "ext2", "ext3", "btrfs", "squashfs", "ubi", "vmdk"]
-Title = "USB Image Maker"
+Title = "USB Image Writer"
class DeployWindow(gtk.Window):
def __init__(self, image_path=''):
@@ -43,13 +43,13 @@ class DeployWindow(gtk.Window):
valid = True
if not os.path.exists(image_path):
valid = False
- lbl = "<b>Invalid image file path: %s.</b>\nPress <b>Select Image</b> button to select an image." % image_path
+ lbl = "<b>Invalid image file path: %s.</b>\nPress <b>Select Image</b> to select an image." % image_path
else:
image_path = os.path.abspath(image_path)
extend_name = os.path.splitext(image_path)[1][1:]
if extend_name not in DEPLOYABLE_IMAGE_TYPES:
valid = False
- lbl = "<b>Undeployable imge type: %s</b>\nPress <b>Select Image</b> button to select an image." % extend_name
+ lbl = "<b>Undeployable imge type: %s</b>\nPress <b>Select Image</b> to select an image." % extend_name
if not valid:
image_path = ''
@@ -66,8 +66,8 @@ class DeployWindow(gtk.Window):
HobAltButton.style_button(close_button)
close_button.connect('clicked', gtk.main_quit)
- make_button = self.deploy_dialog.add_button("Make USB image", gtk.RESPONSE_YES)
- HobAltButton.style_button(make_button)
+ write_button = self.deploy_dialog.add_button("Write USB image", gtk.RESPONSE_YES)
+ HobAltButton.style_button(write_button)
self.deploy_dialog.connect('select_image_clicked', self.select_image_clicked_cb)
self.deploy_dialog.connect('destroy', gtk.main_quit)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/3] Update for Yocto 2388
2012-06-14 10:10 [PATCH 0/3] Update for Yocto 2388 Kang Kai
` (2 preceding siblings ...)
2012-06-14 10:10 ` [PATCH 3/3] image-writer: tweak some strings Kang Kai
@ 2012-06-14 12:55 ` Richard Purdie
3 siblings, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2012-06-14 12:55 UTC (permalink / raw)
To: Kang Kai; +Cc: bitbake-devel, Zhenfeng.Zhao
On Thu, 2012-06-14 at 18:10 +0800, Kang Kai wrote:
> Hi,
>
> These are 3 updates of
> Yocto 2388: [Hob] Separate the hob image writer into a separate application
> Two of them are strings update, and the other one is for simplify code.
>
> Regards,
> Kai
>
> The following changes since commit 5ed855d12cddf2de535c3f6d05d3dfe85d69d99d:
>
> openjade-native: Ensure we reautoconf the package (2012-06-12 16:34:30 +0100)
>
> are available in the git repository at:
> git://git.pokylinux.org/poky-contrib kangkai/distro
> http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/distro
>
> Kang Kai (3):
> ui/crumbs/hig.py: tweak strings
> ui/crumbs/hig.py: simplify subprocess call
> image-writer: tweak some strings
Merged to master, thanks.
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread