--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AssistantEric/ConfigurationPages/AutoCompletionEricPage.py Sun Jan 17 19:22:18 2010 +0000 @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2008 - 2010 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing the Eric Autocompletion configuration page. +""" + +from AssistantEric.Assistant import AcsAPIs, AcsDocument, AcsProject + +from Preferences.ConfigurationPages.ConfigurationPageBase import ConfigurationPageBase +from .Ui_AutoCompletionEricPage import Ui_AutoCompletionEricPage + +class AutoCompletionEricPage(ConfigurationPageBase, Ui_AutoCompletionEricPage): + """ + Class implementing the Eric Autocompletion configuration page. + """ + def __init__(self, plugin): + """ + Constructor + + @param plugin reference to the plugin object + """ + ConfigurationPageBase.__init__(self) + self.setupUi(self) + self.setObjectName("AutoCompletionEricPage") + + self.__plugin = plugin + + # set initial values + self.autocompletionCheckBox.setChecked( + self.__plugin.getPreferences("AutoCompletionEnabled")) + + acSource = self.__plugin.getPreferences("AutoCompletionSource") + self.apisCheckBox.setChecked(acSource & AcsAPIs) + self.documentCheckBox.setChecked(acSource & AcsDocument) + self.projectCheckBox.setChecked(acSource & AcsProject) + + def save(self): + """ + Public slot to save the Eric Autocompletion configuration. + """ + self.__plugin.setPreferences("AutoCompletionEnabled", + int(self.autocompletionCheckBox.isChecked())) + + acSource = 0 + if self.apisCheckBox.isChecked(): + acSource |= AcsAPIs + if self.documentCheckBox.isChecked(): + acSource |= AcsDocument + if self.projectCheckBox.isChecked(): + acSource |= AcsProject + self.__plugin.setPreferences("AutoCompletionSource", acSource)