Esempio n. 1
0
class SplashScreen:
    def __init__(self, image_resource=":/images/splash_wait.png", text=None):
        pixmap = QPixmap(image_resource)
        self.splash = QSplashScreen(pixmap)
        self.splash.setMask(QRegion(pixmap.mask()));
        self.splash.setPixmap(pixmap);
        flags = self.splash.windowFlags()
        flags |= Qt.WindowStaysOnTopHint
        self.splash.setWindowFlags(flags)
        self._text = None
        if text is not None:
            self.setText(text)

    def show(self):
        self.splash.show()

    def hide(self):
        self.splash.hide()

    def setText(self, text):
        self._text = text
        self.splash.showMessage(text, Qt.AlignBottom | Qt.AlignHCenter);

    def getText(self):
        return self._text
Esempio n. 2
0
def showSplash(app):

    # splash pixmap
    logo = QPixmap(RES + ICONS + SPLASH)
    splash = QSplashScreen(logo, Qt.WindowStaysOnTopHint)
    splash.setWindowFlags(Qt.WindowStaysOnTopHint)

    # alpha mask
    splash.show()
    splash.setMask(logo.mask())

    # status message
    labelAlignment = Qt.Alignment(Qt.AlignBottom | Qt.AlignCenter | Qt.AlignAbsolute)
    newline = '<br/>'
    family = FONTS_DICT['splash'][0]
    size = str(FONTS_DICT['splash'][2])
    font = "<font style='font-family: " + family + "; font-size: " + size + "pt; color: white;'>"
    info = newline * 10 + font + 'Loading...<br/>' + __name__ + ' ' + __version__ + '</font'
    splash.showMessage(info, labelAlignment)        #NB: html tags completely break alignment and color settings

    # checking for mouse click
    app.processEvents()

    return splash