# eric6.Preferences.ConfigurationPages.EditorHighlightingStylesPage

Module implementing the Editor Highlighting Styles configuration page.

### Global Attributes

NoFontsOption

### Classes

EditorHighlightingStylesPage | Class implementing the Editor Highlighting Styles configuration page.

### Functions

create | Module function to create the configuration page.

## EditorHighlightingStylesPage

Class implementing the Editor Highlighting Styles configuration page.

### Derived from

ConfigurationPageBase, Ui_EditorHighlightingStylesPage

### Class Attributes

FAMILYANDSIZE
FAMILYONLY
FONT
SIZEONLY
StyleRole
SubstyleRole

### Class Methods

None

### Methods

EditorHighlightingStylesPage | Constructor
__allFontsButtonMenuTriggered | Private slot used to change the font of all styles of a selected lexer.
__changeFont | Private slot to change the highlighter font.
__currentStyles | Private method to get the styles of the current item.
__exportStyles | Private method to export the styles of the given lexers.
__fontButtonMenuTriggered | Private slot used to select the font of the selected style and lexer.
__importStyles | Private method to import the styles of the given lexers.
__setToDefault | Private method to set a specific style to its default values.
__styleAllItems | Private method to style all items of the style element list.
__styleOneItem | Private method to style one item of the style element list.
__stylesForItem | Private method to get the style and sub-style number of the given item.
on_addSubstyleButton_clicked | Private slot to add a new sub-style.
on_allBackgroundColoursButton_clicked | Private method used to select the background colour of all styles of a selected lexer.
on_allDefaultButton_clicked | Private method to set all styles to their default values.
on_allEolFillButton_clicked | Private method used to set the eolfill for all styles of a selected lexer.
on_backgroundButton_clicked | Private method used to select the background colour of the selected style and lexer.
on_copySubstyleButton_clicked | Private slot to copy the selected sub-style.
on_defaultButton_clicked | Private method to set the current style to its default values.
on_defaultSubstylesButton_clicked | Private slot to reset all substyles to default values.
on_deleteSubstyleButton_clicked | Private slot to delete the selected sub-style.
on_editSubstyleButton_clicked | Private slot to edit the selected sub-style entry.
on_eolfillCheckBox_clicked | Private method used to set the eolfill for the selected style and lexer.
on_exportAllButton_clicked | Private slot to export the styles of all lexers.
on_exportCurrentButton_clicked | Private slot to export the styles of the current lexer.
on_foregroundButton_clicked | Private method used to select the foreground colour of the selected style and lexer.
on_importAllButton_clicked | Private slot to import the styles of all lexers.
on_importCurrentButton_clicked | Private slot to import the styles of the current lexer.
on_lexerLanguageComboBox_activated | Private slot to fill the style combo of the source page.
on_styleElementList_currentItemChanged | Private method to handle a change of the current row.
save | Public slot to save the Editor Highlighting Styles configuration.
saveState | Public method to save the current state of the widget.
setFont | Local function to set the font.
setSampleFont | Local function to set the font of the sample text.
setState | Public method to set the state of the widget.

### Static Methods

None

#### EditorHighlightingStylesPage (Constructor)

EditorHighlightingStylesPage(lexers)

Constructor

lexers
  reference to the lexers dictionary

#### EditorHighlightingStylesPage.__allFontsButtonMenuTriggered

__allFontsButtonMenuTriggered(act)

Private slot used to change the font of all styles of a selected lexer.

act
  reference to the triggering action (QAction)

#### EditorHighlightingStylesPage.__changeFont

__changeFont(doAll, familyOnly, sizeOnly)

Private slot to change the highlighter font.

doAll
  flag indicating to change the font for all styles (boolean)
familyOnly
  flag indicating to set the font family only (boolean)
sizeOnly
  flag indicating to set the font size only (boolean

#### EditorHighlightingStylesPage.__currentStyles

__currentStyles()

Private method to get the styles of the current item.

Returns:
  tuple containing the style and sub-style numbers

Return Type:
  tuple of (int, int)

#### EditorHighlightingStylesPage.__exportStyles

__exportStyles(lexers)

Private method to export the styles of the given lexers.

lexers
  list of lexer objects for which to export the styles

#### EditorHighlightingStylesPage.__fontButtonMenuTriggered

__fontButtonMenuTriggered(act)

Private slot used to select the font of the selected style and lexer.

act
  reference to the triggering action (QAction)

#### EditorHighlightingStylesPage.__importStyles

__importStyles(lexers)

Private method to import the styles of the given lexers.

lexers
  dictionary of lexer objects for which to import the styles

#### EditorHighlightingStylesPage.__setToDefault

__setToDefault(style, substyle)

Private method to set a specific style to its default values.

style (int)
  style number
substyle (int)
  sub-style number

#### EditorHighlightingStylesPage.__styleAllItems

__styleAllItems()

Private method to style all items of the style element list.

#### EditorHighlightingStylesPage.__styleOneItem

__styleOneItem(item, style, substyle)

Private method to style one item of the style element list.

item (QTreeWidgetItem)
  reference to the item to be styled
style (int)
  base style number
substyle (int)
  sub-style number

#### EditorHighlightingStylesPage.__stylesForItem

__stylesForItem(itm)

Private method to get the style and sub-style number of the given item.

itm (QTreeWidgetItem)
  reference to the item to extract the styles from

Returns:
  tuple containing the style and sub-style numbers

Return Type:
  tuple of (int, int)

#### EditorHighlightingStylesPage.on_addSubstyleButton_clicked

on_addSubstyleButton_clicked()

Private slot to add a new sub-style.

#### EditorHighlightingStylesPage.on_allBackgroundColoursButton_clicked

on_allBackgroundColoursButton_clicked()

Private method used to select the background colour of all styles of a selected lexer.

#### EditorHighlightingStylesPage.on_allDefaultButton_clicked

on_allDefaultButton_clicked()

Private method to set all styles to their default values.

#### EditorHighlightingStylesPage.on_allEolFillButton_clicked

on_allEolFillButton_clicked()

Private method used to set the eolfill for all styles of a selected lexer.

#### EditorHighlightingStylesPage.on_backgroundButton_clicked

on_backgroundButton_clicked()

Private method used to select the background colour of the selected style and lexer.

#### EditorHighlightingStylesPage.on_copySubstyleButton_clicked

on_copySubstyleButton_clicked()

Private slot to copy the selected sub-style.

#### EditorHighlightingStylesPage.on_defaultButton_clicked

on_defaultButton_clicked()

Private method to set the current style to its default values.

#### EditorHighlightingStylesPage.on_defaultSubstylesButton_clicked

on_defaultSubstylesButton_clicked()

Private slot to reset all substyles to default values.

#### EditorHighlightingStylesPage.on_deleteSubstyleButton_clicked

on_deleteSubstyleButton_clicked()

Private slot to delete the selected sub-style.

#### EditorHighlightingStylesPage.on_editSubstyleButton_clicked

on_editSubstyleButton_clicked()

Private slot to edit the selected sub-style entry.

#### EditorHighlightingStylesPage.on_eolfillCheckBox_clicked

on_eolfillCheckBox_clicked(on)

Private method used to set the eolfill for the selected style and lexer.

on
  flag indicating enabled or disabled state (boolean)

#### EditorHighlightingStylesPage.on_exportAllButton_clicked

on_exportAllButton_clicked()

Private slot to export the styles of all lexers.

#### EditorHighlightingStylesPage.on_exportCurrentButton_clicked

on_exportCurrentButton_clicked()

Private slot to export the styles of the current lexer.

#### EditorHighlightingStylesPage.on_foregroundButton_clicked

on_foregroundButton_clicked()

Private method used to select the foreground colour of the selected style and lexer.

#### EditorHighlightingStylesPage.on_importAllButton_clicked

on_importAllButton_clicked()

Private slot to import the styles of all lexers.

#### EditorHighlightingStylesPage.on_importCurrentButton_clicked

on_importCurrentButton_clicked()

Private slot to import the styles of the current lexer.

#### EditorHighlightingStylesPage.on_lexerLanguageComboBox_activated

on_lexerLanguageComboBox_activated(language)

Private slot to fill the style combo of the source page.

language
  The lexer language (string)

#### EditorHighlightingStylesPage.on_styleElementList_currentItemChanged

on_styleElementList_currentItemChanged(current, previous)

Private method to handle a change of the current row.

current (QTreeWidgetItem)
  reference to the current item
previous (QTreeWidgetItem)
  reference to the previous item

#### EditorHighlightingStylesPage.save

save()

Public slot to save the Editor Highlighting Styles configuration.

#### EditorHighlightingStylesPage.saveState

saveState()

Public method to save the current state of the widget.

Returns:
  list containing the index of the selected lexer language and a tuple containing the index of the parent selected lexer entry and the index of the selected entry

Return Type:
  list of int and tuple of (int, int)

#### EditorHighlightingStylesPage.setFont

setFont(style, substyle, familyOnly, sizeOnly)

Local function to set the font.

font (QFont)
  font to be set
style (int)
  style number
substyle (int)
  sub-style number
familyOnly (bool)
  flag indicating to set the font family only
sizeOnly (bool)
  flag indicating to set the font size only

#### EditorHighlightingStylesPage.setSampleFont

setSampleFont(familyOnly, sizeOnly)

Local function to set the font of the sample text.

font
  font to be set (QFont)
familyOnly
  flag indicating to set the font family only (boolean)
sizeOnly
  flag indicating to set the font size only (boolean

#### EditorHighlightingStylesPage.setState

setState(state)

Public method to set the state of the widget.

state
  state data generated by saveState

Up

## create

create(dlg)

Module function to create the configuration page.

dlg
  reference to the configuration dialog

Returns:
  reference to the instantiated page (ConfigurationPageBase)

Up