Configuration pages for Python: harmonized the Python debugger pages and the Python page and added a button to show the virtual environment manager dialog to the Python configuration pages.

Sat, 30 Jun 2018 13:59:56 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 30 Jun 2018 13:59:56 +0200
changeset 6381
37f23590dbbc
parent 6380
4a932a7ab987
child 6382
4d6e43200bc7

Configuration pages for Python: harmonized the Python debugger pages and the Python page and added a button to show the virtual environment manager dialog to the Python configuration pages.

Preferences/ConfigurationDialog.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/DebuggerPython2Page.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/DebuggerPython2Page.ui file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/DebuggerPython3Page.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/DebuggerPython3Page.ui file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/DebuggerPythonPage.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/DebuggerPythonPage.ui file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/PythonPage.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/PythonPage.ui file | annotate | diff | comparison | revisions
VirtualEnv/VirtualenvManager.py file | annotate | diff | comparison | revisions
eric6.e4p file | annotate | diff | comparison | revisions
--- a/Preferences/ConfigurationDialog.py	Sat Jun 30 13:56:44 2018 +0200
+++ b/Preferences/ConfigurationDialog.py	Sat Jun 30 13:59:56 2018 +0200
@@ -221,9 +221,9 @@
                 "debuggerGeneralPage":
                 [self.tr("General"), "preferences-debugger.png",
                  "DebuggerGeneralPage", "0debuggerPage", None],
-                "debuggerPythonPage":
+                "debuggerPython2Page":
                 [self.tr("Python2"), "preferences-pyDebugger.png",
-                 "DebuggerPythonPage", "0debuggerPage", None],
+                 "DebuggerPython2Page", "0debuggerPage", None],
                 "debuggerPython3Page":
                 [self.tr("Python3"), "preferences-pyDebugger.png",
                  "DebuggerPython3Page", "0debuggerPage", None],
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Preferences/ConfigurationPages/DebuggerPython2Page.py	Sat Jun 30 13:59:56 2018 +0200
@@ -0,0 +1,133 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2006 - 2018 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing the Debugger Python2 configuration page.
+"""
+
+from __future__ import unicode_literals
+
+from PyQt5.QtCore import pyqtSlot
+
+from E5Gui.E5Application import e5App
+from E5Gui.E5PathPicker import E5PathPickerModes
+
+from .ConfigurationPageBase import ConfigurationPageBase
+from .Ui_DebuggerPython2Page import Ui_DebuggerPython2Page
+
+import Preferences
+import UI.PixmapCache
+
+
+class DebuggerPython2Page(ConfigurationPageBase, Ui_DebuggerPython2Page):
+    """
+    Class implementing the Debugger Python2 configuration page.
+    """
+    def __init__(self):
+        """
+        Constructor
+        """
+        super(DebuggerPython2Page, self).__init__()
+        self.setupUi(self)
+        self.setObjectName("DebuggerPython2Page")
+        
+        try:
+            self.__virtualenvManager = e5App().getObject("VirtualEnvManager")
+        except KeyError:
+            from VirtualEnv.VirtualenvManager import VirtualenvManager
+            self.__virtualenvManager = VirtualenvManager()
+        
+        self.venvDlgButton.setIcon(UI.PixmapCache.getIcon("virtualenv.png"))
+        
+        self.debugClientPicker.setMode(E5PathPickerModes.OpenFileMode)
+        self.debugClientPicker.setToolTip(self.tr(
+            "Press to select the Debug Client via a file selection dialog"))
+        self.debugClientPicker.setFilters(self.tr("Python Files (*.py *.py2)"))
+        
+        self.__populateAndSetVenvComboBox()
+        
+        # set initial values
+        dct = Preferences.getDebugger("DebugClientType")
+        if dct == "standard":
+            self.standardButton.setChecked(True)
+        else:
+            self.customButton.setChecked(True)
+        self.debugClientPicker.setText(
+            Preferences.getDebugger("DebugClient"), toNative=False)
+        self.pyRedirectCheckBox.setChecked(
+            Preferences.getDebugger("PythonRedirect"))
+        self.pyNoEncodingCheckBox.setChecked(
+            Preferences.getDebugger("PythonNoEncoding"))
+        self.sourceExtensionsEdit.setText(
+            Preferences.getDebugger("PythonExtensions"))
+    
+    def save(self):
+        """
+        Public slot to save the Debugger Python configuration.
+        """
+        Preferences.setDebugger(
+            "Python2VirtualEnv",
+            self.venvComboBox.currentText())
+        if self.standardButton.isChecked():
+            dct = "standard"
+        else:
+            dct = "custom"
+        Preferences.setDebugger("DebugClientType", dct)
+        Preferences.setDebugger(
+            "DebugClient",
+            self.debugClientPicker.text(toNative=False))
+        Preferences.setDebugger(
+            "PythonRedirect",
+            self.pyRedirectCheckBox.isChecked())
+        Preferences.setDebugger(
+            "PythonNoEncoding",
+            self.pyNoEncodingCheckBox.isChecked())
+    
+    def __populateAndSetVenvComboBox(self):
+        """
+        Private method to populate and set the virtual environment combo box.
+        """
+        self.venvComboBox.clear()
+        self.venvComboBox.addItems(
+            [""] +
+            sorted(self.__virtualenvManager.getVirtualenvNamesForVariant(2))
+        )
+        
+        # set initial value
+        venvName = Preferences.getDebugger("Python2VirtualEnv")
+        if venvName:
+            index = self.venvComboBox.findText(venvName)
+            if index < 0:
+                index = 0
+            self.venvComboBox.setCurrentIndex(index)
+    
+    @pyqtSlot()
+    def on_refreshButton_clicked(self):
+        """
+        Private slot handling a click of the refresh button.
+        """
+        self.sourceExtensionsEdit.setText(
+            Preferences.getDebugger("PythonExtensions"))
+    
+    @pyqtSlot()
+    def on_venvDlgButton_clicked(self):
+        """
+        Slot documentation goes here.
+        """
+        self.__virtualenvManager.showVirtualenvManagerDialog(modal=True)
+        self.__populateAndSetVenvComboBox()
+        self.activateWindow()
+        self.raise_()
+    
+
+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 = DebuggerPython2Page()
+    return page
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Preferences/ConfigurationPages/DebuggerPython2Page.ui	Sat Jun 30 13:59:56 2018 +0200
@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DebuggerPython2Page</class>
+ <widget class="QWidget" name="DebuggerPython2Page">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>455</width>
+    <height>500</height>
+   </rect>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_3">
+   <item>
+    <widget class="QLabel" name="headerLabel">
+     <property name="text">
+      <string>&lt;b&gt;Configure Python2 Debugger&lt;/b&gt;</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="Line" name="line11_2">
+     <property name="frameShape">
+      <enum>QFrame::HLine</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Sunken</enum>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_4">
+     <property name="title">
+      <string>Python2 Virtual Environment</string>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_2">
+      <item>
+       <widget class="QComboBox" name="venvComboBox">
+        <property name="toolTip">
+         <string>Select the virtual environment to be used</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QToolButton" name="venvDlgButton">
+        <property name="toolTip">
+         <string>Press to open the virtual environment manager dialog</string>
+        </property>
+        <property name="text">
+         <string notr="true"/>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="title">
+      <string>Debug Client Type</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout">
+      <item row="1" column="0" colspan="2">
+       <widget class="E5PathPicker" name="debugClientPicker" native="true">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="focusPolicy">
+         <enum>Qt::StrongFocus</enum>
+        </property>
+        <property name="toolTip">
+         <string>Enter the path of the Debug Client to be used.  Leave empty to use the default.</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="0">
+       <widget class="QRadioButton" name="standardButton">
+        <property name="toolTip">
+         <string>Select the standard debug client</string>
+        </property>
+        <property name="text">
+         <string>Standard</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QRadioButton" name="customButton">
+        <property name="toolTip">
+         <string>Select the custom selected debug client</string>
+        </property>
+        <property name="text">
+         <string>Custom</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_3">
+     <property name="title">
+      <string>Source association</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>Please configure the associated file extensions on the 'Python' page.</string>
+        </property>
+        <property name="wordWrap">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLineEdit" name="sourceExtensionsEdit">
+        <property name="readOnly">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <spacer name="horizontalSpacer">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item>
+         <widget class="QPushButton" name="refreshButton">
+          <property name="toolTip">
+           <string>Press to update the display of the source associations</string>
+          </property>
+          <property name="text">
+           <string>Refresh</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer name="horizontalSpacer_2">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="pyRedirectCheckBox">
+     <property name="toolTip">
+      <string>Select, to redirect stdin, stdout and stderr of the program being debugged to the eric6 IDE</string>
+     </property>
+     <property name="text">
+      <string>Redirect stdin/stdout/stderr</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="pyNoEncodingCheckBox">
+     <property name="toolTip">
+      <string>Select to not set the debug client encoding</string>
+     </property>
+     <property name="text">
+      <string>Don't set the encoding of the debug client</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>435</width>
+       <height>21</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>E5PathPicker</class>
+   <extends>QWidget</extends>
+   <header>E5Gui/E5PathPicker.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
+ <tabstops>
+  <tabstop>venvComboBox</tabstop>
+  <tabstop>venvDlgButton</tabstop>
+  <tabstop>standardButton</tabstop>
+  <tabstop>customButton</tabstop>
+  <tabstop>debugClientPicker</tabstop>
+  <tabstop>sourceExtensionsEdit</tabstop>
+  <tabstop>refreshButton</tabstop>
+  <tabstop>pyRedirectCheckBox</tabstop>
+  <tabstop>pyNoEncodingCheckBox</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>customButton</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>debugClientPicker</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>328</x>
+     <y>116</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>328</x>
+     <y>135</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
--- a/Preferences/ConfigurationPages/DebuggerPython3Page.py	Sat Jun 30 13:56:44 2018 +0200
+++ b/Preferences/ConfigurationPages/DebuggerPython3Page.py	Sat Jun 30 13:59:56 2018 +0200
@@ -9,6 +9,8 @@
 
 from __future__ import unicode_literals
 
+from PyQt5.QtCore import pyqtSlot
+
 from E5Gui.E5Application import e5App
 from E5Gui.E5PathPicker import E5PathPickerModes
 
@@ -16,6 +18,7 @@
 from .Ui_DebuggerPython3Page import Ui_DebuggerPython3Page
 
 import Preferences
+import UI.PixmapCache
 
 
 class DebuggerPython3Page(ConfigurationPageBase, Ui_DebuggerPython3Page):
@@ -31,25 +34,21 @@
         self.setObjectName("DebuggerPython3Page")
         
         try:
-            virtualenvManager = e5App().getObject("VirtualEnvManager")
+            self.__virtualenvManager = e5App().getObject("VirtualEnvManager")
         except KeyError:
             from VirtualEnv.VirtualenvManager import VirtualenvManager
-            virtualenvManager = VirtualenvManager()
-        self.venvComboBox.addItems(
-            [""] + sorted(virtualenvManager.getVirtualenvNamesForVariant(3)))
+            self.__virtualenvManager = VirtualenvManager()
+        
+        self.venvDlgButton.setIcon(UI.PixmapCache.getIcon("virtualenv.png"))
         
         self.debugClientPicker.setMode(E5PathPickerModes.OpenFileMode)
         self.debugClientPicker.setToolTip(self.tr(
             "Press to select the Debug Client via a file selection dialog"))
         self.debugClientPicker.setFilters(self.tr("Python Files (*.py *.py3)"))
         
+        self.__populateAndSetVenvComboBox()
+        
         # set initial values
-        venvName = Preferences.getDebugger("Python3VirtualEnv")
-        if venvName:
-            index = self.venvComboBox.findText(venvName)
-            if index < 0:
-                index = 0
-            self.venvComboBox.setCurrentIndex(index)
         dct = Preferences.getDebugger("DebugClientType3")
         if dct == "standard":
             self.standardButton.setChecked(True)
@@ -63,7 +62,7 @@
             Preferences.getDebugger("Python3NoEncoding"))
         self.sourceExtensionsEdit.setText(
             Preferences.getDebugger("Python3Extensions"))
-        
+    
     def save(self):
         """
         Public slot to save the Debugger Python configuration.
@@ -85,9 +84,42 @@
         Preferences.setDebugger(
             "Python3NoEncoding",
             self.pyNoEncodingCheckBox.isChecked())
-        Preferences.setDebugger(
-            "Python3Extensions",
-            self.sourceExtensionsEdit.text())
+    
+    def __populateAndSetVenvComboBox(self):
+        """
+        Private method to populate and set the virtual environment combo box.
+        """
+        self.venvComboBox.clear()
+        self.venvComboBox.addItems(
+            [""] +
+            sorted(self.__virtualenvManager.getVirtualenvNamesForVariant(3))
+        )
+        
+        # set initial value
+        venvName = Preferences.getDebugger("Python3VirtualEnv")
+        if venvName:
+            index = self.venvComboBox.findText(venvName)
+            if index < 0:
+                index = 0
+            self.venvComboBox.setCurrentIndex(index)
+    
+    @pyqtSlot()
+    def on_refreshButton_clicked(self):
+        """
+        Private slot handling a click of the refresh button.
+        """
+        self.sourceExtensionsEdit.setText(
+            Preferences.getDebugger("Python3Extensions"))
+    
+    @pyqtSlot()
+    def on_venvDlgButton_clicked(self):
+        """
+        Slot documentation goes here.
+        """
+        self.__virtualenvManager.showVirtualenvManagerDialog(modal=True)
+        self.__populateAndSetVenvComboBox()
+        self.activateWindow()
+        self.raise_()
     
 
 def create(dlg):
--- a/Preferences/ConfigurationPages/DebuggerPython3Page.ui	Sat Jun 30 13:56:44 2018 +0200
+++ b/Preferences/ConfigurationPages/DebuggerPython3Page.ui	Sat Jun 30 13:59:56 2018 +0200
@@ -36,7 +36,7 @@
      <property name="title">
       <string>Python3 Virtual Environment</string>
      </property>
-     <layout class="QVBoxLayout" name="verticalLayout_2">
+     <layout class="QHBoxLayout" name="horizontalLayout_2">
       <item>
        <widget class="QComboBox" name="venvComboBox">
         <property name="toolTip">
@@ -44,6 +44,16 @@
         </property>
        </widget>
       </item>
+      <item>
+       <widget class="QToolButton" name="venvDlgButton">
+        <property name="toolTip">
+         <string>Press to open the virtual environment manager dialog</string>
+        </property>
+        <property name="text">
+         <string notr="true"/>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
@@ -98,7 +108,7 @@
       <item>
        <widget class="QLabel" name="label">
         <property name="text">
-         <string>Enter the file extensions to be associated with the Python3 debugger separated by a space. They must not overlap with the ones for Python2.</string>
+         <string>Please configure the associated file extensions on the 'Python' page.</string>
         </property>
         <property name="wordWrap">
          <bool>true</bool>
@@ -106,7 +116,51 @@
        </widget>
       </item>
       <item>
-       <widget class="QLineEdit" name="sourceExtensionsEdit"/>
+       <widget class="QLineEdit" name="sourceExtensionsEdit">
+        <property name="readOnly">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <spacer name="horizontalSpacer">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item>
+         <widget class="QPushButton" name="refreshButton">
+          <property name="toolTip">
+           <string>Press to update the display of the source associations</string>
+          </property>
+          <property name="text">
+           <string>Refresh</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer name="horizontalSpacer_2">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
       </item>
      </layout>
     </widget>
@@ -156,10 +210,12 @@
  </customwidgets>
  <tabstops>
   <tabstop>venvComboBox</tabstop>
+  <tabstop>venvDlgButton</tabstop>
   <tabstop>standardButton</tabstop>
   <tabstop>customButton</tabstop>
   <tabstop>debugClientPicker</tabstop>
   <tabstop>sourceExtensionsEdit</tabstop>
+  <tabstop>refreshButton</tabstop>
   <tabstop>pyRedirectCheckBox</tabstop>
   <tabstop>pyNoEncodingCheckBox</tabstop>
  </tabstops>
--- a/Preferences/ConfigurationPages/DebuggerPythonPage.py	Sat Jun 30 13:56:44 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2006 - 2018 Detlev Offenbach <detlev@die-offenbachs.de>
-#
-
-"""
-Module implementing the Debugger Python configuration page.
-"""
-
-from __future__ import unicode_literals
-
-from E5Gui.E5Application import e5App
-from E5Gui.E5PathPicker import E5PathPickerModes
-
-from .ConfigurationPageBase import ConfigurationPageBase
-from .Ui_DebuggerPythonPage import Ui_DebuggerPythonPage
-
-import Preferences
-
-
-class DebuggerPythonPage(ConfigurationPageBase, Ui_DebuggerPythonPage):
-    """
-    Class implementing the Debugger Python configuration page.
-    """
-    def __init__(self):
-        """
-        Constructor
-        """
-        super(DebuggerPythonPage, self).__init__()
-        self.setupUi(self)
-        self.setObjectName("DebuggerPythonPage")
-        
-        try:
-            virtualenvManager = e5App().getObject("VirtualEnvManager")
-        except KeyError:
-            from VirtualEnv.VirtualenvManager import VirtualenvManager
-            virtualenvManager = VirtualenvManager()
-        self.venvComboBox.addItems(
-            [""] + sorted(virtualenvManager.getVirtualenvNamesForVariant(2)))
-        
-        self.debugClientPicker.setMode(E5PathPickerModes.OpenFileMode)
-        self.debugClientPicker.setToolTip(self.tr(
-            "Press to select the Debug Client via a file selection dialog"))
-        self.debugClientPicker.setFilters(self.tr("Python Files (*.py *.py2)"))
-        
-        # set initial values
-        venvName = Preferences.getDebugger("Python2VirtualEnv")
-        if venvName:
-            index = self.venvComboBox.findText(venvName)
-            if index < 0:
-                index = 0
-            self.venvComboBox.setCurrentIndex(index)
-        dct = Preferences.getDebugger("DebugClientType")
-        if dct == "standard":
-            self.standardButton.setChecked(True)
-        else:
-            self.customButton.setChecked(True)
-        self.debugClientPicker.setText(
-            Preferences.getDebugger("DebugClient"), toNative=False)
-        self.pyRedirectCheckBox.setChecked(
-            Preferences.getDebugger("PythonRedirect"))
-        self.pyNoEncodingCheckBox.setChecked(
-            Preferences.getDebugger("PythonNoEncoding"))
-        self.sourceExtensionsEdit.setText(
-            Preferences.getDebugger("PythonExtensions"))
-        
-    def save(self):
-        """
-        Public slot to save the Debugger Python configuration.
-        """
-        Preferences.setDebugger(
-            "Python2VirtualEnv",
-            self.venvComboBox.currentText())
-        if self.standardButton.isChecked():
-            dct = "standard"
-        else:
-            dct = "custom"
-        Preferences.setDebugger("DebugClientType", dct)
-        Preferences.setDebugger(
-            "DebugClient",
-            self.debugClientPicker.text(toNative=False))
-        Preferences.setDebugger(
-            "PythonRedirect",
-            self.pyRedirectCheckBox.isChecked())
-        Preferences.setDebugger(
-            "PythonNoEncoding",
-            self.pyNoEncodingCheckBox.isChecked())
-        Preferences.setDebugger(
-            "PythonExtensions",
-            self.sourceExtensionsEdit.text())
-    
-
-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 = DebuggerPythonPage()
-    return page
--- a/Preferences/ConfigurationPages/DebuggerPythonPage.ui	Sat Jun 30 13:56:44 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>DebuggerPythonPage</class>
- <widget class="QWidget" name="DebuggerPythonPage">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>455</width>
-    <height>500</height>
-   </rect>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout_3">
-   <item>
-    <widget class="QLabel" name="headerLabel">
-     <property name="text">
-      <string>&lt;b&gt;Configure Python2 Debugger&lt;/b&gt;</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="Line" name="line11_2">
-     <property name="frameShape">
-      <enum>QFrame::HLine</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Sunken</enum>
-     </property>
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QGroupBox" name="groupBox_4">
-     <property name="title">
-      <string>Python2 Virtual Environment</string>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout_2">
-      <item>
-       <widget class="QComboBox" name="venvComboBox">
-        <property name="toolTip">
-         <string>Select the virtual environment to be used</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QGroupBox" name="groupBox_2">
-     <property name="title">
-      <string>Debug Client Type</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout">
-      <item row="1" column="0" colspan="2">
-       <widget class="E5PathPicker" name="debugClientPicker" native="true">
-        <property name="enabled">
-         <bool>false</bool>
-        </property>
-        <property name="focusPolicy">
-         <enum>Qt::StrongFocus</enum>
-        </property>
-        <property name="toolTip">
-         <string>Enter the path of the Debug Client to be used.  Leave empty to use the default.</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="0">
-       <widget class="QRadioButton" name="standardButton">
-        <property name="toolTip">
-         <string>Select the standard debug client</string>
-        </property>
-        <property name="text">
-         <string>Standard</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QRadioButton" name="customButton">
-        <property name="toolTip">
-         <string>Select the custom selected debug client</string>
-        </property>
-        <property name="text">
-         <string>Custom</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QGroupBox" name="groupBox_3">
-     <property name="title">
-      <string>Source association</string>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <item>
-       <widget class="QLabel" name="label">
-        <property name="text">
-         <string>Enter the file extensions to be associated with the Python2 debugger separated by a space. They must not overlap with the ones for Python3.</string>
-        </property>
-        <property name="wordWrap">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLineEdit" name="sourceExtensionsEdit"/>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QCheckBox" name="pyRedirectCheckBox">
-     <property name="toolTip">
-      <string>Select, to redirect stdin, stdout and stderr of the program being debugged to the eric6 IDE</string>
-     </property>
-     <property name="text">
-      <string>Redirect stdin/stdout/stderr</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QCheckBox" name="pyNoEncodingCheckBox">
-     <property name="toolTip">
-      <string>Select to not set the debug client encoding</string>
-     </property>
-     <property name="text">
-      <string>Don't set the encoding of the debug client</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <spacer>
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>435</width>
-       <height>21</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-  </layout>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>E5PathPicker</class>
-   <extends>QWidget</extends>
-   <header>E5Gui/E5PathPicker.h</header>
-   <container>1</container>
-  </customwidget>
- </customwidgets>
- <tabstops>
-  <tabstop>venvComboBox</tabstop>
-  <tabstop>standardButton</tabstop>
-  <tabstop>customButton</tabstop>
-  <tabstop>debugClientPicker</tabstop>
-  <tabstop>sourceExtensionsEdit</tabstop>
-  <tabstop>pyRedirectCheckBox</tabstop>
-  <tabstop>pyNoEncodingCheckBox</tabstop>
- </tabstops>
- <resources/>
- <connections>
-  <connection>
-   <sender>customButton</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>debugClientPicker</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>328</x>
-     <y>116</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>328</x>
-     <y>135</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
--- a/Preferences/ConfigurationPages/PythonPage.py	Sat Jun 30 13:56:44 2018 +0200
+++ b/Preferences/ConfigurationPages/PythonPage.py	Sat Jun 30 13:59:56 2018 +0200
@@ -9,6 +9,8 @@
 
 from __future__ import unicode_literals
 
+from PyQt5.QtCore import pyqtSlot
+
 from .ConfigurationPageBase import ConfigurationPageBase
 from .Ui_PythonPage import Ui_PythonPage
 
@@ -45,6 +47,11 @@
         self.py3ExtensionsEdit.setText(
             Preferences.getDebugger("Python3Extensions"))
         
+        self.py2EnvironmentEdit.setText(
+            Preferences.getDebugger("Python2VirtualEnv"))
+        self.py3EnvironmentEdit.setText(
+            Preferences.getDebugger("Python3VirtualEnv"))
+    
     def save(self):
         """
         Public slot to save the Python configuration.
@@ -66,6 +73,16 @@
             "Python3Extensions",
             self.py3ExtensionsEdit.text())
     
+    @pyqtSlot()
+    def on_refreshButton_clicked(self):
+        """
+        Private slot handling a click of the refresh button.
+        """
+        self.py2EnvironmentEdit.setText(
+            Preferences.getDebugger("Python2VirtualEnv"))
+        self.py3EnvironmentEdit.setText(
+            Preferences.getDebugger("Python3VirtualEnv"))
+    
 
 def create(dlg):
     """
--- a/Preferences/ConfigurationPages/PythonPage.ui	Sat Jun 30 13:56:44 2018 +0200
+++ b/Preferences/ConfigurationPages/PythonPage.ui	Sat Jun 30 13:59:56 2018 +0200
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>482</width>
-    <height>473</height>
+    <height>608</height>
    </rect>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
@@ -122,19 +122,96 @@
    <item>
     <widget class="QGroupBox" name="groupBox_2">
      <property name="title">
-      <string>Python 2 Interpreter</string>
+      <string>Python Environments</string>
      </property>
      <layout class="QVBoxLayout" name="verticalLayout">
       <item>
        <widget class="QLabel" name="label_6">
         <property name="text">
-         <string>Please configure the Python 2 interpreter on the 'Python 2 Debugger' page.</string>
+         <string>Please configure the Python environments on the 'Python2 Debugger' page and the 'Python3 Debugger' page.</string>
         </property>
         <property name="wordWrap">
          <bool>true</bool>
         </property>
        </widget>
       </item>
+      <item>
+       <widget class="QGroupBox" name="groupBox_4">
+        <property name="title">
+         <string>Currently selected environments</string>
+        </property>
+        <layout class="QGridLayout" name="gridLayout_3">
+         <item row="0" column="0">
+          <widget class="QLabel" name="label_7">
+           <property name="text">
+            <string>Python 2:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="QLineEdit" name="py2EnvironmentEdit">
+           <property name="readOnly">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="label_9">
+           <property name="text">
+            <string>Python 3:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QLineEdit" name="py3EnvironmentEdit">
+           <property name="readOnly">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <spacer name="horizontalSpacer">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item>
+         <widget class="QPushButton" name="refreshButton">
+          <property name="toolTip">
+           <string>Press to update the display of the currently selected environments</string>
+          </property>
+          <property name="text">
+           <string>Refresh</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer name="horizontalSpacer_2">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </item>
      </layout>
     </widget>
    </item>
@@ -153,6 +230,15 @@
    </item>
   </layout>
  </widget>
+ <tabstops>
+  <tabstop>stringEncodingComboBox</tabstop>
+  <tabstop>ioEncodingComboBox</tabstop>
+  <tabstop>py2ExtensionsEdit</tabstop>
+  <tabstop>py3ExtensionsEdit</tabstop>
+  <tabstop>py2EnvironmentEdit</tabstop>
+  <tabstop>py3EnvironmentEdit</tabstop>
+  <tabstop>refreshButton</tabstop>
+ </tabstops>
  <resources/>
  <connections/>
 </ui>
--- a/VirtualEnv/VirtualenvManager.py	Sat Jun 30 13:56:44 2018 +0200
+++ b/VirtualEnv/VirtualenvManager.py	Sat Jun 30 13:59:56 2018 +0200
@@ -334,16 +334,22 @@
         return copy.deepcopy(self.__virtualEnvironments)
     
     @pyqtSlot()
-    def showVirtualenvManagerDialog(self):
+    def showVirtualenvManagerDialog(self, modal=False):
         """
         Public slot to show the virtual environment manager dialog.
+        
+        @param modal flag indicating that the dialog should be shown in
+            a blocking mode
         """
         if self.__virtualenvManagerDialog is None:
             from .VirtualenvManagerDialog import VirtualenvManagerDialog
             self.__virtualenvManagerDialog = VirtualenvManagerDialog(
                 self, self.__ui)
         
-        self.__virtualenvManagerDialog.show()
+        if modal:
+            self.__virtualenvManagerDialog.exec_()
+        else:
+            self.__virtualenvManagerDialog.show()
     
     def shutdown(self):
         """
--- a/eric6.e4p	Sat Jun 30 13:56:44 2018 +0200
+++ b/eric6.e4p	Sat Jun 30 13:59:56 2018 +0200
@@ -837,8 +837,8 @@
     <Source>Preferences/ConfigurationPages/CooperationPage.py</Source>
     <Source>Preferences/ConfigurationPages/CorbaPage.py</Source>
     <Source>Preferences/ConfigurationPages/DebuggerGeneralPage.py</Source>
+    <Source>Preferences/ConfigurationPages/DebuggerPython2Page.py</Source>
     <Source>Preferences/ConfigurationPages/DebuggerPython3Page.py</Source>
-    <Source>Preferences/ConfigurationPages/DebuggerPythonPage.py</Source>
     <Source>Preferences/ConfigurationPages/DiffColoursPage.py</Source>
     <Source>Preferences/ConfigurationPages/EditorAPIsPage.py</Source>
     <Source>Preferences/ConfigurationPages/EditorAutocompletionPage.py</Source>
@@ -1991,8 +1991,8 @@
     <Form>Preferences/ConfigurationPages/CooperationPage.ui</Form>
     <Form>Preferences/ConfigurationPages/CorbaPage.ui</Form>
     <Form>Preferences/ConfigurationPages/DebuggerGeneralPage.ui</Form>
+    <Form>Preferences/ConfigurationPages/DebuggerPython2Page.ui</Form>
     <Form>Preferences/ConfigurationPages/DebuggerPython3Page.ui</Form>
-    <Form>Preferences/ConfigurationPages/DebuggerPythonPage.ui</Form>
     <Form>Preferences/ConfigurationPages/DiffColoursPage.ui</Form>
     <Form>Preferences/ConfigurationPages/EditorAPIsPage.ui</Form>
     <Form>Preferences/ConfigurationPages/EditorAutocompletionPage.ui</Form>

eric ide

mercurial