openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #15761
[Merge] lp:~googol/openlp/bug-923496 into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/bug-923496 into lp:openlp.
Requested reviews:
Raoul Snyman (raoul-snyman)
Tim Bentley (trb143)
Related bugs:
Bug #923496 in OpenLP: "Traceback when closing main window before the service is loaded"
https://bugs.launchpad.net/openlp/+bug/923496
For more details, see:
https://code.launchpad.net/~googol/openlp/bug-923496/+merge/107528
Hello,
This fixes to bugs:
- we have to set the display attribute to None, so that we cannot close it twice (due to the WA_DeleteOnClose flag).
- when we want to close the application before we entered the event loop, then OpenLP will not close properly. That is why we just ignore the close event until we know that we entered the event loop.
--
https://code.launchpad.net/~googol/openlp/bug-923496/+merge/107528
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/__init__.py'
--- openlp/core/__init__.py 2012-05-20 20:56:11 +0000
+++ openlp/core/__init__.py 2012-05-26 17:13:22 +0000
@@ -91,6 +91,7 @@
"""
Override exec method to allow the shared memory to be released on exit
"""
+ self.eventLoopIsActive = True
QtGui.QApplication.exec_()
self.sharedMemory.detach()
@@ -98,6 +99,7 @@
"""
Run the OpenLP application.
"""
+ self.eventLoopIsActive = False
# On Windows, the args passed into the constructor are
# ignored. Not very handy, so set the ones we want to use.
self.args.extend(args)
@@ -127,7 +129,7 @@
# make sure Qt really display the splash screen
self.processEvents()
# start the main app window
- self.mainWindow = MainWindow(self.clipboard(), self.args)
+ self.mainWindow = MainWindow(self)
self.mainWindow.show()
if show_splash:
# now kill the splashscreen
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2012-05-20 20:56:11 +0000
+++ openlp/core/ui/mainwindow.py 2012-05-26 17:13:22 +0000
@@ -542,14 +542,15 @@
"""
log.info(u'MainWindow loaded')
- def __init__(self, clipboard, arguments):
+ def __init__(self, application):
"""
This constructor sets up the interface, the various managers, and the
plugins.
"""
QtGui.QMainWindow.__init__(self)
- self.clipboard = clipboard
- self.arguments = arguments
+ self.application = application
+ self.clipboard = self.application.clipboard()
+ self.arguments = self.application.args
# Set up settings sections for the main application
# (not for use by plugins)
self.uiSettingsSection = u'user interface'
@@ -830,7 +831,7 @@
translate('OpenLP.MainWindow',
'OpenLP Main Display Blanked'),
translate('OpenLP.MainWindow',
- 'The Main Display has been blanked out'))
+ 'The Main Display has been blanked out'))
def onErrorMessage(self, data):
Receiver.send_message(u'close_splash')
@@ -1132,6 +1133,11 @@
"""
Hook to close the main window and display windows on exit
"""
+ # The MainApplication did not even enter the event loop (this happens
+ # when OpenLP is not fully loaded). Just ignore the event.
+ if not self.application.eventLoopIsActive:
+ event.ignore()
+ return
# If we just did a settings import, close without saving changes.
if self.settingsImported:
event.accept()
@@ -1184,7 +1190,9 @@
# Save settings
self.saveSettings()
# Close down the display
- self.liveController.display.close()
+ if self.liveController.display:
+ self.liveController.display.close()
+ self.liveController.display = None
def serviceChanged(self, reset=False, serviceName=None):
"""
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2012-05-20 20:56:11 +0000
+++ openlp/core/ui/slidecontroller.py 2012-05-26 17:13:22 +0000
@@ -73,6 +73,7 @@
controller = self
Receiver.send_message('%s' % sender, [controller, args])
+
class SlideController(Controller):
"""
SlideController is the slide controller widget. This widget is what the
@@ -577,8 +578,7 @@
# rebuild display as screen size changed
if self.display:
self.display.close()
- self.display = MainDisplay(self, self.imageManager, self.isLive,
- self)
+ self.display = MainDisplay(self, self.imageManager, self.isLive, self)
self.display.setup()
if self.isLive:
self.__addActionsToWidget(self.display)
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py 2012-05-01 12:58:22 +0000
+++ openlp/core/utils/__init__.py 2012-05-26 17:13:22 +0000
@@ -34,7 +34,6 @@
import re
from subprocess import Popen, PIPE
import sys
-import time
import urllib2
from PyQt4 import QtGui, QtCore
@@ -69,7 +68,7 @@
"""
Run the thread.
"""
- time.sleep(1)
+ self.sleep(1)
app_version = get_application_version()
version = check_latest_version(app_version)
if LooseVersion(str(version)) > LooseVersion(str(app_version[u'full'])):
Follow ups