1
0
Fork 0
mirror of synced 2024-06-17 18:14:44 +12:00

Skip widget updates on spontaneous events.

Spontaneous are events external to the application such as the window
manager showing or hiding the application. We don't want to update on those.
This commit is contained in:
loathingKernel 2023-09-23 20:17:30 +03:00
parent c063f5f5b9
commit a87f34163a
No known key found for this signature in database
GPG key ID: CE0C72D0B53821FD
3 changed files with 7 additions and 0 deletions

View file

@ -173,6 +173,8 @@ class InstallDialog(QDialog):
self.ui.install_dialog_layout.setSizeConstraint(QLayout.SetFixedSize)
def showEvent(self, a0: QShowEvent) -> None:
if a0.spontaneous():
return super().showEvent(a0)
self.save_install_edit(self.install_dir_edit.text())
super().showEvent(a0)

View file

@ -107,6 +107,8 @@ class GameWidget(LibraryWidget):
__slots__ = "ui"
def showEvent(self, a0: QShowEvent) -> None:
if a0.spontaneous():
return super().showEvent(a0)
if self.rgame.pixmap.isNull():
QTimer.singleShot(random.randrange(42, 361, 7), self.rgame.load_pixmap)
super().showEvent(a0)

View file

@ -32,7 +32,10 @@ class ProgressLabel(QLabel):
return super().event(e)
def showEvent(self, a0: QShowEvent) -> None:
if a0.spontaneous():
return super().showEvent(a0)
self.__center_on_parent()
super().showEvent(a0)
def eventFilter(self, a0: QObject, a1: QEvent) -> bool:
if a0 is self.parent() and a1.type() == QEvent.Resize: