Phoenix Logo

phoenix_title wx.richtext.RichTextFileHandler

The base class for file handlers.


class_hierarchy Class Hierarchy

Inheritance diagram for class RichTextFileHandler:


method_summary Methods Summary

__init__ Creates a file handler object.
CanHandle Returns True if we handle this filename (if using files).
CanLoad Returns True if we can load using this handler.
CanSave Returns True if we can save using this handler.
DoLoadFile Override to load content from stream into buffer.
DoSaveFile Override to save content to stream from buffer.
GetEncoding Returns the encoding to use when saving a file.
GetExtension Returns the default extension to recognise.
GetFlags Returns flags controlling how loading and saving is done.
GetName Returns the name of the handler.
GetType Returns the handler type.
IsVisible Returns True if this handler should be visible to the user.
LoadFile Loads the buffer from a stream.
SaveFile Saves the buffer to a stream.
SetEncoding Sets the encoding to use when saving a file.
SetExtension Sets the default extension to recognise.
SetFlags Sets flags that change the behaviour of loading or saving.
SetName Sets the name of the handler.
SetType Sets the handler type.
SetVisible Sets whether the handler should be visible to the user (via the application’s load and save dialogs).

api Class API



class wx.richtext.RichTextFileHandler(Object)

Possible constructors:

RichTextFileHandler(name="", ext="", type=0)

The base class for file handlers.


Methods



__init__(self, name="", ext="", type=0)

Creates a file handler object.

Parameters:
  • name (string) –
  • ext (string) –
  • type (int) –


CanHandle(self, filename)

Returns True if we handle this filename (if using files).

By default, checks the extension.

Parameters:filename (string) –
Return type:bool


CanLoad(self)

Returns True if we can load using this handler.

Return type:bool


CanSave(self)

Returns True if we can save using this handler.

Return type:bool


DoLoadFile(self, buffer, stream)

Override to load content from stream into buffer.

Parameters:
Return type:

bool



DoSaveFile(self, buffer, stream)

Override to save content to stream from buffer.

Parameters:
Return type:

bool



GetEncoding(self)

Returns the encoding to use when saving a file.

If empty, a suitable encoding is chosen.

Return type:string


GetExtension(self)

Returns the default extension to recognise.

Return type:string


GetFlags(self)

Returns flags controlling how loading and saving is done.

Return type:int


GetName(self)

Returns the name of the handler.

Return type:string


GetType(self)

Returns the handler type.

Return type:int


IsVisible(self)

Returns True if this handler should be visible to the user.

Return type:bool


LoadFile(self, *args, **kw)

overload Overloaded Implementations:



LoadFile (self, buffer, stream)

Loads the buffer from a stream.

Not all handlers will implement file loading.

Parameters:
Return type:

bool



LoadFile (self, buffer, filename)

Loads the buffer from a file.

Parameters:
Return type:

bool





SaveFile(self, *args, **kw)

overload Overloaded Implementations:



SaveFile (self, buffer, stream)

Saves the buffer to a stream.

Not all handlers will implement file saving.

Parameters:
Return type:

bool



SaveFile (self, buffer, filename)

Saves the buffer to a file.

Parameters:
Return type:

bool





SetEncoding(self, encoding)

Sets the encoding to use when saving a file.

If empty, a suitable encoding is chosen.

Parameters:encoding (string) –


SetExtension(self, ext)

Sets the default extension to recognise.

Parameters:ext (string) –


SetFlags(self, flags)

Sets flags that change the behaviour of loading or saving.

See the documentation for each handler class to see what flags are relevant for each handler.

You call this function directly if you are using a file handler explicitly (without going through the text control or buffer LoadFile/SaveFile API). Or, you can call the control or buffer’s SetHandlerFlags function to set the flags that will be used for subsequent load and save operations.

Parameters:flags (int) –


SetName(self, name)

Sets the name of the handler.

Parameters:name (string) –


SetType(self, type)

Sets the handler type.

Parameters:type (int) –


SetVisible(self, visible)

Sets whether the handler should be visible to the user (via the application’s load and save dialogs).

Parameters:visible (bool) –

Properties



Encoding

See GetEncoding and SetEncoding



Extension

See GetExtension and SetExtension



Flags

See GetFlags and SetFlags



Name

See GetName and SetName



Type

See GetType and SetType