clean ups

This commit is contained in:
Andreas Preikschat 2012-05-23 18:53:04 +02:00
parent ded1e82659
commit 45c05e700d
2 changed files with 5 additions and 4 deletions

View File

@ -91,6 +91,7 @@ class OpenLP(QtGui.QApplication):
"""
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 @@ class OpenLP(QtGui.QApplication):
"""
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)
@ -146,7 +148,6 @@ class OpenLP(QtGui.QApplication):
Receiver.send_message(u'live_display_blank_check')
self.mainWindow.appStartup()
# Skip exec_() for gui tests
self.eventLoopIsActive = True
if not testing:
return self.exec_()

View File

@ -549,8 +549,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
QtGui.QMainWindow.__init__(self)
self.parent = lambda: parent
self.clipboard = self.parent().clipboard()
self.arguments = self.parent().args
self.clipboard = self.mainwindow().clipboard()
self.arguments = self.mainwindow().args
# Set up settings sections for the main application
# (not for use by plugins)
self.uiSettingsSection = u'user interface'
@ -1135,7 +1135,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
# The MainApplication did not even enter the event loop (this happens
# when OpenLP is not fully loaded). Just ignore the event.
if not hasattr(self.parent(), u'eventLoopIsActive'):
if not self.mainwindow().eventLoopIsActive:
event.ignore()
return
# If we just did a settings import, close without saving changes.