I'm following a tutorial, trying to use startup.py to change the main window title at startup and when new projects are opened. My code works in every circumstance (that I've checked), except when clicking on the New Empty Project option in the Project Templates section of the QGIS home.
from qgis.utils import iface
from qgis.core import QgsExpressionContextUtils
def customize():
version = QgsExpressionContextUtils.globalScope().variable('qgis_version')
title = 'QGIS'
iface.mainWindow().setWindowTitle('{} | {}'.format(title, version))
iface.initializationCompleted.connect(customize)
iface.newProjectCreated.connect(customize)
iface.projectRead.connect(customize)
What signal is emitted when the new project is created from a template? There are no other relevant QgisInterface
signals that I can see.
I believe this is related to this question, but that question has no answers.
I also tried using the customVariablesChanged
signal based on the answer to this question but it has no effect when opening the template.