Skip to content
Permalink
Browse files

[pyqgis-console] allows to remove entries from command history dialog

  • Loading branch information
slarosa committed Nov 2, 2013
1 parent 10c62b5 commit c4b5812cf92a8fa958772acfb725ca25c61b9f15
Showing with 11 additions and 0 deletions.
  1. +11 −0 python/console/console_sci.py
@@ -629,6 +629,8 @@ def __init__(self, parent):

self._reloadHistory()

self.deleteScut = QShortcut(QKeySequence(Qt.Key_Delete), self)
self.deleteScut.activated.connect(self._deleteItem)
self.listView.doubleClicked.connect(self._runHistory)
self.reloadHistory.clicked.connect(self._reloadHistory)

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

self.listView.setModel(self.model)
self.listView.scrollToBottom()

def _deleteItem(self):
itemsSelected = self.listView.selectionModel().selectedIndexes()
item = itemsSelected[0].row()
## Remove item from the command history (just for the current session)
self.parent.history.pop(item)
self.parent.historyIndex -= 1
## Remove row from the command history dialog
self.model.removeRow(item)

0 comments on commit c4b5812

Please sign in to comment.
You can’t perform that action at this time.