forked from openlp/openlp
Optimised the app_version usage.
This commit is contained in:
parent
6236d947e8
commit
9b8b5c821a
18
openlp.pyw
18
openlp.pyw
@ -71,12 +71,14 @@ class OpenLP(QtGui.QApplication):
|
|||||||
The core application class. This class inherits from Qt's QApplication
|
The core application class. This class inherits from Qt's QApplication
|
||||||
class in order to provide the core of the application.
|
class in order to provide the core of the application.
|
||||||
"""
|
"""
|
||||||
log.info(u'OpenLP Application Loaded')
|
app_version = None
|
||||||
|
|
||||||
def get_version(self):
|
def get_version(self):
|
||||||
"""
|
"""
|
||||||
Load and store current Application Version
|
Load and store current Application Version
|
||||||
"""
|
"""
|
||||||
|
if self.app_version:
|
||||||
|
return self.app_version
|
||||||
if u'--dev-version' in sys.argv or u'-d' in sys.argv:
|
if u'--dev-version' in sys.argv or u'-d' in sys.argv:
|
||||||
# If we're running the dev version, let's use bzr to get the version
|
# If we're running the dev version, let's use bzr to get the version
|
||||||
try:
|
try:
|
||||||
@ -136,12 +138,12 @@ class OpenLP(QtGui.QApplication):
|
|||||||
if fversion:
|
if fversion:
|
||||||
fversion.close()
|
fversion.close()
|
||||||
bits = full_version.split(u'-')
|
bits = full_version.split(u'-')
|
||||||
app_version = {
|
self.app_version = {
|
||||||
u'full': full_version,
|
u'full': full_version,
|
||||||
u'version': bits[0],
|
u'version': bits[0],
|
||||||
u'build': bits[1] if len(bits) > 1 else None
|
u'build': bits[1] if len(bits) > 1 else None
|
||||||
}
|
}
|
||||||
if app_version[u'build']:
|
if self.app_version[u'build']:
|
||||||
log.info(
|
log.info(
|
||||||
u'Openlp version %s build %s',
|
u'Openlp version %s build %s',
|
||||||
app_version[u'version'],
|
app_version[u'version'],
|
||||||
@ -149,13 +151,12 @@ class OpenLP(QtGui.QApplication):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
log.info(u'Openlp version %s' % app_version[u'version'])
|
log.info(u'Openlp version %s' % app_version[u'version'])
|
||||||
return app_version
|
return self.app_version
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
Run the OpenLP application.
|
Run the OpenLP application.
|
||||||
"""
|
"""
|
||||||
app_version = self._get_version()
|
|
||||||
# provide a listener for widgets to reqest a screen update.
|
# provide a listener for widgets to reqest a screen update.
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'openlp_process_events'), self.processEvents)
|
QtCore.SIGNAL(u'openlp_process_events'), self.processEvents)
|
||||||
@ -180,7 +181,8 @@ class OpenLP(QtGui.QApplication):
|
|||||||
# make sure Qt really display the splash screen
|
# make sure Qt really display the splash screen
|
||||||
self.processEvents()
|
self.processEvents()
|
||||||
# start the main app window
|
# start the main app window
|
||||||
self.mainWindow = MainWindow(screens, app_version, self.clipboard())
|
self.mainWindow = MainWindow(screens, self.app_version,
|
||||||
|
self.clipboard())
|
||||||
self.mainWindow.show()
|
self.mainWindow.show()
|
||||||
if show_splash:
|
if show_splash:
|
||||||
# now kill the splashscreen
|
# now kill the splashscreen
|
||||||
@ -192,7 +194,7 @@ class OpenLP(QtGui.QApplication):
|
|||||||
update_check = QtCore.QSettings().value(
|
update_check = QtCore.QSettings().value(
|
||||||
u'general/update check', QtCore.QVariant(True)).toBool()
|
u'general/update check', QtCore.QVariant(True)).toBool()
|
||||||
if update_check:
|
if update_check:
|
||||||
VersionThread(self.mainWindow, app_version).start()
|
VersionThread(self.mainWindow, self.app_version).start()
|
||||||
return self.exec_()
|
return self.exec_()
|
||||||
|
|
||||||
def hookException(self, exctype, value, traceback):
|
def hookException(self, exctype, value, traceback):
|
||||||
@ -272,7 +274,7 @@ def main():
|
|||||||
app.setApplicationName(u'OpenLP')
|
app.setApplicationName(u'OpenLP')
|
||||||
app.setApplicationVersion(app.get_version()[u'version'])
|
app.setApplicationVersion(app.get_version()[u'version'])
|
||||||
# First time checks in settings
|
# First time checks in settings
|
||||||
if not QSettings().value(u'general/has run wizard',
|
if not QtCore.QSettings().value(u'general/has run wizard',
|
||||||
QtCore.QVariant(False)).toBool():
|
QtCore.QVariant(False)).toBool():
|
||||||
if not FirstTimeLanguageForm().exec_():
|
if not FirstTimeLanguageForm().exec_():
|
||||||
# if cancel then stop processing
|
# if cancel then stop processing
|
||||||
|
Loading…
Reference in New Issue
Block a user