Preferences/ConfigurationPages/EditorHighlightingStylesPage.py

Mon, 18 Mar 2019 19:15:57 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 18 Mar 2019 19:15:57 +0100
changeset 6878
79008f970902
parent 6867
97e86d2426a9
child 6883
57a2dc333cea
permissions
-rw-r--r--

EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
3 # Copyright (c) 2006 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the Editor Highlighting Styles configuration page.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3142
diff changeset
10 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2408
diff changeset
11
5736
000ea446ff4b Prepared the code for Qt > 5.9.99.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
12 from PyQt5.QtCore import pyqtSlot, Qt, QFileInfo, QFile, QIODevice
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
13 from PyQt5.QtGui import QPalette, QFont
6854
f4dd76230eea PreferencesLexer, EditorHighlightingPage: got rid of the 'styles' and 'ind2style' lists (that was very old style programming).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6853
diff changeset
14 from PyQt5.QtWidgets import QColorDialog, QFontDialog, QInputDialog, QMenu, \
6864
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
15 QTreeWidgetItem, QDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
17 from .ConfigurationPageBase import ConfigurationPageBase
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
18 from .Ui_EditorHighlightingStylesPage import Ui_EditorHighlightingStylesPage
6864
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
19 from ..SubstyleDefinitionDialog import SubstyleDefinitionDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
21 from E5Gui import E5MessageBox, E5FileDialog
537
72b32daeb8d6 Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
22
5736
000ea446ff4b Prepared the code for Qt > 5.9.99.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
23 from Globals import qVersionTuple
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
6864
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
25 import UI.PixmapCache
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
26
4698
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
27 try:
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
28 MonospacedFontsOption = QFontDialog.MonospacedFonts
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
29 except AttributeError:
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
30 MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10)
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
31 NoFontsOption = QFontDialog.FontDialogOptions(0)
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
32
4698
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
33
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
34 class EditorHighlightingStylesPage(ConfigurationPageBase,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 Ui_EditorHighlightingStylesPage):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 Class implementing the Editor Highlighting Styles configuration page.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
39 FAMILYONLY = 0
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
40 SIZEONLY = 1
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
41 FAMILYANDSIZE = 2
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
42 FONT = 99
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
43
6854
f4dd76230eea PreferencesLexer, EditorHighlightingPage: got rid of the 'styles' and 'ind2style' lists (that was very old style programming).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6853
diff changeset
44 StyleRole = Qt.UserRole + 1
f4dd76230eea PreferencesLexer, EditorHighlightingPage: got rid of the 'styles' and 'ind2style' lists (that was very old style programming).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6853
diff changeset
45 SubstyleRole = Qt.UserRole + 2
f4dd76230eea PreferencesLexer, EditorHighlightingPage: got rid of the 'styles' and 'ind2style' lists (that was very old style programming).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6853
diff changeset
46
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 def __init__(self, lexers):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 @param lexers reference to the lexers dictionary
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2408
diff changeset
53 super(EditorHighlightingStylesPage, self).__init__()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.setupUi(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 self.setObjectName("EditorHighlightingStylesPage")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56
6878
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
57 self.defaultSubstylesButton.setIcon(UI.PixmapCache.getIcon("editUndo"))
6864
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
58 self.addSubstyleButton.setIcon(UI.PixmapCache.getIcon("plus"))
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
59 self.deleteSubstyleButton.setIcon(UI.PixmapCache.getIcon("minus"))
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
60 self.editSubstyleButton.setIcon(UI.PixmapCache.getIcon("edit"))
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
61 self.copySubstyleButton.setIcon(UI.PixmapCache.getIcon("editCopy"))
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
62
5736
000ea446ff4b Prepared the code for Qt > 5.9.99.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
63 if qVersionTuple() < (5, 0, 0):
4698
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
64 self.monospacedButton.setChecked(False)
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
65 self.monospacedButton.hide()
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
66
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
67 self.__fontButtonMenu = QMenu()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
68 act = self.__fontButtonMenu.addAction(self.tr("Font"))
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
69 act.setData(self.FONT)
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
70 self.__fontButtonMenu.addSeparator()
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
71 act = self.__fontButtonMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
72 self.tr("Family and Size only"))
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
73 act.setData(self.FAMILYANDSIZE)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
74 act = self.__fontButtonMenu.addAction(self.tr("Family only"))
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
75 act.setData(self.FAMILYONLY)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
76 act = self.__fontButtonMenu.addAction(self.tr("Size only"))
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
77 act.setData(self.SIZEONLY)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 454
diff changeset
78 self.__fontButtonMenu.triggered.connect(self.__fontButtonMenuTriggered)
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
79 self.fontButton.setMenu(self.__fontButtonMenu)
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
80
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
81 self.__allFontsButtonMenu = QMenu()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
82 act = self.__allFontsButtonMenu.addAction(self.tr("Font"))
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
83 act.setData(self.FONT)
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
84 self.__allFontsButtonMenu.addSeparator()
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
85 act = self.__allFontsButtonMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
86 self.tr("Family and Size only"))
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
87 act.setData(self.FAMILYANDSIZE)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
88 act = self.__allFontsButtonMenu.addAction(self.tr("Family only"))
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
89 act.setData(self.FAMILYONLY)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
90 act = self.__allFontsButtonMenu.addAction(self.tr("Size only"))
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
91 act.setData(self.SIZEONLY)
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
92 self.__allFontsButtonMenu.triggered.connect(
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
93 self.__allFontsButtonMenuTriggered)
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
94 self.allFontsButton.setMenu(self.__allFontsButtonMenu)
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
95
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 self.lexer = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 self.lexers = lexers
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 # set initial values
5427
614e88cfbd84 Added some eye candy.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
100 import QScintilla.Lexers
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
101 languages = sorted([''] + list(self.lexers.keys()))
5427
614e88cfbd84 Added some eye candy.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
102 for language in languages:
614e88cfbd84 Added some eye candy.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
103 self.lexerLanguageComboBox.addItem(
614e88cfbd84 Added some eye candy.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
104 QScintilla.Lexers.getLanguageIcon(language, False),
614e88cfbd84 Added some eye candy.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
105 language)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 self.on_lexerLanguageComboBox_activated("")
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
107
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 def save(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 Public slot to save the Editor Highlighting Styles configuration.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
112 for lexer in list(self.lexers.values()):
6853
0922aa829e5e PreferencesLexer: started to prepare it for handling of sub-style aware lexers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
113 lexer.writeSettings()
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
114
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 @pyqtSlot(str)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 def on_lexerLanguageComboBox_activated(self, language):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 Private slot to fill the style combo of the source page.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 @param language The lexer language (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 self.styleElementList.clear()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 self.styleGroup.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 self.lexer = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 self.exportCurrentButton.setEnabled(language != "")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 self.importCurrentButton.setEnabled(language != "")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 if not language:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 self.lexer = self.lexers[language]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 except KeyError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 self.styleGroup.setEnabled(True)
6854
f4dd76230eea PreferencesLexer, EditorHighlightingPage: got rid of the 'styles' and 'ind2style' lists (that was very old style programming).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6853
diff changeset
138 for description, styleNo, subStyleNo in self.lexer.getStyles():
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
139 if subStyleNo >= 0:
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
140 parent = self.styleElementList.findItems(
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
141 self.lexer.description(styleNo), Qt.MatchExactly)[0]
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
142 parent.setExpanded(True)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
143 else:
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
144 parent = self.styleElementList
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
145 itm = QTreeWidgetItem(parent, [description])
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
146 itm.setData(0, self.StyleRole, styleNo)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
147 itm.setData(0, self.SubstyleRole, subStyleNo)
3103
451f60e70434 Made the editor highlighting styles page more colorful (i.e. show the colors and fonts in line).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3038
diff changeset
148 self.__styleAllItems()
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
149 self.styleElementList.setCurrentItem(
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
150 self.styleElementList.topLevelItem(0))
6854
f4dd76230eea PreferencesLexer, EditorHighlightingPage: got rid of the 'styles' and 'ind2style' lists (that was very old style programming).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6853
diff changeset
151
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
152 def __stylesForItem(self, itm):
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
153 """
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
154 Private method to get the style and sub-style number of the given item.
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
155
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
156 @param itm reference to the item to extract the styles from
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
157 @type QTreeWidgetItem
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
158 @return tuple containing the style and sub-style numbers
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
159 @rtype tuple of (int, int)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
160 """
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
161 style = itm.data(0, self.StyleRole)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
162 substyle = itm.data(0, self.SubstyleRole)
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
163
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
164 return (style, substyle)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
165
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
166 def __currentStyles(self):
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
167 """
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
168 Private method to get the styles of the current item.
6855
4d80c8cc99a1 SubstyledLexer: continued implementing the getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6854
diff changeset
169
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
170 @return tuple containing the style and sub-style numbers
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
171 @rtype tuple of (int, int)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
172 """
6867
97e86d2426a9 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6864
diff changeset
173 itm = self.styleElementList.currentItem()
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
174 if itm is None:
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
175 styles = (0, -1) # return default style
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
176 else:
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
177 styles = self.__stylesForItem(itm)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
178
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
179 return styles
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
180
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
181 def __styleOneItem(self, item, style, substyle):
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
182 """
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
183 Private method to style one item of the style element list.
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
184
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
185 @param item reference to the item to be styled
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
186 @type QTreeWidgetItem
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
187 @param style base style number
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
188 @type int
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
189 @param substyle sub-style number
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
190 @type int
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
191 """
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
192 colour = self.lexer.color(style, substyle)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
193 paper = self.lexer.paper(style, substyle)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
194 font = self.lexer.font(style, substyle)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
195 eolfill = self.lexer.eolFill(style, substyle)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
196
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
197 item.setFont(0, font)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
198 item.setBackground(0, paper)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
199 item.setForeground(0, colour)
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
200 if eolfill:
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
201 item.setCheckState(0, Qt.Checked)
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
202 else:
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
203 item.setCheckState(0, Qt.Unchecked)
6855
4d80c8cc99a1 SubstyledLexer: continued implementing the getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6854
diff changeset
204
3103
451f60e70434 Made the editor highlighting styles page more colorful (i.e. show the colors and fonts in line).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3038
diff changeset
205 def __styleAllItems(self):
451f60e70434 Made the editor highlighting styles page more colorful (i.e. show the colors and fonts in line).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3038
diff changeset
206 """
451f60e70434 Made the editor highlighting styles page more colorful (i.e. show the colors and fonts in line).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3038
diff changeset
207 Private method to style all items of the style element list.
451f60e70434 Made the editor highlighting styles page more colorful (i.e. show the colors and fonts in line).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3038
diff changeset
208 """
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
209 itm = self.styleElementList.topLevelItem(0)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
210 while itm is not None:
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
211 style, substyle = self.__stylesForItem(itm)
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
212 self.__styleOneItem(itm, style, substyle)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
213 itm = self.styleElementList.itemBelow(itm)
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
214
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
215 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem)
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
216 def on_styleElementList_currentItemChanged(self, current, previous):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 """
6854
f4dd76230eea PreferencesLexer, EditorHighlightingPage: got rid of the 'styles' and 'ind2style' lists (that was very old style programming).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6853
diff changeset
218 Private method to handle a change of the current row.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
220 @param current reference to the current item
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
221 @type QTreeWidgetItem
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
222 @param previous reference to the previous item
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
223 @type QTreeWidgetItem
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 """
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
225 if current is None:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
228 style, substyle = self.__stylesForItem(current)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
229 colour = self.lexer.color(style, substyle)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
230 paper = self.lexer.paper(style, substyle)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
231 eolfill = self.lexer.eolFill(style, substyle)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
232 font = self.lexer.font(style, substyle)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 self.sampleText.setFont(font)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 pl = self.sampleText.palette()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 pl.setColor(QPalette.Text, colour)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 pl.setColor(QPalette.Base, paper)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 self.sampleText.setPalette(pl)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 self.sampleText.repaint()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 self.eolfillCheckBox.setChecked(eolfill)
6864
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
241
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
242 selectedOne = len(self.styleElementList.selectedItems()) == 1
6878
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
243 self.defaultSubstylesButton.setEnabled(
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
244 selectedOne and substyle < 0 and self.lexer.isBaseStyle(style))
6864
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
245 self.addSubstyleButton.setEnabled(
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
246 selectedOne and substyle < 0 and self.lexer.isBaseStyle(style))
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
247 self.deleteSubstyleButton.setEnabled(selectedOne and substyle >= 0)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
248 self.editSubstyleButton.setEnabled(selectedOne and substyle >= 0)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
249 self.copySubstyleButton.setEnabled(selectedOne and substyle >= 0)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
250
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 def on_foregroundButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 """
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
254 Private method used to select the foreground colour of the selected
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
255 style and lexer.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 """
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
257 style, substyle = self.__currentStyles()
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
258 colour = QColorDialog.getColor(self.lexer.color(style, substyle))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 if colour.isValid():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 pl = self.sampleText.palette()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 pl.setColor(QPalette.Text, colour)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 self.sampleText.setPalette(pl)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 self.sampleText.repaint()
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
264 for selItem in self.styleElementList.selectedItems():
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
265 style, substyle = self.__stylesForItem(selItem)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
266 self.lexer.setColor(colour, style, substyle)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
267 selItem.setForeground(0, colour)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
268
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 def on_backgroundButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 """
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
272 Private method used to select the background colour of the selected
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
273 style and lexer.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 """
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
275 style, substyle = self.__currentStyles()
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
276 colour = QColorDialog.getColor(self.lexer.paper(style, substyle))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 if colour.isValid():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 pl = self.sampleText.palette()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 pl.setColor(QPalette.Base, colour)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 self.sampleText.setPalette(pl)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 self.sampleText.repaint()
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
282 for selItem in self.styleElementList.selectedItems():
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
283 style, substyle = self.__stylesForItem(selItem)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
284 self.lexer.setPaper(colour, style, substyle)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
285 selItem.setBackground(0, colour)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
286
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 def on_allBackgroundColoursButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
290 Private method used to select the background colour of all styles of a
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 selected lexer.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 """
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
293 style, substyle = self.__currentStyles()
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
294 colour = QColorDialog.getColor(self.lexer.paper(style, substyle))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 if colour.isValid():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 pl = self.sampleText.palette()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 pl.setColor(QPalette.Base, colour)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 self.sampleText.setPalette(pl)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 self.sampleText.repaint()
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
300
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
301 itm = self.styleElementList.topLevelItem(0)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
302 while itm is not None:
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
303 style, substyle = self.__stylesForItem(itm)
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
304 self.lexer.setPaper(colour, style, substyle)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
305 itm = self.styleElementList.itemBelow(itm)
3103
451f60e70434 Made the editor highlighting styles page more colorful (i.e. show the colors and fonts in line).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3038
diff changeset
306 self.__styleAllItems()
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
307
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
308 def __changeFont(self, doAll, familyOnly, sizeOnly):
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
309 """
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
310 Private slot to change the highlighter font.
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
311
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
312 @param doAll flag indicating to change the font for all styles
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
313 (boolean)
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
314 @param familyOnly flag indicating to set the font family only (boolean)
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
315 @param sizeOnly flag indicating to set the font size only (boolean
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 """
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
317 def setFont(font, style, substyle, familyOnly, sizeOnly):
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
318 """
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
319 Local function to set the font.
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
320
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
321 @param font font to be set
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
322 @type QFont
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
323 @param style style number
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
324 @type int
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
325 @param substyle sub-style number
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
326 @type int
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
327 @param familyOnly flag indicating to set the font family only
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
328 @type bool
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
329 @param sizeOnly flag indicating to set the font size only
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
330 @type bool
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
331 """
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
332 if familyOnly or sizeOnly:
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
333 newFont = QFont(self.lexer.font(style))
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
334 if familyOnly:
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
335 newFont.setFamily(font.family())
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
336 if sizeOnly:
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
337 newFont.setPointSize(font.pointSize())
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
338 self.lexer.setFont(newFont, style, substyle)
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
339 else:
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
340 self.lexer.setFont(font, style, substyle)
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
341
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
342 def setSampleFont(font, familyOnly, sizeOnly):
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
343 """
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
344 Local function to set the font of the sample text.
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
345
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
346 @param font font to be set (QFont)
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
347 @param familyOnly flag indicating to set the font family only
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
348 (boolean)
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
349 @param sizeOnly flag indicating to set the font size only (boolean
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
350 """
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
351 if familyOnly or sizeOnly:
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
352 style, substyle = self.__currentStyles()
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
353 newFont = QFont(self.lexer.font(style, substyle))
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
354 if familyOnly:
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
355 newFont.setFamily(font.family())
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
356 if sizeOnly:
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
357 newFont.setPointSize(font.pointSize())
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
358 self.sampleText.setFont(newFont)
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
359 else:
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
360 self.sampleText.setFont(font)
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
361
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
362 style, substyle = self.__currentStyles()
4698
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
363 if self.monospacedButton.isChecked():
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
364 options = MonospacedFontsOption
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
365 else:
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
366 options = NoFontsOption
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
367 font, ok = QFontDialog.getFont(self.lexer.font(style, substyle), self,
4698
61c0aef6a570 Added capability to select only from monospaced fonts on the highlighters styles page (for PyQt5 only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4675
diff changeset
368 "", options)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 if ok:
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
370 setSampleFont(font, familyOnly, sizeOnly)
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
371 if doAll:
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
372 itm = self.styleElementList.topLevelItem(0)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
373 while itm is not None:
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
374 style, substyle = self.__stylesForItem(itm)
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
375 setFont(font, style, substyle, familyOnly, sizeOnly)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
376 itm = self.styleElementList.itemBelow(itm)
3103
451f60e70434 Made the editor highlighting styles page more colorful (i.e. show the colors and fonts in line).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3038
diff changeset
377 self.__styleAllItems()
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
378 else:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 for selItem in self.styleElementList.selectedItems():
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
380 style, substyle = self.__stylesForItem(selItem)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
381 setFont(font, style, substyle, familyOnly, sizeOnly)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
382 itmFont = self.lexer.font(style, substyle)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
383 selItem.setFont(0, itmFont)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
384
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
385 def __fontButtonMenuTriggered(self, act):
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
386 """
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
387 Private slot used to select the font of the selected style and lexer.
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
388
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
389 @param act reference to the triggering action (QAction)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 """
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
391 if act is None:
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
392 return
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
393
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
394 familyOnly = act.data() in [self.FAMILYANDSIZE, self.FAMILYONLY]
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
395 sizeOnly = act.data() in [self.FAMILYANDSIZE, self.SIZEONLY]
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
396 self.__changeFont(False, familyOnly, sizeOnly)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
397
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
398 def __allFontsButtonMenuTriggered(self, act):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 """
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
400 Private slot used to change the font of all styles of a selected lexer.
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
401
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
402 @param act reference to the triggering action (QAction)
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
403 """
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
404 if act is None:
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
405 return
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
406
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
407 familyOnly = act.data() in [self.FAMILYANDSIZE, self.FAMILYONLY]
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
408 sizeOnly = act.data() in [self.FAMILYANDSIZE, self.SIZEONLY]
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
409 self.__changeFont(True, familyOnly, sizeOnly)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
410
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
411 @pyqtSlot(bool)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
412 def on_eolfillCheckBox_clicked(self, on):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 """
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
414 Private method used to set the eolfill for the selected style and
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
415 lexer.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416
3107
5b496e690984 Another little enhancement to the highlighter style config page to show the eol-fill status in the style list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3103
diff changeset
417 @param on flag indicating enabled or disabled state (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 """
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
419 style, substyle = self.__currentStyles()
3107
5b496e690984 Another little enhancement to the highlighter style config page to show the eol-fill status in the style list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3103
diff changeset
420 checkState = Qt.Checked if on else Qt.Unchecked
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
421 for selItem in self.styleElementList.selectedItems():
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
422 style, substyle = self.__stylesForItem(selItem)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
423 self.lexer.setEolFill(on, style, substyle)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
424 selItem.setCheckState(0, checkState)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
425
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 def on_allEolFillButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 """
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
429 Private method used to set the eolfill for all styles of a selected
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
430 lexer.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 """
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
432 on = self.tr("Enabled")
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
433 off = self.tr("Disabled")
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
434 selection, ok = QInputDialog.getItem(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
436 self.tr("Fill to end of line"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
437 self.tr("Select fill to end of line for all styles"),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
438 [on, off],
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 0, False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 if ok:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 enabled = selection == on
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 self.eolfillCheckBox.setChecked(enabled)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
443
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
444 itm = self.styleElementList.topLevelItem(0)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
445 while itm is not None:
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
446 style, substyle = self.__stylesForItem(itm)
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
447 self.lexer.setEolFill(enabled, style, substyle)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
448 itm = self.styleElementList.itemBelow(itm)
3107
5b496e690984 Another little enhancement to the highlighter style config page to show the eol-fill status in the style list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3103
diff changeset
449 self.__styleAllItems()
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
450
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
452 def on_defaultButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453 """
2763
e4794166ad70 Fixed a serious typo.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
454 Private method to set the current style to its default values.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 """
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
456 for selItem in self.styleElementList.selectedItems():
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
457 style, substyle = self.__stylesForItem(selItem)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
458 self.__setToDefault(style, substyle)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
459 self.on_styleElementList_currentItemChanged(
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
460 self.styleElementList.currentItem(), None)
3103
451f60e70434 Made the editor highlighting styles page more colorful (i.e. show the colors and fonts in line).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3038
diff changeset
461 self.__styleAllItems()
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
462
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 def on_allDefaultButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 Private method to set all styles to their default values.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 """
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
468 itm = self.styleElementList.topLevelItem(0)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
469 while itm is not None:
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
470 style, substyle = self.__stylesForItem(itm)
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
471 self.__setToDefault(style, substyle)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
472 itm = self.styleElementList.itemBelow(itm)
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
473 self.on_styleElementList_currentItemChanged(
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
474 self.styleElementList.currentItem(), None)
3103
451f60e70434 Made the editor highlighting styles page more colorful (i.e. show the colors and fonts in line).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3038
diff changeset
475 self.__styleAllItems()
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
476
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
477 def __setToDefault(self, style, substyle):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478 """
2763
e4794166ad70 Fixed a serious typo.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
479 Private method to set a specific style to its default values.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
481 @param style style number
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
482 @type int
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
483 @param substyle sub-style number
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
484 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485 """
6860
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
486 self.lexer.setColor(self.lexer.defaultColor(style, substyle),
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
487 style, substyle)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
488 self.lexer.setPaper(self.lexer.defaultPaper(style, substyle),
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
489 style, substyle)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
490 self.lexer.setFont(self.lexer.defaultFont(style, substyle),
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
491 style, substyle)
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
492 self.lexer.setEolFill(self.lexer.defaultEolFill(style, substyle),
50069cc0ee49 EditorHighlightingStylesPage: added support for sub-styles and adjusted code to today's Qt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
493 style, substyle)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
494
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
495 #######################################################################
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
496 ## Importing and exporting of styles
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
497 #######################################################################
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
498
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
499 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500 def on_importCurrentButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 Private slot to import the styles of the current lexer.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
504 self.__importStyles({self.lexer.language(): self.lexer})
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
505
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 def on_exportCurrentButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 Private slot to export the styles of the current lexer.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 self.__exportStyles([self.lexer])
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
512
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 def on_importAllButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 Private slot to import the styles of all lexers.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 self.__importStyles(self.lexers)
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
519
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 def on_exportAllButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 Private slot to export the styles of all lexers.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
525 self.__exportStyles(list(self.lexers.values()))
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
526
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 def __exportStyles(self, lexers):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
528 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
529 Private method to export the styles of the given lexers.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 @param lexers list of lexer objects for which to export the styles
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 """
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
533 from eric6config import getConfig
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
534 stylesDir = getConfig("ericStylesDir")
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
535
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
536 fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
538 self.tr("Export Highlighting Styles"),
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
539 stylesDir,
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
540 self.tr("Highlighting styles file (*.e6h)"),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 "",
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
542 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 if not fn:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 ext = QFileInfo(fn).suffix()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 if not ext:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549 ex = selectedFilter.split("(*")[1].split(")")[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 if ex:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551 fn += ex
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552
593
32c9b36eec53 Migrated the highlighting styles handler to highlighting styles reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
553 f = QFile(fn)
32c9b36eec53 Migrated the highlighting styles handler to highlighting styles reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
554 if f.open(QIODevice.WriteOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
555 from E5XML.HighlightingStylesWriter import HighlightingStylesWriter
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556 HighlightingStylesWriter(f, lexers).writeXML()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 f.close()
593
32c9b36eec53 Migrated the highlighting styles handler to highlighting styles reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
558 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
559 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
560 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
561 self.tr("Export Highlighting Styles"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
562 self.tr(
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
563 """<p>The highlighting styles could not be exported"""
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
564 """ to file <b>{0}</b>.</p><p>Reason: {1}</p>""")
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
565 .format(fn, f.errorString())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 )
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
567
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568 def __importStyles(self, lexers):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570 Private method to import the styles of the given lexers.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
571
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
572 @param lexers dictionary of lexer objects for which to import the
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
573 styles
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
574 """
5976
549918576245 Added a dark style (*.qss and Python lexers) provided by Giuseppe Corbelli.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
575 from eric6config import getConfig
549918576245 Added a dark style (*.qss and Python lexers) provided by Giuseppe Corbelli.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
576 stylesDir = getConfig("ericStylesDir")
549918576245 Added a dark style (*.qss and Python lexers) provided by Giuseppe Corbelli.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
577
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
578 fn = E5FileDialog.getOpenFileName(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
580 self.tr("Import Highlighting Styles"),
5976
549918576245 Added a dark style (*.qss and Python lexers) provided by Giuseppe Corbelli.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
581 stylesDir,
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
582 self.tr("Highlighting styles file (*.e6h *.e4h)"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
583
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 if not fn:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
586
593
32c9b36eec53 Migrated the highlighting styles handler to highlighting styles reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
587 f = QFile(fn)
32c9b36eec53 Migrated the highlighting styles handler to highlighting styles reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
588 if f.open(QIODevice.ReadOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
589 from E5XML.HighlightingStylesReader import HighlightingStylesReader
593
32c9b36eec53 Migrated the highlighting styles handler to highlighting styles reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
590 reader = HighlightingStylesReader(f, lexers)
32c9b36eec53 Migrated the highlighting styles handler to highlighting styles reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
591 reader.readXML()
594
cded89ee3e30 Added forgotten close() statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 593
diff changeset
592 f.close()
593
32c9b36eec53 Migrated the highlighting styles handler to highlighting styles reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
593 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
594 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
595 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
596 self.tr("Import Highlighting Styles"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
597 self.tr(
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
598 """<p>The highlighting styles could not be read"""
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
599 """ from file <b>{0}</b>.</p><p>Reason: {1}</p>""")
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
600 .format(fn, f.errorString())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 )
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
604 self.on_lexerLanguageComboBox_activated(
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
605 self.lexerLanguageComboBox.currentText())
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
606
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
607 #######################################################################
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
608 ## Methods to save and restore the state
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
609 #######################################################################
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
610
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611 def saveState(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613 Public method to save the current state of the widget.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
614
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
615 @return list containing the index of the selected lexer language
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
616 and a tuple containing the index of the parent selected lexer
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
617 entry and the index of the selected entry
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
618 @rtype list of int and tuple of (int, int)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
619 """
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
620 itm = self.styleElementList.currentItem()
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
621 parent = itm.parent()
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
622 if parent is None:
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
623 currentData = (
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
624 None, self.styleElementList.indexOfTopLevelItem(itm))
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
625 else:
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
626 currentData = (
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
627 self.styleElementList.indexOfTopLevelItem(parent),
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
628 parent.indexOfChild(itm)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
629 )
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
630
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 savedState = [
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632 self.lexerLanguageComboBox.currentIndex(),
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
633 currentData,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 ]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 return savedState
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
636
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 def setState(self, state):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 Public method to set the state of the widget.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641 @param state state data generated by saveState
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 self.lexerLanguageComboBox.setCurrentIndex(state[0])
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
644 self.on_lexerLanguageComboBox_activated(
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
645 self.lexerLanguageComboBox.currentText())
6862
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
646
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
647 parentIndex, index = state[1]
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
648 if parentIndex is None:
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
649 itm = self.styleElementList.topLevelItem(index)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
650 else:
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
651 parent = self.styleElementList.topLevelItem(parentIndex)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
652 itm = parent.child(index)
6f4237ccf576 EditorHighlightingStylesPage: converted the styles list to QTreeWidget in order to show sub-styles indented.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6860
diff changeset
653 self.styleElementList.setCurrentItem(itm)
6864
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
654
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
655 #######################################################################
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
656 ## Methods to add, delete and edit sub-styles and their definitions
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
657 #######################################################################
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
658
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
659 @pyqtSlot()
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
660 def on_addSubstyleButton_clicked(self):
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
661 """
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
662 Private slot to add a new sub-style.
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
663 """
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
664 style, substyle = self.__currentStyles()
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
665 dlg = SubstyleDefinitionDialog(
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
666 self.lexer, style, substyle, parent=self)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
667 if dlg.exec_() == QDialog.Accepted:
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
668 description, words = dlg.getData()
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
669 substyle = self.lexer.addSubstyle(style)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
670 self.lexer.setDescription(description, style, substyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
671 self.lexer.setWords(words, style, substyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
672
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
673 parent = self.styleElementList.findItems(
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
674 self.lexer.description(style), Qt.MatchExactly)[0]
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
675 parent.setExpanded(True)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
676 itm = QTreeWidgetItem(parent, [description])
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
677 itm.setData(0, self.StyleRole, style)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
678 itm.setData(0, self.SubstyleRole, substyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
679 self.__styleOneItem(itm, style, substyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
680
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
681 @pyqtSlot()
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
682 def on_deleteSubstyleButton_clicked(self):
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
683 """
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
684 Private slot to delete the selected sub-style.
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
685 """
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
686 style, substyle = self.__currentStyles()
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
687 ok = E5MessageBox.yesNo(
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
688 self,
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
689 self.tr("Delete Sub-Style"),
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
690 self.tr("""<p>Shall the sub-style <b>{0}</b> really be"""
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
691 """ deleted?</p>""").format(
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
692 self.lexer.description(style, substyle))
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
693 )
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
694 if ok:
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
695 self.lexer.delSubstyle(style, substyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
696
6867
97e86d2426a9 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6864
diff changeset
697 itm = self.styleElementList.currentItem()
6864
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
698 parent = itm.parent()
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
699 index = parent.indexOfChild(itm)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
700 parent.takeChild(index)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
701 del itm
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
702
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
703 @pyqtSlot()
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
704 def on_editSubstyleButton_clicked(self):
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
705 """
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
706 Private slot to edit the selected sub-style entry.
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
707 """
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
708 style, substyle = self.__currentStyles()
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
709 dlg = SubstyleDefinitionDialog(
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
710 self.lexer, style, substyle, parent=self)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
711 if dlg.exec_() == QDialog.Accepted:
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
712 description, words = dlg.getData()
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
713 self.lexer.setDescription(description, style, substyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
714 self.lexer.setWords(words, style, substyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
715
6867
97e86d2426a9 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6864
diff changeset
716 itm = self.styleElementList.currentItem()
6864
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
717 itm.setText(0, description)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
718
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
719 @pyqtSlot()
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
720 def on_copySubstyleButton_clicked(self):
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
721 """
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
722 Private slot to copy the selected sub-style.
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
723 """
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
724 style, substyle = self.__currentStyles()
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
725 newSubstyle = self.lexer.addSubstyle(style)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
726
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
727 description = self.tr("{0} - Copy").format(
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
728 self.lexer.description(style, substyle))
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
729 self.lexer.setDescription(description, style, newSubstyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
730 self.lexer.setWords(self.lexer.words(style, substyle),
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
731 style, newSubstyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
732 self.lexer.setColor(self.lexer.color(style, substyle),
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
733 style, newSubstyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
734 self.lexer.setPaper(self.lexer.paper(style, substyle),
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
735 style, newSubstyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
736 self.lexer.setFont(self.lexer.font(style, substyle),
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
737 style, newSubstyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
738 self.lexer.setEolFill(self.lexer.eolFill(style, substyle),
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
739 style, newSubstyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
740
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
741 parent = self.styleElementList.findItems(
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
742 self.lexer.description(style), Qt.MatchExactly)[0]
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
743 parent.setExpanded(True)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
744 itm = QTreeWidgetItem(parent, [description])
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
745 itm.setData(0, self.StyleRole, style)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
746 itm.setData(0, self.SubstyleRole, newSubstyle)
7837ab17f079 Sub-Styles: added buttons to the Editor Highlighting Styles configuration page to add, delete, edit and copy sub-style definitions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6862
diff changeset
747 self.__styleOneItem(itm, style, newSubstyle)
6878
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
748
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
749 @pyqtSlot()
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
750 def on_defaultSubstylesButton_clicked(self):
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
751 """
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
752 Private slot to reset all substyles to default values.
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
753 """
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
754 style, substyle = self.__currentStyles()
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
755 ok = E5MessageBox.yesNo(
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
756 self,
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
757 self.tr("Reset Sub-Styles to Default"),
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
758 self.tr("<p>Do you really want to reset all defined sub-styles of"
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
759 " <b>{0}</b> to the default values?</p>""").format(
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
760 self.lexer.description(style, substyle)))
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
761 if ok:
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
762 # 1. reset sub-styles
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
763 self.lexer.loadDefaultSubStyles(style)
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
764
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
765 # 2. delete all existing sub-style items
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
766 parent = self.styleElementList.currentItem()
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
767 while parent.childCount() > 0:
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
768 itm = parent.takeChild(0) # __IGNORE_WARNING__
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
769 del itm
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
770
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
771 # 3. create the new list of sub-style items
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
772 for description, _, substyle in self.lexer.getSubStyles(style):
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
773 itm = QTreeWidgetItem(parent, [description])
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
774 itm.setData(0, self.StyleRole, style)
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
775 itm.setData(0, self.SubstyleRole, substyle)
79008f970902 EditorHighlightingStylesPage: added a button to reset the sub-styles of a base style to its default values.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6867
diff changeset
776 self.__styleOneItem(itm, style, substyle)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
778
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 def create(dlg):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 Module function to create the configuration page.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 @param dlg reference to the configuration dialog
2964
84b65fb9e780 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2763
diff changeset
784 @return reference to the instantiated page (ConfigurationPageBase)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786 page = EditorHighlightingStylesPage(dlg.getLexers())
593
32c9b36eec53 Migrated the highlighting styles handler to highlighting styles reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
787 return page

eric ide

mercurial