gio.Drive — Virtual File System drive management.
class gio.Drive(gobject.GInterface): |
gio.Drive
- this represent a piece of hardware connected to the machine. Its generally
only created for removable hardware or hardware with removable media.
gio.Drive
is a container class for GVolume objects that stem from the same piece of media.
As such, gio.Drive
abstracts a drive with (or without) removable media and provides operations for
querying whether media is available, determing whether media change is automatically
detected and ejecting the media.
If the gio.Drive
reports that media isn't automatically detected, one can poll for media; typically
one should not do this periodically as a poll for media operation is potententially
expensive and may spin up the drive creating noise.
For porting from GnomeVFS note that there is no equivalent of
gio.Drive
in that API.
def can_eject()
Returns : | True if the drive can be ejected,
False otherwise.
|
The can_eject
() method checks if a drive can be ejected.
def can_poll_for_media()
Returns : | True if the drive can be polled
for media changes, False otherwise.
|
The can_poll_for_media
() method checks if a drive
can be polled for media changes.
def eject(callback
, flags
=gio.MOUNT_UNMOUNT_NONE, cancellable
=None, user_data
=None)
| A GAsyncReadyCallback to call when the request is satisfied. |
| flags affecting the unmount if required for eject. |
| Optional
gio.Cancellable
object, None to ignore.
|
| The data to pass to callback function. |
The eject
() method asynchronously ejects a drive.
When the operation is finished, callback will be called. You can then call
gio.Drive.eject_finish
()
to obtain the result of the operation.
def eject_finish(result
)
| a gio.AsyncResult .
|
Returns : | True if the drive has been ejected
successfully, False otherwise.
|
The eject_finish
() method finishes ejecting a drive.
def enumerate_identifiers()
Returns : | a list of strings containing kinds of identifiers. |
The enumerate_identifiers
() method gets the kinds
of identifiers that drive has. Use
gio.Drive.get_identifier
()
to obtain the identifiers themselves.
def get_icon()
Returns : | gio.Icon
for the drive.
|
The get_icon
() method gets the icon for drive.
def get_identifier()
Returns : | A string containing the requested identfier, or
None if the
gio.Drive
doesn't have this kind of identifier.
|
The get_identifier
() method gets the identifier of
the given kind for drive.
def get_name()
Returns : | A string containing drive's name. |
The get_name
() method gets the name of drive.
def get_volumes()
Returns : | A list containing any
gio.Volume
objects on the given drive.
|
The get_volumes
() method get a list of mountable
volumes for drive.
def has_media()
Returns : | True if drive has media,
False otherwise. |
The has_media
() method checks if the drive
has media. Note that the OS may not be polling the drive for media changes; see
gio.Drive.is_media_check_automatic
()
for more details.
def has_volumes()
Returns : | True if drive contains volumes,
False otherwise. |
The has_volumes
() method check if drive has any mountable volumes.
def is_media_check_automatic()
Returns : | True if drive is capabable
of automatically detecting media changes,
False otherwise. |
The is_media_check_automatic
() method checks if
drive is capabable of automatically detecting media changes.
def is_media_removable()
Returns : | True if drive supports removable media,
False otherwise. |
The is_media_removable
() method checks if the
drive supports removable media.
def poll_for_media(callback
, cancellable
=None, user_data
=None)
| A GAsyncReadyCallback to call when the request is satisfied. |
| Optional
gio.Cancellable
object, None to ignore.
|
| The data to pass to callback function. |
The poll_for_media
() method asynchronously polls
drive to see if media has been inserted or removed.
When the operation is finished, callback will be called. You can then call
gio.Drive.poll_for_media_finish
()
to obtain the result of the operation.
def poll_for_media_finish(result
)
| a gio.AsyncResult .
|
Returns : | True if the drive has been poll_for_mediaed
successfully, False otherwise.
|
The poll_for_media_finish
() method finishes
an operation started with
gio.Drive.poll_for_media
()
on a drive.