Skip to content

Commit

Permalink
splash screen integrated use
Browse files Browse the repository at this point in the history
added a custom class to customize behaviour and prepare future evolution see #412
  • Loading branch information
seb5g committed Oct 28, 2024
1 parent 6a27049 commit 344aeec
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Binary file added src/pymodaq_gui/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/pymodaq_gui/utils/splash.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from pathlib import Path

from qtpy import QtWidgets, QtGui, QtCore
from qtpy.QtCore import Qt


class MySplash(QtWidgets.QSplashScreen):

def __init__(self, *args, **kwargs):
here = Path(__file__)
pixmap = QtGui.QPixmap(str(here.parent.parent.joinpath('splash.png')))
super().__init__(pixmap, Qt.WindowStaysOnTopHint, *args, **kwargs)

font = self.font()
font.setPixelSize(18)
self.setFont(font)

def showMessage(self, message, *args, **kwargs):
""" force any message to be printed in white in the right/top corner """
super().showMessage(message, QtCore.Qt.AlignRight, QtCore.Qt.white,
)

def get_splash_sc() -> MySplash:
return MySplash()

0 comments on commit 344aeec

Please sign in to comment.