src/eric7/Preferences/ConfigurationPages/CondaPage.py

Sat, 23 Dec 2023 15:48:12 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 23 Dec 2023 15:48:12 +0100
branch
eric7
changeset 10439
21c28b0f9e41
parent 10428
a071d4065202
child 10683
779cda568acb
permissions
-rw-r--r--

Updated copyright for 2024.

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

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

"""
Module implementing the conda configuration page.
"""

from eric7 import CondaInterface, Preferences
from eric7.EricWidgets.EricPathPicker import EricPathPickerModes

from .ConfigurationPageBase import ConfigurationPageBase
from .Ui_CondaPage import Ui_CondaPage


class CondaPage(ConfigurationPageBase, Ui_CondaPage):
    """
    Class implementing the conda configuration page.
    """

    def __init__(self):
        """
        Constructor
        """
        super().__init__()
        self.setupUi(self)
        self.setObjectName("CondaPage")

        self.condaExePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
        self.condaExePicker.setToolTip(
            self.tr("Press to select the conda executable via a file selection dialog.")
        )

        # set initial values
        self.__condaExecutable = Preferences.getConda("CondaExecutable")
        self.condaExePicker.setText(self.__condaExecutable)

    def save(self):
        """
        Public slot to save the conda configuration.
        """
        condaExecutable = self.condaExePicker.text()
        if condaExecutable != self.__condaExecutable:
            Preferences.setConda("CondaExecutable", condaExecutable)

            CondaInterface.resetInterface()


def create(dlg):  # noqa: U100
    """
    Module function to create the configuration page.

    @param dlg reference to the configuration dialog
    @type ConfigurationDialog
    @return reference to the instantiated page
    @rtype ConfigurationPageBase
    """
    page = CondaPage()
    return page

eric ide

mercurial