From 189d98dc397e455bace406b1285856ec060be51e Mon Sep 17 00:00:00 2001 From: Matthias Hub Date: Sun, 24 Jul 2011 00:39:37 +0200 Subject: [PATCH] using self.args way of opening a file on startup even on OS X --- .bzrignore | 1 + openlp.pyw | 20 ++++++-------------- resources/osx/openlp.cfg | 10 ---------- 3 files changed, 7 insertions(+), 24 deletions(-) delete mode 100755 resources/osx/openlp.cfg diff --git a/.bzrignore b/.bzrignore index 2620fea42..1d2bb8267 100644 --- a/.bzrignore +++ b/.bzrignore @@ -20,3 +20,4 @@ _eric4project openlp/core/resources.py.old *.qm resources/windows/warnOpenLP.txt +openlp.cfg diff --git a/openlp.pyw b/openlp.pyw index d1627a8a6..c01d29b00 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -79,6 +79,8 @@ class OpenLP(QtGui.QApplication): class in order to provide the core of the application. """ + args = [] + def exec_(self): """ Override exec method to allow the shared memory to be released on exit @@ -90,10 +92,10 @@ class OpenLP(QtGui.QApplication): """ Run the OpenLP application. """ - self.eventQueue = [] + log.debug("run()") # On Windows, the args passed into the constructor are # ignored. Not very handy, so set the ones we want to use. - self.args = args + self.args.extend(args) # provide a listener for widgets to reqest a screen update. QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_process_events'), self.processEvents) @@ -136,9 +138,6 @@ class OpenLP(QtGui.QApplication): VersionThread(self.mainWindow).start() Receiver.send_message(u'maindisplay_blank_check') self.mainWindow.appStartup() - # do a check for queued events - for e in self.eventQueue: - self.event(e) DelayStartThread(self.mainWindow).start() return self.exec_() @@ -191,15 +190,8 @@ class OpenLP(QtGui.QApplication): if event.type() == QtCore.QEvent.FileOpen: file_name = event.file() log.debug(u'Got open file event for %s!', file_name) - log.error(file_name) - try: - self.mainWindow.serviceManagerContents.loadFile(file_name) - return True - except AttributeError, NameError: - log.debug(u'The main window is not initialized yet,\ - will queue event!') - self.eventQueue.append(event) - return False + self.args.insert(0, unicode(file_name)) + return True else: return QtGui.QApplication.event(self, event) diff --git a/resources/osx/openlp.cfg b/resources/osx/openlp.cfg deleted file mode 100755 index f72a8fca1..000000000 --- a/resources/osx/openlp.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[openlp] -openlp_appname = OpenLP -openlp_dmgname = OpenLP-1.9.6-bzrXXXX -openlp_version = XXXX -openlp_basedir = /Users/openlp/repo/trunk -openlp_icon_file = openlp-logo-with-text.icns -openlp_dmg_icon_file = openlp-logo-420x420.png -installer_backgroundimage_file = installation-background.png -pyinstaller_basedir = /Users/openlp/pyinstaller/trunk -qt_menu_basedir = /Library/Frameworks/QtGui.framework/Versions/4/Resources/qt_menu.nib