Skip to content

Commit

Permalink
[pyqgis-console] allows to remove entries from command history dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed Nov 2, 2013
1 parent 10c62b5 commit c4b5812
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions python/console/console_sci.py
Expand Up @@ -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)

Expand All @@ -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.