|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2008 - 2010 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the Eric Autocompletion configuration page. |
|
8 """ |
|
9 |
|
10 from AssistantEric.Assistant import AcsAPIs, AcsDocument, AcsProject |
|
11 |
|
12 from Preferences.ConfigurationPages.ConfigurationPageBase import ConfigurationPageBase |
|
13 from .Ui_AutoCompletionEricPage import Ui_AutoCompletionEricPage |
|
14 |
|
15 class AutoCompletionEricPage(ConfigurationPageBase, Ui_AutoCompletionEricPage): |
|
16 """ |
|
17 Class implementing the Eric Autocompletion configuration page. |
|
18 """ |
|
19 def __init__(self, plugin): |
|
20 """ |
|
21 Constructor |
|
22 |
|
23 @param plugin reference to the plugin object |
|
24 """ |
|
25 ConfigurationPageBase.__init__(self) |
|
26 self.setupUi(self) |
|
27 self.setObjectName("AutoCompletionEricPage") |
|
28 |
|
29 self.__plugin = plugin |
|
30 |
|
31 # set initial values |
|
32 self.autocompletionCheckBox.setChecked( |
|
33 self.__plugin.getPreferences("AutoCompletionEnabled")) |
|
34 |
|
35 acSource = self.__plugin.getPreferences("AutoCompletionSource") |
|
36 self.apisCheckBox.setChecked(acSource & AcsAPIs) |
|
37 self.documentCheckBox.setChecked(acSource & AcsDocument) |
|
38 self.projectCheckBox.setChecked(acSource & AcsProject) |
|
39 |
|
40 def save(self): |
|
41 """ |
|
42 Public slot to save the Eric Autocompletion configuration. |
|
43 """ |
|
44 self.__plugin.setPreferences("AutoCompletionEnabled", |
|
45 int(self.autocompletionCheckBox.isChecked())) |
|
46 |
|
47 acSource = 0 |
|
48 if self.apisCheckBox.isChecked(): |
|
49 acSource |= AcsAPIs |
|
50 if self.documentCheckBox.isChecked(): |
|
51 acSource |= AcsDocument |
|
52 if self.projectCheckBox.isChecked(): |
|
53 acSource |= AcsProject |
|
54 self.__plugin.setPreferences("AutoCompletionSource", acSource) |