Debugger/StartDialog.py

changeset 5899
0516f6548ca6
parent 5587
ea526b78ee6c
child 6048
82ad8ec9548c
--- a/Debugger/StartDialog.py	Mon Oct 09 19:06:46 2017 +0200
+++ b/Debugger/StartDialog.py	Tue Oct 10 19:05:00 2017 +0200
@@ -25,7 +25,8 @@
     the commandline parameters, the working directory and
     whether exception reporting should be disabled.
     """
-    def __init__(self, caption, argvList, wdList, envList, exceptions,
+    def __init__(self, caption, interpreterList, argvList, wdList, envList,
+                 exceptions,
                  parent=None, dialogType=0, modfuncList=None,
                  tracePython=False, autoClearShell=True, autoContinue=True,
                  autoFork=False, forkChild=False):
@@ -33,6 +34,7 @@
         Constructor
         
         @param caption the caption to be displayed (string)
+        @param interpreterList list of interpreters (list of string)
         @param argvList history list of commandline arguments (list of strings)
         @param wdList history list of working directories (list of strings)
         @param envList history list of environment settings (list of strings)
@@ -74,6 +76,12 @@
             from .Ui_StartProfileDialog import Ui_StartProfileDialog
             self.ui = Ui_StartProfileDialog()
         self.ui.setupUi(self)
+        
+        self.ui.interpreterPicker.setMode(E5PathPickerModes.OpenFileMode)
+        self.ui.interpreterPicker.setInsertPolicy(QComboBox.InsertAtTop)
+        self.ui.interpreterPicker.setSizeAdjustPolicy(
+            QComboBox.AdjustToMinimumContentsLength)
+        
         self.ui.workdirPicker.setMode(E5PathPickerModes.DirectoryMode)
         self.ui.workdirPicker.setDefaultDirectory(
             Preferences.getMultiProject("Workspace"))
@@ -102,6 +110,10 @@
         self.ui.consoleCheckBox.setEnabled(
             Preferences.getDebugger("ConsoleDbgCommand") != "")
         self.ui.consoleCheckBox.setChecked(False)
+        self.ui.interpreterPicker.clear()
+        self.ui.interpreterPicker.addItems(interpreterList)
+        if len(interpreterList) > 0:
+            self.ui.interpreterPicker.setCurrentIndex(0)
         
         if dialogType == 0:        # start debug dialog
             self.ui.tracePythonCheckBox.setChecked(tracePython)
@@ -134,20 +146,23 @@
         """
         Public method to retrieve the data entered into this dialog.
         
-        @return a tuple of argv (string), workdir (string), environment
-            (string), exceptions flag (boolean), clear interpreter flag
-            (boolean) and run in console flag (boolean)
+        @return a tuple of interpreter (string), argv (string), workdir
+            (string), environment (string), exceptions flag (boolean),
+            clear interpreter flag (boolean) and run in console flag (boolean)
         """
         cmdLine = self.ui.cmdlineCombo.currentText()
         workdir = self.ui.workdirPicker.currentText()
         environment = self.ui.environmentCombo.currentText()
+        interpreter = self.ui.interpreterPicker.currentText()
         
-        return (cmdLine,
+        return (interpreter,
+                cmdLine,
                 workdir,
                 environment,
                 self.ui.exceptionCheckBox.isChecked(),
                 self.ui.clearShellCheckBox.isChecked(),
-                self.ui.consoleCheckBox.isChecked())
+                self.ui.consoleCheckBox.isChecked(),
+                )
         
     def getDebugData(self):
         """
@@ -212,14 +227,17 @@
         cmdLine = self.ui.cmdlineCombo.currentText()
         workdir = self.ui.workdirPicker.currentText()
         environment = self.ui.environmentCombo.currentText()
+        interpreter = self.ui.interpreterPicker.currentText()
         
         self.ui.cmdlineCombo.clear()
         self.ui.workdirPicker.clear()
         self.ui.environmentCombo.clear()
+        self.ui.interpreterPicker.clear()
         
         self.ui.cmdlineCombo.addItem(cmdLine)
         self.ui.workdirPicker.addItem(workdir)
         self.ui.environmentCombo.addItem(environment)
+        self.ui.interpreterPicker.addItem(interpreter)
     
     def __editHistory(self):
         """
@@ -227,6 +245,7 @@
         """
         histories = [
             "",
+            self.tr("Interpreter"),
             self.tr("Command Line"),
             self.tr("Working Directory"),
             self.tr("Environment"),
@@ -239,11 +258,13 @@
             0, False)
         if ok and historyKind:
             historiesIndex = histories.index(historyKind)
-            if historiesIndex == 2:
+            if historiesIndex == 3:
                 history = self.ui.workdirPicker.getPathItems()
+            elif historiesIndex == 1:
+                history = self.ui.interpreterPicker.getPathItems()
             else:
                 history = []
-                if historiesIndex == 1:
+                if historiesIndex == 2:
                     combo = self.ui.cmdlineCombo
                 else:
                     combo = self.ui.environmentCombo
@@ -255,8 +276,10 @@
             if dlg.exec_() == QDialog.Accepted:
                 history = dlg.getHistory()
                 if historiesIndex == 1:
+                    combo = self.ui.interpreterPicker
+                elif historiesIndex == 2:
                     combo = self.ui.cmdlineCombo
-                elif historiesIndex == 2:
+                elif historiesIndex == 3:
                     combo = self.ui.workdirPicker
                 else:
                     combo = self.ui.environmentCombo
@@ -288,8 +311,8 @@
         Public method to get the lists of histories.
         
         @return tuple containing the histories of command line arguments,
-            working directories and environment settings
-        @rtype tuple of three list of str
+            working directories, environment settings and interpreters
+        @rtype tuple of four list of str
         """
         return (
             [self.ui.cmdlineCombo.itemText(index) for index in range(
@@ -297,6 +320,7 @@
             self.ui.workdirPicker.getPathItems(),
             [self.ui.environmentCombo.itemText(index) for index in range(
                 self.ui.environmentCombo.count())],
+            self.ui.interpreterPicker.getPathItems(),
         )
     
     def on_buttonBox_clicked(self, button):

eric ide

mercurial