From 0910c539f06f5d92a3bc613ea9a7e7fc1f76fcf3 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Sat, 7 Sep 2019 15:24:45 +0200 Subject: Add eject order after the writing operation (mga#25347) --- lib/isodumper.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/isodumper.py b/lib/isodumper.py index 1cf29cb..9c34e15 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -58,11 +58,12 @@ class UDisks2(object): BLOCK = 'org.freedesktop.UDisks2.Block' DRIVE = 'org.freedesktop.UDisks2.Drive' + SERVICE = 'org.freedesktop.UDisks2' def __init__(self): self.bus = SystemBus() try: - self.iface = self.bus.get('org.freedesktop.UDisks2') + self.iface = self.bus.get(self.SERVICE) except : raise NoUDisks2() @@ -101,6 +102,14 @@ class UDisks2(object): list.append(item) return list + def eject(self, device): + ''' device is expected like /dev/sda''' + block = os.path.basename(device) + iface = self.bus.get(self.SERVICE,'/org/freedesktop/UDisks2/block_devices/' + block) + drive = iface.Get(self.BLOCK,"Drive") + i_drive = self.bus.get(self.SERVICE, drive) + i_drive.Eject({}) + class Info(object): def __init__(self,title,richtext,text): self.title=title @@ -316,7 +325,7 @@ class IsoDumper(object): self.logger(_('Bytes written: ')+str(b)) self.progress.setLabel(_('Checking ')+target.split('/')[-1]) self.progress.setValue(0) - self.dialog.pollEvent() + self.dialog.pollEvent() # Checking iface.check_write(target, source) progress = iface.progress @@ -335,7 +344,9 @@ class IsoDumper(object): self.logger(_("Adding persistent partition")) iface.do_persistence(target,"mgalive-persist") self.logger(_("Added persistent partition")) - self.success() + #Eject + self.u.eject(target) + self.success() else: self.emergency(message) else: -- cgit v1.2.1