aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageialinux-online.org>2015-03-08 08:16:51 +0100
committerPapoteur <papoteur@mageialinux-online.org>2015-03-08 08:16:51 +0100
commit5e9f15ab850a406663634ba899d9abf1d144db66 (patch)
tree4691c26be714efebcc89f14dc1b6bff213e137df
parentfac28b22b89d8202c3a62ff4380422f302f7b122 (diff)
downloadisodumper-5e9f15ab850a406663634ba899d9abf1d144db66.tar
isodumper-5e9f15ab850a406663634ba899d9abf1d144db66.tar.gz
isodumper-5e9f15ab850a406663634ba899d9abf1d144db66.tar.bz2
isodumper-5e9f15ab850a406663634ba899d9abf1d144db66.tar.xz
isodumper-5e9f15ab850a406663634ba899d9abf1d144db66.zip
Change writing mode for UEFI
-rw-r--r--CHANGELOG8
-rwxr-xr-xlib/isodumper.py43
-rw-r--r--share/isodumper/isodumper.glade31
3 files changed, 71 insertions, 11 deletions
diff --git a/CHANGELOG b/CHANGELOG
index bcb3201..c4fd464 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,14 @@
The initial state comes from https://launchpad.net/usb-imagewriter
The modifications are:
+IsoDumper 0.41
+------------
+ - added a wait for unmount the USB key after writing.
+ - new calcultation for progressbar based on file size instead of number in UEFI mode
+ - added occasions to refresh the window.
+ - replace the shutil.copy2 with built-in instructions
+
+
IsoDumper 0.40
------------
- added a help button and dialog box.
diff --git a/lib/isodumper.py b/lib/isodumper.py
index ba16a2b..590db25 100755
--- a/lib/isodumper.py
+++ b/lib/isodumper.py
@@ -138,7 +138,7 @@ class UDisks2(object):
try:
d = self.device(device_node_path)
mount_options = ['rw', 'noexec', 'nosuid',
- 'nodev', 'uid=%d'%os.geteuid(), 'gid=%d'%os.getegid()]
+ 'nodev','uid=%d'%os.geteuid(), 'gid=%d'%os.getegid()]
r=d.Mount(
{
'auth.no_user_interaction':True,
@@ -184,7 +184,7 @@ class IsoDumper:
def __init__(self,user):
APP="isodumper"
DIR="/usr/share/locale"
- RELEASE="v0.40"
+ RELEASE="v0.41"
gettext.bindtextdomain(APP, DIR)
gettext.textdomain(APP)
@@ -462,7 +462,7 @@ class IsoDumper:
dialog = self.wTree.get_widget("confirm_dialog")
# if self.backup.get_active() :
# backup_dest=self.backup_select.get_label()
- self.logger(_('Image: ')+source)
+# self.logger(_('Image: ')+source)
self.logger(_('Target Device: ')+self.dev)
b = os.path.getsize(source)
if b > (self.deviceSize):
@@ -522,7 +522,7 @@ class IsoDumper:
if dest!="":
self.logger(_("Mounted in: ")+dest)
self.returncode=0
- task = self.files_write(source, dest)
+ task = self.files_write(source, dest, b)
gobject.idle_add(task.next)
self.operation=False
while gtk.events_pending():
@@ -642,6 +642,8 @@ class IsoDumper:
mark = self.log.create_mark("end", self.log.get_end_iter(), False)
self.logview.scroll_to_mark(mark, 0.05, True, 0.0, 1.0)
progress.set_fraction(float(indice)/100)
+ while gtk.events_pending():
+ gtk.main_iteration(True)
indice +=1
try:
os.fsync(ofc)
@@ -702,9 +704,9 @@ class IsoDumper:
progress.set_fraction(1.0)
yield False
- def files_write(self, source, dest):
- import shutil
+ def files_write(self, source, dest, size):
self.operation=True
+ self.logger(time.ctime(time.time()))
temp_dir='/mnt/MGALIVE'
makedirs(temp_dir)
self.process=Popen(['mount', '-o', 'loop',source,temp_dir ], shell=False, stdout=PIPE)
@@ -727,8 +729,8 @@ class IsoDumper:
gtk.main_iteration(True)
total_files=countFiles(temp_dir)
self.logger(_("%s file(s) to copy."%total_files))
+ cumuled_size=0
if total_files > 0:
- numCopied = 0
for path, dirs, filenames in os.walk(temp_dir):
for directory in dirs:
destDir = path.replace(temp_dir,dest)
@@ -736,12 +738,33 @@ class IsoDumper:
for sfile in filenames:
srcFile = os.path.join(path, sfile)
destFile = os.path.join(path.replace(temp_dir, dest), sfile)
- shutil.copy2(srcFile, destFile)
- numCopied += 1
- progress.set_fraction(float(numCopied)/total_files)
+ try:
+ with open(srcFile, 'rb') as fsrc:
+ with open(destFile, 'wb') as fdst:
+ while 1:
+ buf = fsrc.read(256*1024)
+ if not buf:
+ os.fsync(fdst)
+ break
+ fdst.write(buf)
+ cumuled_size += len(buf)
+ progress.set_fraction(min(float(cumuled_size)/size,1))
+ print float(cumuled_size)/size
+ while gtk.events_pending():
+ gtk.main_iteration(True)
+ except:
+ self.returncode=1
+ return
+ while gtk.events_pending():
+ gtk.main_iteration(True)
yield True
self.process = Popen(['umount', temp_dir ], shell=False, stdout=PIPE)
+ while True :
+ self.process.poll()
+ if self.process.returncode != None:
+ break
self.logger(_('Image ')+source.split('/')[-1]+_(' successfully written to ')+dest)
+ self.logger(time.ctime(time.time()))
else:
self.returncode=1
diff --git a/share/isodumper/isodumper.glade b/share/isodumper/isodumper.glade
index 9097588..3e8cea1 100644
--- a/share/isodumper/isodumper.glade
+++ b/share/isodumper/isodumper.glade
@@ -14,6 +14,21 @@
<property name="buttons">ok-cancel</property>
<property name="text" translatable="yes">Writing is in progress. Exiting during writing will occur that the device or the backup will be unusable.
Are you sure you want to quit during writing?</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox2">
+ <property name="can_focus">False</property>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area2">
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
</widget>
<widget class="GtkAboutDialog" id="about_dialog">
<property name="can_focus">False</property>
@@ -608,6 +623,21 @@ Public License instead of this License.
<property name="message_type">warning</property>
<property name="buttons">ok-cancel</property>
<property name="secondary_text" translatable="yes">Do you want to overwrite the file?</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox7">
+ <property name="can_focus">False</property>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area7">
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
</widget>
<widget class="GtkDialog" id="emergency_dialog">
<property name="can_focus">False</property>
@@ -971,7 +1001,6 @@ The fields of the main window are as follows:
<widget class="GtkWindow" id="main_dialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">IsoDumper</property>
- <property name="resizable">False</property>
<property name="window_position">center</property>
<property name="icon_name">isodumper</property>
<property name="type_hint">dialog</property>