Skip to content

Commit c4b5812

Browse files
committedNov 2, 2013
[pyqgis-console] allows to remove entries from command history dialog
1 parent 10c62b5 commit c4b5812

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎python/console/console_sci.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,8 @@ def __init__(self, parent):
629629

630630
self._reloadHistory()
631631

632+
self.deleteScut = QShortcut(QKeySequence(Qt.Key_Delete), self)
633+
self.deleteScut.activated.connect(self._deleteItem)
632634
self.listView.doubleClicked.connect(self._runHistory)
633635
self.reloadHistory.clicked.connect(self._reloadHistory)
634636

@@ -646,3 +648,12 @@ def _reloadHistory(self):
646648

647649
self.listView.setModel(self.model)
648650
self.listView.scrollToBottom()
651+
652+
def _deleteItem(self):
653+
itemsSelected = self.listView.selectionModel().selectedIndexes()
654+
item = itemsSelected[0].row()
655+
## Remove item from the command history (just for the current session)
656+
self.parent.history.pop(item)
657+
self.parent.historyIndex -= 1
658+
## Remove row from the command history dialog
659+
self.model.removeRow(item)

0 commit comments

Comments
 (0)
Please sign in to comment.