src/eric7/Preferences/ConfigurationPages/EditorGeneralPage.py

Mon, 07 Nov 2022 17:19:58 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 07 Nov 2022 17:19:58 +0100
branch
eric7
changeset 9482
a2bc06a54d9d
parent 9473
3f23dbf37dbe
child 9567
0c491346bb8e
permissions
-rw-r--r--

Corrected/acknowledged some bad import style and removed some obsolete code.

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.Qsci import QsciScintillaBase
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
11 from PyQt6.QtCore import Qt, pyqtSlot
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
12 from PyQt6.QtWidgets import QDialog, QHeaderView, QTreeWidgetItem
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
13
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
14 from eric7 import Preferences
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
15 from eric7.EricGui import EricPixmapCache
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
16 from eric7.EricWidgets import EricMessageBox
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
17 from eric7.QScintilla.DocstringGenerator import getSupportedDocstringTypes
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
18
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
19 from .ConfigurationPageBase import ConfigurationPageBase
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
20 from .EditorLanguageTabIndentOverrideDialog import EditorLanguageTabIndentOverrideDialog
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
21 from .Ui_EditorGeneralPage import Ui_EditorGeneralPage
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
23
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 class EditorGeneralPage(ConfigurationPageBase, Ui_EditorGeneralPage):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 Class implementing the Editor General configuration page.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
28
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 def __init__(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 """
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
33 super().__init__()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 self.setupUi(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.setObjectName("EditorGeneralPage")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
36
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
37 self.addButton.setIcon(EricPixmapCache.getIcon("plus"))
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
38 self.deleteButton.setIcon(EricPixmapCache.getIcon("minus"))
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
39 self.editButton.setIcon(EricPixmapCache.getIcon("edit"))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
40
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
41 for docstringType, docstringStyle in sorted(getSupportedDocstringTypes()):
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
42 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
43
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 # set initial values
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
45 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
46 self.indentwidthSlider.setValue(Preferences.getEditor("IndentWidth"))
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
47 self.tabforindentationCheckBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
48 Preferences.getEditor("TabForIndentation")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
49 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
50 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
51 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
52 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
53 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
54
7690
a59680062837 Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
55 self.sourceOutlineGroupBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
56 Preferences.getEditor("ShowSourceOutline")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
57 )
7690
a59680062837 Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
58 self.sourceOutlineWidthSpinBox.setValue(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
59 Preferences.getEditor("SourceOutlineWidth")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
60 )
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
61 self.sourceOutlineWidthStepSpinBox.setValue(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
62 Preferences.getEditor("SourceOutlineStepSize")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
63 )
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
64 self.sourceOutlineShowCodingCheckBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
65 Preferences.getEditor("SourceOutlineShowCoding")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
66 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
67
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
68 index = self.docstringStyleComboBox.findData(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
69 Preferences.getEditor("DocstringType")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
70 )
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
71 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
72 self.docstringCompletionCheckBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
73 Preferences.getEditor("DocstringAutoGenerate")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
74 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
75
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
76 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
77 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
78
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
79 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
80 self.vsSelectionCheckBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
81 virtualSpaceOptions & QsciScintillaBase.SCVS_RECTANGULARSELECTION
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
82 )
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
83 self.vsUserCheckBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
84 virtualSpaceOptions & QsciScintillaBase.SCVS_USERACCESSIBLE
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
85 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
86
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
87 self.__populateLanguageOverrideWidget()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
88
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 def save(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 Public slot to save the Editor General configuration.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
93 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
94 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
95 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
96 "TabForIndentation", self.tabforindentationCheckBox.isChecked()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
97 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
98 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
99 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
100 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
101 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
102
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
103 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
104 "ShowSourceOutline", self.sourceOutlineGroupBox.isChecked()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
105 )
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
106 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
107 "SourceOutlineWidth", self.sourceOutlineWidthSpinBox.value()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
108 )
7690
a59680062837 Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
109 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
110 "SourceOutlineStepSize", self.sourceOutlineWidthStepSpinBox.value()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
111 )
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
112 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
113 "SourceOutlineShowCoding", self.sourceOutlineShowCodingCheckBox.isChecked()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
114 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
115
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
116 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
117 "DocstringType", self.docstringStyleComboBox.currentData()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
118 )
8505
bbe43ddfae56 Added editor configuration parameters to support mouse hover help information.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
119 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
120 "DocstringAutoGenerate", self.docstringCompletionCheckBox.isChecked()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
121 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
122
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
123 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
124 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
125
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
126 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
127 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
128 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
129 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
130 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
131 Preferences.setEditor("VirtualSpaceOptions", virtualSpaceOptions)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
132
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
133 self.__saveLanguageOverrides()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
134
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 def on_tabforindentationCheckBox_toggled(self, checked):
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 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
138
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 @param checked flag received from the signal (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 if checked and self.converttabsCheckBox.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 self.converttabsCheckBox.setChecked(not checked)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 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
144
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
145 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
146 """
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 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
148 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
149 """
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 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
151 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
152 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
153 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
154 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
155 self.on_languageOverrideWidget_itemSelectionChanged()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
156
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
157 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
158 """
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 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
160
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
161 @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
162 @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
163 @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
164 @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
165 @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
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 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
168 itm = QTreeWidgetItem(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
169 self.languageOverrideWidget,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
170 [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
171 )
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
172 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
173 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
174
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
175 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
176 """
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 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
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 self.languageOverrideWidget.header().resizeSections(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
180 QHeaderView.ResizeMode.ResizeToContents
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
181 )
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
182 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
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 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
185 """
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 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
187 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
188 """
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 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
191 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
192 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
193 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
194 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
195 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
196 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
197
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
198 Preferences.setEditor("TabIndentOverride", overrides)
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 @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
201 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
202 """
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 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
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 self.deleteButton.setEnabled(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
206 len(self.languageOverrideWidget.selectedItems()) > 0
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
207 )
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
208 self.editButton.setEnabled(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
209 len(self.languageOverrideWidget.selectedItems()) == 1
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
210 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
211
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
212 @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
213 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
214 """
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 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
216 """
7731
8ec83a027a21 Fixed an issue overriding tab and indent settings for Pygments based lexers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7690
diff changeset
217 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
218 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
219 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
220 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
221 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
222 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
223 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
224 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
225 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
226 )
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
227 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
228 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
229 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
230 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
231 self.__resizeOverrideColumns()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
232
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 @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
234 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
235 """
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 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
237 """
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
238 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
239 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
240 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
241 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
242 )
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
243 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
244 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
245 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
246 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
247 del itm
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
248
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
249 @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
250 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
251 """
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 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
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 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
255 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
256 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
257 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
258 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
259 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
260 )
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
261 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
262 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
263 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
264 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
265
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
266
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 def create(dlg):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 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
270
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 @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
272 @return reference to the instantiated page (ConfigurationPageBase)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 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
275 return page

eric ide

mercurial