GOffice.FileOpener

g GObject.Object GObject.Object GOffice.FileOpener GOffice.FileOpener GObject.Object->GOffice.FileOpener

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class for_id (id)
class new (id, description, suffixes, mimes, probe_func, open_func)
class new_with_enc (id, description, suffixes, mimes, probe_func, open_func)
  can_probe (pl)
  get_description ()
  get_id ()
  get_mimes ()
  get_suffixes ()
  is_encoding_dependent ()
  open (opt_enc, io_context, view, input)
  probe (input, pl)
  register (priority)
  unregister ()

Virtual Methods

Inherited:GObject.Object (7)

Properties

Name Type Flags Short Description
description str r/w The description of the opener
id str r The identifier of the opener
interactive-only bool r/w True if this opener requires interaction

Signals

Inherited:GObject.Object (1)

Fields

Inherited:GObject.Object (1)

Class Details

class GOffice.FileOpener(**kwargs)
Bases:GObject.Object
Abstract:No
Structure:GOffice.FileOpenerClass
classmethod for_id(id)
Parameters:id (str) – File opener’s ID
Returns:GOffice.FileOpener with given id.
Return type:GOffice.FileOpener or None

Searches for file opener with given id, registered using GOffice.FileOpener.register

classmethod new(id, description, suffixes, mimes, probe_func, open_func)
Parameters:
  • id (str or None) – Optional ID of the opener
  • description (str) – Description of supported file format
  • suffixes ([str]) – List of suffixes to associate with the opener
  • mimes ([str]) – List of mime types to associate with the opener
  • probe_func (GOffice.FileOpenerProbeFunc or None) – “probe” function
  • open_func (GOffice.FileOpenerOpenFunc) – “open” function
Returns:

newly created GOffice.FileOpener object.

Return type:

GOffice.FileOpener

Creates new GOffice.FileOpener object. Optional id will be used after registering it with GOffice.FileOpener.register function.

classmethod new_with_enc(id, description, suffixes, mimes, probe_func, open_func)
Parameters:
Returns:

newly created GOffice.FileOpener object.

Return type:

GOffice.FileOpener

Creates new GOffice.FileOpener object. Optional id will be used after registering it with GOffice.FileOpener.register function.

can_probe(pl)
Parameters:pl (GOffice.FileProbeLevel) – probe level
Returns:True if self has a probe function
Return type:bool
get_description()
Returns:the description of self
Return type:str
get_id()
Returns:the id of self
Return type:str or None
get_mimes()
Returns:the supported mime types.
Return type:[str]
get_suffixes()
Returns:the suffixes for the supported file types.
Return type:[str]
is_encoding_dependent()
Returns:True if self is encoding dependent
Return type:bool
open(opt_enc, io_context, view, input)
Parameters:

Reads content of file_name file into GOffice.workbook wbv is attached to. Results are reported using io_context object, use GOffice.io_error_occurred to find out if operation was successful. The state of wbv and its GOffice.workbook is undefined if operation fails, you should destroy them in that case.

probe(input, pl)
Parameters:
Returns:

True, if the opener can read given file and False otherwise.

Return type:

bool

Checks if a given file is supported by the opener.

register(priority)
Parameters:priority (int) – Opener’s priority

Adds self opener to the list of available file openers, making it available for Gnumeric i/o routines. The opener is registered with given priority. The priority is used to determine the order in which openers will be tried when reading a file. The higher the priority, the sooner it will be tried. Default XML-based Gnumeric file opener is registered at priority 50. Recommended range for priority is [0, 100]. Reference GOffice.count for the opener is incremented inside the function, but you don’t have to (and shouldn’t) call GObject.Object.unref on it if it’s floating object (for example, when you pass object newly created with GOffice.FileOpener.new and not referenced anywhere).

unregister()

Removes self opener from list of available file openers. Reference GOffice.count for the opener is decremented inside the function.

Property Details

GOffice.FileOpener.props.description
Name:description
Type:str
Default Value:None
Flags:READABLE, WRITABLE

The description of the opener

GOffice.FileOpener.props.id
Name:id
Type:str
Default Value:None
Flags:READABLE

The identifier of the opener

GOffice.FileOpener.props.interactive_only
Name:interactive-only
Type:bool
Default Value:False
Flags:READABLE, WRITABLE

True if this opener requires interaction