aboutsummaryrefslogtreecommitdiffstats
path: root/lib/isodumper.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/isodumper.py')
-rwxr-xr-xlib/isodumper.py17
1 files changed, 14 insertions, 3 deletions
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: