using self.args way of opening a file on startup even on OS X

This commit is contained in:
Matthias Hub 2011-07-24 00:39:37 +02:00
parent 1c1cfddce4
commit 189d98dc39
3 changed files with 7 additions and 24 deletions

View File

@ -20,3 +20,4 @@ _eric4project
openlp/core/resources.py.old openlp/core/resources.py.old
*.qm *.qm
resources/windows/warnOpenLP.txt resources/windows/warnOpenLP.txt
openlp.cfg

View File

@ -79,6 +79,8 @@ class OpenLP(QtGui.QApplication):
class in order to provide the core of the application. class in order to provide the core of the application.
""" """
args = []
def exec_(self): def exec_(self):
""" """
Override exec method to allow the shared memory to be released on exit 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. Run the OpenLP application.
""" """
self.eventQueue = [] log.debug("run()")
# On Windows, the args passed into the constructor are # On Windows, the args passed into the constructor are
# ignored. Not very handy, so set the ones we want to use. # 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. # 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)
@ -136,9 +138,6 @@ class OpenLP(QtGui.QApplication):
VersionThread(self.mainWindow).start() VersionThread(self.mainWindow).start()
Receiver.send_message(u'maindisplay_blank_check') Receiver.send_message(u'maindisplay_blank_check')
self.mainWindow.appStartup() self.mainWindow.appStartup()
# do a check for queued events
for e in self.eventQueue:
self.event(e)
DelayStartThread(self.mainWindow).start() DelayStartThread(self.mainWindow).start()
return self.exec_() return self.exec_()
@ -191,15 +190,8 @@ class OpenLP(QtGui.QApplication):
if event.type() == QtCore.QEvent.FileOpen: if event.type() == QtCore.QEvent.FileOpen:
file_name = event.file() file_name = event.file()
log.debug(u'Got open file event for %s!', file_name) log.debug(u'Got open file event for %s!', file_name)
log.error(file_name) self.args.insert(0, unicode(file_name))
try: return True
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
else: else:
return QtGui.QApplication.event(self, event) return QtGui.QApplication.event(self, event)

View File

@ -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