Sat, 24 Aug 2013 13:53:56 +0200
Python 2 compatibility for Eric 5
# -*- coding: utf-8 -*- # Copyright (c) 2008 - 2013 Detlev Offenbach <detlev@die-offenbachs.de> # """ Module implementing the Eric Autocompletion configuration page. """ from __future__ import unicode_literals # __IGNORE_WARNING__ 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) self.hierarchyCheckBox.setChecked( self.__plugin.getPreferences("AutoCompletionFollowHierarchy")) def save(self): """ Public slot to save the Eric Autocompletion configuration. """ self.__plugin.setPreferences("AutoCompletionEnabled", 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) self.__plugin.setPreferences("AutoCompletionFollowHierarchy", self.hierarchyCheckBox.isChecked())