RefactoringRope/ConfigurationPage/CallTipsRopePage.py

Tue, 20 Dec 2022 14:33:49 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 20 Dec 2022 14:33:49 +0100
branch
eric7
changeset 409
65153bf17e8d
parent 396
933b8fcd854f
child 411
8cccb49bba7b
permissions
-rw-r--r--

Fixed a bug and resorted the imports with isort.

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

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

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

from PyQt6.QtCore import pyqtSlot

from eric7.Preferences.ConfigurationPages.ConfigurationPageBase import (
    ConfigurationPageBase,
)

from .Ui_CallTipsRopePage import Ui_CallTipsRopePage


class CallTipsRopePage(ConfigurationPageBase, Ui_CallTipsRopePage):
    """
    Class implementing the Rope Calltips configuration page.
    """

    def __init__(self, plugin):
        """
        Constructor

        @param plugin reference to the plugin object
        @type RefactoringRopePlugin
        """
        ConfigurationPageBase.__init__(self)
        self.setupUi(self)
        self.setObjectName("CallTipsRopePage")

        self.__plugin = plugin

        # set initial values
        self.ropeCalltipsCheckBox.setChecked(
            self.__plugin.getPreferences("CodeAssistCalltipsEnabled")
        )
        self.ctMaxfixesSpinBox.setValue(
            self.__plugin.getPreferences("CalltipsMaxFixes")
        )

    def save(self):
        """
        Public slot to save the Rope Calltips configuration.
        """
        self.__plugin.setPreferences(
            "CodeAssistCalltipsEnabled", self.ropeCalltipsCheckBox.isChecked()
        )
        self.__plugin.setPreferences("CalltipsMaxFixes", self.ctMaxfixesSpinBox.value())

    def polishPage(self):
        """
        Public slot to perform some polishing actions.
        """
        names = self.__plugin.getCodeAssistServer().connectionNames()
        self.createPython3Button.setEnabled("Python3" in names)
        self.editPython3Button.setEnabled("Python3" in names)

    @pyqtSlot()
    def on_editPython3Button_clicked(self):
        """
        Private slot to edit the rope configuration for Python 3.
        """
        self.__plugin.getCodeAssistServer().editConfig("Python3")

    @pyqtSlot()
    def on_createPython3Button_clicked(self):
        """
        Private slot to create a new default rope configuration for Python 3.
        """
        self.__plugin.getCodeAssistServer().createConfig("Python3")

eric ide

mercurial