From 0d33cb870794783668b7d1a1e16ff6e1bc13c16b Mon Sep 17 00:00:00 2001 From: Javier Ciberman Mora Date: Fri, 28 Oct 2022 22:38:37 -0300 Subject: [PATCH] Improve start page --- src/Application.py | 10 ++++++++-- src/Main/PhantomMascotAnimationWidget.py | 16 ++++++++++++---- src/Main/ProjectExplorerPage.py | 4 ---- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Application.py b/src/Application.py index b56efa8..d3c0f4b 100644 --- a/src/Application.py +++ b/src/Application.py @@ -108,8 +108,8 @@ def run(self): return from .Main.ProjectExplorerPage import ShellWindow # Avoid circular imports - win = ShellWindow() - win.showMaximized() + self._shell = ShellWindow() + self._shell.showMaximized() self._imageProcessorService.start() @@ -130,3 +130,9 @@ def modelsDownloader(self) -> ModelsDownloader: Returns the models downloader. """ return self._modelsDownloader + + def shell(self): + """ + Returns the shell window. + """ + return self._shell diff --git a/src/Main/PhantomMascotAnimationWidget.py b/src/Main/PhantomMascotAnimationWidget.py index 2e2a0ba..f1b6b0c 100644 --- a/src/Main/PhantomMascotAnimationWidget.py +++ b/src/Main/PhantomMascotAnimationWidget.py @@ -31,8 +31,8 @@ def __init__(self, parent=None): self._width = 400 self._height = 200 self._mascot = PhantomMascot(moveStartX=100, moveEndX=300, baseY=90) - self._tumbleweedBack = Tumbleweed(moveStartX=50, moveEndX=350, baseY=110, scale=0.5, alphaMulti=0.6) - self._tumbleweedFront = Tumbleweed(moveStartX=40, moveEndX=360, baseY=160, scale=0.8) + self._tumbleweedBack = Tumbleweed(moveStartX=50, moveEndX=350, baseY=110, scale=0.5, alphaMulti=0.6, hspeed=40) + self._tumbleweedFront = Tumbleweed(moveStartX=40, moveEndX=360, baseY=160, scale=0.8, alphaMulti=1.0, hspeed=60) def _update(self): t = time_ns() * 1e-9 # seconds @@ -174,7 +174,11 @@ class Tumbleweed: _bounceDeltaY = 15 # From (0,0) to (0, bounceDeltaY) and back - _bounceSpeed = 2 # cycles per second + _bounceSpeedMin = 0.5 # cycles per second + + _bounceSpeedMax = 1.5 # cycles per second + + _bounceSpeed = 0 # cycles per second _movingSpeedX = 60 # pixels per second @@ -202,7 +206,9 @@ class Tumbleweed: _isMoving = False - def __init__(self, moveStartX: int, moveEndX: int, baseY: int, scale: float = 1.0, alphaMulti: float = 1.0) -> None: + def __init__( + self, moveStartX: int, moveEndX: int, baseY: int, + scale: float = 1.0, alphaMulti: float = 1.0, hspeed: float = 60) -> None: self._timer = QtCore.QTimer() self._timer.setSingleShot(True) self._timer.timeout.connect(self._onTimerTimeout) @@ -215,6 +221,7 @@ def __init__(self, moveStartX: int, moveEndX: int, baseY: int, scale: float = 1. self._baseY = baseY self._scale = scale self._alphaMulti = alphaMulti + self._movingSpeedX = hspeed self._transform = QtGui.QTransform() self._alpha = 0 @@ -230,6 +237,7 @@ def _onTimerTimeout(self): self._x = self._movingStartX self._y = self._baseY self._isMoving = True + self._bounceSpeed = random.uniform(self._bounceSpeedMin, self._bounceSpeedMax) def update(self, dt: float, t: float): if self._isMoving: diff --git a/src/Main/ProjectExplorerPage.py b/src/Main/ProjectExplorerPage.py index d2ece7e..5e8fea7 100644 --- a/src/Main/ProjectExplorerPage.py +++ b/src/Main/ProjectExplorerPage.py @@ -1,4 +1,3 @@ -from ctypes import alignment import os from PySide6 import QtCore, QtGui, QtWidgets @@ -288,7 +287,6 @@ class EmptyProjectMessageWidget(QtWidgets.QFrame): def __init__(self, parent: QtWidgets.QWidget): super().__init__(parent) self.setFrameStyle(QtWidgets.QFrame.StyledPanel) - self.setContentsMargins(0, 0, 0, 0) self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) contentWidget = QtWidgets.QWidget(self) @@ -354,8 +352,6 @@ def __init__(self, parent: QtWidgets.QWidget): frameLayout.addWidget(contentWidget, alignment=QtCore.Qt.AlignCenter) self.setLayout(frameLayout) - - @QtCore.Slot() def _onAddImagesPressed(self) -> None: Application.projectManager().importImages(self)