wx.richtext.RichTextFileHandler¶
The base class for file handlers.
Class Hierarchy¶
Known Subclasses¶
wx.richtext.RichTextHTMLHandler, wx.richtext.RichTextPlainTextHandler, wx.richtext.RichTextXMLHandler
Methods Summary¶
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). |
Properties Summary¶
See |
|
See |
|
Class API¶
- class wx.richtext.RichTextFileHandler(Object)¶
Possible constructors:
RichTextFileHandler(name='', ext='', type=0) -> None
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)
- Return type:
None
- 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:
buffer (wx.richtext.RichTextBuffer)
stream (wx.InputStream)
- Return type:
bool
- DoSaveFile(self, buffer, stream)¶
Override to save content to stream from buffer.
- Parameters:
buffer (wx.richtext.RichTextBuffer)
stream (wx.OutputStream)
- Return type:
bool
- GetEncoding(self)¶
Returns the encoding to use when saving a file.
If empty, a suitable encoding is chosen.
- Return type:
str
- GetExtension(self)¶
Returns the default extension to recognise.
- Return type:
str
- GetFlags(self)¶
Returns flags controlling how loading and saving is done.
- Return type:
int
- GetName(self)¶
Returns the name of the handler.
- Return type:
str
- 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)¶
-
LoadFile (self, buffer, stream)
Loads the buffer from a stream.
Not all handlers will implement file loading.
- Parameters:
buffer (wx.richtext.RichTextBuffer)
stream (wx.InputStream)
- Return type:
bool
LoadFile (self, buffer, filename)
Loads the buffer from a file.
- Parameters:
buffer (wx.richtext.RichTextBuffer)
filename (string)
- Return type:
bool
- SaveFile(self, *args, **kw)¶
-
SaveFile (self, buffer, stream)
Saves the buffer to a stream.
Not all handlers will implement file saving.
- Parameters:
buffer (wx.richtext.RichTextBuffer)
stream (wx.OutputStream)
- Return type:
bool
SaveFile (self, buffer, filename)
Saves the buffer to a file.
- Parameters:
buffer (wx.richtext.RichTextBuffer)
filename (string)
- 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)
- Return type:
None
- SetExtension(self, ext)¶
Sets the default extension to recognise.
- Parameters:
ext (string)
- Return type:
None
- 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)
- Return type:
None
- SetName(self, name)¶
Sets the name of the handler.
- Parameters:
name (string)
- Return type:
None
- SetType(self, type)¶
Sets the handler type.
- Parameters:
type (int)
- Return type:
None
- SetVisible(self, visible)¶
Sets whether the handler should be visible to the user (via the application’s load and save dialogs).
- Parameters:
visible (bool)
- Return type:
None
Properties¶
- Encoding¶
See
GetEncoding
andSetEncoding
- Extension¶
See
GetExtension
andSetExtension