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

« back to all changes in this revision

Viewing changes to eric/Preferences/ConfigurationPages/EditorCalltipsPage.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 EditorCalltips configuration page.
 
8
"""
 
9
 
 
10
from PyQt4.Qsci import QsciScintilla
 
11
 
 
12
from ConfigurationPageBase import ConfigurationPageBase
 
13
from Ui_EditorCalltipsPage import Ui_EditorCalltipsPage
 
14
 
 
15
import Preferences
 
16
 
 
17
class EditorCalltipsPage(ConfigurationPageBase, Ui_EditorCalltipsPage):
 
18
    """
 
19
    Class implementing the EditorCalltips configuration page.
 
20
    """
 
21
    def __init__(self):
 
22
        """
 
23
        Constructor
 
24
        """
 
25
        ConfigurationPageBase.__init__(self)
 
26
        self.setupUi(self)
 
27
        self.setObjectName("EditorCalltipsPage")
 
28
        
 
29
        # set initial values
 
30
        self.ctEnabledCheckBox.setChecked(\
 
31
            Preferences.getEditor("CallTipsEnabled"))
 
32
        self.ctVisibleSlider.setValue(\
 
33
            Preferences.getEditor("CallTipsVisible"))
 
34
        
 
35
        ctContext = Preferences.getEditor("CallTipsStyle")
 
36
        if ctContext == QsciScintilla.CallTipsNoContext:
 
37
            self.ctNoContextButton.setChecked(True)
 
38
        elif ctContext == QsciScintilla.CallTipsNoAutoCompletionContext:
 
39
            self.ctNoAutoCompletionButton.setChecked(True)
 
40
        elif ctContext == QsciScintilla.CallTipsContext:
 
41
            self.ctContextButton.setChecked(True)
 
42
        
 
43
    def save(self):
 
44
        """
 
45
        Public slot to save the EditorCalltips configuration.
 
46
        """
 
47
        Preferences.setEditor("CallTipsEnabled",
 
48
            int(self.ctEnabledCheckBox.isChecked()))
 
49
        Preferences.setEditor("CallTipsVisible",
 
50
            self.ctVisibleSlider.value())
 
51
        
 
52
        if self.ctNoContextButton.isChecked():
 
53
            Preferences.setEditor("CallTipsStyle", 
 
54
                                  QsciScintilla.CallTipsNoContext)
 
55
        elif self.ctNoAutoCompletionButton.isChecked():
 
56
            Preferences.setEditor("CallTipsStyle", 
 
57
                                  QsciScintilla.CallTipsNoAutoCompletionContext)
 
58
        elif self.ctContextButton.isChecked():
 
59
            Preferences.setEditor("CallTipsStyle", 
 
60
                                  QsciScintilla.CallTipsContext)
 
61
    
 
62
def create(dlg):
 
63
    """
 
64
    Module function to create the configuration page.
 
65
    
 
66
    @param dlg reference to the configuration dialog
 
67
    """
 
68
    page = EditorCalltipsPage()
 
69
    return page