eric6/Debugger/StartDialog.py

branch
multi_processing
changeset 7411
6d8dcb3551b3
parent 7409
1413bfe73d41
child 7422
9a008ab4811b
diff -r 401791e6f50f -r 6d8dcb3551b3 eric6/Debugger/StartDialog.py
--- a/eric6/Debugger/StartDialog.py	Wed Feb 12 20:04:31 2020 +0100
+++ b/eric6/Debugger/StartDialog.py	Thu Feb 13 19:27:10 2020 +0100
@@ -29,7 +29,8 @@
                  exceptions,
                  parent=None, dialogType=0, modfuncList=None,
                  tracePython=False, autoClearShell=True, autoContinue=True,
-                 autoFork=False, forkChild=False, enableMultiprocess=False):
+                 autoFork=False, forkChild=False, enableMultiprocess=False,
+                 multiprocessNoDebugHistory=None):
         """
         Constructor
         
@@ -74,6 +75,9 @@
         @param enableMultiprocess flag indicating the support for multi process
             debugging
         @type bool
+        @param multiprocessNoDebugHistory list of lists with programs not to be
+            debugged
+        @type list of str
         """
         super(StartDialog, self).__init__(parent)
         self.setModal(True)
@@ -135,7 +139,12 @@
             self.ui.autoContinueCheckBox.setChecked(autoContinue)
             self.ui.forkModeCheckBox.setChecked(autoFork)
             self.ui.forkChildCheckBox.setChecked(forkChild)
-            self.ui.multiprocessEnableCheckBox.setChecked(enableMultiprocess)
+            self.ui.multiprocessGroup.setChecked(enableMultiprocess)
+            self.ui.multiprocessNoDebugCombo.clear()
+            if multiprocessNoDebugHistory:
+                self.ui.multiprocessNoDebugCombo.addItems(
+                    multiprocessNoDebugHistory)
+                self.ui.multiprocessNoDebugCombo.setCurrentIndex(0)
         
         if dialogType == 1:       # start run dialog
             self.ui.forkModeCheckBox.setChecked(autoFork)
@@ -186,19 +195,22 @@
         
         @return a tuple of a flag indicating, if the Python library should be
             traced as well, a flag indicating, that the debugger should not
-            stop at the first executable line (boolean), a flag indicating,
-            that the debugger should fork automatically (boolean) and a flag
-            indicating, that the debugger should debug the child process after
-            forking automatically (boolean)
+            stop at the first executable line, a flag indicating, that the
+            debugger should fork automatically, a flag indicating, that the
+            debugger should debug the child process after forking
+            automatically, a flag indicating to support multi process debugging
+            and a space separated list of programs not to be debugged
+        @rtype tuple of (bool, bool, bool, bool, bool, str)
         """
         if self.dialogType == 0:
             return (self.ui.tracePythonCheckBox.isChecked(),
                     self.ui.autoContinueCheckBox.isChecked(),
                     self.ui.forkModeCheckBox.isChecked(),
                     self.ui.forkChildCheckBox.isChecked(),
-                    self.ui.multiprocessEnableCheckBox.isChecked())
+                    self.ui.multiprocessGroup.isChecked(),
+                    self.ui.multiprocessNoDebugCombo.currentText())
         else:
-            return (False, False, False, False, False)
+            return (False, False, False, False, False, [])
         
     def getRunData(self):
         """
@@ -259,6 +271,11 @@
         self.ui.cmdlineCombo.addItem(cmdLine)
         self.ui.workdirPicker.addItem(workdir)
         self.ui.environmentCombo.addItem(environment)
+        
+        if self.dialogType == 0:
+            noDebugList = self.ui.multiprocessNoDebugCombo.currentText()
+            self.ui.multiprocessNoDebugCombo.clear()
+            self.ui.multiprocessNoDebugCombo.addItem(noDebugList)
     
     def __editHistory(self):
         """
@@ -270,6 +287,15 @@
             self.tr("Working Directory"),
             self.tr("Environment"),
         ]
+        combos = [
+            None,
+            self.ui.cmdlineCombo,
+            self.ui.workdirPicker,
+            self.ui.environmentCombo,
+        ]
+        if self.dialogType == 0:
+            histories.append(self.tr("No Debug Programs"))
+            combos.append(self.ui.multiprocessNoDebugCombo)
         historyKind, ok = QInputDialog.getItem(
             self,
             self.tr("Edit History"),
@@ -277,32 +303,27 @@
             histories,
             0, False)
         if ok and historyKind:
+            history = []
             historiesIndex = histories.index(historyKind)
             if historiesIndex == 2:
                 history = self.ui.workdirPicker.getPathItems()
             else:
-                history = []
-                if historiesIndex == 1:
-                    combo = self.ui.cmdlineCombo
-                else:
-                    combo = self.ui.environmentCombo
-                for index in range(combo.count()):
-                    history.append(combo.itemText(index))
+                combo = combos[historiesIndex]
+                if combo:
+                    for index in range(combo.count()):
+                        history.append(combo.itemText(index))
             
-            from .StartHistoryEditDialog import StartHistoryEditDialog
-            dlg = StartHistoryEditDialog(history, self)
-            if dlg.exec_() == QDialog.Accepted:
-                history = dlg.getHistory()
-                if historiesIndex == 1:
-                    combo = self.ui.cmdlineCombo
-                elif historiesIndex == 2:
-                    combo = self.ui.workdirPicker
-                else:
-                    combo = self.ui.environmentCombo
-                combo.clear()
-                combo.addItems(history)
-                
-                self.__historiesModified = True
+            if history:
+                from .StartHistoryEditDialog import StartHistoryEditDialog
+                dlg = StartHistoryEditDialog(history, self)
+                if dlg.exec_() == QDialog.Accepted:
+                    history = dlg.getHistory()
+                    combo = combos[historiesIndex]
+                    if combo:
+                        combo.clear()
+                        combo.addItems(history)
+                        
+                        self.__historiesModified = True
     
     def historiesModified(self):
         """
@@ -327,15 +348,24 @@
         Public method to get the lists of histories.
         
         @return tuple containing the histories of command line arguments,
-            working directories, environment settings and interpreters
+            working directories, environment settings and no debug programs
+            lists
         @rtype tuple of four list of str
         """
+        if self.dialogType == 0:
+            noDebugHistory = [
+                self.ui.multiprocessNoDebugCombo.itemText(index)
+                for index in range(self.ui.multiprocessNoDebugCombo.count())
+            ]
+        else:
+            noDebugHistory = None
         return (
             [self.ui.cmdlineCombo.itemText(index) for index in range(
                 self.ui.cmdlineCombo.count())],
             self.ui.workdirPicker.getPathItems(),
             [self.ui.environmentCombo.itemText(index) for index in range(
                 self.ui.environmentCombo.count())],
+            noDebugHistory,
         )
     
     def on_buttonBox_clicked(self, button):

eric ide

mercurial