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
visible_title = self.plugin.getString(StringContent.VisibleName)
self.title = unicode(visible_title[u'title'])
self.settingsSection = self.plugin.name.lower()
self.settingsSection = self.plugin.name
self.icon = None
if icon:
self.icon = build_icon(icon)
@ -113,7 +113,7 @@ class MediaManagerItem(QtGui.QWidget):
self.retranslateUi()
self.auto_select_id = -1
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)
def requiredIcons(self):
@ -558,7 +558,7 @@ class MediaManagerItem(QtGui.QWidget):
QtGui.QMessageBox.information(self, UiStrings().NISs,
translate('OpenLP.MediaManagerItem',
'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.plugin.serviceManager.addServiceItem(serviceItem,
replace=True)

View File

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

View File

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

View File

@ -781,48 +781,25 @@ class ServiceManager(QtGui.QWidget):
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)
tempItem = None
setLastItem = False
while serviceIterator.value():
if serviceIterator.value().isSelected() and tempItem is None:
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)
item = self.serviceManagerList.currentItem()
itemBefore = self.serviceManagerList.itemAbove(item)
if itemBefore is None:
return
self.serviceManagerList.setCurrentItem(itemBefore)
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)
firstItem = None
setSelected = False
while serviceIterator.value():
if not firstItem:
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)
item = self.serviceManagerList.currentItem()
itemAfter = self.serviceManagerList.itemBelow(item)
if itemAfter is None:
return
self.serviceManagerList.setCurrentItem(itemAfter)
def onCollapseAll(self):
"""

View File

@ -508,6 +508,11 @@ class SlideController(QtGui.QWidget):
self.mediabar.setVisible(False)
self.toolbar.makeWidgetsInvisible([u'Song Menu'])
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 QtCore.QSettings().value(
self.parent().songsSettingsSection + u'/display songbar',

View File

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

View File

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

View File

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

View File

@ -36,7 +36,7 @@ class ImagePlugin(Plugin):
log.info(u'Image Plugin loaded')
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.icon_path = u':/plugins/plugin_images.png'
self.icon = build_icon(self.icon_path)

View File

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

View File

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

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

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

View File

@ -57,7 +57,7 @@ class SongsPlugin(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.manager = Manager(u'songs', init_schema)
self.icon_path = u':/plugins/plugin_songs.png'

View File

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

View File

@ -46,12 +46,6 @@ PyEnchant
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
This is used to build the documentation. The documentation trunk must be at
the same directory level as Openlp trunk and named "documentation"
@ -179,6 +173,7 @@ def run_pyinstaller():
pyinstaller = Popen((python_exe, pyi_build,
u'--noconfirm',
u'--windowed',
u'--noupx',
u'-o', branch_path,
u'-i', win32_icon,
u'-p', branch_path,