# eric7.Preferences.ConfigurationPages.EditorHighlightingStylesPage

Module implementing the Editor Highlighting Styles configuration page.

### Global Attributes

None

### Classes

EditorHighlightingStylesPage | Class implementing the Editor Highlighting Styles configuration page.
FontChangeMode | Class defining the modes for font changes.

### 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

StyleRole
SubstyleRole

### Class Methods

None

### Methods

EditorHighlightingStylesPage | Constructor
__allFontsButtonMenuTriggered | Private slot used to change the font of all styles of a selected lexer.
__applyStyles | Private method to apply the imported styles to this dialog.
__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 selectable lexers.
__fontButtonMenuTriggered | Private slot used to select the font of the selected style and lexer.
__importStyles | Private method to import the styles of lexers to be selected.
__populateLanguages | Private method to populate the language selection box.
__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.
__styleSample | Private method to style the sample text.
__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_exportButton_clicked | Private slot to export styles to be selected.
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_importButton_clicked | Private slot to import styles to be selected.
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.
setMode | Public method to perform mode dependent setups.
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 (dict)
  reference to the lexers dictionary

#### EditorHighlightingStylesPage.__allFontsButtonMenuTriggered

__allFontsButtonMenuTriggered(act)

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

act (QAction)
  reference to the triggering action

#### EditorHighlightingStylesPage.__applyStyles

__applyStyles(stylesList, importAll=False)

Private method to apply the imported styles to this dialog.

stylesList (list of dict)
  list of imported lexer styles
importAll (bool (optional))
  flag indicating to import all styles without asking (defaults to False)

#### EditorHighlightingStylesPage.__changeFont

__changeFont(doAll, familyOnly, sizeOnly)

Private slot to change the highlighter font.

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

#### EditorHighlightingStylesPage.__currentStyles

__currentStyles()

Private method to get the styles of the current item.

Return:
  tuple containing the style and sub-style numbers

Return Type:
  tuple of (int, int)

#### EditorHighlightingStylesPage.__exportStyles

__exportStyles(exportAll=False)

Private method to export the styles of selectable lexers.

exportAll (bool (optional))
  flag indicating to export all styles without asking (defaults to False)

#### EditorHighlightingStylesPage.__fontButtonMenuTriggered

__fontButtonMenuTriggered(act)

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

act (QAction)
  reference to the triggering action

#### EditorHighlightingStylesPage.__importStyles

__importStyles(importAll=False)

Private method to import the styles of lexers to be selected.

importAll (bool (optional))
  flag indicating to import all styles without asking (defaults to False)

#### EditorHighlightingStylesPage.__populateLanguages

__populateLanguages(languages)

Private method to populate the language selection box.

languages (list of str)
  list of languages to include in the language selector

#### 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.__styleSample

__styleSample(color, paper, font=None)

Private method to style the sample text.

color (QColor)
  foreground color for the sample
paper (QColor)
  background color for the sample
font (QFont (optional))
  font for the sample (defaults to None)

#### 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

Return:
  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 (bool)
  flag indicating enabled or disabled state

#### EditorHighlightingStylesPage.on_exportAllButton_clicked

on_exportAllButton_clicked()

Private slot to export the styles of all lexers.

#### EditorHighlightingStylesPage.on_exportButton_clicked

on_exportButton_clicked()

Private slot to export styles to be selected.

#### 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_importButton_clicked

on_importButton_clicked()

Private slot to import styles to be selected.

#### EditorHighlightingStylesPage.on_lexerLanguageComboBox_activated

on_lexerLanguageComboBox_activated(index)

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

index (int)
  index of the selected entry

#### 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 (unused)

#### 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.

Return:
  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, 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.setMode

setMode(displayMode)

Public method to perform mode dependent setups.

displayMode (ConfigurationMode)
  mode of the configuration dialog

#### 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 (list of [int, tuple of (int, int)])
  state data generated by saveState

Up

## FontChangeMode

Class defining the modes for font changes.

### Derived from

enum.Enum

### Class Attributes

FAMILYANDSIZE
FAMILYONLY
FONT
SIZEONLY

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## create

create(dlg)

Module function to create the configuration page.

dlg (ConfigurationDialog)
  reference to the configuration dialog

Return:
  reference to the instantiated page

Return Type:
  ConfigurationPageBase

Up