Preferences/ConfigurationPages/PipPage.py

Sun, 17 Feb 2019 19:19:30 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 17 Feb 2019 19:19:30 +0100
branch
pypi
changeset 6782
390a45748883
parent 6645
Plugins/UiExtensionPlugins/PipInterface/ConfigurationPage/PipPage.py@ad476851d7e0
child 6800
ce5b800b2fe2
permissions
-rw-r--r--

PipInterface: started to convert the pip interface from a menu based plug-in to a widget based interface to be placed in the right side tools bar.

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

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

"""
Package implementing the pip configuration page.
"""

from __future__ import unicode_literals

from .ConfigurationPageBase import ConfigurationPageBase
from .Ui_PipPage import Ui_PipPage

from PipInterface import DefaultPyPiUrl

import Preferences


class PipPage(ConfigurationPageBase, Ui_PipPage):
    """
    Class implementing the pip configuration page.
    """
    def __init__(self):
        """
        Constructor
        
        @param plugin reference to the plugin object
        @type PipInterfacePlugin
        """
        super(PipPage, self).__init__()
        self.setupUi(self)
        self.setObjectName("PipPage")
        
        self.indexLabel.setText(self.tr(
            '<b>Note:</b> Leave empty to use the default index URL ('
            '<a href="{0}">{0}</a>).')
            .format(DefaultPyPiUrl))
        
        # set initial values
        self.indexEdit.setText(Preferences.getPip("PipSearchIndex"))
    
    def save(self):
        """
        Public slot to save the pip configuration.
        """
        Preferences.setPip(
            "PipSearchIndex", self.indexEdit.text().strip())


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

eric ide

mercurial