Minor tidying

This commit is contained in:
Keith Edmunds 2023-10-10 01:27:13 +01:00
parent c078fa69e7
commit ee391e42e7
2 changed files with 6 additions and 4 deletions

View File

@ -27,8 +27,7 @@ class InfoTabs(QTabWidget):
widget = QWebEngineView()
widget.setZoomFactor(Config.WEB_ZOOM_FACTOR)
self.last_update[widget] = datetime.now()
tab_index = self.addTab(widget, "")
_ = self.addTab(widget, "")
def open_in_songfacts(self, title):
"""Search Songfacts for title"""

View File

@ -92,7 +92,7 @@ class EscapeDelegate(QStyledItemDelegate):
super().__init__(parent)
def createEditor(
self, parent: QWidget, option: QStyleOptionViewItem, index: QModelIndex
self, parent: Optional[QWidget], option: QStyleOptionViewItem, index: QModelIndex
):
"""
Intercept createEditor call and make row just a little bit taller
@ -107,9 +107,12 @@ class EscapeDelegate(QStyledItemDelegate):
return QPlainTextEdit(parent)
return super().createEditor(parent, option, index)
def eventFilter(self, editor: QObject, event: QEvent) -> bool:
def eventFilter(self, editor: Optional[QObject], event: Optional[QEvent]) -> bool:
"""By default, QPlainTextEdit doesn't handle enter or return"""
if editor is None or event is None:
return False
if event.type() == QEvent.Type.KeyPress:
key_event = cast(QKeyEvent, event)
if key_event.key() == Qt.Key.Key_Return: