matevfs Functions

matevfs Functions — Additional functions which are not part of a class.

Synopsis

    def matevfs.create(uri, open_mode=matevfs.OPEN_NONE, exclusive=False, perm=0666)
def matevfs.get_file_info(uri, options=matevfs.FILE_INFO_DEFAULT)
def matevfs.set_file_info(uri, info, mask=matevfs.SET_FILE_INFO_NONE)
def matevfs.truncate(uri, length)
def matevfs.make_directory(uri, perm)
def matevfs.remove_directory(uri)
def matevfs.unlink(uri)
def matevfs.exists(uri)
def matevfs.format_file_size_for_display(size)
def matevfs.get_mime_type(uri)
def matevfs.get_mime_type_for_data(data)
def matevfs.mime_get_icon(mime_type)
def matevfs.mime_set_icon()
def matevfs.mime_get_description(mime_type)
def matevfs.mime_set_description()
def matevfs.mime_can_be_executable(mime_type)
def matevfs.mime_set_can_be_executable()
def matevfs.monitor_add(text_uri, monitor_type, callback, user_data=None)
def matevfs.monitor_cancel(id)
def matevfs.read_entire_file(text_uri)
def matevfs.mime_get_default_application(mime_type)
def matevfs.xfer_uri()
def matevfs.xfer_uri_list()
def matevfs.xfer_delete_list()
def matevfs.mime_get_default_action_type()
def matevfs.mime_get_default_action()
def matevfs.mime_get_default_component()
def matevfs.mime_get_short_list_components()
def matevfs.mime_get_short_list_applications()
def matevfs.mime_get_all_applications()
def matevfs.mime_get_all_components()
def matevfs.mime_set_default_action_type()
def matevfs.mime_set_default_application()
def matevfs.mime_set_default_component()
def matevfs.mime_set_short_list_applications()
def matevfs.mime_set_short_list_components()
def matevfs.mime_add_application_to_short_list()
def matevfs.mime_remove_application_from_short_list()
def matevfs.mime_add_component_to_short_list()
def matevfs.mime_remove_component_from_short_list()
def matevfs.mime_add_extension()
def matevfs.mime_remove_extension()
def matevfs.mime_extend_all_applications()
def matevfs.mime_remove_from_all_applications()
def matevfs.mime_application_new_from_id()
def matevfs.connect_to_server()
def matevfs.escape_string()
def matevfs.escape_path_string()
def matevfs.escape_host_and_path_string()
def matevfs.escape_slashes()
def matevfs.escape_set()
def matevfs.unescape_string()
def matevfs.make_uri_canonical()
def matevfs.make_path_name_canonical()
def matevfs.unescape_string_for_display()
def matevfs.get_local_path_from_uri()
def matevfs.get_uri_from_local_path()
def matevfs.is_executable_command_string()
def matevfs.get_volume_free_space()
def matevfs.icon_path_from_filename()
def matevfs.open_fd()
def matevfs.is_primary_thread()
def matevfs.format_uri_for_display()
def matevfs.make_uri_from_input()
def matevfs.make_uri_from_input_with_dirs()
def matevfs.make_uri_canonical_strip_fragment()
def matevfs.uris_match()
def matevfs.get_uri_scheme()
def matevfs.make_uri_from_shell_arg()
def matevfs.url_show()
def matevfs.resolve()
def matevfs.dns_sd_browse_sync()
def matevfs.dns_sd_resolve_sync()
def matevfs.dns_sd_list_browse_domains_sync()
def matevfs.get_default_browse_domains()

Description

These functions are part of the matevfs module but are not associated with a specific class.

Functions

matevfs.create

            def matevfs.create(uri, open_mode=matevfs.OPEN_NONE, exclusive=False, perm=0666)
      

uri:

The URI to create.

open_mode:

Mode to leave the file in after creation (or matevfs.OPEN_MODE_NONE to leave the file closed).

exclusive:

Whether the file should be created in "exclusive" mode. i.e. if this flag is nonzero, The operation will fail if a file with the same name already exists.

perm:

Or'd set of file permissions flags

Returns:

A matevfs.Handle.

Create and open uri according to open_mode.

matevfs.get_file_info

            def matevfs.get_file_info(uri, options=matevfs.FILE_INFO_DEFAULT)
      

uri:

The URI to retrieve information for.

options:

Or'd set of file info options.

Returns:

A matevfs.FileInfo

Retrieve information about uri.

matevfs.set_file_info

            def matevfs.set_file_info(uri, info, mask=matevfs.SET_FILE_INFO_NONE)
      

uri:

The URI to set information on.

info:

matevfs.FileInfo with the information to set.

mask:

Or'd set of file info set flags.

Set file information for uri. Only the information for which the corresponding bit in mask is set is actually modified.

matevfs.truncate

            def matevfs.truncate(uri, length)
      

uri:

The URI of the file to truncate.

length:

The length to truncate to.

Truncate a file to a specific length.

matevfs.make_directory

            def matevfs.make_directory(uri, perm)
      

uri:

The URI of the directory to create.

perm:

Or'd set of file permissions flags.

Create a directory with the given name and permissions.

matevfs.remove_directory

            def matevfs.remove_directory(uri)
      

uri:

The URI of the directory to remove.

Remove a directory.

matevfs.unlink

            def matevfs.unlink(uri)
      

uri:

The URI of the file to unlink

Unlink (delete) a URI.

matevfs.exists

            def matevfs.exists(uri)
      

uri:

The URI to check.

Returns:

True if the URI exists.

Check if a given URI exists.

matevfs.format_file_size_for_display

            def matevfs.format_file_size_for_display(size)
      

size:

The size of the file in bytes

Returns:

A string with the printable size

Formats size in a way that is easy for the user to read. Gives the size in bytes, kilobytes, megabytes or gigabytes, choosing whatever is appropriate.

matevfs.get_mime_type

            def matevfs.get_mime_type(uri)
      

uri:

The URI to retrieve the mime type for.

Returns:

A string containing the mime type.

Determine the mime type of uri. The mime type is determined in the same way as by matevfs.get_file_info.

matevfs.get_mime_type_for_data

      

data:

A string containing the data.

Returns:

A string containing the mime type.

Tries to guess the mime type of the data in data using magic patterns.

matevfs.mime_get_icon

            def matevfs.mime_get_icon(mime_type)
      

mime_type:

A string with the mime type.

Returns:

A string with an icon name.

Query the MIME database for an icon representing mime_type. It usually returns a filename without path information, e.g. "i-chardev.png", and sometimes does not have an extension, e.g. "i-regular" if the icon is supposed to be image type agnostic between icon themes. Icons are generic and not theme specific. These will not necessarily match with the icons a user sees in Caja, you have been warned.

matevfs.mime_get_description

            def matevfs.mime_get_description(mime_type)
      

mime_type:

The mime type to query.

Returns:

A description of the mime type.

Query the MIME database for a description of mime_type.

matevfs.mime_can_be_executable

            def matevfs.mime_can_be_executable(mime_type)
      

mime_type:

The mime type to query.

Returns:

True if files of mime_type can be executable, False otherwise.

Check whether files of mime_type might conceivably be executable. Default for known types is False. Default for unknown types is True.

matevfs.monitor_add

            def matevfs.monitor_add(text_uri, monitor_type, callback, extra=None)
      

text_uri:

String representing the URI to monitor.

monitor_type:

A monitor type signifying the type of the URI.

callback:

Function to call when the monitor is tripped.

user_data:

Data to pass to callback

Returns:

An identifier representing this monitor.

Watch the file or directory at text_uri for changes (or the creation/deletion of the file) and call callback when there is a change. If a directory monitor is added, callback is notified when any file in the directory changes.

matevfs.monitor_cancel

            def matevfs.monitor_cancel(id)
      

id:

Identifier which was given by monitor_add

Cancel the monitor pointed to by id

matevfs.read_entire_file

            def matevfs.read_entire_file(text_uri)
      

text_uri:

String containing the URI of the file to read.

Returns:

String containing the data in the file.

Reads an entire file into memory for convenience. Beware of accidentally loading large files into memory with this function.

matevfs.mime_get_default_application

            def matevfs.mime_get_default_application(mime_type)
      

mime_type:

Mime type to query.

Returns:

Information about the application configured as the default handler for mime_type.

Query the MIME database for the default MateComponent component to be activated to view files of MIME type mime_type