Preferences/ConfigurationPages/EditorAutocompletionPage.py

Sun, 27 May 2018 11:32:01 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Sun, 27 May 2018 11:32:01 +0200
changeset 6305
7652b925c25e
parent 6048
82ad8ec9548c
child 6319
df201b9fbad4
child 6645
ad476851d7e0
permissions
-rw-r--r--

Resize auto complete list box to fit with contents.

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
6048
82ad8ec9548c Updated copyright for 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5932
diff changeset
3 # Copyright (c) 2006 - 2018 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 Autocompletion configuration page.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3058
diff changeset
10 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
11
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
12 from .ConfigurationPageBase import ConfigurationPageBase
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
13 from .Ui_EditorAutocompletionPage import Ui_EditorAutocompletionPage
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
17
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
18 class EditorAutocompletionPage(ConfigurationPageBase,
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
19 Ui_EditorAutocompletionPage):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 Class implementing the Editor Autocompletion configuration page.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 def __init__(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
27 super(EditorAutocompletionPage, self).__init__()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 self.setupUi(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 self.setObjectName("EditorAutocompletionPage")
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 # set initial values
5932
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5909
diff changeset
32 self.acEnabledGroupBox.setChecked(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 Preferences.getEditor("AutoCompletionEnabled"))
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
34 self.acCaseSensitivityCheckBox.setChecked(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 Preferences.getEditor("AutoCompletionCaseSensitivity"))
5886
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
36 self.acReversedCheckBox.setChecked(
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
37 Preferences.getEditor("AutoCompletionReversedList"))
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
38 self.acReplaceWordCheckBox.setChecked(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 Preferences.getEditor("AutoCompletionReplaceWord"))
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
40 self.acThresholdSlider.setValue(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 Preferences.getEditor("AutoCompletionThreshold"))
5932
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5909
diff changeset
42 self.acScintillaCheckBox.setChecked(
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5909
diff changeset
43 Preferences.getEditor("AutoCompletionScintillaOnFail"))
5886
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
44 self.acTimeoutSpinBox.setValue(
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
45 Preferences.getEditor("AutoCompletionTimeout"))
5906
fef02b3fdc32 Added an entry to configure the size of the editor completions cache.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5888
diff changeset
46 self.acCacheSizeSpinBox.setValue(
fef02b3fdc32 Added an entry to configure the size of the editor completions cache.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5888
diff changeset
47 Preferences.getEditor("AutoCompletionCacheSize"))
5909
21d90a3abc7c Added a timeout configuration value to the completions cache after which completions will be removed from the cache.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5906
diff changeset
48 self.acCacheTimeSpinBox.setValue(
21d90a3abc7c Added a timeout configuration value to the completions cache after which completions will be removed from the cache.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5906
diff changeset
49 Preferences.getEditor("AutoCompletionCacheTime"))
5932
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5909
diff changeset
50 self.acWatchdogDoubleSpinBox.setValue(
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5909
diff changeset
51 Preferences.getEditor("AutoCompletionWatchdogTime") / 1000.0)
6305
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6048
diff changeset
52 self.acLinesSlider.setValue(
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6048
diff changeset
53 Preferences.getEditor("AutoCompletionMaxLines"))
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6048
diff changeset
54 self.acCharSlider.setValue(
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6048
diff changeset
55 Preferences.getEditor("AutoCompletionMaxChars"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 def save(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 Public slot to save the Editor Autocompletion configuration.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 """
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
61 Preferences.setEditor(
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
62 "AutoCompletionEnabled",
5932
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5909
diff changeset
63 self.acEnabledGroupBox.isChecked())
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
64 Preferences.setEditor(
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
65 "AutoCompletionCaseSensitivity",
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
66 self.acCaseSensitivityCheckBox.isChecked())
5886
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
67
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
68 Preferences.setEditor(
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
69 "AutoCompletionReversedList",
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
70 self.acReversedCheckBox.isChecked())
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
71 Preferences.setEditor(
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
72 "AutoCompletionReplaceWord",
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
73 self.acReplaceWordCheckBox.isChecked())
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
74 Preferences.setEditor(
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
75 "AutoCompletionThreshold",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.acThresholdSlider.value())
4271
480434472ac1 Added capability to the editor to ask multiple completion list and call-tip providers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
77 Preferences.setEditor(
5932
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5909
diff changeset
78 "AutoCompletionScintillaOnFail",
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5909
diff changeset
79 self.acScintillaCheckBox.isChecked())
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5909
diff changeset
80 Preferences.setEditor(
5886
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
81 "AutoCompletionTimeout",
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
82 self.acTimeoutSpinBox.value())
5906
fef02b3fdc32 Added an entry to configure the size of the editor completions cache.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5888
diff changeset
83 Preferences.setEditor(
fef02b3fdc32 Added an entry to configure the size of the editor completions cache.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5888
diff changeset
84 "AutoCompletionCacheSize",
fef02b3fdc32 Added an entry to configure the size of the editor completions cache.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5888
diff changeset
85 self.acCacheSizeSpinBox.value())
5909
21d90a3abc7c Added a timeout configuration value to the completions cache after which completions will be removed from the cache.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5906
diff changeset
86 Preferences.setEditor(
21d90a3abc7c Added a timeout configuration value to the completions cache after which completions will be removed from the cache.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5906
diff changeset
87 "AutoCompletionCacheTime",
21d90a3abc7c Added a timeout configuration value to the completions cache after which completions will be removed from the cache.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5906
diff changeset
88 self.acCacheTimeSpinBox.value())
5932
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5909
diff changeset
89 Preferences.setEditor(
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5909
diff changeset
90 "AutoCompletionWatchdogTime",
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5909
diff changeset
91 self.acWatchdogDoubleSpinBox.value() * 1000)
6305
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6048
diff changeset
92 Preferences.setEditor(
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6048
diff changeset
93 "AutoCompletionMaxLines",
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6048
diff changeset
94 self.acLinesSlider.value())
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6048
diff changeset
95 Preferences.setEditor(
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6048
diff changeset
96 "AutoCompletionMaxChars",
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6048
diff changeset
97 self.acCharSlider.value())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
99
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 def create(dlg):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 Module function to create the configuration page.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 @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: 2302
diff changeset
105 @return reference to the instantiated page (ConfigurationPageBase)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 page = EditorAutocompletionPage()
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
108 return page

eric ide

mercurial