grid: remove unused imports, stop animation before widget deletion
Unused: Path, Post, QPainterPath, QMenu, QApplication. FlowLayout.clear() now stops any in-flight fade animation before calling deleteLater() on thumbnails. Without this, a mid-flight QPropertyAnimation can fire property updates on a widget that's queued for deletion.
This commit is contained in:
parent
a51c9a1fda
commit
e262a2d3bb
@ -3,22 +3,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
log = logging.getLogger("booru")
|
||||
|
||||
from PySide6.QtCore import Qt, Signal, QSize, QRect, QRectF, QMimeData, QUrl, QPoint, Property, QPropertyAnimation, QEasingCurve
|
||||
from PySide6.QtGui import QPixmap, QPainter, QPainterPath, QColor, QPen, QKeyEvent, QWheelEvent, QDrag, QMouseEvent
|
||||
from PySide6.QtGui import QPixmap, QPainter, QColor, QPen, QKeyEvent, QWheelEvent, QDrag, QMouseEvent
|
||||
from PySide6.QtWidgets import (
|
||||
QWidget,
|
||||
QScrollArea,
|
||||
QMenu,
|
||||
QApplication,
|
||||
QRubberBand,
|
||||
)
|
||||
|
||||
from ..core.api.base import Post
|
||||
|
||||
THUMB_SIZE = 180
|
||||
THUMB_SPACING = 2
|
||||
BORDER_WIDTH = 2
|
||||
@ -382,6 +377,8 @@ class FlowLayout(QWidget):
|
||||
|
||||
def clear(self) -> None:
|
||||
for w in self._items:
|
||||
if hasattr(w, '_fade_anim') and w._fade_anim is not None:
|
||||
w._fade_anim.stop()
|
||||
w.setParent(None) # type: ignore
|
||||
w.deleteLater()
|
||||
self._items.clear()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user