This is a kind of paragraph layout box, used to represent the whole buffer.
See also
wx.richtext.RichTextParagraphLayoutBox, wx.richtext.RichTextCtrl
Default constructor. |
|
Adds a drawing handler to the end. |
|
Adds an event handler. |
|
Adds a field type. |
|
Adds a file handler to the end. |
|
Convenience function to add a paragraph of text. |
|
Returns |
|
Begins using alignment. |
|
Begin collapsing undo/redo commands. |
|
Begins using bold. |
|
Begins named character style. |
|
Begins using this font. |
|
Begins using point size. |
|
Begins using italic. |
|
Begins using leftIndent for the left indent, and optionally leftSubIndent for the sub-indent. |
|
Begins line spacing using the specified value. |
|
Begins named list style. |
|
Begins numbered bullet. |
|
Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of a millimetre. |
|
Begins named paragraph style. |
|
Begins a right indent, specified in tenths of a millimetre. |
|
Begins applying a standard bullet, using one of the standard bullet names (currently |
|
Begin using a style. |
|
Begin suppressing undo/redo commands. |
|
Begins applying a symbol bullet, using a character from the current font. |
|
Begins using this colour. |
|
Begins applying |
|
Begins using underline. |
|
Returns |
|
Clean up drawing handlers. |
|
Cleans up field types. |
|
Clean up file handlers. |
|
Clear event handlers. |
|
Clears the style stack. |
|
Clones the buffer. |
|
Copies the buffer. |
|
Copy the range to the clipboard. |
|
Submits a command to delete this range. |
|
Ends alignment. |
|
End all styles. |
|
End collapsing undo/redo commands. |
|
Ends using bold. |
|
Ends named character style. |
|
Ends using a font. |
|
Ends using point size. |
|
Ends using italic. |
|
Ends left indent. |
|
Ends line spacing. |
|
Ends named character style. |
|
Ends numbered bullet. |
|
Ends paragraph spacing. |
|
Ends named character style. |
|
Ends right indent. |
|
Ends standard bullet. |
|
End the style. |
|
End suppressing undo/redo commands. |
|
Ends symbol bullet. |
|
Ends using a colour. |
|
Ends URL. |
|
Ends using underline. |
|
Finds a drawing handler by name. |
|
Finds a field type by name. |
|
Finds a handler by type. |
|
Finds a file handler by extension and type. |
|
Finds a file handler by name. |
|
Finds a handler by filename or, if supplied, type. |
|
Returns the collapsed command. |
|
Returns the factor to multiply by character height to get a reasonable bullet size. |
|
Returns the minimum margin between bullet and paragraph in 10ths of a mm. |
|
Returns the command processor. |
|
Returns the scale factor for displaying certain dimensions such as indentation and inter-paragraph spacing. |
|
Returns the drawing handlers. |
|
Gets a wildcard string for the file dialog based on all the currently |
|
Returns the floating layout mode. |
|
Returns the scale factor for displaying fonts, for example for more comfortable editing. |
|
Returns the table storing fonts, for quick access and font reuse. |
|
Gets the handler flags, controlling loading and saving. |
|
Returns the file handlers. |
|
Returns the renderer object. |
|
Returns the scale factor for calculating dimensions. |
|
Returns the style sheet. |
|
Returns the size of the style stack, for example to check correct nesting. |
|
Hit-testing: returns a flag indicating hit test details, plus information about position. |
|
Initialisation. |
|
Initialise the standard file handlers. |
|
Inserts a drawing handler at the front. |
|
Inserts a file handler at the front. |
|
Submits a command to insert the given image. |
|
Submits a command to insert a newline. |
|
Submits a command to insert an object. |
|
Submits a command to insert paragraphs. |
|
Submits a command to insert the given text. |
|
Returns |
|
Loads content from a stream or file. |
|
Mark modified. |
|
Paste the clipboard content to the buffer. |
|
Pops the style sheet from the top of the style sheet stack. |
|
Pushes the style sheet to the top of the style sheet stack. |
|
Removes a drawing handler. |
|
Removes an event handler from the buffer’s list of handlers, deleting the object if deleteHandler is |
|
Removes a field type by name. |
|
Removes a file handler. |
|
Clears the buffer, adds an empty paragraph, and clears the command processor. |
|
Saves content to a stream or file. |
|
Send event to event handlers. |
|
Sets the factor to multiply by character height to get a reasonable bullet size. |
|
Sets the minimum margin between bullet and paragraph in 10ths of a mm. |
|
Sets the scale factor for displaying certain dimensions such as indentation and inter-paragraph spacing. |
|
Sets the floating layout mode. |
|
Sets the scale factor for displaying fonts, for example for more comfortable editing. |
|
Sets table storing fonts, for quick access and font reuse. |
|
Sets the handler flags, controlling loading and saving. |
|
Sets renderer as the object to be used to render certain aspects of the content, such as bullets. |
|
Sets the scale factor for calculating dimensions. |
|
Sets style sheet, if any. |
|
Sets the style sheet and sends a notification of the change. |
|
Submit the action immediately, or delay according to whether collapsing is on. |
|
Are we suppressing undo?? |
See |
|
See |
|
See |
|
See |
|
See |
|
wx.richtext.
RichTextBuffer
(RichTextParagraphLayoutBox)¶Possible constructors:
RichTextBuffer()
RichTextBuffer(obj)
This is a kind of paragraph layout box, used to represent the whole buffer.
__init__
(self, *args, **kw)¶__init__ (self)
Default constructor.
__init__ (self, obj)
Copy constructor.
obj (wx.richtext.RichTextBuffer) –
AddDrawingHandler
(handler)¶Adds a drawing handler to the end.
handler (wx.richtext.RichTextDrawingHandler) –
AddEventHandler
(self, handler)¶Adds an event handler.
A buffer associated with a control has the control as the only event handler, but the application is free to add more if further notification is required. All handlers are notified of an event originating from the buffer, such as the replacement of a style sheet during loading.
The buffer never deletes any of the event handlers, unless RemoveEventHandler
is called with True
as the second argument.
handler (wx.EvtHandler) –
bool
AddFieldType
(fieldType)¶Adds a field type.
fieldType (wx.richtext.RichTextFieldType) –
AddHandler
(handler)¶Adds a file handler to the end.
handler (wx.richtext.RichTextFileHandler) –
AddParagraph
(self, text, paraStyle=None)¶Convenience function to add a paragraph of text.
text (string) –
paraStyle (wx.richtext.RichTextAttr) –
BatchingUndo
(self)¶Returns True
if we are collapsing commands.
bool
BeginAlignment
(self, alignment)¶Begins using alignment.
alignment (TextAttrAlignment) –
bool
BeginBatchUndo
(self, cmdName)¶Begin collapsing undo/redo commands.
Note that this may not work properly if combining commands that delete or insert content, changing ranges for subsequent actions.
cmdName should be the name of the combined command that will appear next to Undo and Redo in the edit menu.
cmdName (string) –
bool
BeginBold
(self)¶Begins using bold.
bool
BeginCharacterStyle
(self, characterStyle)¶Begins named character style.
characterStyle (string) –
bool
BeginFontSize
(self, pointSize)¶Begins using point size.
pointSize (int) –
bool
BeginItalic
(self)¶Begins using italic.
bool
BeginLeftIndent
(self, leftIndent, leftSubIndent=0)¶Begins using leftIndent for the left indent, and optionally leftSubIndent for the sub-indent.
Both are expressed in tenths of a millimetre.
The sub-indent is an offset from the left of the paragraph, and is used for all but the first line in a paragraph. A positive value will cause the first line to appear to the left of the subsequent lines, and a negative value will cause the first line to be indented relative to the subsequent lines.
leftIndent (int) –
leftSubIndent (int) –
bool
BeginLineSpacing
(self, lineSpacing)¶Begins line spacing using the specified value.
spacing is a multiple, where 10 means single-spacing, 15 means 1.5 spacing, and 20 means float spacing.
The wx.TextAttrLineSpacing enumeration values are defined for convenience.
lineSpacing (int) –
bool
BeginListStyle
(self, listStyle, level=1, number=1)¶Begins named list style.
Optionally, you can also pass a level and a number.
listStyle (string) –
level (int) –
number (int) –
bool
BeginNumberedBullet
(self, bulletNumber, leftIndent, leftSubIndent, bulletStyle=TEXT_ATTR_BULLET_STYLE_ARABIC|TEXT_ATTR_BULLET_STYLE_PERIOD)¶Begins numbered bullet.
This call will be needed for each item in the list, and the application should take care of incrementing the numbering.
bulletNumber is a number, usually starting with 1. leftIndent and leftSubIndent are values in tenths of a millimetre. bulletStyle is a bitlist of the following values:
wx.richtext.RichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between the margin and the bullet. The content of the paragraph, including the first line, starts at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the left of the actual paragraph is leftSubIndent.
bulletNumber (int) –
leftIndent (int) –
leftSubIndent (int) –
bulletStyle (int) –
bool
BeginParagraphSpacing
(self, before, after)¶Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of a millimetre.
before (int) –
after (int) –
bool
BeginParagraphStyle
(self, paragraphStyle)¶Begins named paragraph style.
paragraphStyle (string) –
bool
BeginRightIndent
(self, rightIndent)¶Begins a right indent, specified in tenths of a millimetre.
rightIndent (int) –
bool
BeginStandardBullet
(self, bulletName, leftIndent, leftSubIndent, bulletStyle=TEXT_ATTR_BULLET_STYLE_STANDARD)¶Begins applying a standard bullet, using one of the standard bullet names (currently standard/circle
or standard/square
.
See BeginNumberedBullet
for an explanation of how indentation is used to render the bulleted paragraph.
bulletName (string) –
leftIndent (int) –
leftSubIndent (int) –
bulletStyle (int) –
bool
BeginStyle
(self, style)¶Begin using a style.
style (wx.richtext.RichTextAttr) –
bool
BeginSuppressUndo
(self)¶Begin suppressing undo/redo commands.
The way undo is suppressed may be implemented differently by each command. If not dealt with by a command implementation, then it will be implemented automatically by not storing the command in the undo history when the action is submitted to the command processor.
bool
BeginSymbolBullet
(self, symbol, leftIndent, leftSubIndent, bulletStyle=TEXT_ATTR_BULLET_STYLE_SYMBOL)¶Begins applying a symbol bullet, using a character from the current font.
See BeginNumberedBullet
for an explanation of how indentation is used to render the bulleted paragraph.
symbol (string) –
leftIndent (int) –
leftSubIndent (int) –
bulletStyle (int) –
bool
BeginTextColour
(self, colour)¶Begins using this colour.
colour (wx.Colour) –
bool
BeginURL
(self, url, characterStyle="")¶Begins applying wx.TEXT_ATTR_URL
to the content.
Pass a URL and optionally, a character style to apply, since it is common to mark a URL with a familiar style such as blue text with underlining.
url (string) –
characterStyle (string) –
bool
BeginUnderline
(self)¶Begins using underline.
bool
CanPasteFromClipboard
(self)¶Returns True
if we can paste from the clipboard.
bool
CleanUpDrawingHandlers
()¶Clean up drawing handlers.
CleanUpFieldTypes
()¶Cleans up field types.
CleanUpHandlers
()¶Clean up file handlers.
ClearEventHandlers
(self)¶Clear event handlers.
ClearStyleStack
(self)¶Clears the style stack.
Clone
(self)¶Clones the buffer.
Copy
(self, obj)¶Copies the buffer.
obj (wx.richtext.RichTextBuffer) –
CopyToClipboard
(self, range)¶Copy the range to the clipboard.
range (wx.richtext.RichTextRange) –
bool
DeleteRangeWithUndo
(self, range, ctrl)¶Submits a command to delete this range.
range (wx.richtext.RichTextRange) –
ctrl (wx.richtext.RichTextCtrl) –
bool
EndAlignment
(self)¶Ends alignment.
bool
EndAllStyles
(self)¶End all styles.
bool
EndBatchUndo
(self)¶End collapsing undo/redo commands.
bool
EndBold
(self)¶Ends using bold.
bool
EndCharacterStyle
(self)¶Ends named character style.
bool
EndFont
(self)¶Ends using a font.
bool
EndFontSize
(self)¶Ends using point size.
bool
EndItalic
(self)¶Ends using italic.
bool
EndLeftIndent
(self)¶Ends left indent.
bool
EndLineSpacing
(self)¶Ends line spacing.
bool
EndListStyle
(self)¶Ends named character style.
bool
EndNumberedBullet
(self)¶Ends numbered bullet.
bool
EndParagraphSpacing
(self)¶Ends paragraph spacing.
bool
EndParagraphStyle
(self)¶Ends named character style.
bool
EndRightIndent
(self)¶Ends right indent.
bool
EndStandardBullet
(self)¶Ends standard bullet.
bool
EndStyle
(self)¶End the style.
bool
EndSuppressUndo
(self)¶End suppressing undo/redo commands.
bool
EndSymbolBullet
(self)¶Ends symbol bullet.
bool
EndTextColour
(self)¶Ends using a colour.
bool
EndURL
(self)¶Ends URL.
bool
EndUnderline
(self)¶Ends using underline.
bool
FindDrawingHandler
(name)¶Finds a drawing handler by name.
name (string) –
FindFieldType
(name)¶Finds a field type by name.
name (string) –
FindHandlerByType
(imageType)¶Finds a handler by type.
imageType (RichTextFileType) –
FindHandlerByExtension
(extension, imageType)¶Finds a file handler by extension and type.
extension (string) –
imageType (RichTextFileType) –
FindHandlerByName
(name)¶Finds a file handler by name.
name (string) –
FindHandlerByFilename
(filename, imageType)¶Finds a handler by filename or, if supplied, type.
filename (string) –
imageType (RichTextFileType) –
GetBatchedCommand
(self)¶Returns the collapsed command.
GetBulletProportion
()¶Returns the factor to multiply by character height to get a reasonable bullet size.
float
GetBulletRightMargin
()¶Returns the minimum margin between bullet and paragraph in 10ths of a mm.
int
GetCommandProcessor
(self)¶Returns the command processor.
A text buffer always creates its own command processor when it is initialized.
GetDimensionScale
(self)¶Returns the scale factor for displaying certain dimensions such as indentation and inter-paragraph spacing.
float
GetDrawingHandlers
()¶Returns the drawing handlers.
RichTextDrawingHandlerList
GetExtWildcard
(combine=False, save=False)¶Gets a wildcard string for the file dialog based on all the currently loaded richtext file handlers, and a list that can be used to map those filter types to the file handler type.
PyObject
GetFloatingLayoutMode
()¶Returns the floating layout mode.
The default is True
, where objects are laid out according to their floating status.
bool
GetFontScale
(self)¶Returns the scale factor for displaying fonts, for example for more comfortable editing.
float
GetFontTable
(self)¶Returns the table storing fonts, for quick access and font reuse.
GetHandlerFlags
(self)¶Gets the handler flags, controlling loading and saving.
int
GetHandlers
()¶Returns the file handlers.
RichTextFileHandlerList
GetRenderer
()¶Returns the renderer object.
GetScale
(self)¶Returns the scale factor for calculating dimensions.
float
GetStyleSheet
(self)¶Returns the style sheet.
GetStyleStackSize
(self)¶Returns the size of the style stack, for example to check correct nesting.
int
HitTest
(self, dc, context, pt, flags=0)¶Hit-testing: returns a flag indicating hit test details, plus information about position.
contextObj is returned to specify what object position is relevant to, since otherwise there’s an ambiguity. @ obj might not be a child of contextObj, since we may be referring to the container itself if we have no hit on a child - for example if we click outside an object.
The function puts the position in textPosition if one is found. pt is in logical units (a zero y position is at the beginning of the buffer).
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
pt (wx.Point) –
flags (int) –
tuple
( int, textPosition, obj, contextObj )
Init
(self)¶Initialisation.
InitStandardHandlers
()¶Initialise the standard file handlers.
Currently, only the plain text loading/saving handler is initialised by default.
InsertDrawingHandler
(handler)¶Inserts a drawing handler at the front.
handler (wx.richtext.RichTextDrawingHandler) –
InsertHandler
(handler)¶Inserts a file handler at the front.
handler (wx.richtext.RichTextFileHandler) –
InsertImageWithUndo
(self, pos, imageBlock, ctrl, flags=0, textAttr=RichTextAttr())¶Submits a command to insert the given image.
pos (long) –
imageBlock (wx.richtext.RichTextImageBlock) –
ctrl (wx.richtext.RichTextCtrl) –
flags (int) –
textAttr (wx.richtext.RichTextAttr) –
bool
InsertNewlineWithUndo
(self, pos, ctrl, flags=0)¶Submits a command to insert a newline.
pos (long) –
ctrl (wx.richtext.RichTextCtrl) –
flags (int) –
bool
InsertObjectWithUndo
(self, pos, object, ctrl, flags)¶Submits a command to insert an object.
pos (long) –
object (wx.richtext.RichTextObject) –
ctrl (wx.richtext.RichTextCtrl) –
flags (int) –
InsertParagraphsWithUndo
(self, pos, paragraphs, ctrl, flags=0)¶Submits a command to insert paragraphs.
pos (long) –
paragraphs (wx.richtext.RichTextParagraphLayoutBox) –
ctrl (wx.richtext.RichTextCtrl) –
flags (int) –
bool
InsertTextWithUndo
(self, pos, text, ctrl, flags=0)¶Submits a command to insert the given text.
pos (long) –
text (string) –
ctrl (wx.richtext.RichTextCtrl) –
flags (int) –
bool
IsModified
(self)¶Returns True
if the buffer was modified.
bool
LoadFile
(self, *args, **kw)¶Loads content from a stream or file.
Not all handlers will implement file loading.
LoadFile (self, filename, type=RICHTEXT_TYPE_ANY)
filename (string) –
type (RichTextFileType) –
bool
LoadFile (self, stream, type=RICHTEXT_TYPE_ANY)
stream (wx.InputStream) –
type (RichTextFileType) –
bool
Modify
(self, modify=True)¶Mark modified.
modify (bool) –
PasteFromClipboard
(self, position)¶Paste the clipboard content to the buffer.
position (long) –
bool
PopStyleSheet
(self)¶Pops the style sheet from the top of the style sheet stack.
PushStyleSheet
(self, styleSheet)¶Pushes the style sheet to the top of the style sheet stack.
styleSheet (wx.richtext.RichTextStyleSheet) –
bool
RemoveDrawingHandler
(name)¶Removes a drawing handler.
name (string) –
bool
RemoveEventHandler
(self, handler, deleteHandler=False)¶Removes an event handler from the buffer’s list of handlers, deleting the object if deleteHandler is True
.
handler (wx.EvtHandler) –
deleteHandler (bool) –
bool
RemoveFieldType
(name)¶Removes a field type by name.
name (string) –
bool
RemoveHandler
(name)¶Removes a file handler.
name (string) –
bool
ResetAndClearCommands
(self)¶Clears the buffer, adds an empty paragraph, and clears the command processor.
SaveFile
(self, *args, **kw)¶Saves content to a stream or file.
Not all handlers will implement file saving.
SaveFile (self, filename, type=RICHTEXT_TYPE_ANY)
filename (string) –
type (RichTextFileType) –
bool
SaveFile (self, stream, type=RICHTEXT_TYPE_ANY)
stream (wx.OutputStream) –
type (RichTextFileType) –
bool
SendEvent
(self, event, sendToAll=True)¶Send event to event handlers.
If sendToAll is True
, will send to all event handlers, otherwise will stop at the first successful one.
event (wx.Event) –
sendToAll (bool) –
bool
SetBulletProportion
(prop)¶Sets the factor to multiply by character height to get a reasonable bullet size.
prop (float) –
SetBulletRightMargin
(margin)¶Sets the minimum margin between bullet and paragraph in 10ths of a mm.
margin (int) –
SetDimensionScale
(self, dimScale)¶Sets the scale factor for displaying certain dimensions such as indentation and inter-paragraph spacing.
This can be useful when editing in a small control where you still want legible text, but a minimum of wasted white space.
dimScale (float) –
SetFloatingLayoutMode
(mode)¶Sets the floating layout mode.
Pass False
to speed up editing by not performing floating layout. This setting affects all buffers.
mode (bool) –
SetFontScale
(self, fontScale)¶Sets the scale factor for displaying fonts, for example for more comfortable editing.
fontScale (float) –
SetFontTable
(self, table)¶Sets table storing fonts, for quick access and font reuse.
table (wx.richtext.RichTextFontTable) –
SetHandlerFlags
(self, flags)¶Sets the handler flags, controlling loading and saving.
flags (int) –
SetRenderer
(renderer)¶Sets renderer as the object to be used to render certain aspects of the content, such as bullets.
You can override default rendering by deriving a new class from wx.richtext.RichTextRenderer or wx.richtext.RichTextStdRenderer, overriding one or more virtual functions, and setting an instance of the class using this function.
renderer (wx.richtext.RichTextRenderer) –
SetScale
(self, scale)¶Sets the scale factor for calculating dimensions.
scale (float) –
SetStyleSheet
(self, styleSheet)¶Sets style sheet, if any.
This will allow the application to use named character and paragraph styles found in the style sheet.
Neither the buffer nor the control owns the style sheet so must be deleted by the application.
styleSheet (wx.richtext.RichTextStyleSheet) –
SetStyleSheetAndNotify
(self, sheet)¶Sets the style sheet and sends a notification of the change.
sheet (wx.richtext.RichTextStyleSheet) –
bool
SubmitAction
(self, action)¶Submit the action immediately, or delay according to whether collapsing is on.
action (wx.richtext.RichTextAction) –
bool
SuppressingUndo
(self)¶Are we suppressing undo??
bool
BatchedCommand
¶CommandProcessor
¶DimensionScale
¶See GetDimensionScale
and SetDimensionScale
FontScale
¶See GetFontScale
and SetFontScale
FontTable
¶See GetFontTable
and SetFontTable
HandlerFlags
¶See GetHandlerFlags
and SetHandlerFlags
StyleSheet
¶See GetStyleSheet
and SetStyleSheet
StyleStackSize
¶