From 2b3d7e313330b9335cd1a20658155bb835d2f1e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Fri, 12 Apr 2024 17:24:04 +0800 Subject: [PATCH] Update specialwidget.py --- .../LunaTranslator/gui/specialwidget.py | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/specialwidget.py b/LunaTranslator/LunaTranslator/gui/specialwidget.py index b4128c82..52f689d2 100644 --- a/LunaTranslator/LunaTranslator/gui/specialwidget.py +++ b/LunaTranslator/LunaTranslator/gui/specialwidget.py @@ -173,22 +173,19 @@ class ScrollFlow(QWidget): self.qscrollarea.setWidgetResizable(True) self.qscrollarea.setWidget(self.listWidget) self.qscrollarea.scrolled.connect(self.doshowlazywidget) + @trypass def doshowlazywidget(self,region:QRect): - try: - #print(region) - for i,widget in enumerate(self.lazyitems): - if i in self.lazydoneidx: - continue - widget_rect = widget.geometry() #有可能已被delete,必须try - #print(widget_rect) - if region.intersects(widget_rect): - #print(i,widget_rect) - self.lazydoneidx.append(i) - widget.do() - QApplication.processEvents() - except: - print_exc() - + for i,widget in enumerate(self.lazyitems): + if i in self.lazydoneidx: + continue + widget_rect = widget.geometry() #有可能已被delete,必须try + #print(widget_rect) + if region.intersects(widget_rect): + #print(i,widget_rect) + self.lazydoneidx.append(i) + widget.do() + QApplication.processEvents() + def refreshscroll(self): QApplication.processEvents() self.doshowlazywidget(self.geometry())