diff --git a/python/console/console_history_dlg.ui b/python/console/console_history_dlg.ui index e413a857e19..1f10c325ee8 100644 --- a/python/console/console_history_dlg.ui +++ b/python/console/console_history_dlg.ui @@ -29,7 +29,7 @@ 6 - + Qt::Horizontal @@ -39,14 +39,7 @@ - - - - Reload - - - - + QFrame::NoFrame @@ -60,6 +53,26 @@ true + + QAbstractItemView::SingleSelection + + + + + + + Reload + + + + + + + true + + + Save + diff --git a/python/console/console_sci.py b/python/console/console_sci.py index ca756f7cb48..66fc49d5fa9 100644 --- a/python/console/console_sci.py +++ b/python/console/console_sci.py @@ -633,11 +633,15 @@ class HistoryDialog(QDialog, Ui_HistoryDialogPythonConsole): self.deleteScut.activated.connect(self._deleteItem) self.listView.doubleClicked.connect(self._runHistory) self.reloadHistory.clicked.connect(self._reloadHistory) + self.saveHistory.clicked.connect(self._saveHistory) def _runHistory(self, item): cmd = item.data(Qt.DisplayRole) self.parent.runCommand(unicode(cmd)) + def _saveHistory(self): + self.parent.writeHistoryFile(True) + def _reloadHistory(self): self.model.clear() for i in self.parent.history: @@ -651,9 +655,10 @@ class HistoryDialog(QDialog, Ui_HistoryDialogPythonConsole): 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) + if itemsSelected: + 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)