gio.DriveVirtual File System drive management.Synopsisgio.Drivegobject.GInterfacecan_ejectcan_poll_for_mediaejectcallbackflagsgio.MOUNT_UNMOUNT_NONEcancellableNoneuser_dataNoneeject_finishresultenumerate_identifiersget_iconget_identifierget_nameget_volumeshas_mediahas_volumesis_media_check_automaticis_media_removablepoll_for_mediacallbackcancellableNoneuser_dataNonepoll_for_media_finishresultAncestry+-- gobject.GInterface
+-- gio.Drive
Prerequisitesgio.Drive requires
gobject.GObjectDescriptiongio.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.
Methodsgio.Drive.can_ejectcan_ejectReturns :True if the drive can be ejected,
False otherwise.
The can_eject() method checks if a drive can be ejected.
gio.Drive.can_poll_for_mediacan_poll_for_mediaReturns :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.
gio.Drive.ejectejectcallbackflagsgio.MOUNT_UNMOUNT_NONEcancellableNoneuser_dataNonecallback :A GAsyncReadyCallback to call when the request is satisfied.
flags :flags affecting the unmount if required for eject.
cancellable :Optional
gio.Cancellable
object, None to ignore.
user_data :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.
gio.Drive.eject_finisheject_finishresultresult :a gio.AsyncResult.
Returns :True if the drive has been ejected
successfully, False otherwise.
The eject_finish() method finishes ejecting a drive.
gio.Drive.enumerate_identifiersenumerate_identifiersReturns :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.
gio.Drive.get_iconget_iconReturns :gio.Icon
for the drive.
The get_icon() method gets the icon for drive.
gio.Drive.get_identifierget_identifierReturns :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.
gio.Drive.get_nameget_nameReturns :A string containing drive's name.
The get_name() method gets the name of drive.
gio.Drive.get_volumesget_volumesReturns :A list containing any
gio.Volume
objects on the given drive.
The get_volumes() method get a list of mountable
volumes for drive.
gio.Drive.has_mediahas_mediaReturns :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.
gio.Drive.has_volumeshas_volumesReturns :True if drive contains volumes,
False otherwise.
The has_volumes() method check if drive has any mountable volumes.
gio.Drive.is_media_check_automaticis_media_check_automaticReturns :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.
gio.Drive.is_media_removableis_media_removableReturns :True if drive supports removable media,
False otherwise.
The is_media_removable() method checks if the
drive supports removable media.
gio.Drive.poll_for_mediapoll_for_mediacallbackcancellableNoneuser_dataNonecallback :A GAsyncReadyCallback to call when the request is satisfied.
cancellable :Optional
gio.Cancellable
object, None to ignore.
user_data :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.
gio.Drive.poll_for_media_finishpoll_for_media_finishresultresult :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.