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
def startup(self): """Do startup.""" if not (self.options.listen or self.options.export): # show the splash screen on normal start self.splash = qt4.QSplashScreen(makeSplashLogo()) self.splash.show() # optionally load a translation if self.options.translation: trans = qt4.QTranslator() trans.load(self.options.translation) self.installTranslator(trans) self.thread = ImportThread() self.thread.finished.connect(self.slotStartApplication) self.thread.start()
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
def __init__(self, options, args): qt4.QObject.__init__(self) self.splash = None if not (options.listen or options.export): # show the splash screen on normal start self.splash = qt4.QSplashScreen(makeSplashLogo()) self.splash.show() self.options = options self.args = args # optionally load a translation if options.translation: trans = qt4.QTranslator() trans.load(options.translation) qt4.qApp.installTranslator(trans) self.thread = ImportThread() self.connect(self.thread, qt4.SIGNAL('finished()'), self.slotStartApplication) self.thread.start()