PipxInterface/ConfigurationPage/PipxPage.py

Sun, 29 Dec 2024 14:56:04 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 29 Dec 2024 14:56:04 +0100
changeset 121
8deb7d8d9b86
parent 104
45c88e73e3dd
permissions
-rw-r--r--

Prepared a new release.

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

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

"""
Module implementing the pipx configuration page.
"""

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

from .Ui_PipxPage import Ui_PipxPage


class PipxPage(ConfigurationPageBase, Ui_PipxPage):
    """
    Class implementing the pipx configuration page.
    """

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

        @param plugin reference to the plugin object
        @type PluginPipxInterface
        """
        super().__init__()
        self.setupUi(self)
        self.setObjectName("PipxPage")

        self.__plugin = plugin

        # set the pip index URL for information only
        self.indexEdit.setText(Preferences.getPip("PipSearchIndex"))

        # set initial values
        self.autoCheckOutdatedCheckBox.setChecked(
            self.__plugin.getPreferences("AutoCheckOutdated")
        )
        self.outdatedDependenciesCheckBox.setChecked(
            self.__plugin.getPreferences("IncludeOutdatedDependencies")
        )
        self.periodicCheckOutdatedSpinBox.setValue(
            self.__plugin.getPreferences("PeriodicOutdatedCheckInterval")
        )
        self.recentWorkdirsSpinBox.setValue(
            self.__plugin.getPreferences("MaxRecentAppWorkdirs")
        )

    def save(self):
        """
        Public slot to save the pipx interface configuration.
        """
        self.__plugin.setPreferences(
            "AutoCheckOutdated", self.autoCheckOutdatedCheckBox.isChecked()
        )
        self.__plugin.setPreferences(
            "IncludeOutdatedDependencies", self.outdatedDependenciesCheckBox.isChecked()
        )
        self.__plugin.setPreferences(
            "PeriodicOutdatedCheckInterval", self.periodicCheckOutdatedSpinBox.value()
        )
        self.__plugin.setPreferences(
            "MaxRecentAppWorkdirs", self.recentWorkdirsSpinBox.value()
        )

eric ide

mercurial