aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2018-10-10 14:43:23 +0200
committerPapoteur <papoteur@mageia.org>2018-10-10 14:43:23 +0200
commitab2638828a1f80f3c2cae77d313d071ae8811428 (patch)
tree1d46ee265383d2a6870485a722121ba5d65c3a2c
parent9b88f96ffafe2176fb76af2e83d0d0c72ee44635 (diff)
downloadisodumper-ab2638828a1f80f3c2cae77d313d071ae8811428.tar
isodumper-ab2638828a1f80f3c2cae77d313d071ae8811428.tar.gz
isodumper-ab2638828a1f80f3c2cae77d313d071ae8811428.tar.bz2
isodumper-ab2638828a1f80f3c2cae77d313d071ae8811428.tar.xz
isodumper-ab2638828a1f80f3c2cae77d313d071ae8811428.zip
Apply same method over DBus to Backup feature
-rwxr-xr-xbackend/magiback6
-rwxr-xr-xbackend/raw_write.py3
-rwxr-xr-xlib/isodumper.py27
3 files changed, 24 insertions, 12 deletions
diff --git a/backend/magiback b/backend/magiback
index f5c58a7..7f3785b 100755
--- a/backend/magiback
+++ b/backend/magiback
@@ -16,6 +16,7 @@ class Isodumper(raw_write.Dumper):
<method name='do_write'>
<arg type='s' name='source' direction='in'/>
<arg type='s' name='target' direction='in'/>
+ <arg type='x' name='size' direction='in'/>
</method>
<method name='do_unmount'>
<arg type='s' name='device' direction='in'/>
@@ -53,11 +54,10 @@ class Isodumper(raw_write.Dumper):
self.authorized_sender_read = set()
self.authorized_sender_write = set()
- def do_write(self,source, target, dbus_context):
+ def do_write(self,source, target, size, dbus_context):
if check_permission('org.mageia.Magiback.Isodumper.write',dbus_context):
- print("Writing")
self.finished.clear()
- self.thread = threading.Thread(target=self._do_write, args=(source, target, ))
+ self.thread = threading.Thread(target=self._do_write, args=(source, target, size, ))
self.thread.start()
else:
self.return_message = "Access denied"
diff --git a/backend/raw_write.py b/backend/raw_write.py
index 309cf17..ed617cd 100755
--- a/backend/raw_write.py
+++ b/backend/raw_write.py
@@ -37,11 +37,10 @@ import gnupg
class Dumper(object):
- def _do_write(self,source,target):
+ def _do_write(self,source,target, b):
# Writing step
#Dump mode
self.returncode=0
- b=os.path.getsize(source)
self.operation=True
bs=4096*128
try:
diff --git a/lib/isodumper.py b/lib/isodumper.py
index df67d67..d0d9aa5 100755
--- a/lib/isodumper.py
+++ b/lib/isodumper.py
@@ -162,10 +162,8 @@ class IsoDumper(object):
self.backup_select.setLabel(tail)
self.dialog.recalcLayout()
self.backupbt.setEnabled()
- #self.backup_select.set_tooltip_text(self.backup_img_name)
- self.logger(_('Backup to: ')+ self.backup_img_name)
- def do_format(self,format_type,name) :
+ def do_format(self,format_type,name):
target = self.dev.split('(')[1].split(')')[0]
info = Info(_("Formatting confirmation"),True,self.warning)
if self.ask_YesOrNo(info):
@@ -241,9 +239,24 @@ class IsoDumper(object):
self.returncode=0
source = self.dev.split('(')[1].split(')')[0]
self.logger(_('Backup to:')+' '+dest)
- self.raw_write(source, dest, self.deviceSize)
- if self.returncode==0:
- self.success()
+ bus = SystemBus()
+ iface = bus.get("org.mageia.Magiback","Isodumper")
+ #Writing step
+ iface.do_write(source, dest, self.deviceSize)
+ progress = iface.progress
+ while not iface.done :
+ progress = iface.progress
+ self.progress.setValue(progress)
+ time.sleep(1)
+ success, message = iface.end()
+ if success:
+ self.logger(_('{source} successfully written to {target}').format( source=source.split('/')[-1], target=dest))
+ self.progress.setEnabled()
+ self.progress.setValue(100)
+ self.logger(message)
+ self.success()
+ else:
+ self.emergency(message)
def do_write(self):
self.writebt.setDisabled()
@@ -281,7 +294,7 @@ class IsoDumper(object):
if success:
#Writing step
#Dump mode
- iface.do_write(source, target)
+ iface.do_write(source, target, b)
progress = iface.progress
while not iface.done :
progress = iface.progress