.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.richtext.RichTextFormattingDialog:
==========================================================================================================================================
|phoenix_title| **wx.richtext.RichTextFormattingDialog**
==========================================================================================================================================
This dialog allows the user to edit a character and/or paragraph style.
In the constructor, specify the pages that will be created. Use :meth:`wx.richtext.RichTextFormattingDialog.GetStyle` to retrieve the common style for a given range, and then use :meth:`wx.richtext.RichTextFormattingDialog.ApplyStyle` to apply the user-selected formatting to a control.
For example: ::
if self.richTextCtrl.HasSelection():
range = self.richTextCtrl.GetSelectionRange()
else:
range = wx.RichTextRange(0, self.richTextCtrl.GetLastPosition()+1)
pages = wx.richtext.RICHTEXT_FORMAT_FONT \
| wx.richtext.RICHTEXT_FORMAT_INDENTS_SPACING \
| wx.richtext.RICHTEXT_FORMAT_TABS \
| wx.richtext.RICHTEXT_FORMAT_BULLETS
with wx.richtext.RichTextFormattingDialog(pages, self) as dlg:
dlg.GetStyle(self.richTextCtrl, range)
if dlg.ShowModal() == wx.ID_OK:
dlg.ApplyStyle(self.richTextCtrl, range)
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
RichTextFormattingDialog:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextFormattingDialog.__init__` Default constructor.
:meth:`~wx.richtext.RichTextFormattingDialog.ApplyStyle` Apply attributes to the given range, only changing attributes that need to be changed.
:meth:`~wx.richtext.RichTextFormattingDialog.Create` Creation: see :ref:`wx.richtext.RichTextFormattingDialog` "the constructor" for details about the parameters.
:meth:`~wx.richtext.RichTextFormattingDialog.GetAttributes`
:meth:`~wx.richtext.RichTextFormattingDialog.GetClassDefaultAttributes`
:meth:`~wx.richtext.RichTextFormattingDialog.GetColourData` Returns the custom colour data for use by the colour dialog.
:meth:`~wx.richtext.RichTextFormattingDialog.GetDialog` Helper for pages to get the top-level dialog.
:meth:`~wx.richtext.RichTextFormattingDialog.GetDialogAttributes` Helper for pages to get the attributes.
:meth:`~wx.richtext.RichTextFormattingDialog.GetDialogStyleDefinition` Helper for pages to get the style.
:meth:`~wx.richtext.RichTextFormattingDialog.GetFormattingDialogFactory` Returns the object to be used to customize the dialog and provide pages.
:meth:`~wx.richtext.RichTextFormattingDialog.GetImageList` Returns the image list associated with the dialog, used for example if showing the dialog as a toolbook.
:meth:`~wx.richtext.RichTextFormattingDialog.GetLastPage` Returns the page identifier of the last page selected (not the control id).
:meth:`~wx.richtext.RichTextFormattingDialog.GetOptions` Gets the dialog options, determining what the interface presents to the user.
:meth:`~wx.richtext.RichTextFormattingDialog.GetRestoreLastPage` Returns ``True`` if the dialog will restore the last-selected page.
:meth:`~wx.richtext.RichTextFormattingDialog.GetStyle` Gets common attributes from the given range and calls :meth:`~RichTextFormattingDialog.SetAttributes` .
:meth:`~wx.richtext.RichTextFormattingDialog.GetStyleDefinition` Gets the associated style definition, if any.
:meth:`~wx.richtext.RichTextFormattingDialog.GetStyleSheet` Gets the associated style sheet, if any.
:meth:`~wx.richtext.RichTextFormattingDialog.HasOption` Returns ``True`` if the given option is present.
:meth:`~wx.richtext.RichTextFormattingDialog.SetAttributes` Sets the attributes to be edited.
:meth:`~wx.richtext.RichTextFormattingDialog.SetColourData` Sets the custom colour data for use by the colour dialog.
:meth:`~wx.richtext.RichTextFormattingDialog.SetFormattingDialogFactory` Sets the formatting factory object to be used for customization and page creation.
:meth:`~wx.richtext.RichTextFormattingDialog.SetImageList` Sets the image list associated with the dialog's property sheet.
:meth:`~wx.richtext.RichTextFormattingDialog.SetLastPage` Sets the page identifier of the last page selected (not the control id).
:meth:`~wx.richtext.RichTextFormattingDialog.SetOptions` Sets the dialog options, determining what the interface presents to the user.
:meth:`~wx.richtext.RichTextFormattingDialog.SetRestoreLastPage` Pass ``True`` if the dialog should restore the last-selected page.
:meth:`~wx.richtext.RichTextFormattingDialog.SetStyle` Sets the attributes and optionally updates the display, if `update` is ``True``.
:meth:`~wx.richtext.RichTextFormattingDialog.SetStyleDefinition` Sets the style definition and optionally update the display, if `update` is ``True``.
:meth:`~wx.richtext.RichTextFormattingDialog.UpdateDisplay` Updates the display.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextFormattingDialog.Attributes` See :meth:`~wx.richtext.RichTextFormattingDialog.GetAttributes` and :meth:`~wx.richtext.RichTextFormattingDialog.SetAttributes`
:attr:`~wx.richtext.RichTextFormattingDialog.ImageList` See :meth:`~wx.richtext.RichTextFormattingDialog.GetImageList` and :meth:`~wx.richtext.RichTextFormattingDialog.SetImageList`
:attr:`~wx.richtext.RichTextFormattingDialog.Options` See :meth:`~wx.richtext.RichTextFormattingDialog.GetOptions` and :meth:`~wx.richtext.RichTextFormattingDialog.SetOptions`
:attr:`~wx.richtext.RichTextFormattingDialog.StyleDefinition` See :meth:`~wx.richtext.RichTextFormattingDialog.GetStyleDefinition` and :meth:`~wx.richtext.RichTextFormattingDialog.SetStyleDefinition`
:attr:`~wx.richtext.RichTextFormattingDialog.StyleSheet` See :meth:`~wx.richtext.RichTextFormattingDialog.GetStyleSheet`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.richtext.RichTextFormattingDialog(PropertySheetDialog)
**Possible constructors**::
RichTextFormattingDialog() -> None
RichTextFormattingDialog(flags : int, parent : Window, title:
str="Formatting", id: int=ID_ANY, pos: Point=DefaultPosition, sz:
Size=DefaultSize, style: int=DEFAULT_DIALOG_STYLE) -> None
This dialog allows the user to edit a character and/or paragraph
style.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self)`
Default constructor.
:rtype: `None`
:html:`
`
**__init__** `(self, flags : int, parent : Window, title: str="Formatting", id: int=ID_ANY, pos: Point=DefaultPosition, sz: Size=DefaultSize, style: int=DEFAULT_DIALOG_STYLE)`
Constructors.
:param `flags`: The pages to show.
:type `flags`: long
:param `parent`: The dialog's parent.
:type `parent`: wx.Window
:param `title`: The dialog's title.
:type `title`: string
:param `id`: The dialog's ``ID``.
:type `id`: wx.WindowID
:param `pos`: The dialog's position.
:type `pos`: wx.Point
:param `sz`: The dialog's size.
:type `sz`: wx.Size
:param `style`: The dialog's window style.
:type `style`: long
:rtype: `None`
:html:`
`
.. method:: ApplyStyle(self, ctrl : RichTextCtrl, range : RichTextRange, flags: int=RICHTEXT_SETSTYLE_WITH_UNDO|RICHTEXT_SETSTYLE_OPTIMIZE)
Apply attributes to the given range, only changing attributes that need to be changed.
:param `ctrl`:
:type `ctrl`: wx.richtext.RichTextCtrl
:param `range`:
:type `range`: wx.richtext.RichTextRange
:param `flags`:
:type `flags`: int
:rtype: `bool`
.. method:: Create(self, flags : int, parent : Window, title: str=GetTranslation("Formatting"), id: int=ID_ANY, pos: Point=DefaultPosition, sz: Size=DefaultSize, style: int=DEFAULT_DIALOG_STYLE)
Creation: see :ref:`wx.richtext.RichTextFormattingDialog` "the constructor" for details about the parameters.
:param `flags`:
:type `flags`: long
:param `parent`:
:type `parent`: wx.Window
:param `title`:
:type `title`: string
:param `id`:
:type `id`: wx.WindowID
:param `pos`:
:type `pos`: wx.Point
:param `sz`:
:type `sz`: wx.Size
:param `style`:
:type `style`: long
:rtype: `bool`
.. method:: GetAttributes(self)
:rtype: `TextAttr`
.. staticmethod:: GetClassDefaultAttributes(variant: WindowVariant=WINDOW_VARIANT_NORMAL)
:param `variant`:
:type `variant`: wx.WindowVariant
:rtype: `VisualAttributes`
.. staticmethod:: GetColourData()
Returns the custom colour data for use by the colour dialog.
:rtype: `ColourData`
.. staticmethod:: GetDialog(win : Window)
Helper for pages to get the top-level dialog.
:param `win`:
:type `win`: wx.Window
:rtype: :ref:`wx.richtext.RichTextFormattingDialog`
.. staticmethod:: GetDialogAttributes(win : Window)
Helper for pages to get the attributes.
:param `win`:
:type `win`: wx.Window
:rtype: `TextAttr`
.. staticmethod:: GetDialogStyleDefinition(win : Window)
Helper for pages to get the style.
:param `win`:
:type `win`: wx.Window
:rtype: :ref:`wx.richtext.RichTextStyleDefinition`
.. staticmethod:: GetFormattingDialogFactory()
Returns the object to be used to customize the dialog and provide pages.
:rtype: :ref:`wx.richtext.RichTextFormattingDialogFactory`
.. method:: GetImageList(self)
Returns the image list associated with the dialog, used for example if showing the dialog as a toolbook.
:rtype: `ImageList`
.. staticmethod:: GetLastPage()
Returns the page identifier of the last page selected (not the control id).
:rtype: `int`
.. method:: GetOptions(self)
Gets the dialog options, determining what the interface presents to the user.
Currently the only option is Option_AllowPixelFontSize.
:rtype: `int`
.. staticmethod:: GetRestoreLastPage()
Returns ``True`` if the dialog will restore the last-selected page.
:rtype: `bool`
.. method:: GetStyle(self, ctrl : RichTextCtrl, range : RichTextRange)
Gets common attributes from the given range and calls :meth:`SetAttributes` .
Attributes that do not have common values in the given range will be omitted from the style's flags.
:param `ctrl`:
:type `ctrl`: wx.richtext.RichTextCtrl
:param `range`:
:type `range`: wx.richtext.RichTextRange
:rtype: `bool`
.. method:: GetStyleDefinition(self)
Gets the associated style definition, if any.
:rtype: :ref:`wx.richtext.RichTextStyleDefinition`
.. method:: GetStyleSheet(self)
Gets the associated style sheet, if any.
:rtype: :ref:`wx.richtext.RichTextStyleSheet`
.. method:: HasOption(self, option : int)
Returns ``True`` if the given option is present.
:param `option`:
:type `option`: int
:rtype: `bool`
.. method:: SetAttributes(self, attr : TextAttr)
Sets the attributes to be edited.
:param `attr`:
:type `attr`: wx.TextAttr
:rtype: `None`
.. staticmethod:: SetColourData(colourData : ColourData)
Sets the custom colour data for use by the colour dialog.
:param `colourData`:
:type `colourData`: wx.ColourData
:rtype: `None`
.. staticmethod:: SetFormattingDialogFactory(factory : RichTextFormattingDialogFactory)
Sets the formatting factory object to be used for customization and page creation.
It deletes the existing factory object.
:param `factory`:
:type `factory`: wx.richtext.RichTextFormattingDialogFactory
:rtype: `None`
.. method:: SetImageList(self, imageList : ImageList)
Sets the image list associated with the dialog's property sheet.
:param `imageList`:
:type `imageList`: wx.ImageList
:rtype: `None`
.. staticmethod:: SetLastPage(lastPage : int)
Sets the page identifier of the last page selected (not the control id).
:param `lastPage`:
:type `lastPage`: int
:rtype: `None`
.. method:: SetOptions(self, options : int)
Sets the dialog options, determining what the interface presents to the user.
Currently the only option is Option_AllowPixelFontSize.
:param `options`:
:type `options`: int
:rtype: `None`
.. staticmethod:: SetRestoreLastPage(b : bool)
Pass ``True`` if the dialog should restore the last-selected page.
:param `b`:
:type `b`: bool
:rtype: `None`
.. method:: SetStyle(self, style : TextAttr, update: bool=True)
Sets the attributes and optionally updates the display, if `update` is ``True``.
:param `style`:
:type `style`: wx.TextAttr
:param `update`:
:type `update`: bool
:rtype: `bool`
.. method:: SetStyleDefinition(self, styleDef : RichTextStyleDefinition, sheet : RichTextStyleSheet, update: bool=True)
Sets the style definition and optionally update the display, if `update` is ``True``.
:param `styleDef`:
:type `styleDef`: wx.richtext.RichTextStyleDefinition
:param `sheet`:
:type `sheet`: wx.richtext.RichTextStyleSheet
:param `update`:
:type `update`: bool
:rtype: `bool`
.. method:: UpdateDisplay(self)
Updates the display.
:rtype: `bool`
.. attribute:: Attributes
See :meth:`~wx.richtext.RichTextFormattingDialog.GetAttributes` and :meth:`~wx.richtext.RichTextFormattingDialog.SetAttributes`
.. attribute:: ImageList
See :meth:`~wx.richtext.RichTextFormattingDialog.GetImageList` and :meth:`~wx.richtext.RichTextFormattingDialog.SetImageList`
.. attribute:: Options
See :meth:`~wx.richtext.RichTextFormattingDialog.GetOptions` and :meth:`~wx.richtext.RichTextFormattingDialog.SetOptions`
.. attribute:: StyleDefinition
See :meth:`~wx.richtext.RichTextFormattingDialog.GetStyleDefinition` and :meth:`~wx.richtext.RichTextFormattingDialog.SetStyleDefinition`
.. attribute:: StyleSheet
See :meth:`~wx.richtext.RichTextFormattingDialog.GetStyleSheet`