Plugins/UiExtensionPlugins/PipInterface/PipSelectionDialog.py

changeset 6327
a1716d9210f4
child 6342
c79ecba9cde7
diff -r 5ef9456a0cbe -r a1716d9210f4 Plugins/UiExtensionPlugins/PipInterface/PipSelectionDialog.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/UiExtensionPlugins/PipInterface/PipSelectionDialog.py	Wed Jun 06 20:05:39 2018 +0200
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2018 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing a dialog to select the pip executable to be used.
+"""
+
+from __future__ import unicode_literals
+
+from PyQt5.QtWidgets import QDialog
+
+from .Ui_PipSelectionDialog import Ui_PipSelectionDialog
+
+
+class PipSelectionDialog(QDialog, Ui_PipSelectionDialog):
+    """
+    Class implementing a dialog to select the pip executable to be used.
+    """
+    def __init__(self, plugin, parent=None):
+        """
+        Constructor
+        
+        @param plugin reference to the plugin object
+        @type ToolPipPlugin
+        @param parent reference to the parent widget
+        @type QWidget
+        """
+        super(PipSelectionDialog, self).__init__(parent)
+        self.setupUi(self)
+        
+        self.__default = self.tr("<Default>")
+        pipExecutables = sorted(plugin.getPreferences("PipExecutables"))
+        self.pipComboBox.addItem(self.__default)
+        self.pipComboBox.addItems(pipExecutables)
+        
+        msh = self.minimumSizeHint()
+        self.resize(max(self.width(), msh.width()), msh.height())
+    
+    def getData(self):
+        """
+        Public method to get the entered data.
+        
+        @return tuple with the pip command and a flag indicating to install
+            to the user install directory
+        @rtype tuple of (str, bool)
+        """
+        command = self.pipComboBox.currentText()
+        if command == self.__default:
+            command = ""
+        
+        return command, self.userCheckBox.isChecked()

eric ide

mercurial