Improve typing

This commit is contained in:
Keith Edmunds 2023-04-10 13:58:07 +01:00
parent 3d32ce2f34
commit ebc087f1f6

View File

@ -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)