src/eric7/Preferences/ConfigurationPages/EditorAutocompletionPage.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2006 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the Editor Autocompletion configuration page.
8 """
9
10 from .ConfigurationPageBase import ConfigurationPageBase
11 from .Ui_EditorAutocompletionPage import Ui_EditorAutocompletionPage
12
13 import Preferences
14
15
16 class EditorAutocompletionPage(ConfigurationPageBase,
17 Ui_EditorAutocompletionPage):
18 """
19 Class implementing the Editor Autocompletion configuration page.
20 """
21 def __init__(self):
22 """
23 Constructor
24 """
25 super().__init__()
26 self.setupUi(self)
27 self.setObjectName("EditorAutocompletionPage")
28
29 # set initial values
30 self.acEnabledGroupBox.setChecked(
31 Preferences.getEditor("AutoCompletionEnabled"))
32 self.acCaseSensitivityCheckBox.setChecked(
33 Preferences.getEditor("AutoCompletionCaseSensitivity"))
34 self.acReversedCheckBox.setChecked(
35 Preferences.getEditor("AutoCompletionReversedList"))
36 self.acReplaceWordCheckBox.setChecked(
37 Preferences.getEditor("AutoCompletionReplaceWord"))
38 self.acThresholdSlider.setValue(
39 Preferences.getEditor("AutoCompletionThreshold"))
40 self.acScintillaCheckBox.setChecked(
41 Preferences.getEditor("AutoCompletionScintillaOnFail"))
42 self.acTimeoutSpinBox.setValue(
43 Preferences.getEditor("AutoCompletionTimeout"))
44 self.acCacheGroup.setChecked(
45 Preferences.getEditor("AutoCompletionCacheEnabled"))
46 self.acCacheSizeSpinBox.setValue(
47 Preferences.getEditor("AutoCompletionCacheSize"))
48 self.acCacheTimeSpinBox.setValue(
49 Preferences.getEditor("AutoCompletionCacheTime"))
50 self.acWatchdogDoubleSpinBox.setValue(
51 Preferences.getEditor("AutoCompletionWatchdogTime") / 1000.0)
52 self.acLinesSlider.setValue(
53 Preferences.getEditor("AutoCompletionMaxLines"))
54 self.acCharSlider.setValue(
55 Preferences.getEditor("AutoCompletionMaxChars"))
56
57 def save(self):
58 """
59 Public slot to save the Editor Autocompletion configuration.
60 """
61 Preferences.setEditor(
62 "AutoCompletionEnabled",
63 self.acEnabledGroupBox.isChecked())
64 Preferences.setEditor(
65 "AutoCompletionCaseSensitivity",
66 self.acCaseSensitivityCheckBox.isChecked())
67
68 Preferences.setEditor(
69 "AutoCompletionReversedList",
70 self.acReversedCheckBox.isChecked())
71 Preferences.setEditor(
72 "AutoCompletionReplaceWord",
73 self.acReplaceWordCheckBox.isChecked())
74 Preferences.setEditor(
75 "AutoCompletionThreshold",
76 self.acThresholdSlider.value())
77 Preferences.setEditor(
78 "AutoCompletionScintillaOnFail",
79 self.acScintillaCheckBox.isChecked())
80 Preferences.setEditor(
81 "AutoCompletionTimeout",
82 self.acTimeoutSpinBox.value())
83 Preferences.setEditor(
84 "AutoCompletionCacheEnabled",
85 self.acCacheGroup.isChecked())
86 Preferences.setEditor(
87 "AutoCompletionCacheSize",
88 self.acCacheSizeSpinBox.value())
89 Preferences.setEditor(
90 "AutoCompletionCacheTime",
91 self.acCacheTimeSpinBox.value())
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
103 def create(dlg):
104 """
105 Module function to create the configuration page.
106
107 @param dlg reference to the configuration dialog
108 @return reference to the instantiated page (ConfigurationPageBase)
109 """
110 page = EditorAutocompletionPage()
111 return page

eric ide

mercurial