diff --git a/app/playlists.py b/app/playlists.py index 54d7bbe..e48c0db 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -4,7 +4,7 @@ import stackprinter # type: ignore import subprocess import threading -import obsws_python as obs +import obsws_python as obs # type: ignore from collections import namedtuple from datetime import datetime, timedelta @@ -36,6 +36,7 @@ from PyQt5.QtWidgets import ( QMessageBox, QPlainTextEdit, QStyledItemDelegate, + QStyleOptionViewItem, QTableWidget, QTableWidgetItem, QWidget @@ -112,13 +113,18 @@ class NoSelectDelegate(QStyledItemDelegate): - closes the edit on control-return """ - def createEditor(self, parent, option, index): + def createEditor(self, parent: QWidget, option: QStyleOptionViewItem, + index: QModelIndex): + """ + Intercept createEditor call and make row just a little bit taller + """ + + if isinstance(self.parent(), PlaylistTab): + p = cast(PlaylistTab, self.parent()) if isinstance(index.data(), str): - # Make row just a little bit taller row = index.row() - row_height = self.parent().rowHeight(row) - self.parent().setRowHeight(row, - row_height + Config.MINIMUM_ROW_HEIGHT) + row_height = p.rowHeight(row) + p.setRowHeight(row, row_height + Config.MINIMUM_ROW_HEIGHT) return QPlainTextEdit(parent) return super().createEditor(parent, option, index)