--- a/src/eric7/Debugger/StartHistoryEditDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Debugger/StartHistoryEditDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -19,10 +19,11 @@ """ Class implementing a dialog to edit a list of history entries. """ + def __init__(self, history, parent=None): """ Constructor - + @param history list of history entries to be edited @type list of str @param parent reference to the parent widget @@ -30,15 +31,15 @@ """ super().__init__(parent) self.setupUi(self) - + self.historyList.addItems(history) for row in range(self.historyList.count()): itm = self.historyList.item(row) flags = itm.flags() | Qt.ItemFlag.ItemIsEditable itm.setFlags(flags) - + self.__updateEditButtons() - + def __updateEditButtons(self): """ Private method to set the state of the edit buttons. @@ -47,14 +48,14 @@ self.editButton.setEnabled(selectedCount == 1) self.deleteButton.setEnabled(selectedCount > 0) self.deleteAllButton.setEnabled(self.historyList.count() > 0) - + @pyqtSlot() def on_historyList_itemSelectionChanged(self): """ Private slot to handle the selection of entries. """ self.__updateEditButtons() - + @pyqtSlot() def on_editButton_clicked(self): """ @@ -66,10 +67,11 @@ self.tr("Edit History Entry"), self.tr("Enter the new text:"), QLineEdit.EchoMode.Normal, - itm.text()) + itm.text(), + ) if ok: itm.setText(historyText) - + @pyqtSlot() def on_deleteButton_clicked(self): """ @@ -78,14 +80,16 @@ yes = EricMessageBox.yesNo( self, self.tr("Delete Selected Entries"), - self.tr("""Do you really want to delete the selected""" - """ history entries?""")) + self.tr( + """Do you really want to delete the selected""" """ history entries?""" + ), + ) if yes: for itm in self.historyList.selectedItems(): row = self.historyList.row(itm) self.historyList.takeItem(row) del itm - + @pyqtSlot() def on_deleteAllButton_clicked(self): """ @@ -94,14 +98,15 @@ yes = EricMessageBox.yesNo( self, self.tr("Delete All Entries"), - self.tr("""Do you really want to delete the shown history?""")) + self.tr("""Do you really want to delete the shown history?"""), + ) if yes: self.historyList.clear() - + def getHistory(self): """ Public method to get the new list of history entries. - + @return list of history entries @rtype list of str """ @@ -109,5 +114,5 @@ for row in range(self.historyList.count()): entry = self.historyList.item(row).text() history.append(entry) - + return history