7 Module implementing the Eric Autocompletion configuration page. |
7 Module implementing the Eric Autocompletion configuration page. |
8 """ |
8 """ |
9 |
9 |
10 from AssistantEric.Assistant import AcsAPIs, AcsDocument, AcsProject |
10 from AssistantEric.Assistant import AcsAPIs, AcsDocument, AcsProject |
11 |
11 |
12 from Preferences.ConfigurationPages.ConfigurationPageBase import ( |
12 from Preferences.ConfigurationPages.ConfigurationPageBase import ConfigurationPageBase |
13 ConfigurationPageBase |
|
14 ) |
|
15 from .Ui_AutoCompletionEricPage import Ui_AutoCompletionEricPage |
13 from .Ui_AutoCompletionEricPage import Ui_AutoCompletionEricPage |
16 |
14 |
17 |
15 |
18 class AutoCompletionEricPage(ConfigurationPageBase, Ui_AutoCompletionEricPage): |
16 class AutoCompletionEricPage(ConfigurationPageBase, Ui_AutoCompletionEricPage): |
19 """ |
17 """ |
20 Class implementing the Eric Autocompletion configuration page. |
18 Class implementing the Eric Autocompletion configuration page. |
21 """ |
19 """ |
|
20 |
22 def __init__(self, plugin): |
21 def __init__(self, plugin): |
23 """ |
22 """ |
24 Constructor |
23 Constructor |
25 |
24 |
26 @param plugin reference to the plugin object |
25 @param plugin reference to the plugin object |
27 """ |
26 """ |
28 ConfigurationPageBase.__init__(self) |
27 ConfigurationPageBase.__init__(self) |
29 self.setupUi(self) |
28 self.setupUi(self) |
30 self.setObjectName("AutoCompletionEricPage") |
29 self.setObjectName("AutoCompletionEricPage") |
31 |
30 |
32 self.__plugin = plugin |
31 self.__plugin = plugin |
33 |
32 |
34 # set initial values |
33 # set initial values |
35 self.autocompletionCheckBox.setChecked( |
34 self.autocompletionCheckBox.setChecked( |
36 self.__plugin.getPreferences("AutoCompletionEnabled")) |
35 self.__plugin.getPreferences("AutoCompletionEnabled") |
37 |
36 ) |
|
37 |
38 acSource = self.__plugin.getPreferences("AutoCompletionSource") |
38 acSource = self.__plugin.getPreferences("AutoCompletionSource") |
39 self.apisCheckBox.setChecked(acSource & AcsAPIs) |
39 self.apisCheckBox.setChecked(acSource & AcsAPIs) |
40 self.documentCheckBox.setChecked(acSource & AcsDocument) |
40 self.documentCheckBox.setChecked(acSource & AcsDocument) |
41 self.projectCheckBox.setChecked(acSource & AcsProject) |
41 self.projectCheckBox.setChecked(acSource & AcsProject) |
42 |
42 |
43 self.hierarchyCheckBox.setChecked( |
43 self.hierarchyCheckBox.setChecked( |
44 self.__plugin.getPreferences("AutoCompletionFollowHierarchy")) |
44 self.__plugin.getPreferences("AutoCompletionFollowHierarchy") |
45 |
45 ) |
|
46 |
46 def save(self): |
47 def save(self): |
47 """ |
48 """ |
48 Public slot to save the Eric Autocompletion configuration. |
49 Public slot to save the Eric Autocompletion configuration. |
49 """ |
50 """ |
50 self.__plugin.setPreferences( |
51 self.__plugin.setPreferences( |
51 "AutoCompletionEnabled", |
52 "AutoCompletionEnabled", self.autocompletionCheckBox.isChecked() |
52 self.autocompletionCheckBox.isChecked()) |
53 ) |
53 |
54 |
54 acSource = 0 |
55 acSource = 0 |
55 if self.apisCheckBox.isChecked(): |
56 if self.apisCheckBox.isChecked(): |
56 acSource |= AcsAPIs |
57 acSource |= AcsAPIs |
57 if self.documentCheckBox.isChecked(): |
58 if self.documentCheckBox.isChecked(): |
58 acSource |= AcsDocument |
59 acSource |= AcsDocument |
59 if self.projectCheckBox.isChecked(): |
60 if self.projectCheckBox.isChecked(): |
60 acSource |= AcsProject |
61 acSource |= AcsProject |
61 self.__plugin.setPreferences("AutoCompletionSource", acSource) |
62 self.__plugin.setPreferences("AutoCompletionSource", acSource) |
62 |
63 |
63 self.__plugin.setPreferences( |
64 self.__plugin.setPreferences( |
64 "AutoCompletionFollowHierarchy", |
65 "AutoCompletionFollowHierarchy", self.hierarchyCheckBox.isChecked() |
65 self.hierarchyCheckBox.isChecked()) |
66 ) |