- fixed view adjustments for os x 10.6

- added compatibility with the file extension on os x
- started to work on the "open with" file event on os x
This commit is contained in:
Matthias Hub 2011-07-13 22:41:54 +02:00
parent cb60e6e9ef
commit 68c1c86ac5
7 changed files with 135 additions and 11 deletions

View File

@ -90,6 +90,7 @@ class OpenLP(QtGui.QApplication):
"""
Run the OpenLP application.
"""
self.eventQueue = []
# On Windows, the args passed into the constructor are
# ignored. Not very handy, so set the ones we want to use.
self.args = args
@ -135,6 +136,9 @@ 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_()
@ -180,6 +184,25 @@ class OpenLP(QtGui.QApplication):
"""
self.restoreOverrideCursor()
def event(self, event):
"""
Enables direct file opening on OS X
"""
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
else:
return QtGui.QApplication.event(self, event)
def main():
"""
The main function which parses command line options and then runs

View File

@ -2,6 +2,99 @@
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtension</key>
<array>
<string>osz</string>
</array>
<key>CFBundleTypeIconFiles</key>
<array>
<string>openlp-logo-with-text.icns</string>
</array>
<key>CFBundleTypeName</key>
<string>OpenLP Service</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>org.openlp.osz</string>
</array>
</dict>
<dict>
<key>CFBundleTypeExtension</key>
<array>
<string>otz</string>
</array>
<key>CFBundleTypeIconFiles</key>
<array>
<string>openlp-logo-with-text.icns</string>
</array>
<key>CFBundleTypeName</key>
<string>OpenLP Theme</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>org.openlp.otz</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>org.openlp.osz</string>
<key>UTTypeDescription</key>
<string>OpenLP Service</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.content</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>osz</string>
</array>
<key>public.mime-type</key>
<array>
<string>application/x-openlp-service</string>
</array>
</dict>
</dict>
<dict>
<key>UTTypeIdentifier</key>
<string>org.openlp.otz</string>
<key>UTTypeDescription</key>
<string>OpenLP Theme</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.content</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>otz</string>
</array>
<key>public.mime-type</key>
<array>
<string>application/x-openlp-theme</string>
</array>
</dict>
</dict>
</array>
<key>CFBundleIdentifier</key>
<string>org.openlp</string>
<key>CFBundleShortVersionString</key>

View File

@ -48,7 +48,7 @@ on run
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 128
set background picture of theViewOptions to file ".installer-background.png"
set background picture of theViewOptions to file ".background:installer-background.png"
if not exists file "Applications" then
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
end if

View File

@ -49,15 +49,19 @@ on run
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 128
set background picture of theViewOptions to file ".installer-background.png"
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
delay 5
set background picture of theViewOptions to file ".background:installer-background.png"
if not exists file "Applications" then
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
end if
delay 1
set position of item "%s" of container window to {160, 200}
set position of item ".Trashes" of container window to {100, 500}
set position of item ".installer-background.png" of container window to {200, 500}
set position of item ".background" of container window to {200, 500}
set position of item ".DS_Store" of container window to {400, 500}
set position of item "Applications" of container window to {550, 200}
set position of item ".VolumeIcon.icns" of container window to {500, 500}
if exists file ".VolumeIcon.icns" then
set position of item ".VolumeIcon.icns" of container window to {500, 500}
end if
set position of item ".fseventsd" of container window to {300, 500}
if exists POSIX file ".SymAVx86QSFile" then
set position of item ".SymAVx86QSFile" of container window to {600, 500}

View File

@ -93,8 +93,12 @@ script_name = "build"
def build_application(settings, app_name_lower, app_dir):
logging.info('[%s] now building the app with pyinstaller at "%s"...',
script_name, settings['pyinstaller_basedir'])
result = os.system('python %s/pyinstaller.py openlp.spec' \
% settings['pyinstaller_basedir'])
full_python_dir = os.path.join('/opt/local/Library/Frameworks',
'Python.framework/Versions/2.6/Resources/',
'Python.app/Contents/MacOS/Python')
result = os.system('arch -i386 %s %s/pyinstaller.py openlp.spec' \
% ( full_python_dir,
settings['pyinstaller_basedir']) )
if (result != 0):
logging.error('[%s] The pyinstaller build reported an error, cannot \
continue!', script_name)
@ -219,10 +223,10 @@ def create_dmg(settings):
sys.exit(1)
logging.info('[%s] copying the background image...', script_name)
# os.mkdir(volume_basedir + '/.background')
os.mkdir(volume_basedir + '/.background')
result = os.system('CpMac %s %s'
% (settings['installer_backgroundimage_file'],
volume_basedir + '/.installer-background.png'))
volume_basedir + '/.background/installer-background.png'))
if (result != 0):
logging.error('[%s] could not copy the background image, dmg creation\
failed!', script_name)

0
resources/osx/openlp-logo-with-text.icns Executable file → Normal file
View File

View File

@ -1,5 +1,5 @@
# -*- mode: python -*-
a = Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'), os.path.join(HOMEPATH,'support/useUnicode.py'), '%(openlp_basedir)s/openlp.pyw'],
a = Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'), os.path.join(CONFIGDIR,'support/useUnicode.py'), '%(openlp_basedir)s/openlp.pyw'],
pathex=['%(pyinstaller_basedir)s'], hookspath=['%(openlp_basedir)s/resources/pyinstaller'])
pyz = PYZ(a.pure)
exe = EXE(pyz,