mypy: Fix new issues in miscwidgets
This commit is contained in:
parent
8e2f84bb88
commit
6c8126543f
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
"""Misc. widgets used at different places."""
|
||||
|
||||
import typing
|
||||
|
||||
from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QSize, QTimer
|
||||
from PyQt5.QtWidgets import (QLineEdit, QWidget, QHBoxLayout, QLabel,
|
||||
QStyleOption, QStyle, QLayout, QApplication)
|
||||
|
|
@ -34,14 +36,16 @@ class MinimalLineEditMixin:
|
|||
"""A mixin to give a QLineEdit a minimal look and nicer repr()."""
|
||||
|
||||
def __init__(self):
|
||||
self.setStyleSheet("""
|
||||
self.setStyleSheet( # type: ignore
|
||||
"""
|
||||
QLineEdit {
|
||||
border: 0px;
|
||||
padding-left: 1px;
|
||||
background-color: transparent;
|
||||
}
|
||||
""")
|
||||
self.setAttribute(Qt.WA_MacShowFocusRect, False)
|
||||
"""
|
||||
)
|
||||
self.setAttribute(Qt.WA_MacShowFocusRect, False) # type: ignore
|
||||
|
||||
def keyPressEvent(self, e):
|
||||
"""Override keyPressEvent to paste primary selection on Shift + Ins."""
|
||||
|
|
@ -52,7 +56,7 @@ class MinimalLineEditMixin:
|
|||
e.ignore()
|
||||
else:
|
||||
e.accept()
|
||||
self.insert(text)
|
||||
self.insert(text) # type: ignore
|
||||
return
|
||||
super().keyPressEvent(e) # type: ignore
|
||||
|
||||
|
|
@ -231,7 +235,7 @@ class WrapperLayout(QLayout):
|
|||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self._widget = None
|
||||
self._widget = typing.cast(QWidget, None)
|
||||
|
||||
def addItem(self, _widget):
|
||||
raise utils.Unreachable
|
||||
|
|
@ -255,7 +259,7 @@ class WrapperLayout(QLayout):
|
|||
widget.setParent(container)
|
||||
|
||||
def unwrap(self):
|
||||
self._widget.setParent(None)
|
||||
self._widget.setParent(None) # type: ignore
|
||||
self._widget.deleteLater()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue