~ubuntu-branches/ubuntu/karmic/eric/karmic

« back to all changes in this revision

Viewing changes to eric/Preferences/ConfigurationPages/EditorAutocompletionPage.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2008-01-28 18:02:25 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080128180225-6nrox6yrworh2c4v
Tags: 4.0.4-1ubuntu1
* Add python-qt3 to build-depends becuase that's where Ubuntu puts 
  pyqtconfig
* Change maintainer to MOTU

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
# Copyright (c) 2006 - 2007 Detlev Offenbach <detlev@die-offenbachs.de>
 
4
#
 
5
 
 
6
"""
 
7
Module implementing the Editor Autocompletion configuration page.
 
8
"""
 
9
 
 
10
from PyQt4.Qsci import QsciScintilla
 
11
 
 
12
from ConfigurationPageBase import ConfigurationPageBase
 
13
from Ui_EditorAutocompletionPage import Ui_EditorAutocompletionPage
 
14
 
 
15
import Preferences
 
16
 
 
17
class EditorAutocompletionPage(ConfigurationPageBase, Ui_EditorAutocompletionPage):
 
18
    """
 
19
    Class implementing the Editor Autocompletion configuration page.
 
20
    """
 
21
    def __init__(self):
 
22
        """
 
23
        Constructor
 
24
        """
 
25
        ConfigurationPageBase.__init__(self)
 
26
        self.setupUi(self)
 
27
        self.setObjectName("EditorAutocompletionPage")
 
28
        
 
29
        # set initial values
 
30
        self.acEnabledCheckBox.setChecked(\
 
31
            Preferences.getEditor("AutoCompletionEnabled"))
 
32
        self.acCaseSensitivityCheckBox.setChecked(\
 
33
            Preferences.getEditor("AutoCompletionCaseSensitivity"))
 
34
        self.acReplaceWordCheckBox.setChecked(\
 
35
            Preferences.getEditor("AutoCompletionReplaceWord"))
 
36
        self.acShowSingleCheckBox.setChecked(\
 
37
            Preferences.getEditor("AutoCompletionShowSingle"))
 
38
        self.acFillupsCheckBox.setChecked(\
 
39
            Preferences.getEditor("AutoCompletionFillups"))
 
40
        self.acThresholdSlider.setValue(\
 
41
            Preferences.getEditor("AutoCompletionThreshold"))
 
42
        
 
43
        acSource = Preferences.getEditor("AutoCompletionSource")
 
44
        if acSource == QsciScintilla.AcsDocument:
 
45
            self.acSourceDocumentRadioButton.setChecked(True)
 
46
        elif acSource == QsciScintilla.AcsAPIs:
 
47
            self.acSourceAPIsRadioButton.setChecked(True)
 
48
        elif acSource == QsciScintilla.AcsAll:
 
49
            self.acSourceAllRadioButton.setChecked(True)
 
50
        
 
51
    def save(self):
 
52
        """
 
53
        Public slot to save the Editor Autocompletion configuration.
 
54
        """
 
55
        Preferences.setEditor("AutoCompletionEnabled",
 
56
            int(self.acEnabledCheckBox.isChecked()))
 
57
        Preferences.setEditor("AutoCompletionCaseSensitivity",
 
58
            int(self.acCaseSensitivityCheckBox.isChecked()))
 
59
        Preferences.setEditor("AutoCompletionReplaceWord",
 
60
            int(self.acReplaceWordCheckBox.isChecked()))
 
61
        Preferences.setEditor("AutoCompletionShowSingle",
 
62
            int(self.acShowSingleCheckBox.isChecked()))
 
63
        Preferences.setEditor("AutoCompletionFillups",
 
64
            int(self.acFillupsCheckBox.isChecked()))
 
65
        Preferences.setEditor("AutoCompletionThreshold",
 
66
            self.acThresholdSlider.value())
 
67
        if self.acSourceDocumentRadioButton.isChecked():
 
68
            Preferences.setEditor("AutoCompletionSource", QsciScintilla.AcsDocument)
 
69
        elif self.acSourceAPIsRadioButton.isChecked():
 
70
            Preferences.setEditor("AutoCompletionSource", QsciScintilla.AcsAPIs)
 
71
        elif self.acSourceAllRadioButton.isChecked():
 
72
            Preferences.setEditor("AutoCompletionSource", QsciScintilla.AcsAll)
 
73
    
 
74
def create(dlg):
 
75
    """
 
76
    Module function to create the configuration page.
 
77
    
 
78
    @param dlg reference to the configuration dialog
 
79
    """
 
80
    page = EditorAutocompletionPage()
 
81
    return page