Debugger/StartDialog.py

changeset 5372
7ba8d3d61fdd
parent 4631
5c1a96925da4
child 5373
7826884089fd
diff -r 01c4c059142b -r 7ba8d3d61fdd Debugger/StartDialog.py
--- a/Debugger/StartDialog.py	Sun Dec 11 16:25:42 2016 +0100
+++ b/Debugger/StartDialog.py	Sun Dec 11 18:28:42 2016 +0100
@@ -9,7 +9,7 @@
 
 from __future__ import unicode_literals
 
-from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QComboBox
+from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QComboBox, QInputDialog
 
 from E5Gui.E5PathPicker import E5PathPickerModes
 
@@ -83,6 +83,8 @@
         
         self.clearButton = self.ui.buttonBox.addButton(
             self.tr("Clear Histories"), QDialogButtonBox.ActionRole)
+        self.editButton = self.ui.buttonBox.addButton(
+            self.tr("Edit History"), QDialogButtonBox.ActionRole)
         
         self.setWindowTitle(caption)
         self.ui.cmdlineCombo.clear()
@@ -218,6 +220,48 @@
         self.ui.cmdlineCombo.addItem(cmdLine)
         self.ui.workdirPicker.addItem(workdir)
         self.ui.environmentCombo.addItem(environment)
+    
+    def __editHistory(self):
+        """
+        Private slot to edit a history list.
+        """
+        histories = [
+            "",
+            self.tr("Command Line"),
+            self.tr("Working Directory"),
+            self.tr("Environment"),
+        ]
+        historyKind, ok = QInputDialog.getItem(
+            self,
+            self.tr("Edit History"),
+            self.tr("Select the history list to be edited:"),
+            histories,
+            0, False)
+        if ok and historyKind:
+            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))
+            
+            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)
         
     def on_buttonBox_clicked(self, button):
         """
@@ -227,3 +271,5 @@
         """
         if button == self.clearButton:
             self.__clearHistories()
+        elif button == self.editButton:
+            self.__editHistory()

eric ide

mercurial