src/eric7/Preferences/ConfigurationPages/EditorGeneralPage.py

Thu, 25 May 2023 19:51:47 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 25 May 2023 19:51:47 +0200
branch
eric7
changeset 10069
435cc5875135
parent 9653
e67609152c5e
child 10135
36839e2c6945
permissions
-rw-r--r--

Corrected and checked some code style issues (unused function arguments).

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
9653
e67609152c5e Updated copyright for 2023.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9567
diff changeset
3 # Copyright (c) 2006 - 2023 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
9567
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
55 self.sourceNavigationGroupBox.setChecked(
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
56 Preferences.getEditor("ShowSourceNavigator")
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
57 )
7690
a59680062837 Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
58 self.sourceOutlineGroupBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
59 Preferences.getEditor("ShowSourceOutline")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
60 )
7690
a59680062837 Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
61 self.sourceOutlineWidthSpinBox.setValue(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
62 Preferences.getEditor("SourceOutlineWidth")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
63 )
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
64 self.sourceOutlineWidthStepSpinBox.setValue(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
65 Preferences.getEditor("SourceOutlineStepSize")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
66 )
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
67 self.sourceOutlineShowCodingCheckBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
68 Preferences.getEditor("SourceOutlineShowCoding")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
69 )
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 index = self.docstringStyleComboBox.findData(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
72 Preferences.getEditor("DocstringType")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
73 )
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
74 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
75 self.docstringCompletionCheckBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
76 Preferences.getEditor("DocstringAutoGenerate")
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
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
79 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
80 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
81
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
82 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
83 self.vsSelectionCheckBox.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_RECTANGULARSELECTION
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
85 )
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
86 self.vsUserCheckBox.setChecked(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
87 virtualSpaceOptions & QsciScintillaBase.SCVS_USERACCESSIBLE
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
88 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
89
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
90 self.__populateLanguageOverrideWidget()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
91
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 def save(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 Public slot to save the Editor General configuration.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
96 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
97 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
98 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
99 "TabForIndentation", self.tabforindentationCheckBox.isChecked()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
100 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
101 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
102 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
103 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
104 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
105
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
106 Preferences.setEditor(
9567
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
107 "ShowSourceNavigator", self.sourceNavigationGroupBox.isChecked()
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
108 )
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
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 "ShowSourceOutline", self.sourceOutlineGroupBox.isChecked()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
111 )
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
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 "SourceOutlineWidth", self.sourceOutlineWidthSpinBox.value()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
114 )
7690
a59680062837 Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
115 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
116 "SourceOutlineStepSize", self.sourceOutlineWidthStepSpinBox.value()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
117 )
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
118 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
119 "SourceOutlineShowCoding", self.sourceOutlineShowCodingCheckBox.isChecked()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
120 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
121
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
122 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
123 "DocstringType", self.docstringStyleComboBox.currentData()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
124 )
8505
bbe43ddfae56 Added editor configuration parameters to support mouse hover help information.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
125 Preferences.setEditor(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
126 "DocstringAutoGenerate", self.docstringCompletionCheckBox.isChecked()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
127 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
128
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
129 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
130 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
131
2659
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_NONE
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
133 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
134 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
135 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
136 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
137 Preferences.setEditor("VirtualSpaceOptions", virtualSpaceOptions)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
138
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
139 self.__saveLanguageOverrides()
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 def on_tabforindentationCheckBox_toggled(self, checked):
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 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
144
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 @param checked flag received from the signal (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 if checked and self.converttabsCheckBox.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 self.converttabsCheckBox.setChecked(not checked)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 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
150
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
151 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
152 """
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 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
154 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
155 """
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 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
157 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
158 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
159 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
160 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
161 self.on_languageOverrideWidget_itemSelectionChanged()
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 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
164 """
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 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
166
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
167 @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
168 @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
169 @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
170 @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
171 @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
172 @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
173 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
174 itm = QTreeWidgetItem(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
175 self.languageOverrideWidget,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
176 [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
177 )
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
178 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
179 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
180
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
181 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
182 """
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
183 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
184 """
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 self.languageOverrideWidget.header().resizeSections(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
186 QHeaderView.ResizeMode.ResizeToContents
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
187 )
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
188 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
189
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
190 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
191 """
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 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
193 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
194 """
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 = {}
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 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
197 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
198 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
199 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
200 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
201 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
202 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
203
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
204 Preferences.setEditor("TabIndentOverride", overrides)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
205
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
206 @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
207 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
208 """
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
209 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
210 """
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
211 self.deleteButton.setEnabled(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
212 len(self.languageOverrideWidget.selectedItems()) > 0
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 self.editButton.setEnabled(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
215 len(self.languageOverrideWidget.selectedItems()) == 1
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
216 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
217
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 @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
219 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
220 """
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 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
222 """
7731
8ec83a027a21 Fixed an issue overriding tab and indent settings for Pygments based lexers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7690
diff changeset
223 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
224 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
225 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
226 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
227 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
228 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
229 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
230 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
231 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
232 )
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
233 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
234 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
235 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
236 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
237 self.__resizeOverrideColumns()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
238
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 @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
240 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
241 """
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 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
243 """
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
244 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
245 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
246 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
247 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
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 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
250 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
251 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
252 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
253 del itm
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
254
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
255 @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
256 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
257 """
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 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
259 """
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 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
261 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
262 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
263 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
264 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
265 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
266 )
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
267 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
268 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
269 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
270 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
271
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
272
10069
435cc5875135 Corrected and checked some code style issues (unused function arguments).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
273 def create(dlg): # noqa: U100
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 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
276
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 @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
278 @return reference to the instantiated page (ConfigurationPageBase)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 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
281 return page

eric ide

mercurial