This commit is contained in:
Tim Bentley 2011-07-30 17:00:11 +01:00
commit c9c0904c31
12 changed files with 210 additions and 38 deletions

View File

@ -20,3 +20,4 @@ _eric4project
openlp/core/resources.py.old
*.qm
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.
"""
args = []
def exec_(self):
"""
Override exec method to allow the shared memory to be released on exit
@ -92,8 +94,8 @@ class OpenLP(QtGui.QApplication):
"""
# On Windows, the args passed into the constructor are
# ignored. Not very handy, so set the ones we want to use.
self.args = args
# provide a listener for widgets to request a screen update.
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)
QtCore.QObject.connect(Receiver.get_receiver(),
@ -182,6 +184,18 @@ 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)
self.args.insert(0, unicode(file_name))
return True
else:
return QtGui.QApplication.event(self, event)
def main():
"""
The main function which parses command line options and then runs

View File

@ -129,6 +129,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
os.path.join(gettempdir(), u'openlp', screenshot)))
item.setCheckState(QtCore.Qt.Unchecked)
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
Receiver.send_message(u'cursor_normal')
def nextId(self):
"""

View File

@ -33,7 +33,7 @@ from tempfile import gettempdir
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, \
PluginManager, Receiver, translate, ImageManager
PluginManager, Receiver, translate, ImageManager, PluginStatus
from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \
icon_action, shortcut_action
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
@ -42,6 +42,8 @@ from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
from openlp.core.utils import AppLocation, add_actions, LanguageManager, \
get_application_version, delete_file
from openlp.core.utils.actions import ActionList, CategoryOrder
from openlp.core.ui.firsttimeform import FirstTimeForm
from openlp.core.ui import ScreenList
log = logging.getLogger(__name__)
@ -244,6 +246,9 @@ class Ui_MainWindow(object):
self.toolsOpenDataFolder = icon_action(mainWindow,
u'toolsOpenDataFolder', u':/general/general_open.png',
category=UiStrings().Tools)
self.toolsFirstTimeWizard = icon_action(mainWindow,
u'toolsFirstTimeWizard', u':/general/general_revert.png',
category=UiStrings().Tools)
self.updateThemeImages = base_action(mainWindow,
u'updateThemeImages', category=UiStrings().Tools)
action_list.add_category(UiStrings().Settings,
@ -323,6 +328,7 @@ class Ui_MainWindow(object):
self.settingsConfigureItem))
add_actions(self.toolsMenu, (self.toolsAddToolItem, None))
add_actions(self.toolsMenu, (self.toolsOpenDataFolder, None))
add_actions(self.toolsMenu, (self.toolsFirstTimeWizard, None))
add_actions(self.toolsMenu, [self.updateThemeImages])
if os.name == u'nt':
add_actions(self.helpMenu, (self.offlineHelpItem,
@ -471,6 +477,10 @@ class Ui_MainWindow(object):
translate('OpenLP.MainWindow', 'Open &Data Folder...'))
self.toolsOpenDataFolder.setStatusTip(translate('OpenLP.MainWindow',
'Open the folder where songs, bibles and other data resides.'))
self.toolsFirstTimeWizard.setText(
translate('OpenLP.MainWindow', 'Re-run First Time Wizard'))
self.toolsFirstTimeWizard.setStatusTip(translate('OpenLP.MainWindow',
'Re-run the First Time Wizard, importing songs, Bibles and themes.'))
self.updateThemeImages.setText(
translate('OpenLP.MainWindow', 'Update Theme Images'))
self.updateThemeImages.setStatusTip(
@ -546,6 +556,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'triggered()'), self.onHelpWebSiteClicked)
QtCore.QObject.connect(self.toolsOpenDataFolder,
QtCore.SIGNAL(u'triggered()'), self.onToolsOpenDataFolderClicked)
QtCore.QObject.connect(self.toolsFirstTimeWizard,
QtCore.SIGNAL(u'triggered()'), self.onFirstTimeWizardClicked)
QtCore.QObject.connect(self.updateThemeImages,
QtCore.SIGNAL(u'triggered()'), self.onUpdateThemeImages)
QtCore.QObject.connect(self.displayTagItem,
@ -714,6 +726,45 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
delete_file(os.path.join(temp_dir, filename))
os.removedirs(temp_dir)
def onFirstTimeWizardClicked(self):
"""
Re-run the first time wizard. Prompts the user for run confirmation
If wizard is run, songs, bibles and themes are imported. The default
theme is changed (if necessary). The plugins in pluginmanager are
set active/in-active to match the selection in the wizard.
"""
answer = QtGui.QMessageBox.warning(self,
translate('OpenLP.MainWindow', 'Re-run First Time Wizard?'),
translate('OpenLP.MainWindow',
'Are you sure you want to re-run the First Time Wizard?\n\n'
'Re-running this wizard may make changes to your current '
'OpenLP configuration and possibly add songs to your '
'existing songs list and change your default theme.'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
return
Receiver.send_message(u'cursor_busy')
screens = ScreenList.get_instance()
if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
self.firstTime()
for plugin in self.pluginManager.plugins:
self.activePlugin = plugin
oldStatus = self.activePlugin.status
self.activePlugin.setStatus()
if oldStatus != self.activePlugin.status:
if self.activePlugin.status == PluginStatus.Active:
self.activePlugin.toggleStatus(PluginStatus.Active)
self.activePlugin.appStartup()
else:
self.activePlugin.toggleStatus(PluginStatus.Inactive)
self.themeManagerContents.configUpdated()
self.themeManagerContents.loadThemes(True)
Receiver.send_message(u'theme_update_global',
self.themeManagerContents.global_theme)
def blankCheck(self):
"""
Check and display message if screen blank on setup.

View File

@ -150,13 +150,11 @@ class HttpResponse(object):
class HttpServer(object):
"""
Ability to control OpenLP via a webbrowser
e.g. http://localhost:4316/send/slidecontroller_live_next
http://localhost:4316/send/alerts_text?q=your%20alert%20text
Ability to control OpenLP via a web browser.
"""
def __init__(self, plugin):
"""
Initialise the httpserver, and start the server
Initialise the httpserver, and start the server.
"""
log.debug(u'Initialise httpserver')
self.plugin = plugin
@ -170,9 +168,9 @@ class HttpServer(object):
def start_tcp(self):
"""
Start the http server, use the port in the settings default to 4316
Start the http server, use the port in the settings default to 4316.
Listen out for slide and song changes so they can be broadcast to
clients. Listen out for socket connections
clients. Listen out for socket connections.
"""
log.debug(u'Start TCP server')
port = QtCore.QSettings().value(
@ -195,20 +193,20 @@ class HttpServer(object):
def slide_change(self, row):
"""
Slide change listener. Store the item and tell the clients
Slide change listener. Store the item and tell the clients.
"""
self.current_slide = row
def item_change(self, items):
"""
Item (song) change listener. Store the slide and tell the clients
Item (song) change listener. Store the slide and tell the clients.
"""
self.current_item = items[0]
def new_connection(self):
"""
A new http connection has been made. Create a client object to handle
communication
communication.
"""
log.debug(u'new http connection')
socket = self.server.nextPendingConnection()
@ -225,15 +223,16 @@ class HttpServer(object):
def close(self):
"""
Close down the http server
Close down the http server.
"""
log.debug(u'close http server')
self.server.close()
class HttpConnection(object):
"""
A single connection, this handles communication between the server
and the client
and the client.
"""
def __init__(self, parent, socket):
"""
@ -287,9 +286,12 @@ class HttpConnection(object):
"""
self.template_vars = {
'app_title': translate('RemotePlugin.Mobile', 'OpenLP 2.0 Remote'),
'stage_title': translate('RemotePlugin.Mobile', 'OpenLP 2.0 Stage View'),
'service_manager': translate('RemotePlugin.Mobile', 'Service Manager'),
'slide_controller': translate('RemotePlugin.Mobile', 'Slide Controller'),
'stage_title': translate('RemotePlugin.Mobile',
'OpenLP 2.0 Stage View'),
'service_manager': translate('RemotePlugin.Mobile',
'Service Manager'),
'slide_controller': translate('RemotePlugin.Mobile',
'Slide Controller'),
'alerts': translate('RemotePlugin.Mobile', 'Alerts'),
'search': translate('RemotePlugin.Mobile', 'Search'),
'back': translate('RemotePlugin.Mobile', 'Back'),
@ -301,7 +303,8 @@ class HttpConnection(object):
'text': translate('RemotePlugin.Mobile', 'Text'),
'show_alert': translate('RemotePlugin.Mobile', 'Show Alert'),
'go_live': translate('RemotePlugin.Mobile', 'Go Live'),
'add_to_service': translate('RemotePlugin.Mobile', 'Add To Service'),
'add_to_service': translate('RemotePlugin.Mobile',
'Add to Service'),
'no_results': translate('RemotePlugin.Mobile', 'No Results'),
'options': translate('RemotePlugin.Mobile', 'Options')
}
@ -397,7 +400,7 @@ class HttpConnection(object):
if self.parent.current_item else u''
}
return HttpResponse(json.dumps({u'results': result}),
{u'Content-Type': u'application/json'})
{u'Content-Type': u'application/json'})
def display(self, action):
"""
@ -483,10 +486,11 @@ class HttpConnection(object):
def pluginInfo(self, action):
"""
Return plugin related information, based on the action
Return plugin related information, based on the action.
``action`` - The action to perform
if 'search' return a list of plugin names which support search
``action``
The action to perform. If *search* return a list of plugin names
which support search.
"""
if action == u'search':
searches = []
@ -501,10 +505,10 @@ class HttpConnection(object):
def search(self, type):
"""
Return a list of items that match the search text
Return a list of items that match the search text.
``type``
The plugin name to search in.
The plugin name to search in.
"""
text = json.loads(self.url_params[u'data'][0])[u'request'][u'text']
plugin = self.parent.plugin.pluginManager.get_plugin_by_name(type)
@ -528,7 +532,7 @@ class HttpConnection(object):
def add_to_service(self, type):
"""
Add item of type ``type`` to the end of the service
Add item of type ``type`` to the end of the service.
"""
id = json.loads(self.url_params[u'data'][0])[u'request'][u'id']
plugin = self.parent.plugin.pluginManager.get_plugin_by_name(type)

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,8 +1,8 @@
[openlp]
openlp_appname = OpenLP
openlp_dmgname = OpenLP-1.9.4-bzrXXXX
openlp_dmgname = OpenLP-1.9.6-bzrXXXX
openlp_version = XXXX
openlp_basedir = /Users/openlp/trunk
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

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,