The base class for file handlers.
See also
wx.richtext.RichTextBuffer, wx.richtext.RichTextCtrl
wx.richtext.RichTextHTMLHandler, wx.richtext.RichTextPlainTextHandler, wx.richtext.RichTextXMLHandler
Creates a file handler object. |
|
Returns |
|
Returns |
|
Returns |
|
Override to load content from stream into buffer. |
|
Override to save content to stream from buffer. |
|
Returns the encoding to use when saving a file. |
|
Returns the default extension to recognise. |
|
Returns flags controlling how loading and saving is done. |
|
Returns the name of the handler. |
|
Returns the handler type. |
|
Returns |
|
Loads the buffer from a stream. |
|
Saves the buffer to a stream. |
|
Sets the encoding to use when saving a file. |
|
Sets the default extension to recognise. |
|
Sets flags that change the behaviour of loading or saving. |
|
Sets the name of the handler. |
|
Sets the handler type. |
|
Sets whether the handler should be visible to the user (via the application’s load and save dialogs). |
See |
|
See |
|
wx.richtext.
RichTextFileHandler
(Object)¶Possible constructors:
RichTextFileHandler(name="", ext="", type=0)
The base class for file handlers.
__init__
(self, name="", ext="", type=0)¶Creates a file handler object.
name (string) –
ext (string) –
type (int) –
CanHandle
(self, filename)¶Returns True
if we handle this filename (if using files).
By default, checks the extension.
filename (string) –
bool
CanLoad
(self)¶Returns True
if we can load using this handler.
bool
CanSave
(self)¶Returns True
if we can save using this handler.
bool
DoLoadFile
(self, buffer, stream)¶Override to load content from stream into buffer.
buffer (wx.richtext.RichTextBuffer) –
stream (wx.InputStream) –
bool
DoSaveFile
(self, buffer, stream)¶Override to save content to stream from buffer.
buffer (wx.richtext.RichTextBuffer) –
stream (wx.OutputStream) –
bool
GetEncoding
(self)¶Returns the encoding to use when saving a file.
If empty, a suitable encoding is chosen.
string
GetExtension
(self)¶Returns the default extension to recognise.
string
GetFlags
(self)¶Returns flags controlling how loading and saving is done.
int
GetName
(self)¶Returns the name of the handler.
string
GetType
(self)¶Returns the handler type.
int
IsVisible
(self)¶Returns True
if this handler should be visible to the user.
bool
LoadFile
(self, *args, **kw)¶LoadFile (self, buffer, stream)
Loads the buffer from a stream.
Not all handlers will implement file loading.
buffer (wx.richtext.RichTextBuffer) –
stream (wx.InputStream) –
bool
LoadFile (self, buffer, filename)
Loads the buffer from a file.
buffer (wx.richtext.RichTextBuffer) –
filename (string) –
bool
SaveFile
(self, *args, **kw)¶SaveFile (self, buffer, stream)
Saves the buffer to a stream.
Not all handlers will implement file saving.
buffer (wx.richtext.RichTextBuffer) –
stream (wx.OutputStream) –
bool
SaveFile (self, buffer, filename)
Saves the buffer to a file.
buffer (wx.richtext.RichTextBuffer) –
filename (string) –
bool
SetEncoding
(self, encoding)¶Sets the encoding to use when saving a file.
If empty, a suitable encoding is chosen.
encoding (string) –
SetExtension
(self, ext)¶Sets the default extension to recognise.
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.
flags (int) –
SetName
(self, name)¶Sets the name of the handler.
name (string) –
SetType
(self, type)¶Sets the handler type.
type (int) –
SetVisible
(self, visible)¶Sets whether the handler should be visible to the user (via the application’s load and save dialogs).
visible (bool) –
Encoding
¶See GetEncoding
and SetEncoding
Extension
¶See GetExtension
and SetExtension