src/eric7/Preferences/ConfigurationPages/EditorAutocompletionPage.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
11 from .Ui_EditorAutocompletionPage import Ui_EditorAutocompletionPage 11 from .Ui_EditorAutocompletionPage import Ui_EditorAutocompletionPage
12 12
13 import Preferences 13 import Preferences
14 14
15 15
16 class EditorAutocompletionPage(ConfigurationPageBase, 16 class EditorAutocompletionPage(ConfigurationPageBase, Ui_EditorAutocompletionPage):
17 Ui_EditorAutocompletionPage):
18 """ 17 """
19 Class implementing the Editor Autocompletion configuration page. 18 Class implementing the Editor Autocompletion configuration page.
20 """ 19 """
20
21 def __init__(self): 21 def __init__(self):
22 """ 22 """
23 Constructor 23 Constructor
24 """ 24 """
25 super().__init__() 25 super().__init__()
26 self.setupUi(self) 26 self.setupUi(self)
27 self.setObjectName("EditorAutocompletionPage") 27 self.setObjectName("EditorAutocompletionPage")
28 28
29 # set initial values 29 # set initial values
30 self.acEnabledGroupBox.setChecked( 30 self.acEnabledGroupBox.setChecked(
31 Preferences.getEditor("AutoCompletionEnabled")) 31 Preferences.getEditor("AutoCompletionEnabled")
32 )
32 self.acCaseSensitivityCheckBox.setChecked( 33 self.acCaseSensitivityCheckBox.setChecked(
33 Preferences.getEditor("AutoCompletionCaseSensitivity")) 34 Preferences.getEditor("AutoCompletionCaseSensitivity")
35 )
34 self.acReversedCheckBox.setChecked( 36 self.acReversedCheckBox.setChecked(
35 Preferences.getEditor("AutoCompletionReversedList")) 37 Preferences.getEditor("AutoCompletionReversedList")
38 )
36 self.acReplaceWordCheckBox.setChecked( 39 self.acReplaceWordCheckBox.setChecked(
37 Preferences.getEditor("AutoCompletionReplaceWord")) 40 Preferences.getEditor("AutoCompletionReplaceWord")
41 )
38 self.acThresholdSlider.setValue( 42 self.acThresholdSlider.setValue(
39 Preferences.getEditor("AutoCompletionThreshold")) 43 Preferences.getEditor("AutoCompletionThreshold")
44 )
40 self.acScintillaCheckBox.setChecked( 45 self.acScintillaCheckBox.setChecked(
41 Preferences.getEditor("AutoCompletionScintillaOnFail")) 46 Preferences.getEditor("AutoCompletionScintillaOnFail")
42 self.acTimeoutSpinBox.setValue( 47 )
43 Preferences.getEditor("AutoCompletionTimeout")) 48 self.acTimeoutSpinBox.setValue(Preferences.getEditor("AutoCompletionTimeout"))
44 self.acCacheGroup.setChecked( 49 self.acCacheGroup.setChecked(
45 Preferences.getEditor("AutoCompletionCacheEnabled")) 50 Preferences.getEditor("AutoCompletionCacheEnabled")
51 )
46 self.acCacheSizeSpinBox.setValue( 52 self.acCacheSizeSpinBox.setValue(
47 Preferences.getEditor("AutoCompletionCacheSize")) 53 Preferences.getEditor("AutoCompletionCacheSize")
54 )
48 self.acCacheTimeSpinBox.setValue( 55 self.acCacheTimeSpinBox.setValue(
49 Preferences.getEditor("AutoCompletionCacheTime")) 56 Preferences.getEditor("AutoCompletionCacheTime")
57 )
50 self.acWatchdogDoubleSpinBox.setValue( 58 self.acWatchdogDoubleSpinBox.setValue(
51 Preferences.getEditor("AutoCompletionWatchdogTime") / 1000.0) 59 Preferences.getEditor("AutoCompletionWatchdogTime") / 1000.0
52 self.acLinesSlider.setValue( 60 )
53 Preferences.getEditor("AutoCompletionMaxLines")) 61 self.acLinesSlider.setValue(Preferences.getEditor("AutoCompletionMaxLines"))
54 self.acCharSlider.setValue( 62 self.acCharSlider.setValue(Preferences.getEditor("AutoCompletionMaxChars"))
55 Preferences.getEditor("AutoCompletionMaxChars")) 63
56
57 def save(self): 64 def save(self):
58 """ 65 """
59 Public slot to save the Editor Autocompletion configuration. 66 Public slot to save the Editor Autocompletion configuration.
60 """ 67 """
61 Preferences.setEditor( 68 Preferences.setEditor(
62 "AutoCompletionEnabled", 69 "AutoCompletionEnabled", self.acEnabledGroupBox.isChecked()
63 self.acEnabledGroupBox.isChecked()) 70 )
64 Preferences.setEditor( 71 Preferences.setEditor(
65 "AutoCompletionCaseSensitivity", 72 "AutoCompletionCaseSensitivity", self.acCaseSensitivityCheckBox.isChecked()
66 self.acCaseSensitivityCheckBox.isChecked()) 73 )
67 74
68 Preferences.setEditor( 75 Preferences.setEditor(
69 "AutoCompletionReversedList", 76 "AutoCompletionReversedList", self.acReversedCheckBox.isChecked()
70 self.acReversedCheckBox.isChecked()) 77 )
71 Preferences.setEditor( 78 Preferences.setEditor(
72 "AutoCompletionReplaceWord", 79 "AutoCompletionReplaceWord", self.acReplaceWordCheckBox.isChecked()
73 self.acReplaceWordCheckBox.isChecked()) 80 )
81 Preferences.setEditor("AutoCompletionThreshold", self.acThresholdSlider.value())
74 Preferences.setEditor( 82 Preferences.setEditor(
75 "AutoCompletionThreshold", 83 "AutoCompletionScintillaOnFail", self.acScintillaCheckBox.isChecked()
76 self.acThresholdSlider.value()) 84 )
85 Preferences.setEditor("AutoCompletionTimeout", self.acTimeoutSpinBox.value())
77 Preferences.setEditor( 86 Preferences.setEditor(
78 "AutoCompletionScintillaOnFail", 87 "AutoCompletionCacheEnabled", self.acCacheGroup.isChecked()
79 self.acScintillaCheckBox.isChecked()) 88 )
80 Preferences.setEditor( 89 Preferences.setEditor(
81 "AutoCompletionTimeout", 90 "AutoCompletionCacheSize", self.acCacheSizeSpinBox.value()
82 self.acTimeoutSpinBox.value()) 91 )
83 Preferences.setEditor( 92 Preferences.setEditor(
84 "AutoCompletionCacheEnabled", 93 "AutoCompletionCacheTime", self.acCacheTimeSpinBox.value()
85 self.acCacheGroup.isChecked()) 94 )
86 Preferences.setEditor( 95 Preferences.setEditor(
87 "AutoCompletionCacheSize", 96 "AutoCompletionWatchdogTime", self.acWatchdogDoubleSpinBox.value() * 1000
88 self.acCacheSizeSpinBox.value()) 97 )
89 Preferences.setEditor( 98 Preferences.setEditor("AutoCompletionMaxLines", self.acLinesSlider.value())
90 "AutoCompletionCacheTime", 99 Preferences.setEditor("AutoCompletionMaxChars", self.acCharSlider.value())
91 self.acCacheTimeSpinBox.value()) 100
92 Preferences.setEditor(
93 "AutoCompletionWatchdogTime",
94 self.acWatchdogDoubleSpinBox.value() * 1000)
95 Preferences.setEditor(
96 "AutoCompletionMaxLines",
97 self.acLinesSlider.value())
98 Preferences.setEditor(
99 "AutoCompletionMaxChars",
100 self.acCharSlider.value())
101
102 101
103 def create(dlg): 102 def create(dlg):
104 """ 103 """
105 Module function to create the configuration page. 104 Module function to create the configuration page.
106 105
107 @param dlg reference to the configuration dialog 106 @param dlg reference to the configuration dialog
108 @return reference to the instantiated page (ConfigurationPageBase) 107 @return reference to the instantiated page (ConfigurationPageBase)
109 """ 108 """
110 page = EditorAutocompletionPage() 109 page = EditorAutocompletionPage()
111 return page 110 return page

eric ide

mercurial