src/eric7/Preferences/ConfigurationPages/EditorGeneralPage.py

Wed, 13 Jul 2022 14:55:47 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 13 Jul 2022 14:55:47 +0200
branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
permissions
-rw-r--r--

Reformatted the source code using the 'Black' utility.

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
8881
54e42bc2437a Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8505
diff changeset
3 # Copyright (c) 2006 - 2022 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 General 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
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
10 from PyQt6.QtCore import pyqtSlot, Qt
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
11 from PyQt6.QtWidgets import QTreeWidgetItem, QHeaderView, QDialog
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
12 from PyQt6.Qsci import QsciScintillaBase
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
13
8358
144a6b854f70 Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8356
diff changeset
14 from EricWidgets import EricMessageBox
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
15
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
16 from .ConfigurationPageBase import ConfigurationPageBase
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
17 from .Ui_EditorGeneralPage import Ui_EditorGeneralPage
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
18 from .EditorLanguageTabIndentOverrideDialog import EditorLanguageTabIndentOverrideDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
20 from QScintilla.DocstringGenerator import getSupportedDocstringTypes
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
21
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 import Preferences
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
23 import UI.PixmapCache
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
25
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 class EditorGeneralPage(ConfigurationPageBase, Ui_EditorGeneralPage):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 Class implementing the Editor General configuration page.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
30
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 def __init__(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
35 super().__init__()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.setupUi(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.setObjectName("EditorGeneralPage")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
38
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
39 self.addButton.setIcon(UI.PixmapCache.getIcon("plus"))
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
40 self.deleteButton.setIcon(UI.PixmapCache.getIcon("minus"))
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
41 self.editButton.setIcon(UI.PixmapCache.getIcon("edit"))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
42
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
43 for docstringType, docstringStyle in sorted(getSupportedDocstringTypes()):
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
44 self.docstringStyleComboBox.addItem(docstringStyle, docstringType)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
45
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 # set initial values
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
47 self.tabwidthSlider.setValue(Preferences.getEditor("TabWidth"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
48 self.indentwidthSlider.setValue(Preferences.getEditor("IndentWidth"))
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
49 self.tabforindentationCheckBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
50 Preferences.getEditor("TabForIndentation")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
51 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
52 self.tabindentsCheckBox.setChecked(Preferences.getEditor("TabIndents"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
53 self.converttabsCheckBox.setChecked(Preferences.getEditor("ConvertTabsOnLoad"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
54 self.autoindentCheckBox.setChecked(Preferences.getEditor("AutoIndentation"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
55 self.comment0CheckBox.setChecked(Preferences.getEditor("CommentColumn0"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
56
7690
a59680062837 Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
57 self.sourceOutlineGroupBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
58 Preferences.getEditor("ShowSourceOutline")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
59 )
7690
a59680062837 Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
60 self.sourceOutlineWidthSpinBox.setValue(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
61 Preferences.getEditor("SourceOutlineWidth")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
62 )
7750
b16930e5baa9 Editor Outline Viewer: made the width step size configurable and optimized the context menu handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7731
diff changeset
63 self.sourceOutlineWidthStepSpinBox.setValue(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
64 Preferences.getEditor("SourceOutlineStepSize")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
65 )
7757
1f9f35f9be6d File Browser, Project Source Browser, Editor Outline: added option to suppress the source code encoding line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7750
diff changeset
66 self.sourceOutlineShowCodingCheckBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
67 Preferences.getEditor("SourceOutlineShowCoding")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
68 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
69
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
70 index = self.docstringStyleComboBox.findData(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
71 Preferences.getEditor("DocstringType")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
72 )
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
73 self.docstringStyleComboBox.setCurrentIndex(index)
8002
6002378278c9 Editor: added configuration option (Editor->General page) to enable the automatic generation of docstrings, if a docstring start sequenz was entered (default on).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7998
diff changeset
74 self.docstringCompletionCheckBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
75 Preferences.getEditor("DocstringAutoGenerate")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
76 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
77
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
78 self.mouseHoverHelpGroupBox.setChecked(Preferences.getEditor("MouseHoverHelp"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
79 self.mouseDwellTimeSpinBox.setValue(Preferences.getEditor("MouseHoverTimeout"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
80
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
81 virtualSpaceOptions = Preferences.getEditor("VirtualSpaceOptions")
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
82 self.vsSelectionCheckBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
83 virtualSpaceOptions & QsciScintillaBase.SCVS_RECTANGULARSELECTION
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
84 )
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
85 self.vsUserCheckBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
86 virtualSpaceOptions & QsciScintillaBase.SCVS_USERACCESSIBLE
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
87 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
88
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
89 self.__populateLanguageOverrideWidget()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
90
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 def save(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 Public slot to save the Editor General configuration.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
95 Preferences.setEditor("TabWidth", self.tabwidthSlider.value())
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
96 Preferences.setEditor("IndentWidth", self.indentwidthSlider.value())
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
97 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
98 "TabForIndentation", self.tabforindentationCheckBox.isChecked()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
99 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
100 Preferences.setEditor("TabIndents", self.tabindentsCheckBox.isChecked())
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
101 Preferences.setEditor("ConvertTabsOnLoad", self.converttabsCheckBox.isChecked())
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
102 Preferences.setEditor("AutoIndentation", self.autoindentCheckBox.isChecked())
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
103 Preferences.setEditor("CommentColumn0", self.comment0CheckBox.isChecked())
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
104
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
105 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
106 "ShowSourceOutline", self.sourceOutlineGroupBox.isChecked()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
107 )
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
108 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
109 "SourceOutlineWidth", self.sourceOutlineWidthSpinBox.value()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
110 )
7690
a59680062837 Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
111 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
112 "SourceOutlineStepSize", self.sourceOutlineWidthStepSpinBox.value()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
113 )
7750
b16930e5baa9 Editor Outline Viewer: made the width step size configurable and optimized the context menu handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7731
diff changeset
114 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
115 "SourceOutlineShowCoding", self.sourceOutlineShowCodingCheckBox.isChecked()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
116 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
117
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
118 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
119 "DocstringType", self.docstringStyleComboBox.currentData()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
120 )
8505
bbe43ddfae56 Added editor configuration parameters to support mouse hover help information.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
121 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
122 "DocstringAutoGenerate", self.docstringCompletionCheckBox.isChecked()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
123 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
124
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
125 Preferences.setEditor("MouseHoverHelp", self.mouseHoverHelpGroupBox.isChecked())
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
126 Preferences.setEditor("MouseHoverTimeout", self.mouseDwellTimeSpinBox.value())
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
127
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
128 virtualSpaceOptions = QsciScintillaBase.SCVS_NONE
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
129 if self.vsSelectionCheckBox.isChecked():
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
130 virtualSpaceOptions |= QsciScintillaBase.SCVS_RECTANGULARSELECTION
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
131 if self.vsUserCheckBox.isChecked():
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
132 virtualSpaceOptions |= QsciScintillaBase.SCVS_USERACCESSIBLE
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
133 Preferences.setEditor("VirtualSpaceOptions", virtualSpaceOptions)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
134
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
135 self.__saveLanguageOverrides()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
136
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 def on_tabforindentationCheckBox_toggled(self, checked):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 Private slot used to set the tab conversion check box.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
140
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 @param checked flag received from the signal (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 if checked and self.converttabsCheckBox.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 self.converttabsCheckBox.setChecked(not checked)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 self.converttabsCheckBox.setEnabled(not checked)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
146
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
147 def __populateLanguageOverrideWidget(self):
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
148 """
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
149 Private method to populate the language specific indentation and tab
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
150 width override widget.
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
151 """
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
152 overrides = Preferences.getEditor("TabIndentOverride")
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
153 for language, (tabWidth, indentWidth) in overrides.items():
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
154 self.__createOverrideItem(language, tabWidth, indentWidth)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8002
diff changeset
155 self.languageOverrideWidget.sortItems(0, Qt.SortOrder.AscendingOrder)
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
156 self.__resizeOverrideColumns()
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
157 self.on_languageOverrideWidget_itemSelectionChanged()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
158
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
159 def __createOverrideItem(self, language, tabWidth, indentWidth):
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
160 """
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
161 Private method to create an entry for a language override.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
162
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
163 @param language name of the language
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
164 @type str
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
165 @param tabWidth tabulator width
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
166 @type int
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
167 @param indentWidth indentation width
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
168 @type int
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
169 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
170 itm = QTreeWidgetItem(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
171 self.languageOverrideWidget,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
172 [language, "{0:2d}".format(tabWidth), "{0:2d}".format(indentWidth)],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
173 )
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8002
diff changeset
174 itm.setTextAlignment(1, Qt.AlignmentFlag.AlignHCenter)
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8002
diff changeset
175 itm.setTextAlignment(2, Qt.AlignmentFlag.AlignHCenter)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
176
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
177 def __resizeOverrideColumns(self):
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
178 """
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
179 Private method to resize the list columns.
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
180 """
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
181 self.languageOverrideWidget.header().resizeSections(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
182 QHeaderView.ResizeMode.ResizeToContents
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
183 )
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
184 self.languageOverrideWidget.header().setStretchLastSection(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
185
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
186 def __saveLanguageOverrides(self):
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
187 """
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
188 Private method to save the language specific indentation and tab width
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
189 overrides.
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
190 """
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
191 overrides = {}
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
192 for row in range(self.languageOverrideWidget.topLevelItemCount()):
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
193 itm = self.languageOverrideWidget.topLevelItem(row)
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
194 language = itm.text(0)
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
195 overrides[language] = [
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
196 int(itm.text(1)),
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
197 int(itm.text(2)),
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
198 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
199
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
200 Preferences.setEditor("TabIndentOverride", overrides)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
201
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
202 @pyqtSlot()
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
203 def on_languageOverrideWidget_itemSelectionChanged(self):
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
204 """
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
205 Private slot handling a change of the override selection.
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
206 """
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
207 self.deleteButton.setEnabled(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
208 len(self.languageOverrideWidget.selectedItems()) > 0
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
209 )
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
210 self.editButton.setEnabled(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
211 len(self.languageOverrideWidget.selectedItems()) == 1
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
212 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
213
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
214 @pyqtSlot()
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
215 def on_addButton_clicked(self):
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
216 """
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
217 Private slot to add a new override entry.
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
218 """
7731
8ec83a027a21 Fixed an issue overriding tab and indent settings for Pygments based lexers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7690
diff changeset
219 languages = []
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
220 for row in range(self.languageOverrideWidget.topLevelItemCount()):
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
221 itm = self.languageOverrideWidget.topLevelItem(row)
7731
8ec83a027a21 Fixed an issue overriding tab and indent settings for Pygments based lexers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7690
diff changeset
222 languages.append(itm.text(0))
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
223 dlg = EditorLanguageTabIndentOverrideDialog(
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
224 editMode=False,
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
225 languages=languages,
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
226 tabWidth=self.tabwidthSlider.value(),
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
227 indentWidth=self.indentwidthSlider.value(),
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
228 )
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8002
diff changeset
229 if dlg.exec() == QDialog.DialogCode.Accepted:
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
230 language, tabWidth, indentWidth = dlg.getData()
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
231 self.__createOverrideItem(language, tabWidth, indentWidth)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
232 self.languageOverrideWidget.sortItems(0, Qt.SortOrder.AscendingOrder)
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
233 self.__resizeOverrideColumns()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
234
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
235 @pyqtSlot()
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
236 def on_deleteButton_clicked(self):
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
237 """
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
238 Private slot to delete the selected override entries.
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
239 """
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
240 ok = EricMessageBox.yesNo(
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
241 self,
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
242 self.tr("Tab and Indent Override"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
243 self.tr("""Shall the selected entries really be removed?"""),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
244 )
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
245 if ok:
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
246 for itm in self.languageOverrideWidget.selectedItems():
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
247 index = self.languageOverrideWidget.indexOfTopLevelItem(itm)
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
248 self.languageOverrideWidget.takeTopLevelItem(index)
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
249 del itm
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
250
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
251 @pyqtSlot()
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
252 def on_editButton_clicked(self):
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
253 """
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
254 Private slot to edit the selected override entry.
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
255 """
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
256 itm = self.languageOverrideWidget.selectedItems()[0]
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
257 dlg = EditorLanguageTabIndentOverrideDialog(
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
258 editMode=True,
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
259 languages=[itm.text(0)],
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
260 tabWidth=int(itm.text(1)),
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
261 indentWidth=int(itm.text(2)),
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
262 )
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8002
diff changeset
263 if dlg.exec() == QDialog.DialogCode.Accepted:
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
264 language, tabWidth, indentWidth = dlg.getData()
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
265 itm.setText(1, "{0:2d}".format(tabWidth))
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
266 itm.setText(2, "{0:2d}".format(indentWidth))
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
267
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
268
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 def create(dlg):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 Module function to create the configuration page.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
272
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 @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: 2659
diff changeset
274 @return reference to the instantiated page (ConfigurationPageBase)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 page = EditorGeneralPage()
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
277 return page

eric ide

mercurial