mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 11:30:19 +01:00
* Fixed bugs in eject functionality.
This commit is contained in:
@@ -5,7 +5,6 @@ device (cd, dvd) helper
|
|||||||
|
|
||||||
import string
|
import string
|
||||||
import os
|
import os
|
||||||
import popen2
|
|
||||||
|
|
||||||
def volname(mntp):
|
def volname(mntp):
|
||||||
"""read volume name from cd/dvd"""
|
"""read volume name from cd/dvd"""
|
||||||
@@ -23,7 +22,7 @@ def volname(mntp):
|
|||||||
|
|
||||||
def volmount(mntp):
|
def volmount(mntp):
|
||||||
"""mount device, return True/False"""
|
"""mount device, return True/False"""
|
||||||
_in,_out,_err = popen2.popen3("mount %s" % mntp)
|
_in,_out,_err = os.popen3("mount %s" % mntp)
|
||||||
inf = _err.readlines()
|
inf = _err.readlines()
|
||||||
if len(inf) > 0:
|
if len(inf) > 0:
|
||||||
for i in inf:
|
for i in inf:
|
||||||
@@ -34,7 +33,7 @@ def volmount(mntp):
|
|||||||
|
|
||||||
def volumount(mntp):
|
def volumount(mntp):
|
||||||
"""mount device, return True/False"""
|
"""mount device, return True/False"""
|
||||||
_in,_out,_err = popen2.popen3("umount %s" % mntp)
|
_in,_out,_err = os.popen3("umount %s" % mntp)
|
||||||
inf = _err.readlines()
|
inf = _err.readlines()
|
||||||
if len(inf) > 0:
|
if len(inf) > 0:
|
||||||
for error in inf:
|
for error in inf:
|
||||||
@@ -68,17 +67,19 @@ def mountpoint_to_dev(mntp):
|
|||||||
fstab.close()
|
fstab.close()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def eject_cd(eject_app,cd):
|
def eject_cd(eject_app, cd):
|
||||||
"""mount device, return True/False"""
|
"""mount device, return True/False"""
|
||||||
if len(eject_app) > 0:
|
if len(eject_app) > 0:
|
||||||
_in,_out,_err = popen2.popen3("%s %s" %(eject_app,cd))
|
_in,_out,_err = os.popen3("%s %s" % (eject_app, cd))
|
||||||
inf = _err.readlines()
|
inf = _err.readlines()
|
||||||
error = ''
|
error = ''
|
||||||
|
|
||||||
for error in inf:
|
for error in inf:
|
||||||
error.strip()
|
error.strip()
|
||||||
|
|
||||||
|
if error !='':
|
||||||
|
return error
|
||||||
|
|
||||||
if error.strip()[:6] == 'eject:':
|
return 'ok'
|
||||||
return error.strip()
|
return "Eject program not specified"
|
||||||
else:
|
|
||||||
return 'ok'
|
|
||||||
return "Mount point does'nt exist in fstab"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user