This class shows a style sheet and allows the user to edit, add and remove styles.
It can also be used as a style browser, for example if the application is not using a permanent wx.richtext.RichTextStyleComboCtrl or wx.richtext.RichTextStyleListCtrl to present styles.
__init__ |
Default constructor. |
ApplyStyle |
Applies the selected style to selection in the given control or the control passed to the constructor. |
Create |
Creates the dialog. |
GetFlags |
Returns the flags used to control the interface presented to the user. |
GetRestartNumbering |
Returns True if the user has opted to restart numbering. |
GetRichTextCtrl |
Returns the associated rich text control (if any). |
GetSelectedStyle |
Returns selected style name. |
GetSelectedStyleDefinition |
Returns selected style definition. |
GetStyleSheet |
Returns the associated style sheet. |
SetFlags |
Sets the flags used to control the interface presented to the user. |
SetRestartNumbering |
Checks or unchecks the restart numbering checkbox. |
SetRichTextCtrl |
Sets the control to be associated with the dialog, for the purposes of applying a style to the selection. |
SetShowToolTips |
Determines whether tooltips will be shown. |
SetStyleSheet |
Sets the associated style sheet. |
wx.richtext.
RichTextStyleOrganiserDialog
(Dialog)¶Possible constructors:
RichTextStyleOrganiserDialog()
RichTextStyleOrganiserDialog(flags, sheet, ctrl, parent, id=ID_ANY,
caption=_("StyleOrganiser"), pos=DefaultPosition, size=DefaultSize,
style=DEFAULT_DIALOG_STYLE|RESIZE_BORDER|SYSTEM_MENU|CLOSE_BOX)
This class shows a style sheet and allows the user to edit, add and remove styles.
__init__
(self, *args, **kw)¶__init__ (self)
Default constructor.
__init__ (self, flags, sheet, ctrl, parent, id=ID_ANY, caption=_(“StyleOrganiser”), pos=DefaultPosition, size=DefaultSize, style=DEFAULT_DIALOG_STYLE|RESIZE_BORDER|SYSTEM_MENU|CLOSE_BOX)
Constructor.
To create a dialog, pass a bitlist of flags (see below), a style sheet, a text control to apply a selected style to (or None
), followed by the usual window parameters.
To specify the operations available to the user, pass a combination of these values to flags:
wx.richtext.RICHTEXT_ORGANISER_DELETE_STYLES
: Provides a button for deleting styles.wx.richtext.RICHTEXT_ORGANISER_CREATE_STYLES
: Provides buttons for creating styles.wx.richtext.RICHTEXT_ORGANISER_APPLY_STYLES
: Provides a button for applying the currently selected style to the selection.wx.richtext.RICHTEXT_ORGANISER_EDIT_STYLES
: Provides a button for editing styles.wx.richtext.RICHTEXT_ORGANISER_RENAME_STYLES
: Provides a button for renaming styles.wx.richtext.RICHTEXT_ORGANISER_OK_CANCEL
: Provides wx.OK
and Cancel buttons.wx.richtext.RICHTEXT_ORGANISER_RENUMBER
: Provides a checkbox for specifying that the selection should be renumbered.The following flags determine what will be displayed in the style list:
wx.richtext.RICHTEXT_ORGANISER_SHOW_CHARACTER
: Displays character styles only.wx.richtext.RICHTEXT_ORGANISER_SHOW_PARAGRAPH
: Displays paragraph styles only.wx.richtext.RICHTEXT_ORGANISER_SHOW_LIST
: Displays list styles only.wx.richtext.RICHTEXT_ORGANISER_SHOW_ALL
: Displays all styles.The following symbols define commonly-used combinations of flags:
wx.richtext.RICHTEXT_ORGANISER_ORGANISE
: Enable all style editing operations so the dialog behaves as a style organiser.wx.richtext.RICHTEXT_ORGANISER_BROWSE
: Show a list of all styles and their previews, but only allow application of a style or cancellation of the dialog. This makes the dialog behave as a style browser.wx.richtext.RICHTEXT_ORGANISER_BROWSE_NUMBERING
: Enables only list style browsing, plus a control to specify renumbering. This allows the dialog to be used for applying list styles to the selection.Parameters: |
|
---|
ApplyStyle
(self, ctrl=None)¶Applies the selected style to selection in the given control or the control passed to the constructor.
Parameters: | ctrl (wx.richtext.RichTextCtrl) – |
---|---|
Return type: | bool |
Create
(self, flags, sheet, ctrl, parent, id=ID_ANY, caption=GetTranslation("StyleOrganiser"), pos=DefaultPosition, size=Size(400, 300), style=DEFAULT_DIALOG_STYLE|RESIZE_BORDER|SYSTEM_MENU|CLOSE_BOX)¶Creates the dialog.
See the constructor.
Parameters: |
|
---|---|
Return type: | bool |
GetFlags
(self)¶Returns the flags used to control the interface presented to the user.
Return type: | int |
---|
GetRestartNumbering
(self)¶Returns True
if the user has opted to restart numbering.
Return type: | bool |
---|
GetRichTextCtrl
(self)¶Returns the associated rich text control (if any).
Return type: | wx.richtext.RichTextCtrl |
---|
GetSelectedStyle
(self)¶Returns selected style name.
Return type: | string |
---|
GetSelectedStyleDefinition
(self)¶Returns selected style definition.
Return type: | wx.richtext.RichTextStyleDefinition |
---|
GetStyleSheet
(self)¶Returns the associated style sheet.
Return type: | wx.richtext.RichTextStyleSheet |
---|
SetFlags
(self, flags)¶Sets the flags used to control the interface presented to the user.
Parameters: | flags (int) – |
---|
SetRestartNumbering
(self, restartNumbering)¶Checks or unchecks the restart numbering checkbox.
Parameters: | restartNumbering (bool) – |
---|
SetRichTextCtrl
(self, ctrl)¶Sets the control to be associated with the dialog, for the purposes of applying a style to the selection.
Parameters: | ctrl (wx.richtext.RichTextCtrl) – |
---|
SetShowToolTips
(show)¶Determines whether tooltips will be shown.
Parameters: | show (bool) – |
---|
SetStyleSheet
(self, sheet)¶Sets the associated style sheet.
Parameters: | sheet (wx.richtext.RichTextStyleSheet) – |
---|
RestartNumbering
¶RichTextCtrl
¶See GetRichTextCtrl
and SetRichTextCtrl
SelectedStyle
¶See GetSelectedStyle
SelectedStyleDefinition
¶StyleSheet
¶See GetStyleSheet
and SetStyleSheet