This commit is contained in:
Andreas Preikschat 2011-07-28 15:36:58 +02:00
commit 0afe5be99c
16 changed files with 61 additions and 80 deletions

View File

@ -96,7 +96,7 @@ class MediaManagerItem(QtGui.QWidget):
self.plugin = plugin self.plugin = plugin
visible_title = self.plugin.getString(StringContent.VisibleName) visible_title = self.plugin.getString(StringContent.VisibleName)
self.title = unicode(visible_title[u'title']) self.title = unicode(visible_title[u'title'])
self.settingsSection = self.plugin.name.lower() self.settingsSection = self.plugin.name
self.icon = None self.icon = None
if icon: if icon:
self.icon = build_icon(icon) self.icon = build_icon(icon)
@ -113,7 +113,7 @@ class MediaManagerItem(QtGui.QWidget):
self.retranslateUi() self.retranslateUi()
self.auto_select_id = -1 self.auto_select_id = -1
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'%s_service_load' % self.plugin.name.lower()), QtCore.SIGNAL(u'%s_service_load' % self.plugin.name),
self.serviceLoad) self.serviceLoad)
def requiredIcons(self): def requiredIcons(self):
@ -558,7 +558,7 @@ class MediaManagerItem(QtGui.QWidget):
QtGui.QMessageBox.information(self, UiStrings().NISs, QtGui.QMessageBox.information(self, UiStrings().NISs,
translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'You must select an existing service item to add to.')) 'You must select an existing service item to add to.'))
elif self.plugin.name.lower() == serviceItem.name.lower(): elif self.plugin.name == serviceItem.name:
self.generateSlideData(serviceItem) self.generateSlideData(serviceItem)
self.plugin.serviceManager.addServiceItem(serviceItem, self.plugin.serviceManager.addServiceItem(serviceItem,
replace=True) replace=True)

View File

@ -152,7 +152,7 @@ class Plugin(QtCore.QObject):
self.version = version self.version = version
else: else:
self.version = get_application_version()[u'version'] self.version = get_application_version()[u'version']
self.settingsSection = self.name.lower() self.settingsSection = self.name
self.icon = None self.icon = None
self.media_item_class = media_item_class self.media_item_class = media_item_class
self.settings_tab_class = settings_tab_class self.settings_tab_class = settings_tab_class

View File

@ -66,7 +66,7 @@ class MediaDockManager(object):
match = False match = False
for dock_index in range(0, self.media_dock.count()): for dock_index in range(0, self.media_dock.count()):
if self.media_dock.widget(dock_index).settingsSection == \ if self.media_dock.widget(dock_index).settingsSection == \
media_item.plugin.name.lower(): media_item.plugin.name:
match = True match = True
break break
if not match: if not match:
@ -84,6 +84,6 @@ class MediaDockManager(object):
for dock_index in range(0, self.media_dock.count()): for dock_index in range(0, self.media_dock.count()):
if self.media_dock.widget(dock_index): if self.media_dock.widget(dock_index):
if self.media_dock.widget(dock_index).settingsSection == \ if self.media_dock.widget(dock_index).settingsSection == \
media_item.plugin.name.lower(): media_item.plugin.name:
self.media_dock.widget(dock_index).setVisible(False) self.media_dock.widget(dock_index).setVisible(False)
self.media_dock.removeItem(dock_index) self.media_dock.removeItem(dock_index)

View File

@ -781,48 +781,25 @@ class ServiceManager(QtGui.QWidget):
def onMoveSelectionUp(self): def onMoveSelectionUp(self):
""" """
Moves the selection up the window. Called by the up arrow. Moves the cursor selection up the window.
Called by the up arrow.
""" """
serviceIterator = QtGui.QTreeWidgetItemIterator(self.serviceManagerList) item = self.serviceManagerList.currentItem()
tempItem = None itemBefore = self.serviceManagerList.itemAbove(item)
setLastItem = False if itemBefore is None:
while serviceIterator.value(): return
if serviceIterator.value().isSelected() and tempItem is None: self.serviceManagerList.setCurrentItem(itemBefore)
setLastItem = True
serviceIterator.value().setSelected(False)
if serviceIterator.value().isSelected():
# We are on the first record
if tempItem:
tempItem.setSelected(True)
serviceIterator.value().setSelected(False)
else:
tempItem = serviceIterator.value()
lastItem = serviceIterator.value()
serviceIterator += 1
# Top Item was selected so set the last one
if setLastItem:
lastItem.setSelected(True)
def onMoveSelectionDown(self): def onMoveSelectionDown(self):
""" """
Moves the selection down the window. Called by the down arrow. Moves the cursor selection down the window.
Called by the down arrow.
""" """
serviceIterator = QtGui.QTreeWidgetItemIterator(self.serviceManagerList) item = self.serviceManagerList.currentItem()
firstItem = None itemAfter = self.serviceManagerList.itemBelow(item)
setSelected = False if itemAfter is None:
while serviceIterator.value(): return
if not firstItem: self.serviceManagerList.setCurrentItem(itemAfter)
firstItem = serviceIterator.value()
if setSelected:
setSelected = False
serviceIterator.value().setSelected(True)
elif serviceIterator.value() and \
serviceIterator.value().isSelected():
serviceIterator.value().setSelected(False)
setSelected = True
serviceIterator += 1
if setSelected:
firstItem.setSelected(True)
def onCollapseAll(self): def onCollapseAll(self):
""" """

View File

@ -508,6 +508,11 @@ class SlideController(QtGui.QWidget):
self.mediabar.setVisible(False) self.mediabar.setVisible(False)
self.toolbar.makeWidgetsInvisible([u'Song Menu']) self.toolbar.makeWidgetsInvisible([u'Song Menu'])
self.toolbar.makeWidgetsInvisible(self.loopList) self.toolbar.makeWidgetsInvisible(self.loopList)
# Reset the button
self.playSlidesOnce.setChecked(False)
self.playSlidesOnce.setIcon(build_icon(u':/media/media_time.png'))
self.playSlidesLoop.setChecked(False)
self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
if item.is_text(): if item.is_text():
if QtCore.QSettings().value( if QtCore.QSettings().value(
self.parent().songsSettingsSection + u'/display songbar', self.parent().songsSettingsSection + u'/display songbar',

View File

@ -43,7 +43,7 @@ class AlertsPlugin(Plugin):
log.info(u'Alerts Plugin loaded') log.info(u'Alerts Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Alerts', plugin_helpers, Plugin.__init__(self, u'alerts', plugin_helpers,
settings_tab_class=AlertsTab) settings_tab_class=AlertsTab)
self.weight = -3 self.weight = -3
self.icon_path = u':/plugins/plugin_alerts.png' self.icon_path = u':/plugins/plugin_alerts.png'

View File

@ -41,7 +41,7 @@ class BiblePlugin(Plugin):
log.info(u'Bible Plugin loaded') log.info(u'Bible Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Bibles', plugin_helpers, Plugin.__init__(self, u'bibles', plugin_helpers,
BibleMediaItem, BiblesTab) BibleMediaItem, BiblesTab)
self.weight = -9 self.weight = -9
self.icon_path = u':/plugins/plugin_bibles.png' self.icon_path = u':/plugins/plugin_bibles.png'

View File

@ -46,7 +46,7 @@ class CustomPlugin(Plugin):
log.info(u'Custom Plugin loaded') log.info(u'Custom Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Custom', plugin_helpers, Plugin.__init__(self, u'custom', plugin_helpers,
CustomMediaItem, CustomTab) CustomMediaItem, CustomTab)
self.weight = -5 self.weight = -5
self.manager = Manager(u'custom', init_schema) self.manager = Manager(u'custom', init_schema)

View File

@ -36,7 +36,7 @@ class ImagePlugin(Plugin):
log.info(u'Image Plugin loaded') log.info(u'Image Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Images', plugin_helpers, ImageMediaItem) Plugin.__init__(self, u'images', plugin_helpers, ImageMediaItem)
self.weight = -7 self.weight = -7
self.icon_path = u':/plugins/plugin_images.png' self.icon_path = u':/plugins/plugin_images.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)

View File

@ -39,7 +39,7 @@ class MediaPlugin(Plugin):
log.info(u'%s MediaPlugin loaded', __name__) log.info(u'%s MediaPlugin loaded', __name__)
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Media', plugin_helpers, Plugin.__init__(self, u'media', plugin_helpers,
MediaMediaItem, MediaTab) MediaMediaItem, MediaTab)
self.weight = -6 self.weight = -6
self.icon_path = u':/plugins/plugin_media.png' self.icon_path = u':/plugins/plugin_media.png'

View File

@ -52,7 +52,7 @@ class PresentationPlugin(Plugin):
""" """
log.debug(u'Initialised') log.debug(u'Initialised')
self.controllers = {} self.controllers = {}
Plugin.__init__(self, u'Presentations', plugin_helpers) Plugin.__init__(self, u'presentations', plugin_helpers)
self.weight = -8 self.weight = -8
self.icon_path = u':/plugins/plugin_presentations.png' self.icon_path = u':/plugins/plugin_presentations.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)

View File

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

View File

@ -39,7 +39,7 @@ class RemotesPlugin(Plugin):
""" """
remotes constructor remotes constructor
""" """
Plugin.__init__(self, u'Remotes', plugin_helpers, Plugin.__init__(self, u'remotes', plugin_helpers,
settings_tab_class=RemoteTab) settings_tab_class=RemoteTab)
self.icon_path = u':/plugins/plugin_remote.png' self.icon_path = u':/plugins/plugin_remote.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)

View File

@ -57,7 +57,7 @@ class SongsPlugin(Plugin):
""" """
Create and set up the Songs plugin. Create and set up the Songs plugin.
""" """
Plugin.__init__(self, u'Songs', plugin_helpers, SongMediaItem, SongsTab) Plugin.__init__(self, u'songs', plugin_helpers, SongMediaItem, SongsTab)
self.weight = -10 self.weight = -10
self.manager = Manager(u'songs', init_schema) self.manager = Manager(u'songs', init_schema)
self.icon_path = u':/plugins/plugin_songs.png' self.icon_path = u':/plugins/plugin_songs.png'

View File

@ -45,7 +45,7 @@ class SongUsagePlugin(Plugin):
log.info(u'SongUsage Plugin loaded') log.info(u'SongUsage Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'SongUsage', plugin_helpers) Plugin.__init__(self, u'songusage', plugin_helpers)
self.weight = -4 self.weight = -4
self.icon = build_icon(u':/plugins/plugin_songusage.png') self.icon = build_icon(u':/plugins/plugin_songusage.png')
self.activeIcon = build_icon(u':/songusage/song_usage_active.png') self.activeIcon = build_icon(u':/songusage/song_usage_active.png')

View File

@ -46,12 +46,6 @@ PyEnchant
Inno Setup 5 Inno Setup 5
Inno Setup should be installed into "C:\%PROGRAMFILES%\Inno Setup 5" Inno Setup should be installed into "C:\%PROGRAMFILES%\Inno Setup 5"
UPX
This is used to compress DLLs and EXEs so that they take up less space, but
still function exactly the same. To install UPX, download it from
http://upx.sourceforge.net/, extract it into C:\%PROGRAMFILES%\UPX, and then
add that directory to your PATH environment variable.
Sphinx Sphinx
This is used to build the documentation. The documentation trunk must be at This is used to build the documentation. The documentation trunk must be at
the same directory level as Openlp trunk and named "documentation" the same directory level as Openlp trunk and named "documentation"
@ -179,6 +173,7 @@ def run_pyinstaller():
pyinstaller = Popen((python_exe, pyi_build, pyinstaller = Popen((python_exe, pyi_build,
u'--noconfirm', u'--noconfirm',
u'--windowed', u'--windowed',
u'--noupx',
u'-o', branch_path, u'-o', branch_path,
u'-i', win32_icon, u'-i', win32_icon,
u'-p', branch_path, u'-p', branch_path,