From 45c05e700d8ca0707ae40ec8db9e5c148b9f8749 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 23 May 2012 18:53:04 +0200 Subject: [PATCH] clean ups --- openlp/core/__init__.py | 3 ++- openlp/core/ui/mainwindow.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index 88f31b2ad..96520195d 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -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_() diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 3b26820e9..6deb769af 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -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.