12

During the startup of QGIS there are status messages shown in the lower part of the splashscreen like "restoring loaded plugins".

I am using a startup.py from which I would like to inform the user which part of my startup script is executed at the moment.

Is it possible to show these informations on the splashscreen?

enter image description here

Edit1:

As a workaround I managed to use my own splashscreen during startup:

from qgis.gui import *
from qgis.utils import *
from qgis.core import *
from PyQt4.QtGui import *
from qgis.PyQt.QtCore import QSettings, Qt
import time


template=QgsApplication.qgisSettingsDirPath() + "python/"
app=QgsApplication.instance()
splash_pix = QPixmap(template+'splashscreen.png')

splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
splash.setEnabled(False)

splash.setMask(splash_pix.mask())

progressBar = QProgressBar(splash)
progressBar.setMaximum(10)
progressBar.setGeometry(0, splash_pix.height() - 20, splash_pix.width(), 10)

splash.show()

if QgsApplication.instance().findChild(QSplashScreen):
    QgsMessageLog.logMessage("ja", "gridseen", level=QgsMessageLog.INFO)
else:
    QgsMessageLog.logMessage("nein", "gridseen", level=QgsMessageLog.INFO)

splash.showMessage("<h1><font color='white'>Grid Integration-Check!</font></h1>", Qt.AlignBottom | Qt.AlignCenter, Qt.black)

for i in range(1, 11):
    progressBar.setValue(i)
    t = time.time()
    while time.time() < t + 0.1:
        app.processEvents()

time.sleep(2)
splash.close()

Therefore I put the splashscreen in my qgis-python folder (for example https://github.com/webgeodatavore/qgis-splash-screens-birthday/raw/master/resized/qgis_version_2.18.png )

enter image description here

But this solutions is a bit of a quick and dirty workaround.

Isn't it possible to get access to the splashscreen that's created during the startup of the QGIS app? I tried to get access by using QgsApplication.instance().findChild(QSplashScreen) but couldn't get access to it.

https://github.com/qgis/QGIS/blob/7bd0285dfdef9456a5929a7b7031270ea0ee2601/src/app/main.cpp#L1286

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.