eric7/Debugger/StartDialog.py

branch
eric7
changeset 8529
569623270e29
parent 8528
2175f268ad9b
child 8881
54e42bc2437a
--- a/eric7/Debugger/StartDialog.py	Sun Aug 22 19:59:18 2021 +0200
+++ b/eric7/Debugger/StartDialog.py	Mon Aug 23 17:59:09 2021 +0200
@@ -32,7 +32,7 @@
                  tracePython=False, autoClearShell=True, autoContinue=True,
                  enableMultiprocess=False, multiprocessNoDebugHistory=None,
                  configOverride=None,
-                 forProject=False, lastUsedScriptName="", scriptsList=None):
+                 forProject=False, scriptName="", scriptsList=None):
         """
         Constructor
         
@@ -82,7 +82,7 @@
         @param forProject flag indicating to get the parameters for a
             run/debug/... action for a project
         @type bool
-        @param lastUsedScriptName name of the most recently used script
+        @param scriptName name of the script
         @type str
         @param scriptsList history list of script names
         @type list of str
@@ -132,7 +132,6 @@
         self.ui.workdirPicker.setSizeAdjustPolicy(
             QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
         
-        # TODO: extend these History actions
         self.clearButton = self.ui.buttonBox.addButton(
             self.tr("Clear Histories"), QDialogButtonBox.ButtonRole.ActionRole)
         self.editButton = self.ui.buttonBox.addButton(
@@ -159,6 +158,9 @@
         self.ui.globalOverrideGroup.setChecked(configOverride["enable"])
         self.ui.redirectCheckBox.setChecked(configOverride["redirect"])
         
+        self.ui.scriptnamePicker.addItems(scriptsList)
+        self.ui.scriptnamePicker.setText(scriptName)
+        
         if dialogType == 0:        # start debug dialog
             enableMultiprocessGlobal = Preferences.getDebugger(
                 "MultiProcessEnabled")
@@ -199,16 +201,23 @@
         """
         Public method to retrieve the data entered into this dialog.
         
-        @return a tuple of interpreter, argv, workdir, environment,
-            exceptions flag, clear interpreter flag and run in console flag
-        @rtype tuple of (str, str, str, str, bool, bool, bool)
+        @return a tuple of virtual environment, script name, argv, workdir,
+            environment, exceptions flag, clear interpreter flag and run in
+            console flag
+        @rtype tuple of (str, str, str, str, str, bool, bool, bool)
         """
         cmdLine = self.ui.cmdlineCombo.currentText()
         workdir = self.ui.workdirPicker.currentText(toNative=False)
         environment = self.ui.environmentCombo.currentText()
         venvName = self.ui.venvComboBox.currentText()
+        scriptName = (
+            self.ui.scriptnamePicker.currentText()
+            if self.ui.scriptnamePicker.isEnabled() else
+            ""
+        )
         
         return (venvName,
+                scriptName,
                 cmdLine,
                 workdir,
                 environment,
@@ -288,14 +297,18 @@
         cmdLine = self.ui.cmdlineCombo.currentText()
         workdir = self.ui.workdirPicker.currentText()
         environment = self.ui.environmentCombo.currentText()
+        scriptName = self.ui.scriptnamePicker.currentText()
         
         self.ui.cmdlineCombo.clear()
         self.ui.workdirPicker.clear()
         self.ui.environmentCombo.clear()
+        self.ui.scriptnamePicker.clear()
         
         self.ui.cmdlineCombo.addItem(cmdLine)
         self.ui.workdirPicker.addItem(workdir)
         self.ui.environmentCombo.addItem(environment)
+        self.ui.scriptnamePicker.addItem("")
+        self.ui.scriptnamePicker.setCurrentText(scriptName)
         
         if self.dialogType == 0:
             noDebugList = self.ui.multiprocessNoDebugCombo.currentText()
@@ -308,12 +321,14 @@
         """
         histories = [
             "",
+            self.tr("Script Name"),
             self.tr("Command Line"),
             self.tr("Working Directory"),
             self.tr("Environment"),
         ]
         combos = [
             None,
+            self.ui.scriptnamePicker,
             self.ui.cmdlineCombo,
             self.ui.workdirPicker,
             self.ui.environmentCombo,
@@ -330,7 +345,9 @@
         if ok and historyKind:
             history = []
             historiesIndex = histories.index(historyKind)
-            if historiesIndex == 2:
+            if historiesIndex == 1:
+                history = self.ui.scriptnamePicker.getPathItems()
+            elif historiesIndex == 3:
                 history = self.ui.workdirPicker.getPathItems()
             else:
                 combo = combos[historiesIndex]
@@ -372,10 +389,10 @@
         """
         Public method to get the lists of histories.
         
-        @return tuple containing the histories of command line arguments,
-            working directories, environment settings and no debug programs
-            lists
-        @rtype tuple of four list of str
+        @return tuple containing the histories of script names, command line
+            arguments, working directories, environment settings and no debug
+            programs lists
+        @rtype tuple of five list of str
         """
         noDebugHistory = (
             [
@@ -386,6 +403,7 @@
             None
         )
         return (
+            self.ui.scriptnamePicker.getPathNames(),
             [self.ui.cmdlineCombo.itemText(index) for index in range(
                 self.ui.cmdlineCombo.count())],
             self.ui.workdirPicker.getPathItems(),

eric ide

mercurial