Debugger/DebugUI.py

changeset 5374
c18d759b6b86
parent 5373
7826884089fd
child 5389
9b1c800daff3
--- a/Debugger/DebugUI.py	Sun Dec 11 18:43:05 2016 +0100
+++ b/Debugger/DebugUI.py	Mon Dec 12 18:56:42 2016 +0100
@@ -650,7 +650,6 @@
         
         return [starttb, debugtb]
         
-    # TODO: accept history list
     def setArgvHistory(self, argsStr, clearHistories=False, history=None):
         """
         Public slot to initialize the argv history.
@@ -661,13 +660,14 @@
         @param history list of history entries to be set (list of strings)
         """
         if clearHistories:
-            self.argvHistory = []
+            del self.argvHistory[1:]
+        elif history is not None:
+            self.argvHistory = history[:]
         else:
             if argsStr in self.argvHistory:
                 self.argvHistory.remove(argsStr)
-        self.argvHistory.insert(0, argsStr)
+            self.argvHistory.insert(0, argsStr)
 
-    # TODO: accept history list
     def setWdHistory(self, wdStr, clearHistories=False, history=None):
         """
         Public slot to initialize the wd history.
@@ -678,13 +678,14 @@
         @param history list of history entries to be set (list of strings)
         """
         if clearHistories:
-            self.wdHistory = []
+            del self.wdHistory[1:]
+        elif history is not None:
+            self.wdHistory = history[:]
         else:
             if wdStr in self.wdHistory:
                 self.wdHistory.remove(wdStr)
-        self.wdHistory.insert(0, wdStr)
+            self.wdHistory.insert(0, wdStr)
         
-    # TODO: accept history list
     def setEnvHistory(self, envStr, clearHistories=False, history=None):
         """
         Public slot to initialize the env history.
@@ -695,11 +696,13 @@
         @param history list of history entries to be set (list of strings)
         """
         if clearHistories:
-            self.envHistory = []
+            del self.envHistory[1:]
+        elif history is not None:
+            self.envHistory = history[:]
         else:
             if envStr in self.envHistory:
                 self.envHistory.remove(envStr)
-        self.envHistory.insert(0, envStr)
+            self.envHistory.insert(0, envStr)
         
     def setExceptionReporting(self, exceptions):
         """
@@ -1520,9 +1523,7 @@
             self.envHistory, self.exceptions, self.ui, 2,
             autoClearShell=self.autoClearShell)
         if dlg.exec_() == QDialog.Accepted:
-            # TODO: get the complete histories
-            argv, wd, env, exceptions, clearShell, clearHistories, console = \
-                dlg.getData()
+            argv, wd, env, exceptions, clearShell, console = dlg.getData()
             eraseCoverage = dlg.getCoverageData()
             
             if runProject:
@@ -1568,10 +1569,9 @@
             
             # This moves any previous occurrence of these arguments to the head
             # of the list.
-            # TODO: modify histories as retrieved
-            self.setArgvHistory(argv, clearHistories)
-            self.setWdHistory(wd, clearHistories)
-            self.setEnvHistory(env, clearHistories)
+            self.setArgvHistory(argv)
+            self.setWdHistory(wd)
+            self.setEnvHistory(env)
             
             # Save the exception flags
             self.exceptions = exceptions
@@ -1604,7 +1604,17 @@
                     clientType=self.clientType)
                 
                 self.stopAct.setEnabled(True)
-            
+        
+        if dlg.clearHistories():
+            self.setArgvHistory("", clearHistories=True)
+            self.setWdHistory("", clearHistories=True)
+            self.setEnvHistory("", clearHistories=True)
+        elif dlg.historiesModified():
+            argvHistory, wdHistory, envHistory = dlg.getHistories()
+            self.setArgvHistory("", history=argvHistory)
+            self.setWdHistory("", history=wdHistory)
+            self.setEnvHistory("", history=envHistory)
+    
     def __profileScript(self):
         """
         Private slot to handle the profile script action.
@@ -1641,9 +1651,7 @@
             self.exceptions, self.ui, 3,
             autoClearShell=self.autoClearShell)
         if dlg.exec_() == QDialog.Accepted:
-            # TODO: get the complete histories
-            argv, wd, env, exceptions, clearShell, clearHistories, console = \
-                dlg.getData()
+            argv, wd, env, exceptions, clearShell, console = dlg.getData()
             eraseTimings = dlg.getProfilingData()
             
             if runProject:
@@ -1689,10 +1697,9 @@
             
             # This moves any previous occurrence of these arguments to the head
             # of the list.
-            # TODO: modify histories as retrieved
-            self.setArgvHistory(argv, clearHistories)
-            self.setWdHistory(wd, clearHistories)
-            self.setEnvHistory(env, clearHistories)
+            self.setArgvHistory(argv)
+            self.setWdHistory(wd)
+            self.setEnvHistory(env)
             
             # Save the exception flags
             self.exceptions = exceptions
@@ -1725,7 +1732,17 @@
                     clientType=self.clientType)
                 
                 self.stopAct.setEnabled(True)
-            
+        
+        if dlg.clearHistories():
+            self.setArgvHistory("", clearHistories=True)
+            self.setWdHistory("", clearHistories=True)
+            self.setEnvHistory("", clearHistories=True)
+        elif dlg.historiesModified():
+            argvHistory, wdHistory, envHistory = dlg.getHistories()
+            self.setArgvHistory("", history=argvHistory)
+            self.setWdHistory("", history=wdHistory)
+            self.setEnvHistory("", history=envHistory)
+    
     def __runScript(self):
         """
         Private slot to handle the run script action.
@@ -1764,9 +1781,7 @@
             autoFork=self.forkAutomatically,
             forkChild=self.forkIntoChild)
         if dlg.exec_() == QDialog.Accepted:
-            # TODO: get the complete histories
-            argv, wd, env, exceptions, clearShell, clearHistories, console = \
-                dlg.getData()
+            argv, wd, env, exceptions, clearShell, console = dlg.getData()
             forkAutomatically, forkIntoChild = dlg.getRunData()
             
             if runProject:
@@ -1812,10 +1827,9 @@
             
             # This moves any previous occurrence of these arguments to the head
             # of the list.
-            # TODO: modify histories as retrieved
-            self.setArgvHistory(argv, clearHistories)
-            self.setWdHistory(wd, clearHistories)
-            self.setEnvHistory(env, clearHistories)
+            self.setArgvHistory(argv)
+            self.setWdHistory(wd)
+            self.setEnvHistory(env)
             
             # Save the exception flags
             self.exceptions = exceptions
@@ -1850,6 +1864,16 @@
                 
                 self.stopAct.setEnabled(True)
         
+        if dlg.clearHistories():
+            self.setArgvHistory("", clearHistories=True)
+            self.setWdHistory("", clearHistories=True)
+            self.setEnvHistory("", clearHistories=True)
+        elif dlg.historiesModified():
+            argvHistory, wdHistory, envHistory = dlg.getHistories()
+            self.setArgvHistory("", history=argvHistory)
+            self.setWdHistory("", history=wdHistory)
+            self.setEnvHistory("", history=envHistory)
+    
     def __debugScript(self):
         """
         Private slot to handle the debug script action.
@@ -1887,9 +1911,7 @@
             autoClearShell=self.autoClearShell, autoContinue=self.autoContinue,
             autoFork=self.forkAutomatically, forkChild=self.forkIntoChild)
         if dlg.exec_() == QDialog.Accepted:
-            # TODO: get the complete histories
-            argv, wd, env, exceptions, clearShell, clearHistories, console = \
-                dlg.getData()
+            argv, wd, env, exceptions, clearShell, console = dlg.getData()
             tracePython, autoContinue, forkAutomatically, forkIntoChild = \
                 dlg.getDebugData()
             
@@ -1937,10 +1959,9 @@
             
             # This moves any previous occurrence of these arguments to the head
             # of the list.
-            # TODO: modify histories as retrieved
-            self.setArgvHistory(argv, clearHistories)
-            self.setWdHistory(wd, clearHistories)
-            self.setEnvHistory(env, clearHistories)
+            self.setArgvHistory(argv)
+            self.setWdHistory(wd)
+            self.setEnvHistory(env)
             
             # Save the exception flags
             self.exceptions = exceptions
@@ -1993,6 +2014,16 @@
                 
                 self.stopAct.setEnabled(True)
         
+        if dlg.clearHistories():
+            self.setArgvHistory("", clearHistories=True)
+            self.setWdHistory("", clearHistories=True)
+            self.setEnvHistory("", clearHistories=True)
+        elif dlg.historiesModified():
+            argvHistory, wdHistory, envHistory = dlg.getHistories()
+            self.setArgvHistory("", history=argvHistory)
+            self.setWdHistory("", history=wdHistory)
+            self.setEnvHistory("", history=envHistory)
+    
     def __doRestart(self):
         """
         Private slot to handle the restart action to restart the last

eric ide

mercurial