Exemplo n.º 1
0
def makeSplashLogo():
    '''Make a splash screen logo.'''

    splash = qt4.QSplashScreen()
    splash.setStyleSheet("background-color:whitesmoke;")

    # draw logo on pixmap
    layout = qt4.QVBoxLayout(splash)
    pm = utils.getPixmap('logo.png')
    logo = qt4.QLabel()
    logo.setPixmap(pm)
    logo.setAlignment(qt4.Qt.AlignCenter)
    layout.addWidget(logo)

    # add copyright text
    message = qt4.QLabel()
    message.setText(splashcopyr % utils.version())
    message.setAlignment(qt4.Qt.AlignCenter)
    # increase size of font
    font = message.font()
    font.setPointSize(font.pointSize() * 1.5)
    message.setFont(font)
    layout.addWidget(message)
    h = qt4.QFontMetrics(font).height()
    layout.setContentsMargins(h, h, h, h)

    # Center the spash screen
    splash.setGeometry(5, 5, 100, 100)
    screen = qt4.QDesktopWidget().screenGeometry()
    splash.move((screen.width() - layout.sizeHint().width()) / 2,
                (screen.height() - layout.sizeHint().height()) / 2)

    return splash
Exemplo n.º 2
0
def makeSplash(app):
    '''Make a splash screen logo.'''

    splash = qt.QSplashScreen()
    splash.setStyleSheet("background-color:white; color: black;")

    # draw logo on pixmap
    layout = qt.QVBoxLayout(splash)
    logo = qt.QLabel()
    logo.setPixmap(utils.getPixmap('logo.png'))
    logo.setAlignment(qt.Qt.AlignCenter)
    layout.addWidget(logo)

    # add copyright text
    message = qt.QLabel()
    message.setText(splashcopyr % utils.version())
    message.setAlignment(qt.Qt.AlignCenter)
    # increase size of font
    font = message.font()
    font.setPointSizeF(font.pointSize()*1.5)
    message.setFont(font)
    layout.addWidget(message)
    h = qt.QFontMetrics(font).height()
    layout.setContentsMargins(h,h,h,h)

    # Center the spash screen
    splash.setGeometry(5, 5, 100, 100)
    screen = qt.QDesktopWidget().screenGeometry()
    splash.move(
        (screen.width()-layout.sizeHint().width())//2,
        (screen.height()-layout.sizeHint().height())//2
    )

    # make sure dialog goes away - avoid problem if a message box pops
    # up before it is removed
    qt.QTimer.singleShot(2000, splash.hide)

    return splash