Preferences/ConfigurationPages/EditorCalltipsPage.py

Wed, 01 Jan 2014 14:40:41 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 01 Jan 2014 14:40:41 +0100
branch
5_3_x
changeset 3163
9f50365a0870
parent 2302
f29e9405c851
permissions
-rw-r--r--

Updated copyright for 2014.

# -*- coding: utf-8 -*-

# Copyright (c) 2006 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing the Editor Calltips configuration page.
"""

from PyQt4.Qsci import QsciScintilla

from QScintilla.QsciScintillaCompat import QSCINTILLA_VERSION

from .ConfigurationPageBase import ConfigurationPageBase
from .Ui_EditorCalltipsPage import Ui_EditorCalltipsPage

import Preferences


class EditorCalltipsPage(ConfigurationPageBase, Ui_EditorCalltipsPage):
    """
    Class implementing the Editor Calltips configuration page.
    """
    def __init__(self):
        """
        Constructor
        """
        super().__init__()
        self.setupUi(self)
        self.setObjectName("EditorCalltipsPage")
        
        if QSCINTILLA_VERSION() >= 0x020700:
            self.positionComboBox.addItem(self.trUtf8("Below Text"),
                QsciScintilla.CallTipsBelowText)
            self.positionComboBox.addItem(self.trUtf8("Above Text"),
                QsciScintilla.CallTipsAboveText)
        else:
            self.calltipsPositionBox.hide()
        
        # set initial values
        self.ctEnabledCheckBox.setChecked(
            Preferences.getEditor("CallTipsEnabled"))
        
        self.ctVisibleSlider.setValue(
            Preferences.getEditor("CallTipsVisible"))
        self.initColour("CallTipsBackground", self.calltipsBackgroundButton,
            Preferences.getEditorColour)
        
        self.ctScintillaCheckBox.setChecked(
            Preferences.getEditor("CallTipsScintillaOnFail"))
        
        if QSCINTILLA_VERSION() >= 0x020700:
            self.positionComboBox.setCurrentIndex(self.positionComboBox.findData(
                Preferences.getEditor("CallTipsPosition")))
        
    def save(self):
        """
        Public slot to save the EditorCalltips configuration.
        """
        Preferences.setEditor("CallTipsEnabled",
            self.ctEnabledCheckBox.isChecked())
        
        Preferences.setEditor("CallTipsVisible",
            self.ctVisibleSlider.value())
        self.saveColours(Preferences.setEditorColour)
        
        Preferences.setEditor("CallTipsScintillaOnFail",
            self.ctScintillaCheckBox.isChecked())
        
        if QSCINTILLA_VERSION() >= 0x020700:
            Preferences.setEditor("CallTipsPosition",
                self.positionComboBox.itemData(self.positionComboBox.currentIndex()))


def create(dlg):
    """
    Module function to create the configuration page.
    
    @param dlg reference to the configuration dialog
    """
    page = EditorCalltipsPage()
    return page

eric ide

mercurial