openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #18301
[Merge] lp:~trb143/openlp/style into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/style into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~trb143/openlp/style/+merge/139059
Only style cleanups of the core classes I need to change for the media.
No functionality has been changed as part of this update.
--
https://code.launchpad.net/~trb143/openlp/style/+merge/139059
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/style into lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2012-12-03 19:19:10 +0000
+++ openlp/core/lib/serviceitem.py 2012-12-10 18:08:26 +0000
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
@@ -37,8 +37,7 @@
import os
import uuid
-from openlp.core.lib import build_icon, clean_tags, expand_tags, translate, \
- ImageSource
+from openlp.core.lib import build_icon, clean_tags, expand_tags, translate, ImageSource
log = logging.getLogger(__name__)
@@ -247,12 +246,10 @@
previous_pages = {}
for slide in self._raw_frames:
verse_tag = slide[u'verseTag']
- if verse_tag in previous_pages and \
- previous_pages[verse_tag][0] == slide[u'raw_slide']:
+ if verse_tag in previous_pages and previous_pages[verse_tag][0] == slide[u'raw_slide']:
pages = previous_pages[verse_tag][1]
else:
- pages = \
- self.renderer.format_slide(slide[u'raw_slide'], self)
+ pages = self.renderer.format_slide(slide[u'raw_slide'], self)
previous_pages[verse_tag] = (slide[u'raw_slide'], pages)
for page in pages:
page = page.replace(u'<br>', u'{br}')
@@ -263,8 +260,7 @@
u'html': html.replace(u'&nbsp;', u' '),
u'verseTag': verse_tag
})
- elif self.service_item_type == ServiceItemType.Image or \
- self.service_item_type == ServiceItemType.Command:
+ elif self.service_item_type == ServiceItemType.Image or self.service_item_type == ServiceItemType.Command:
pass
else:
log.error(u'Invalid value renderer: %s' % self.service_item_type)
@@ -290,8 +286,7 @@
self.image_border = background
self.service_item_type = ServiceItemType.Image
self._raw_frames.append({u'title': title, u'path': path})
- self.renderer.image_manager.addImage(
- path, ImageSource.ImagePlugin, self.image_border)
+ self.renderer.image_manager.addImage(path, ImageSource.ImagePlugin, self.image_border)
self._new_item()
def add_from_text(self, raw_slide, verse_tag=None):
@@ -305,8 +300,7 @@
verse_tag = verse_tag.upper()
self.service_item_type = ServiceItemType.Text
title = raw_slide[:30].split(u'\n')[0]
- self._raw_frames.append(
- {u'title': title, u'raw_slide': raw_slide, u'verseTag': verse_tag})
+ self._raw_frames.append({u'title': title, u'raw_slide': raw_slide, u'verseTag': verse_tag})
self._new_item()
def add_from_command(self, path, file_name, image):
@@ -323,8 +317,7 @@
The command of/for the slide.
"""
self.service_item_type = ServiceItemType.Command
- self._raw_frames.append(
- {u'title': file_name, u'image': image, u'path': path})
+ self._raw_frames.append({u'title': file_name, u'image': image, u'path': path})
self._new_item()
def get_service_repr(self, lite_save):
@@ -360,15 +353,12 @@
elif self.service_item_type == ServiceItemType.Image:
if lite_save:
for slide in self._raw_frames:
- service_data.append(
- {u'title': slide[u'title'], u'path': slide[u'path']})
+ service_data.append({u'title': slide[u'title'], u'path': slide[u'path']})
else:
service_data = [slide[u'title'] for slide in self._raw_frames]
elif self.service_item_type == ServiceItemType.Command:
for slide in self._raw_frames:
- service_data.append(
- {u'title': slide[u'title'], u'image': slide[u'image'],
- u'path': slide[u'path']})
+ service_data.append({u'title': slide[u'title'], u'image': slide[u'image'], u'path': slide[u'path']})
return {u'header': service_header, u'data': service_data}
def set_from_service(self, serviceitem, path=None):
@@ -421,17 +411,13 @@
self.add_from_image(filename, text_image)
else:
for text_image in serviceitem[u'serviceitem'][u'data']:
- self.add_from_image(text_image[u'path'],
- text_image[u'title'])
+ self.add_from_image(text_image[u'path'], text_image[u'title'])
elif self.service_item_type == ServiceItemType.Command:
for text_image in serviceitem[u'serviceitem'][u'data']:
if path:
- self.add_from_command(
- path, text_image[u'title'], text_image[u'image'])
+ self.add_from_command(path, text_image[u'title'], text_image[u'image'])
else:
- self.add_from_command(
- text_image[u'path'], text_image[u'title'],
- text_image[u'image'])
+ self.add_from_command(text_image[u'path'], text_image[u'title'], text_image[u'image'])
self._new_item()
@@ -505,8 +491,7 @@
"""
Confirms if the ServiceItem uses a file
"""
- return self.service_item_type == ServiceItemType.Image or \
- self.service_item_type == ServiceItemType.Command
+ return self.service_item_type == ServiceItemType.Image or self.service_item_type == ServiceItemType.Command
def is_text(self):
"""
@@ -573,7 +558,7 @@
def remove_frame(self, frame):
"""
- Remove the soecified frame from the item
+ Remove the specified frame from the item
"""
if frame in self._raw_frames:
self._raw_frames.remove(frame)
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2012-12-07 18:56:33 +0000
+++ openlp/core/ui/servicemanager.py 2012-12-10 18:08:26 +0000
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
@@ -39,17 +39,14 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, \
- ItemCapabilities, SettingsManager, translate, str_to_bool, \
- check_directory_exists
+from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, ItemCapabilities, SettingsManager, \
+ translate, str_to_bool, check_directory_exists
from openlp.core.lib.theme import ThemeLevel
from openlp.core.lib.settings import Settings
-from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
- create_widget_action, find_and_set_in_combo_box
+from openlp.core.lib.ui import UiStrings, critical_error_message_box, create_widget_action, find_and_set_in_combo_box
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm
from openlp.core.ui.printserviceform import PrintServiceForm
-from openlp.core.utils import AppLocation, delete_file, split_filename, \
- format_time
+from openlp.core.utils import AppLocation, delete_file, split_filename, format_time
from openlp.core.utils.actions import ActionList, CategoryOrder
class ServiceManagerList(QtGui.QTreeWidget):
@@ -127,30 +124,21 @@
self.layout.setMargin(0)
# Create the top toolbar
self.toolbar = OpenLPToolbar(self)
- self.toolbar.addToolbarAction(u'newService',
- text=UiStrings().NewService, icon=u':/general/general_new.png',
- tooltip=UiStrings().CreateService,
- triggers=self.onNewServiceClicked)
- self.toolbar.addToolbarAction(u'openService',
- text=UiStrings().OpenService, icon=u':/general/general_open.png',
- tooltip=translate('OpenLP.ServiceManager',
- 'Load an existing service.'), triggers=self.onLoadServiceClicked)
- self.toolbar.addToolbarAction(u'saveService',
- text=UiStrings().SaveService, icon=u':/general/general_save.png',
- tooltip=translate('OpenLP.ServiceManager', 'Save this service.'),
- triggers=self.decideSaveMethod)
+ self.toolbar.addToolbarAction(u'newService', text=UiStrings().NewService, icon=u':/general/general_new.png',
+ tooltip=UiStrings().CreateService, triggers=self.onNewServiceClicked)
+ self.toolbar.addToolbarAction(u'openService', text=UiStrings().OpenService, icon=u':/general/general_open.png',
+ tooltip=translate('OpenLP.ServiceManager', 'Load an existing service.'), triggers=self.onLoadServiceClicked)
+ self.toolbar.addToolbarAction(u'saveService', text=UiStrings().SaveService, icon=u':/general/general_save.png',
+ tooltip=translate('OpenLP.ServiceManager', 'Save this service.'), triggers=self.decideSaveMethod)
self.toolbar.addSeparator()
self.themeLabel = QtGui.QLabel(u'%s:' % UiStrings().Theme, self)
self.themeLabel.setMargin(3)
self.themeLabel.setObjectName(u'themeLabel')
self.toolbar.addToolbarWidget(self.themeLabel)
self.themeComboBox = QtGui.QComboBox(self.toolbar)
- self.themeComboBox.setToolTip(translate('OpenLP.ServiceManager',
- 'Select a theme for the service.'))
- self.themeComboBox.setSizeAdjustPolicy(
- QtGui.QComboBox.AdjustToMinimumContentsLength)
- self.themeComboBox.setSizePolicy(
- QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
+ self.themeComboBox.setToolTip(translate('OpenLP.ServiceManager', 'Select a theme for the service.'))
+ self.themeComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
+ self.themeComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.themeComboBox.setObjectName(u'themeComboBox')
self.toolbar.addToolbarWidget(self.themeComboBox)
self.toolbar.setObjectName(u'toolbar')
@@ -161,15 +149,12 @@
QtGui.QAbstractItemView.CurrentChanged |
QtGui.QAbstractItemView.DoubleClicked |
QtGui.QAbstractItemView.EditKeyPressed)
- self.serviceManagerList.setDragDropMode(
- QtGui.QAbstractItemView.DragDrop)
+ self.serviceManagerList.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
self.serviceManagerList.setAlternatingRowColors(True)
self.serviceManagerList.setHeaderHidden(True)
self.serviceManagerList.setExpandsOnDoubleClick(False)
- self.serviceManagerList.setContextMenuPolicy(
- QtCore.Qt.CustomContextMenu)
- QtCore.QObject.connect(self.serviceManagerList,
- QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
+ self.serviceManagerList.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
+ QtCore.QObject.connect(self.serviceManagerList, QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
self.contextMenu)
self.serviceManagerList.setObjectName(u'serviceManagerList')
# enable drop
@@ -182,54 +167,37 @@
action_list = ActionList.get_instance()
action_list.add_category(
unicode(UiStrings().Service), CategoryOrder.standardToolbar)
- self.serviceManagerList.moveTop = self.orderToolbar.addToolbarAction(
- u'moveTop', text=translate('OpenLP.ServiceManager', 'Move to &top'),
- icon=u':/services/service_top.png', tooltip=translate(
- 'OpenLP.ServiceManager', 'Move item to the top of the service.'),
- shortcuts=[QtCore.Qt.Key_Home], category=UiStrings().Service,
- triggers=self.onServiceTop)
- self.serviceManagerList.moveUp = self.orderToolbar.addToolbarAction(
- u'moveUp', text=translate('OpenLP.ServiceManager', 'Move &up'),
- icon=u':/services/service_up.png',
- tooltip=translate('OpenLP.ServiceManager',
- 'Move item up one position in the service.'),
- shortcuts=[QtCore.Qt.Key_PageUp], category=UiStrings().Service,
- triggers=self.onServiceUp)
- self.serviceManagerList.moveDown = self.orderToolbar.addToolbarAction(
- u'moveDown', text=translate('OpenLP.ServiceManager', 'Move &down'),
- icon=u':/services/service_down.png',
- tooltip=translate('OpenLP.ServiceManager',
- 'Move item down one position in the service.'),
- shortcuts=[QtCore.Qt.Key_PageDown], category=UiStrings().Service,
- triggers=self.onServiceDown)
- self.serviceManagerList.moveBottom = self.orderToolbar.addToolbarAction(
- u'moveBottom',
- text=translate('OpenLP.ServiceManager', 'Move to &bottom'),
- icon=u':/services/service_bottom.png', tooltip=translate(
- 'OpenLP.ServiceManager', 'Move item to the end of the service.'),
- shortcuts=[QtCore.Qt.Key_End], category=UiStrings().Service,
- triggers=self.onServiceEnd)
- self.serviceManagerList.down = self.orderToolbar.addToolbarAction(
- u'down', text=translate('OpenLP.ServiceManager', 'Move &down'),
- tooltip=translate('OpenLP.ServiceManager',
- 'Moves the selection down the window.'), visible=False,
- shortcuts=[QtCore.Qt.Key_Down], triggers=self.onMoveSelectionDown)
+ self.serviceManagerList.moveTop = self.orderToolbar.addToolbarAction(u'moveTop',
+ text=translate('OpenLP.ServiceManager', 'Move to &top'), icon=u':/services/service_top.png',
+ tooltip=translate('OpenLP.ServiceManager', 'Move item to the top of the service.'),
+ shortcuts=[QtCore.Qt.Key_Home], category=UiStrings().Service, triggers=self.onServiceTop)
+ self.serviceManagerList.moveUp = self.orderToolbar.addToolbarAction(u'moveUp',
+ text=translate('OpenLP.ServiceManager', 'Move &up'), icon=u':/services/service_up.png',
+ tooltip=translate('OpenLP.ServiceManager', 'Move item up one position in the service.'),
+ shortcuts=[QtCore.Qt.Key_PageUp], category=UiStrings().Service, triggers=self.onServiceUp)
+ self.serviceManagerList.moveDown = self.orderToolbar.addToolbarAction(u'moveDown',
+ text=translate('OpenLP.ServiceManager', 'Move &down'), icon=u':/services/service_down.png',
+ tooltip=translate('OpenLP.ServiceManager', 'Move item down one position in the service.'),
+ shortcuts=[QtCore.Qt.Key_PageDown], category=UiStrings().Service, triggers=self.onServiceDown)
+ self.serviceManagerList.moveBottom = self.orderToolbar.addToolbarAction(u'moveBottom',
+ text=translate('OpenLP.ServiceManager', 'Move to &bottom'), icon=u':/services/service_bottom.png',
+ tooltip=translate('OpenLP.ServiceManager', 'Move item to the end of the service.'),
+ shortcuts=[QtCore.Qt.Key_End], category=UiStrings().Service, triggers=self.onServiceEnd)
+ self.serviceManagerList.down = self.orderToolbar.addToolbarAction(u'down',
+ text=translate('OpenLP.ServiceManager', 'Move &down'), tooltip=translate('OpenLP.ServiceManager',
+ 'Moves the selection down the window.'), visible=False, shortcuts=[QtCore.Qt.Key_Down],
+ triggers=self.onMoveSelectionDown)
action_list.add_action(self.serviceManagerList.down)
- self.serviceManagerList.up = self.orderToolbar.addToolbarAction(
- u'up', text=translate('OpenLP.ServiceManager', 'Move up'),
- tooltip=translate('OpenLP.ServiceManager',
- 'Moves the selection up the window.'), visible=False,
- shortcuts=[QtCore.Qt.Key_Up], triggers=self.onMoveSelectionUp)
+ self.serviceManagerList.up = self.orderToolbar.addToolbarAction(u'up',
+ text=translate('OpenLP.ServiceManager', 'Move up'), tooltip=translate('OpenLP.ServiceManager',
+ 'Moves the selection up the window.'), visible=False, shortcuts=[QtCore.Qt.Key_Up],
+ triggers=self.onMoveSelectionUp)
action_list.add_action(self.serviceManagerList.up)
self.orderToolbar.addSeparator()
- self.serviceManagerList.delete = self.orderToolbar.addToolbarAction(
- u'delete',
- text=translate('OpenLP.ServiceManager', '&Delete From Service'),
- icon=u':/general/general_delete.png',
- tooltip=translate('OpenLP.ServiceManager',
- 'Delete the selected item from the service.'),
- shortcuts=[QtCore.Qt.Key_Delete],
- triggers=self.onDeleteFromService)
+ self.serviceManagerList.delete = self.orderToolbar.addToolbarAction(u'delete',
+ text=translate('OpenLP.ServiceManager', '&Delete From Service'), icon=u':/general/general_delete.png',
+ tooltip=translate('OpenLP.ServiceManager', 'Delete the selected item from the service.'),
+ shortcuts=[QtCore.Qt.Key_Delete], triggers=self.onDeleteFromService)
self.orderToolbar.addSeparator()
self.serviceManagerList.expand = self.orderToolbar.addToolbarAction(
u'expand', text=translate('OpenLP.ServiceManager', '&Expand all'),
@@ -237,52 +205,35 @@
'OpenLP.ServiceManager', 'Expand all the service items.'),
shortcuts=[QtCore.Qt.Key_Plus], category=UiStrings().Service,
triggers=self.onExpandAll)
- self.serviceManagerList.collapse = self.orderToolbar.addToolbarAction(
- u'collapse',
- text=translate('OpenLP.ServiceManager', '&Collapse all'),
- icon=u':/services/service_collapse_all.png', tooltip=translate(
- 'OpenLP.ServiceManager', 'Collapse all the service items.'),
- shortcuts=[QtCore.Qt.Key_Minus], category=UiStrings().Service,
- triggers=self.onCollapseAll)
+ self.serviceManagerList.collapse = self.orderToolbar.addToolbarAction(u'collapse',
+ text=translate('OpenLP.ServiceManager', '&Collapse all'), icon=u':/services/service_collapse_all.png',
+ tooltip=translate('OpenLP.ServiceManager', 'Collapse all the service items.'),
+ shortcuts=[QtCore.Qt.Key_Minus], category=UiStrings().Service, triggers=self.onCollapseAll)
self.orderToolbar.addSeparator()
- self.serviceManagerList.makeLive = self.orderToolbar.addToolbarAction(
- u'makeLive', text=translate('OpenLP.ServiceManager', 'Go Live'),
- icon=u':/general/general_live.png', tooltip=translate(
- 'OpenLP.ServiceManager', 'Send the selected item to Live.'),
- shortcuts=[QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return],
- category=UiStrings().Service, triggers=self.makeLive)
+ self.serviceManagerList.makeLive = self.orderToolbar.addToolbarAction(u'makeLive',
+ text=translate('OpenLP.ServiceManager', 'Go Live'), icon=u':/general/general_live.png',
+ tooltip=translate('OpenLP.ServiceManager', 'Send the selected item to Live.'),
+ shortcuts=[QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return], category=UiStrings().Service, triggers=self.makeLive)
self.layout.addWidget(self.orderToolbar)
# Connect up our signals and slots
- QtCore.QObject.connect(self.themeComboBox,
- QtCore.SIGNAL(u'activated(int)'), self.onThemeComboBoxSelected)
- QtCore.QObject.connect(self.serviceManagerList,
- QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onMakeLive)
- QtCore.QObject.connect(self.serviceManagerList,
- QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'), self.collapsed)
- QtCore.QObject.connect(self.serviceManagerList,
- QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'), self.expanded)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'servicemanager_preview_live'), self.previewLive)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'servicemanager_next_item'), self.nextItem)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'servicemanager_previous_item'), self.previousItem)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'servicemanager_set_item'), self.onSetItem)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'config_updated'), self.configUpdated)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'config_screen_changed'),
+ QtCore.QObject.connect(self.themeComboBox, QtCore.SIGNAL(u'activated(int)'), self.onThemeComboBoxSelected)
+ QtCore.QObject.connect(self.serviceManagerList, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onMakeLive)
+ QtCore.QObject.connect(self.serviceManagerList, QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'),
+ self.collapsed)
+ QtCore.QObject.connect(self.serviceManagerList, QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'), self.expanded)
+ QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
+ QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_preview_live'), self.previewLive)
+ QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_next_item'), self.nextItem)
+ QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_previous_item'),
+ self.previousItem)
+ QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_set_item'), self.onSetItem)
+ QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configUpdated)
+ QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'),
self.regenerateServiceItems)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'theme_update_global'), self.themeChange)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'service_item_update'), self.serviceItemUpdate)
+ QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_global'), self.themeChange)
+ QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'service_item_update'), self.serviceItemUpdate)
# Last little bits of setting up
- self.service_theme = unicode(Settings().value(
- self.mainwindow.serviceManagerSettingsSection + u'/service theme',
+ self.service_theme = unicode(Settings().value(self.mainwindow.serviceManagerSettingsSection + u'/service theme',
QtCore.QVariant(u'')).toString())
self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
# build the drag and drop context menu
@@ -295,34 +246,25 @@
self.addToAction.setIcon(build_icon(u':/general/general_edit.png'))
# build the context menu
self.menu = QtGui.QMenu()
- self.editAction = create_widget_action(self.menu,
- text=translate('OpenLP.ServiceManager', '&Edit Item'),
+ self.editAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Edit Item'),
icon=u':/general/general_edit.png', triggers=self.remoteEdit)
- self.maintainAction = create_widget_action(self.menu,
- text=translate('OpenLP.ServiceManager', '&Reorder Item'),
- icon=u':/general/general_edit.png',
- triggers=self.onServiceItemEditForm)
- self.notesAction = create_widget_action(self.menu,
- text=translate('OpenLP.ServiceManager', '&Notes'),
- icon=u':/services/service_notes.png',
- triggers=self.onServiceItemNoteForm)
- self.timeAction = create_widget_action(self.menu,
- text=translate('OpenLP.ServiceManager', '&Start Time'),
+ self.maintainAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Reorder Item'),
+ icon=u':/general/general_edit.png', triggers=self.onServiceItemEditForm)
+ self.notesAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Notes'),
+ icon=u':/services/service_notes.png', triggers=self.onServiceItemNoteForm)
+ self.timeAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Start Time'),
icon=u':/media/media_time.png', triggers=self.onStartTimeForm)
- self.autoStartAction = create_widget_action(self.menu,
- text=u'',
+ self.autoStartAction = create_widget_action(self.menu, text=u'',
icon=u':/media/auto-start_active.png', triggers=self.onAutoStart)
# Add already existing delete action to the menu.
self.menu.addAction(self.serviceManagerList.delete)
self.menu.addSeparator()
- self.previewAction = create_widget_action(self.menu,
- text=translate('OpenLP.ServiceManager', 'Show &Preview'),
+ self.previewAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', 'Show &Preview'),
icon=u':/general/general_preview.png', triggers=self.makePreview)
# Add already existing make live action to the menu.
self.menu.addAction(self.serviceManagerList.makeLive)
self.menu.addSeparator()
- self.themeMenu = QtGui.QMenu(
- translate('OpenLP.ServiceManager', '&Change Item Theme'))
+ self.themeMenu = QtGui.QMenu(translate('OpenLP.ServiceManager', '&Change Item Theme'))
self.menu.addMenu(self.themeMenu)
self.serviceManagerList.addActions(
[self.serviceManagerList.moveDown,
@@ -345,8 +287,7 @@
if modified:
self.serviceId += 1
self._modified = modified
- serviceFile = self.shortFileName() or translate(
- 'OpenLP.ServiceManager', 'Untitled Service')
+ serviceFile = self.shortFileName() or translate('OpenLP.ServiceManager', 'Untitled Service')
self.mainwindow.setServiceModified(modified, serviceFile)
def isModified(self):
@@ -362,8 +303,7 @@
self._fileName = unicode(fileName)
self.mainwindow.setServiceModified(self.isModified(),
self.shortFileName())
- Settings(). \
- setValue(u'servicemanager/last file',QtCore.QVariant(fileName))
+ Settings().setValue(u'servicemanager/last file',QtCore.QVariant(fileName))
self._saveLite = True if self._fileName.endswith(u'.oszl') else False
def fileName(self):
@@ -382,9 +322,7 @@
"""
Triggered when Config dialog is updated.
"""
- self.expandTabs = Settings().value(
- u'advanced/expand service item',
- QtCore.QVariant(u'False')).toBool()
+ self.expandTabs = Settings().value(u'advanced/expand service item', QtCore.QVariant(u'False')).toBool()
def resetSupportedSuffixes(self):
"""
@@ -432,29 +370,23 @@
elif result == QtGui.QMessageBox.Save:
self.decideSaveMethod()
if not loadFile:
- fileName = unicode(QtGui.QFileDialog.getOpenFileName(
- self.mainwindow,
+ fileName = unicode(QtGui.QFileDialog.getOpenFileName(self.mainwindow,
translate('OpenLP.ServiceManager', 'Open File'),
- SettingsManager.get_last_dir(
- self.mainwindow.serviceManagerSettingsSection),
- translate('OpenLP.ServiceManager',
- 'OpenLP Service Files (*.osz *.oszl)')))
+ SettingsManager.get_last_dir(self.mainwindow.serviceManagerSettingsSection),
+ translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz *.oszl)')))
if not fileName:
return False
else:
fileName = loadFile
- SettingsManager.set_last_dir(
- self.mainwindow.serviceManagerSettingsSection,
- split_filename(fileName)[0])
+ SettingsManager.set_last_dir(self.mainwindow.serviceManagerSettingsSection, split_filename(fileName)[0])
self.loadFile(fileName)
def saveModifiedService(self):
return QtGui.QMessageBox.question(self.mainwindow,
translate('OpenLP.ServiceManager', 'Modified Service'),
- translate('OpenLP.ServiceManager', 'The current service has '
- 'been modified. Would you like to save this service?'),
- QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard |
- QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
+ translate('OpenLP.ServiceManager',
+ 'The current service has been modified. Would you like to save this service?'),
+ QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard | QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
def onRecentServiceClicked(self):
sender = self.sender()
@@ -469,8 +401,7 @@
self.setFileName(u'')
self.serviceId += 1
self.setModified(False)
- Settings(). \
- setValue(u'servicemanager/last file',QtCore.QVariant(u''))
+ Settings().setValue(u'servicemanager/last file',QtCore.QVariant(u''))
Receiver.send_message(u'servicemanager_new_service')
def saveFile(self):
@@ -518,16 +449,12 @@
write_list.append(path_from)
if missing_list:
Receiver.send_message(u'cursor_normal')
- title = unicode(translate('OpenLP.ServiceManager',
- 'Service File(s) Missing'))
+ title = unicode(translate('OpenLP.ServiceManager', 'Service File(s) Missing'))
message = unicode(translate('OpenLP.ServiceManager',
'The following file(s) in the service are missing:\n\t%s\n\n'
- 'These files will be removed if you continue to save.')
- ) % "\n\t".join(missing_list)
- answer = QtGui.QMessageBox.critical(self, title,
- message,
- QtGui.QMessageBox.StandardButtons(
- QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel))
+ 'These files will be removed if you continue to save.')) % "\n\t".join(missing_list)
+ answer = QtGui.QMessageBox.critical(self, title, message,
+ QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel))
if answer == QtGui.QMessageBox.Cancel:
self.mainwindow.finishedProgressBar()
return False
@@ -546,16 +473,14 @@
new_file = os.path.join(u'audio',
item[u'service_item']._uuid, filename)
audio_files.append((filename, new_file))
- service_item[u'header'][u'background_audio'][i] = \
- new_file
+ service_item[u'header'][u'background_audio'][i] = new_file
# Add the service item to the service.
service.append({u'serviceitem': service_item})
self.repaintServiceList(-1, -1)
for file in write_list:
file_size = os.path.getsize(file)
total_size += file_size
- log.debug(u'ServiceManager.saveFile - ZIP contents size is %i bytes' %
- total_size)
+ log.debug(u'ServiceManager.saveFile - ZIP contents size is %i bytes' % total_size)
service_content = cPickle.dumps(service)
# Usual Zip file cannot exceed 2GiB, file with Zip64 cannot be
# extracted using unzip in UNIX.
@@ -565,8 +490,7 @@
success = True
self.mainwindow.incrementProgressBar()
try:
- zip = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED,
- allow_zip_64)
+ zip = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED, allow_zip_64)
# First we add service contents.
# We save ALL filenames into ZIP using UTF-8.
zip.writestr(service_file_name.encode(u'utf-8'), service_content)
@@ -589,10 +513,8 @@
except IOError:
log.exception(u'Failed to save service to disk: %s', temp_file_name)
Receiver.send_message(u'openlp_error_message', {
- u'title': translate(u'OpenLP.ServiceManager',
- u'Error Saving File'),
- u'message': translate(u'OpenLP.ServiceManager',
- u'There was an error saving your file.')
+ u'title': translate(u'OpenLP.ServiceManager', u'Error Saving File'),
+ u'message': translate(u'OpenLP.ServiceManager', u'There was an error saving your file.')
})
success = False
finally:
@@ -630,17 +552,14 @@
basename = os.path.splitext(file_name)[0]
service_file_name = '%s.osd' % basename
log.debug(u'ServiceManager.saveFile - %s', path_file_name)
- SettingsManager.set_last_dir(
- self.mainwindow.serviceManagerSettingsSection,
- path)
+ SettingsManager.set_last_dir(self.mainwindow.serviceManagerSettingsSection, path)
service = []
Receiver.send_message(u'cursor_busy')
# Number of items + 1 to zip it
self.mainwindow.displayProgressBar(len(self.serviceItems) + 1)
for item in self.serviceItems:
self.mainwindow.incrementProgressBar()
- service_item = item[u'service_item']. \
- get_service_repr(self._saveLite)
+ service_item = item[u'service_item'].get_service_repr(self._saveLite)
#@todo check for file item on save.
service.append({u'serviceitem': service_item})
self.mainwindow.incrementProgressBar()
@@ -656,10 +575,8 @@
except IOError:
log.exception(u'Failed to save service to disk: %s', temp_file_name)
Receiver.send_message(u'openlp_error_message', {
- u'title': translate(u'OpenLP.ServiceManager',
- u'Error Saving File'),
- u'message': translate(u'OpenLP.ServiceManager',
- u'There was an error saving your file.')
+ u'title': translate(u'OpenLP.ServiceManager', u'Error Saving File'),
+ u'message': translate(u'OpenLP.ServiceManager', u'There was an error saving your file.')
})
success = False
finally:
@@ -682,50 +599,39 @@
Get a file name and then call :func:`ServiceManager.saveFile` to
save the file.
"""
- default_service_enabled = Settings().value(
- u'advanced/default service enabled', QtCore.QVariant(True)).toBool()
+ default_service_enabled = Settings().value(u'advanced/default service enabled', QtCore.QVariant(True)).toBool()
if default_service_enabled:
- service_day = Settings().value(
- u'advanced/default service day', 7).toInt()[0]
+ service_day = Settings().value(u'advanced/default service day', 7).toInt()[0]
if service_day == 7:
local_time = datetime.now()
else:
- service_hour = Settings().value(
- u'advanced/default service hour', 11).toInt()[0]
- service_minute = Settings().value(
- u'advanced/default service minute', 0).toInt()[0]
+ service_hour = Settings().value(u'advanced/default service hour', 11).toInt()[0]
+ service_minute = Settings().value(u'advanced/default service minute', 0).toInt()[0]
now = datetime.now()
day_delta = service_day - now.weekday()
if day_delta < 0:
day_delta += 7
time = now + timedelta(days=day_delta)
local_time = time.replace(hour=service_hour, minute=service_minute)
- default_pattern = unicode(Settings().value(
- u'advanced/default service name',
+ default_pattern = unicode(Settings().value(u'advanced/default service name',
translate('OpenLP.AdvancedTab', 'Service %Y-%m-%d %H-%M',
'This may not contain any of the following characters: '
'/\\?*|<>\[\]":+\nSee http://docs.python.org/library/'
- 'datetime.html#strftime-strptime-behavior for more '
- 'information.')).toString())
+ 'datetime.html#strftime-strptime-behavior for more information.')).toString())
default_filename = format_time(default_pattern, local_time)
else:
default_filename = u''
- directory = unicode(SettingsManager.get_last_dir(
- self.mainwindow.serviceManagerSettingsSection))
+ directory = unicode(SettingsManager.get_last_dir(self.mainwindow.serviceManagerSettingsSection))
path = os.path.join(directory, default_filename)
# SaveAs from osz to oszl is not valid as the files will be deleted
# on exit which is not sensible or usable in the long term.
if self._fileName.endswith(u'oszl') or not self._fileName:
- fileName = unicode(QtGui.QFileDialog.getSaveFileName(
- self.mainwindow, UiStrings().SaveService, path,
+ fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager',
- 'OpenLP Service Files (*.osz);;'
- 'OpenLP Service Files - lite (*.oszl)')))
+ 'OpenLP Service Files (*.osz);; OpenLP Service Files - lite (*.oszl)')))
else:
- fileName = unicode(QtGui.QFileDialog.getSaveFileName(
- self.mainwindow, UiStrings().SaveService, path,
- translate('OpenLP.ServiceManager',
- 'OpenLP Service Files (*.osz);;')))
+ fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow, UiStrings().SaveService, path,
+ translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz);;')))
if not fileName:
return False
if os.path.splitext(fileName)[1] == u'':
@@ -764,12 +670,9 @@
try:
ucsfile = zipinfo.filename.decode(u'utf-8')
except UnicodeDecodeError:
- log.exception(u'Filename "%s" is not valid UTF-8' %
- zipinfo.filename.decode(u'utf-8', u'replace'))
- critical_error_message_box(
- message=translate('OpenLP.ServiceManager',
- 'File is not a valid service.\n'
- 'The content encoding is not UTF-8.'))
+ log.exception(u'Filename "%s" is not valid UTF-8' % zipinfo.filename.decode(u'utf-8', u'replace'))
+ critical_error_message_box(message=translate('OpenLP.ServiceManager',
+ 'File is not a valid service.\n The content encoding is not UTF-8.'))
continue
osfile = ucsfile.replace(u'/', os.path.sep)
if not osfile.startswith(u'audio'):
@@ -798,8 +701,7 @@
self.validateItem(serviceItem)
self.load_item_uuid = 0
if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate):
- Receiver.send_message(u'%s_service_load' %
- serviceItem.name.lower(), serviceItem)
+ Receiver.send_message(u'%s_service_load' % serviceItem.name.lower(), serviceItem)
# if the item has been processed
if serviceItem._uuid == self.load_item_uuid:
serviceItem.edit_id = int(self.load_item_edit_id)
@@ -808,32 +710,25 @@
delete_file(p_file)
self.mainwindow.addRecentFile(fileName)
self.setModified(False)
- Settings().setValue(
- 'servicemanager/last file', QtCore.QVariant(fileName))
+ Settings().setValue(u'servicemanager/last file', QtCore.QVariant(fileName))
else:
- critical_error_message_box(
- message=translate('OpenLP.ServiceManager',
- 'File is not a valid service.'))
+ critical_error_message_box(message=translate('OpenLP.ServiceManager', 'File is not a valid service.'))
log.exception(u'File contains no service data')
except (IOError, NameError, zipfile.BadZipfile):
log.exception(u'Problem loading service file %s' % fileName)
- critical_error_message_box(
- message=translate('OpenLP.ServiceManager',
+ critical_error_message_box(message=translate('OpenLP.ServiceManager',
'File could not be opened because it is corrupt.'))
except zipfile.BadZipfile:
if os.path.getsize(fileName) == 0:
log.exception(u'Service file is zero sized: %s' % fileName)
- QtGui.QMessageBox.information(self,
- translate('OpenLP.ServiceManager', 'Empty File'),
- translate('OpenLP.ServiceManager', 'This service file '
- 'does not contain any data.'))
+ QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Empty File'),
+ translate('OpenLP.ServiceManager', 'This service file does not contain any data.'))
else:
log.exception(u'Service file is cannot be extracted as zip: '
u'%s' % fileName)
- QtGui.QMessageBox.information(self,
- translate('OpenLP.ServiceManager', 'Corrupt File'),
- translate('OpenLP.ServiceManager', 'This file is either '
- 'corrupt or it is not an OpenLP 2.0 service file.'))
+ QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'),
+ translate('OpenLP.ServiceManager',
+ 'This file is either corrupt or it is not an OpenLP 2 service file.'))
return
finally:
if fileTo:
@@ -850,8 +745,7 @@
service was last closed. Can be blank if there was no service
present.
"""
- fileName = Settings(). \
- value(u'servicemanager/last file',QtCore.QVariant(u'')).toString()
+ fileName = Settings().value(u'servicemanager/last file',QtCore.QVariant(u'')).toString()
if fileName:
self.loadFile(fileName)
@@ -869,19 +763,15 @@
self.notesAction.setVisible(False)
self.timeAction.setVisible(False)
self.autoStartAction.setVisible(False)
- if serviceItem[u'service_item'].is_capable(ItemCapabilities.CanEdit)\
- and serviceItem[u'service_item'].edit_id:
+ if serviceItem[u'service_item'].is_capable(ItemCapabilities.CanEdit) and serviceItem[u'service_item'].edit_id:
self.editAction.setVisible(True)
- if serviceItem[u'service_item']\
- .is_capable(ItemCapabilities.CanMaintain):
+ if serviceItem[u'service_item'].is_capable(ItemCapabilities.CanMaintain):
self.maintainAction.setVisible(True)
if item.parent() is None:
self.notesAction.setVisible(True)
- if serviceItem[u'service_item']\
- .is_capable(ItemCapabilities.HasVariableStartTime):
+ if serviceItem[u'service_item'].is_capable(ItemCapabilities.HasVariableStartTime):
self.timeAction.setVisible(True)
- if serviceItem[u'service_item']\
- .is_capable(ItemCapabilities.CanAutoStartForLive):
+ if serviceItem[u'service_item'].is_capable(ItemCapabilities.CanAutoStartForLive):
self.autoStartAction.setVisible(True)
self.autoStartAction.setIcon(self.inactive)
self.autoStartAction.setText(translate('OpenLP.ServiceManager','&Auto Start - inactive'))
@@ -890,15 +780,13 @@
self.autoStartAction.setIcon(self.active)
self.themeMenu.menuAction().setVisible(False)
# Set up the theme menu.
- if serviceItem[u'service_item'].is_text() and \
- self.mainwindow.renderer.theme_level == ThemeLevel.Song:
+ if serviceItem[u'service_item'].is_text() and self.mainwindow.renderer.theme_level == ThemeLevel.Song:
self.themeMenu.menuAction().setVisible(True)
# The service item does not have a theme, check the "Default".
if serviceItem[u'service_item'].theme is None:
themeAction = self.themeMenu.defaultAction()
else:
- themeAction = self.themeMenu.findChild(
- QtGui.QAction, serviceItem[u'service_item'].theme)
+ themeAction = self.themeMenu.findChild(QtGui.QAction, serviceItem[u'service_item'].theme)
if themeAction is not None:
themeAction.setChecked(True)
self.menu.exec_(self.serviceManagerList.mapToGlobal(point))
@@ -908,8 +796,7 @@
self.serviceNoteForm.textEdit.setPlainText(
self.serviceItems[item][u'service_item'].notes)
if self.serviceNoteForm.exec_():
- self.serviceItems[item][u'service_item'].notes = \
- self.serviceNoteForm.textEdit.toPlainText()
+ self.serviceItems[item][u'service_item'].notes = self.serviceNoteForm.textEdit.toPlainText()
self.repaintServiceList(item, -1)
self.setModified()
@@ -1155,22 +1042,18 @@
if serviceitem.is_valid:
if serviceitem.notes:
icon = QtGui.QImage(serviceitem.icon)
- icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio,
- QtCore.Qt.SmoothTransformation)
+ icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
overlay = QtGui.QImage(':/services/service_item_notes.png')
- overlay = overlay.scaled(80, 80, QtCore.Qt.KeepAspectRatio,
- QtCore.Qt.SmoothTransformation)
+ overlay = overlay.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
painter = QtGui.QPainter(icon)
painter.drawImage(0, 0, overlay)
painter.end()
treewidgetitem.setIcon(0, build_icon(icon))
elif serviceitem.temporary_edit:
icon = QtGui.QImage(serviceitem.icon)
- icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio,
- QtCore.Qt.SmoothTransformation)
+ icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
overlay = QtGui.QImage(':/general/general_export.png')
- overlay = overlay.scaled(40, 40, QtCore.Qt.KeepAspectRatio,
- QtCore.Qt.SmoothTransformation)
+ overlay = overlay.scaled(40, 40, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
painter = QtGui.QPainter(icon)
painter.drawImage(40, 0, overlay)
painter.end()
@@ -1178,29 +1061,23 @@
else:
treewidgetitem.setIcon(0, serviceitem.iconic_representation)
else:
- treewidgetitem.setIcon(0,
- build_icon(u':/general/general_delete.png'))
+ treewidgetitem.setIcon(0, build_icon(u':/general/general_delete.png'))
treewidgetitem.setText(0, serviceitem.get_display_title())
tips = []
if serviceitem.temporary_edit:
tips.append(u'<strong>%s:</strong> <em>%s</em>' %
(unicode(translate('OpenLP.ServiceManager', 'Edit')),
- (unicode(translate('OpenLP.ServiceManager',
- 'Service copy only')))))
+ (unicode(translate('OpenLP.ServiceManager', 'Service copy only')))))
if serviceitem.theme and serviceitem.theme != -1:
tips.append(u'<strong>%s:</strong> <em>%s</em>' %
- (unicode(translate('OpenLP.ServiceManager', 'Slide theme')),
- serviceitem.theme))
+ (unicode(translate('OpenLP.ServiceManager', 'Slide theme')), serviceitem.theme))
if serviceitem.notes:
tips.append(u'<strong>%s: </strong> %s' %
- (unicode(translate('OpenLP.ServiceManager', 'Notes')),
- cgi.escape(unicode(serviceitem.notes))))
- if item[u'service_item'] \
- .is_capable(ItemCapabilities.HasVariableStartTime):
+ (unicode(translate('OpenLP.ServiceManager', 'Notes')), cgi.escape(unicode(serviceitem.notes))))
+ if item[u'service_item'].is_capable(ItemCapabilities.HasVariableStartTime):
tips.append(item[u'service_item'].get_media_time())
treewidgetitem.setToolTip(0, u'<br>'.join(tips))
- treewidgetitem.setData(0, QtCore.Qt.UserRole,
- QtCore.QVariant(item[u'order']))
+ treewidgetitem.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(item[u'order']))
treewidgetitem.setSelected(item[u'selected'])
# Add the children to their parent treewidgetitem.
for count, frame in enumerate(serviceitem.get_frames()):
@@ -1245,9 +1122,7 @@
log.debug(u'onThemeComboBoxSelected')
self.service_theme = unicode(self.themeComboBox.currentText())
self.mainwindow.renderer.set_service_theme(self.service_theme)
- Settings().setValue(
- self.mainwindow.serviceManagerSettingsSection +
- u'/service theme',
+ Settings().setValue(self.mainwindow.serviceManagerSettingsSection + u'/service theme',
QtCore.QVariant(self.service_theme))
self.regenerateServiceItems(True)
@@ -1273,8 +1148,7 @@
if self.serviceItems:
for item in self.serviceItems:
item[u'selected'] = False
- serviceIterator = QtGui.QTreeWidgetItemIterator(
- self.serviceManagerList)
+ serviceIterator = QtGui.QTreeWidgetItemIterator(self.serviceManagerList)
selectedItem = None
while serviceIterator.value():
if serviceIterator.value().isSelected():
@@ -1284,17 +1158,15 @@
if selectedItem.parent() is None:
pos = selectedItem.data(0, QtCore.Qt.UserRole).toInt()[0]
else:
- pos = selectedItem.parent().data(0, QtCore.Qt.UserRole). \
- toInt()[0]
+ pos = selectedItem.parent().data(0, QtCore.Qt.UserRole).toInt()[0]
self.serviceItems[pos - 1][u'selected'] = True
tempServiceItems = self.serviceItems
self.serviceManagerList.clear()
self.serviceItems = []
self.isNew = True
for item in tempServiceItems:
- self.addServiceItem(
- item[u'service_item'], False, expand=item[u'expanded'],
- repaint=False, selected=item[u'selected'])
+ self.addServiceItem(item[u'service_item'], False, expand=item[u'expanded'], repaint=False,
+ selected=item[u'selected'])
# Set to False as items may have changed rendering
# does not impact the saved song so True may also be valid
if changed:
@@ -1318,18 +1190,15 @@
if found.
"""
for itemcount, item in enumerate(self.serviceItems):
- if item[u'service_item'].edit_id == newItem.edit_id and \
- item[u'service_item'].name == newItem.name:
+ if item[u'service_item'].edit_id == newItem.edit_id and item[u'service_item'].name == newItem.name:
newItem.render()
newItem.merge(item[u'service_item'])
item[u'service_item'] = newItem
self.repaintServiceList(itemcount + 1, 0)
- self.mainwindow.liveController.replaceServiceManagerItem(
- newItem)
+ self.mainwindow.liveController.replaceServiceManagerItem(newItem)
self.setModified()
- def addServiceItem(self, item, rebuild=False, expand=None, replace=False,
- repaint=True, selected=False):
+ def addServiceItem(self, item, rebuild=False, expand=None, replace=False, repaint=True, selected=False):
"""
Add a Service item to the list
@@ -1385,10 +1254,9 @@
self.mainwindow.previewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], child)
else:
- critical_error_message_box(
- translate('OpenLP.ServiceManager', 'Missing Display Handler'),
- translate('OpenLP.ServiceManager', 'Your item cannot be '
- 'displayed as there is no handler to display it'))
+ critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
+ translate('OpenLP.ServiceManager',
+ 'Your item cannot be displayed as there is no handler to display it'))
Receiver.send_message(u'cursor_normal')
def getServiceItem(self):
@@ -1431,17 +1299,13 @@
QtCore.QVariant(False)).toBool():
item += 1
if self.serviceItems and item < len(self.serviceItems) and \
- self.serviceItems[item][u'service_item'].is_capable(
- ItemCapabilities.CanPreview):
- self.mainwindow.previewController.addServiceManagerItem(
- self.serviceItems[item][u'service_item'], 0)
+ self.serviceItems[item][u'service_item'].is_capable(ItemCapabilities.CanPreview):
+ self.mainwindow.previewController.addServiceManagerItem(self.serviceItems[item][u'service_item'], 0)
self.mainwindow.liveController.previewListWidget.setFocus()
else:
- critical_error_message_box(
- translate('OpenLP.ServiceManager', 'Missing Display Handler'),
- translate('OpenLP.ServiceManager', 'Your item cannot be '
- 'displayed as the plugin required to display it is missing '
- 'or inactive'))
+ critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
+ translate('OpenLP.ServiceManager',
+ 'Your item cannot be displayed as the plugin required to display it is missing or inactive'))
Receiver.send_message(u'cursor_normal')
def remoteEdit(self):
@@ -1449,10 +1313,8 @@
Posts a remote edit message to a plugin to allow item to be edited.
"""
item = self.findServiceItem()[0]
- if self.serviceItems[item][u'service_item']\
- .is_capable(ItemCapabilities.CanEdit):
- Receiver.send_message(u'%s_edit' %
- self.serviceItems[item][u'service_item'].name.lower(),
+ if self.serviceItems[item][u'service_item'].is_capable(ItemCapabilities.CanEdit):
+ Receiver.send_message(u'%s_edit' % self.serviceItems[item][u'service_item'].name.lower(),
u'L:%s' % self.serviceItems[item][u'service_item'].edit_id)
def findServiceItem(self):
@@ -1537,8 +1399,7 @@
pos = self._getParentItemData(item) - 1
serviceItem = self.serviceItems[pos]
if (plugin == serviceItem[u'service_item'].name and
- serviceItem[u'service_item'].is_capable(
- ItemCapabilities.CanAppend)):
+ serviceItem[u'service_item'].is_capable(ItemCapabilities.CanAppend)):
action = self.dndMenu.exec_(QtGui.QCursor.pos())
# New action required
if action == self.newAction:
@@ -1567,16 +1428,15 @@
themeGroup.setObjectName(u'themeGroup')
# Create a "Default" theme, which allows the user to reset the item's
# theme to the service theme or global theme.
- defaultTheme = create_widget_action(self.themeMenu,
- text=UiStrings().Default, checked=False,
+ defaultTheme = create_widget_action(self.themeMenu, text=UiStrings().Default, checked=False,
triggers=self.onThemeChangeAction)
self.themeMenu.setDefaultAction(defaultTheme)
themeGroup.addAction(defaultTheme)
self.themeMenu.addSeparator()
for theme in theme_list:
self.themeComboBox.addItem(theme)
- themeGroup.addAction(create_widget_action(self.themeMenu, theme,
- text=theme, checked=False, triggers=self.onThemeChangeAction))
+ themeGroup.addAction(create_widget_action(self.themeMenu, theme, text=theme, checked=False,
+ triggers=self.onThemeChangeAction))
find_and_set_in_combo_box(self.themeComboBox, self.service_theme)
self.mainwindow.renderer.set_service_theme(self.service_theme)
self.regenerateServiceItems()
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2012-12-07 19:00:33 +0000
+++ openlp/core/ui/slidecontroller.py 2012-12-10 18:08:26 +0000
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
@@ -65,8 +65,7 @@
created from within other plugins
This function is needed to catch the current controller
"""
- sender = self.sender().objectName() if self.sender().objectName() \
- else self.sender().text()
+ sender = self.sender().objectName() if self.sender().objectName() else self.sender().text()
controller = self
Receiver.send_message('%s' % sender, [controller, args])
@@ -83,8 +82,7 @@
DisplayController.__init__(self, parent, isLive)
self.screens = ScreenList()
try:
- self.ratio = float(self.screens.current[u'size'].width()) / \
- float(self.screens.current[u'size'].height())
+ self.ratio = float(self.screens.current[u'size'].width()) / float(self.screens.current[u'size'].height())
except ZeroDivisionError:
self.ratio = 1
self.imageManager = self.parent().imageManager
@@ -120,8 +118,7 @@
self.keypress_queue = deque()
self.keypress_loop = False
self.category = UiStrings().LiveToolbar
- ActionList.get_instance().add_category(
- unicode(self.category), CategoryOrder.standardToolbar)
+ ActionList.get_instance().add_category(unicode(self.category), CategoryOrder.standardToolbar)
else:
self.typeLabel.setText(UiStrings().Preview)
self.split = 0
@@ -137,9 +134,7 @@
# Actual controller section
self.controller = QtGui.QWidget(self.splitter)
self.controller.setGeometry(QtCore.QRect(0, 0, 100, 536))
- self.controller.setSizePolicy(
- QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
- QtGui.QSizePolicy.Maximum))
+ self.controller.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Maximum))
self.controllerLayout = QtGui.QVBoxLayout(self.controller)
self.controllerLayout.setSpacing(0)
self.controllerLayout.setMargin(0)
@@ -150,40 +145,29 @@
self.previewListWidget.setColumnWidth(0, self.controller.width())
self.previewListWidget.isLive = self.isLive
self.previewListWidget.setObjectName(u'previewListWidget')
- self.previewListWidget.setSelectionBehavior(
- QtGui.QAbstractItemView.SelectRows)
- self.previewListWidget.setSelectionMode(
- QtGui.QAbstractItemView.SingleSelection)
- self.previewListWidget.setEditTriggers(
- QtGui.QAbstractItemView.NoEditTriggers)
- self.previewListWidget.setHorizontalScrollBarPolicy(
- QtCore.Qt.ScrollBarAlwaysOff)
+ self.previewListWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
+ self.previewListWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
+ self.previewListWidget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
+ self.previewListWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.previewListWidget.setAlternatingRowColors(True)
self.controllerLayout.addWidget(self.previewListWidget)
# Build the full toolbar
self.toolbar = OpenLPToolbar(self)
- sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
- QtGui.QSizePolicy.Fixed)
+ sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizeToolbarPolicy.setHorizontalStretch(0)
sizeToolbarPolicy.setVerticalStretch(0)
- sizeToolbarPolicy.setHeightForWidth(
- self.toolbar.sizePolicy().hasHeightForWidth())
+ sizeToolbarPolicy.setHeightForWidth(self.toolbar.sizePolicy().hasHeightForWidth())
self.toolbar.setSizePolicy(sizeToolbarPolicy)
- self.previousItem = create_action(self,
- u'previousItem_' + self.typePrefix,
- text=translate('OpenLP.SlideController', 'Previous Slide'),
- icon=u':/slides/slide_previous.png',
+ self.previousItem = create_action(self, u'previousItem_' + self.typePrefix,
+ text=translate('OpenLP.SlideController', 'Previous Slide'), icon=u':/slides/slide_previous.png',
tooltip=translate('OpenLP.SlideController', 'Move to previous.'),
- shortcuts=[QtCore.Qt.Key_Up, QtCore.Qt.Key_PageUp],
- context=QtCore.Qt.WidgetWithChildrenShortcut,
+ shortcuts=[QtCore.Qt.Key_Up, QtCore.Qt.Key_PageUp], context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category, triggers=self.onSlideSelectedPrevious)
self.toolbar.addAction(self.previousItem)
self.nextItem = create_action(self, u'nextItem_' + self.typePrefix,
- text=translate('OpenLP.SlideController', 'Next Slide'),
- icon=u':/slides/slide_next.png',
+ text=translate('OpenLP.SlideController', 'Next Slide'), icon=u':/slides/slide_next.png',
tooltip=translate('OpenLP.SlideController', 'Move to next.'),
- shortcuts=[QtCore.Qt.Key_Down, QtCore.Qt.Key_PageDown],
- context=QtCore.Qt.WidgetWithChildrenShortcut,
+ shortcuts=[QtCore.Qt.Key_Down, QtCore.Qt.Key_PageDown], context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category, triggers=self.onSlideSelectedNextAction)
self.toolbar.addAction(self.nextItem)
self.toolbar.addSeparator()
@@ -195,24 +179,19 @@
self.hideMenu.setObjectName(u'hideMenu')
self.hideMenu.setText(translate('OpenLP.SlideController', 'Hide'))
self.hideMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
- self.hideMenu.setMenu(QtGui.QMenu(
- translate('OpenLP.SlideController', 'Hide'), self.toolbar))
+ self.hideMenu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
self.toolbar.addToolbarWidget(self.hideMenu)
self.blankScreen = create_action(self, u'blankScreen',
- text=translate('OpenLP.SlideController', 'Blank Screen'),
- icon=u':/slides/slide_blank.png', checked=False,
- shortcuts=[QtCore.Qt.Key_Period],
- category=self.category, triggers=self.onBlankDisplay)
+ text=translate('OpenLP.SlideController', 'Blank Screen'), icon=u':/slides/slide_blank.png',
+ checked=False, shortcuts=[QtCore.Qt.Key_Period], category=self.category, triggers=self.onBlankDisplay)
self.themeScreen = create_action(self, u'themeScreen',
- text=translate('OpenLP.SlideController', 'Blank to Theme'),
- icon=u':/slides/slide_theme.png', checked=False,
- shortcuts=[QtGui.QKeySequence(u'T')],
- category=self.category, triggers=self.onThemeDisplay)
+ text=translate('OpenLP.SlideController', 'Blank to Theme'), icon=u':/slides/slide_theme.png',
+ checked=False, shortcuts=[QtGui.QKeySequence(u'T')], category=self.category,
+ triggers=self.onThemeDisplay)
self.desktopScreen = create_action(self, u'desktopScreen',
- text=translate('OpenLP.SlideController', 'Show Desktop'),
- icon=u':/slides/slide_desktop.png', checked=False,
- shortcuts=[QtGui.QKeySequence(u'D')],
- category=self.category, triggers=self.onHideDisplay)
+ text=translate('OpenLP.SlideController', 'Show Desktop'), icon=u':/slides/slide_desktop.png',
+ checked=False, shortcuts=[QtGui.QKeySequence(u'D')], category=self.category,
+ triggers=self.onHideDisplay)
self.hideMenu.setDefaultAction(self.blankScreen)
self.hideMenu.menu().addAction(self.blankScreen)
self.hideMenu.menu().addAction(self.themeScreen)
@@ -221,23 +200,18 @@
# Play Slides Menu
self.playSlidesMenu = QtGui.QToolButton(self.toolbar)
self.playSlidesMenu.setObjectName(u'playSlidesMenu')
- self.playSlidesMenu.setText(translate('OpenLP.SlideController',
- 'Play Slides'))
+ self.playSlidesMenu.setText(translate('OpenLP.SlideController', 'Play Slides'))
self.playSlidesMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
- self.playSlidesMenu.setMenu(QtGui.QMenu(
- translate('OpenLP.SlideController', 'Play Slides'),
- self.toolbar))
+ self.playSlidesMenu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Play Slides'), self.toolbar))
self.toolbar.addToolbarWidget(self.playSlidesMenu)
- self.playSlidesLoop = create_action(self, u'playSlidesLoop',
- text=UiStrings().PlaySlidesInLoop,
- icon=u':/media/media_time.png', checked=False, shortcuts=[],
- category=self.category, triggers=self.onPlaySlidesLoop)
- self.playSlidesOnce = create_action(self, u'playSlidesOnce',
- text=UiStrings().PlaySlidesToEnd,
- icon=u':/media/media_time.png', checked=False, shortcuts=[],
- category=self.category, triggers=self.onPlaySlidesOnce)
- if Settings().value(self.parent().generalSettingsSection +
- u'/enable slide loop', QtCore.QVariant(True)).toBool():
+ self.playSlidesLoop = create_action(self, u'playSlidesLoop', text=UiStrings().PlaySlidesInLoop,
+ icon=u':/media/media_time.png', checked=False, shortcuts=[], category=self.category,
+ triggers=self.onPlaySlidesLoop)
+ self.playSlidesOnce = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd,
+ icon=u':/media/media_time.png', checked=False, shortcuts=[], category=self.category,
+ triggers=self.onPlaySlidesOnce)
+ if Settings().value(self.parent().generalSettingsSection + u'/enable slide loop',
+ QtCore.QVariant(True)).toBool():
self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
else:
self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
@@ -248,23 +222,16 @@
self.delaySpinBox.setObjectName(u'delaySpinBox')
self.delaySpinBox.setRange(1, 180)
self.delaySpinBox.setSuffix(UiStrings().Seconds)
- self.delaySpinBox.setToolTip(translate('OpenLP.SlideController',
- 'Delay between slides in seconds.'))
+ self.delaySpinBox.setToolTip(translate('OpenLP.SlideController', 'Delay between slides in seconds.'))
self.toolbar.addToolbarWidget(self.delaySpinBox)
else:
- self.toolbar.addToolbarAction(u'goLive',
- icon=u':/general/general_live.png',
- tooltip=translate('OpenLP.SlideController', 'Move to live.'),
- triggers=self.onGoLive)
- self.toolbar.addToolbarAction(u'addToService',
- icon=u':/general/general_add.png',
- tooltip=translate('OpenLP.SlideController', 'Add to Service.'),
- triggers=self.onPreviewAddToService)
+ self.toolbar.addToolbarAction(u'goLive', icon=u':/general/general_live.png',
+ tooltip=translate('OpenLP.SlideController', 'Move to live.'), triggers=self.onGoLive)
+ self.toolbar.addToolbarAction(u'addToService', icon=u':/general/general_add.png',
+ tooltip=translate('OpenLP.SlideController', 'Add to Service.'), triggers=self.onPreviewAddToService)
self.toolbar.addSeparator()
- self.toolbar.addToolbarAction(u'editSong',
- icon=u':/general/general_edit.png',
- tooltip=translate('OpenLP.SlideController',
- 'Edit and reload song preview.'), triggers=self.onEditSong)
+ self.toolbar.addToolbarAction(u'editSong', icon=u':/general/general_edit.png',
+ tooltip=translate('OpenLP.SlideController', 'Edit and reload song preview.'), triggers=self.onEditSong)
self.controllerLayout.addWidget(self.toolbar)
# Build the Media Toolbar
self.mediaController.register_controller(self)
@@ -274,35 +241,27 @@
self.songMenu.setObjectName(u'songMenu')
self.songMenu.setText(translate('OpenLP.SlideController', 'Go To'))
self.songMenu.setPopupMode(QtGui.QToolButton.InstantPopup)
- self.songMenu.setMenu(QtGui.QMenu(
- translate('OpenLP.SlideController', 'Go To'), self.toolbar))
+ self.songMenu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Go To'), self.toolbar))
self.toolbar.addToolbarWidget(self.songMenu)
# Stuff for items with background audio.
- self.audioPauseItem = self.toolbar.addToolbarAction(
- u'audioPauseItem', icon=u':/slides/media_playback_pause.png',
- text=translate('OpenLP.SlideController', 'Pause Audio'),
+ self.audioPauseItem = self.toolbar.addToolbarAction(u'audioPauseItem',
+ icon=u':/slides/media_playback_pause.png', text=translate('OpenLP.SlideController', 'Pause Audio'),
tooltip=translate('OpenLP.SlideController', 'Pause audio.'),
- checked=False, visible=False, category=self.category,
- context=QtCore.Qt.WindowShortcut,
+ checked=False, visible=False, category=self.category, context=QtCore.Qt.WindowShortcut,
shortcuts=[], triggers=self.onAudioPauseClicked)
- self.audioMenu = QtGui.QMenu(
- translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
+ self.audioMenu = QtGui.QMenu(translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
self.audioPauseItem.setMenu(self.audioMenu)
self.audioPauseItem.setParent(self.toolbar)
self.toolbar.widgetForAction(self.audioPauseItem).setPopupMode(
QtGui.QToolButton.MenuButtonPopup)
- self.nextTrackItem = create_action(self, u'nextTrackItem',
- text=UiStrings().NextTrack,
- icon=u':/slides/media_playback_next.png', tooltip=translate(
- 'OpenLP.SlideController', 'Go to next audio track.'),
- category=self.category,
- shortcuts=[], triggers=self.onNextTrackClicked)
+ self.nextTrackItem = create_action(self, u'nextTrackItem', text=UiStrings().NextTrack,
+ icon=u':/slides/media_playback_next.png',
+ tooltip=translate('OpenLP.SlideController', 'Go to next audio track.'),
+ category=self.category, shortcuts=[], triggers=self.onNextTrackClicked)
self.audioMenu.addAction(self.nextTrackItem)
- self.trackMenu = self.audioMenu.addMenu(
- translate('OpenLP.SlideController', 'Tracks'))
+ self.trackMenu = self.audioMenu.addMenu(translate('OpenLP.SlideController', 'Tracks'))
self.audioTimeLabel = QtGui.QLabel(u' 00:00 ', self.toolbar)
- self.audioTimeLabel.setAlignment(
- QtCore.Qt.AlignCenter|QtCore.Qt.AlignHCenter)
+ self.audioTimeLabel.setAlignment(QtCore.Qt.AlignCenter|QtCore.Qt.AlignHCenter)
self.audioTimeLabel.setStyleSheet(
u'background-color: palette(background); '
u'border-top-color: palette(shadow); '
@@ -319,8 +278,7 @@
self.previewFrame = QtGui.QFrame(self.splitter)
self.previewFrame.setGeometry(QtCore.QRect(0, 0, 300, 300 * self.ratio))
self.previewFrame.setMinimumHeight(100)
- self.previewFrame.setSizePolicy(QtGui.QSizePolicy(
- QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored,
+ self.previewFrame.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored,
QtGui.QSizePolicy.Label))
self.previewFrame.setFrameShape(QtGui.QFrame.StyledPanel)
self.previewFrame.setFrameShadow(QtGui.QFrame.Sunken)
@@ -340,8 +298,7 @@
self.previewDisplay.hide()
# Actual preview screen
self.slidePreview = QtGui.QLabel(self)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
- QtGui.QSizePolicy.Fixed)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
@@ -385,20 +342,16 @@
self.shortcutTimer, QtCore.SIGNAL(u'timeout()'),
self._slideShortcutActivated)
# Signals
- QtCore.QObject.connect(self.previewListWidget,
- QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
+ QtCore.QObject.connect(self.previewListWidget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
if self.isLive:
QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
- self.receiveSpinDelay)
+ QtCore.SIGNAL(u'slidecontroller_live_spin_delay'), self.receiveSpinDelay)
QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_toggle_display'),
- self.toggleDisplay)
+ QtCore.SIGNAL(u'slidecontroller_toggle_display'), self.toggleDisplay)
self.toolbar.setWidgetVisible(self.loopList, False)
else:
QtCore.QObject.connect(self.previewListWidget,
- QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
- self.onGoLiveClick)
+ QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onGoLiveClick)
self.toolbar.setWidgetVisible([u'editSong'], False)
if self.isLive:
self.setLiveHotkeys(self)
@@ -407,29 +360,21 @@
self.previewListWidget.addActions(
[self.nextItem, self.previousItem])
QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_stop_loop' % self.typePrefix),
- self.onStopLoop)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_next' % self.typePrefix),
- self.onSlideSelectedNext)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.typePrefix),
- self.onSlideSelectedPrevious)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_change' % self.typePrefix),
- self.onSlideChange)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_set' % self.typePrefix),
- self.onSlideSelectedIndex)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_blank' % self.typePrefix),
- self.onSlideBlank)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.typePrefix),
- self.onSlideUnblank)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_update_slide_limits'),
- self.updateSlideLimits)
+ QtCore.SIGNAL(u'slidecontroller_%s_stop_loop' % self.typePrefix), self.onStopLoop)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_next' % self.typePrefix), self.onSlideSelectedNext)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.typePrefix), self.onSlideSelectedPrevious)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_change' % self.typePrefix), self.onSlideChange)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_set' % self.typePrefix), self.onSlideSelectedIndex)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_blank' % self.typePrefix), self.onSlideBlank)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.typePrefix), self.onSlideUnblank)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_update_slide_limits'), self.updateSlideLimits)
def _slideShortcutActivated(self):
"""
@@ -448,30 +393,22 @@
except ImportError:
SONGS_PLUGIN_AVAILABLE = False
sender_name = unicode(self.sender().objectName())
- verse_type = sender_name[15:] \
- if sender_name[:15] == u'shortcutAction_' else u''
+ verse_type = sender_name[15:] if sender_name[:15] == u'shortcutAction_' else u''
if SONGS_PLUGIN_AVAILABLE:
if verse_type == u'V':
- self.current_shortcut = \
- VerseType.TranslatedTags[VerseType.Verse]
+ self.current_shortcut = VerseType.TranslatedTags[VerseType.Verse]
elif verse_type == u'C':
- self.current_shortcut = \
- VerseType.TranslatedTags[VerseType.Chorus]
+ self.current_shortcut = VerseType.TranslatedTags[VerseType.Chorus]
elif verse_type == u'B':
- self.current_shortcut = \
- VerseType.TranslatedTags[VerseType.Bridge]
+ self.current_shortcut = VerseType.TranslatedTags[VerseType.Bridge]
elif verse_type == u'P':
- self.current_shortcut = \
- VerseType.TranslatedTags[VerseType.PreChorus]
+ self.current_shortcut = VerseType.TranslatedTags[VerseType.PreChorus]
elif verse_type == u'I':
- self.current_shortcut = \
- VerseType.TranslatedTags[VerseType.Intro]
+ self.current_shortcut = VerseType.TranslatedTags[VerseType.Intro]
elif verse_type == u'E':
- self.current_shortcut = \
- VerseType.TranslatedTags[VerseType.Ending]
+ self.current_shortcut = VerseType.TranslatedTags[VerseType.Ending]
elif verse_type == u'O':
- self.current_shortcut = \
- VerseType.TranslatedTags[VerseType.Other]
+ self.current_shortcut = VerseType.TranslatedTags[VerseType.Other]
elif verse_type.isnumeric():
self.current_shortcut += verse_type
self.current_shortcut = self.current_shortcut.upper()
@@ -495,8 +432,7 @@
if self.current_shortcut in keys:
# We had more than one match for example "V1" and "V10", but
# "V1" was the slide we wanted to go.
- self.__checkUpdateSelectedSlide(
- self.slideList[self.current_shortcut])
+ self.__checkUpdateSelectedSlide(self.slideList[self.current_shortcut])
self.slideSelected()
# Reset the shortcut.
self.current_shortcut = u''
@@ -504,19 +440,16 @@
def setLiveHotkeys(self, parent=None):
self.previousService = create_action(parent, u'previousService',
text=translate('OpenLP.SlideController', 'Previous Service'),
- shortcuts=[QtCore.Qt.Key_Left],
- context=QtCore.Qt.WidgetWithChildrenShortcut,
- category=self.category, triggers=self.servicePrevious)
+ shortcuts=[QtCore.Qt.Key_Left], context=QtCore.Qt.WidgetWithChildrenShortcut, category=self.category,
+ triggers=self.servicePrevious)
self.nextService = create_action(parent, 'nextService',
text=translate('OpenLP.SlideController', 'Next Service'),
- shortcuts=[QtCore.Qt.Key_Right],
- context=QtCore.Qt.WidgetWithChildrenShortcut,
- category=self.category, triggers=self.serviceNext)
+ shortcuts=[QtCore.Qt.Key_Right], context=QtCore.Qt.WidgetWithChildrenShortcut, category=self.category,
+ triggers=self.serviceNext)
self.escapeItem = create_action(parent, 'escapeItem',
text=translate('OpenLP.SlideController', 'Escape Item'),
- shortcuts=[QtCore.Qt.Key_Escape],
- context=QtCore.Qt.WidgetWithChildrenShortcut,
- category=self.category, triggers=self.liveEscape)
+ shortcuts=[QtCore.Qt.Key_Escape],context=QtCore.Qt.WidgetWithChildrenShortcut, category=self.category,
+ triggers=self.liveEscape)
def liveEscape(self):
self.display.setVisible(False)
@@ -564,8 +497,7 @@
Receiver.send_message('servicemanager_previous_item')
elif keypressCommand == ServiceItemAction.PreviousLastSlide:
# Go to the last slide of the previous item
- Receiver.send_message('servicemanager_previous_item',
- u'last slide')
+ Receiver.send_message('servicemanager_previous_item', u'last slide')
else:
Receiver.send_message('servicemanager_next_item')
self.keypress_loop = False
@@ -582,20 +514,17 @@
self.display.setup()
if self.isLive:
self.__addActionsToWidget(self.display)
- self.display.audioPlayer.connectSlot(
- QtCore.SIGNAL(u'tick(qint64)'), self.onAudioTimeRemaining)
+ self.display.audioPlayer.connectSlot(QtCore.SIGNAL(u'tick(qint64)'), self.onAudioTimeRemaining)
# The SlidePreview's ratio.
try:
- self.ratio = float(self.screens.current[u'size'].width()) / \
- float(self.screens.current[u'size'].height())
+ self.ratio = float(self.screens.current[u'size'].width()) / float(self.screens.current[u'size'].height())
except ZeroDivisionError:
self.ratio = 1
self.mediaController.setup_display(self.display, False)
self.previewSizeChanged()
self.previewDisplay.setup()
serviceItem = ServiceItem()
- self.previewDisplay.webView.setHtml(build_html(serviceItem,
- self.previewDisplay.screen, None, self.isLive,
+ self.previewDisplay.webView.setHtml(build_html(serviceItem, self.previewDisplay.screen, None, self.isLive,
plugins=PluginManager.get_instance().plugins))
self.mediaController.setup_display(self.previewDisplay,True)
if self.serviceItem:
@@ -613,23 +542,18 @@
splitters is moved or when the screen size is changed. Note, that this
method is (also) called frequently from the mainwindow *paintEvent*.
"""
- if self.ratio < float(self.previewFrame.width()) / float(
- self.previewFrame.height()):
+ if self.ratio < float(self.previewFrame.width()) / float(self.previewFrame.height()):
# We have to take the height as limit.
max_height = self.previewFrame.height() - self.grid.margin() * 2
- self.slidePreview.setFixedSize(QtCore.QSize(
- max_height * self.ratio, max_height))
- self.previewDisplay.setFixedSize(QtCore.QSize(
- max_height * self.ratio, max_height))
+ self.slidePreview.setFixedSize(QtCore.QSize(max_height * self.ratio, max_height))
+ self.previewDisplay.setFixedSize(QtCore.QSize(max_height * self.ratio, max_height))
self.previewDisplay.screen = {
u'size': self.previewDisplay.geometry()}
else:
# We have to take the width as limit.
max_width = self.previewFrame.width() - self.grid.margin() * 2
- self.slidePreview.setFixedSize(QtCore.QSize(max_width,
- max_width / self.ratio))
- self.previewDisplay.setFixedSize(QtCore.QSize(max_width,
- max_width / self.ratio))
+ self.slidePreview.setFixedSize(QtCore.QSize(max_width, max_width / self.ratio))
+ self.previewDisplay.setFixedSize(QtCore.QSize(max_width, max_width / self.ratio))
self.previewDisplay.screen = {
u'size': self.previewDisplay.geometry()}
# Make sure that the frames have the correct size.
@@ -643,8 +567,7 @@
# Sort out image heights.
width = self.parent().controlSplitter.sizes()[self.split]
for framenumber in range(len(self.serviceItem.get_frames())):
- self.previewListWidget.setRowHeight(
- framenumber, width / self.ratio)
+ self.previewListWidget.setRowHeight(framenumber, width / self.ratio)
def onSongBarHandler(self):
request = unicode(self.sender().text())
@@ -662,8 +585,7 @@
"""
Updates the Slide Limits variable from the settings.
"""
- self.slide_limits = Settings().value(
- self.parent().advancedSettingsSection + u'/slide limits',
+ self.slide_limits = Settings().value(self.parent().advancedSettingsSection + u'/slide limits',
QtCore.QVariant(SlideLimits.End)).toInt()[0]
def enableToolBar(self, item):
@@ -692,12 +614,10 @@
self.playSlidesLoop.setChecked(False)
self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
if item.is_text():
- if Settings().value(
- self.parent().songsSettingsSection + u'/display songbar',
- QtCore.QVariant(True)).toBool() and self.slideList:
+ if Settings().value(self.parent().songsSettingsSection + u'/display songbar',
+ QtCore.QVariant(True)).toBool() and self.slideList:
self.songMenu.show()
- if item.is_capable(ItemCapabilities.CanLoop) and \
- len(item.get_frames()) > 1:
+ if item.is_capable(ItemCapabilities.CanLoop) and len(item.get_frames()) > 1:
self.toolbar.setWidgetVisible(self.loopList)
if item.is_media():
self.mediabar.show()
@@ -785,8 +705,7 @@
old_item = self.serviceItem
# take a copy not a link to the servicemanager copy.
self.serviceItem = copy.copy(serviceItem)
- if old_item and self.isLive and old_item.is_capable(
- ItemCapabilities.ProvidesOwnDisplay):
+ if old_item and self.isLive and old_item.is_capable(ItemCapabilities.ProvidesOwnDisplay):
self._resetBlank()
Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
[serviceItem, self.isLive, self.hideMode(), slideno])
@@ -803,24 +722,16 @@
# If the current item has background audio
if self.serviceItem.is_capable(ItemCapabilities.HasBackgroundAudio):
log.debug(u'Starting to play...')
- self.display.audioPlayer.addToPlaylist(
- self.serviceItem.background_audio)
+ self.display.audioPlayer.addToPlaylist(self.serviceItem.background_audio)
self.trackMenu.clear()
for counter in range(len(self.serviceItem.background_audio)):
- action = self.trackMenu.addAction(os.path.basename(
- self.serviceItem.background_audio[counter]))
+ action = self.trackMenu.addAction(os.path.basename(self.serviceItem.background_audio[counter]))
action.setData(counter)
- QtCore.QObject.connect(action,
- QtCore.SIGNAL(u'triggered(bool)'),
- self.onTrackTriggered)
+ QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), self.onTrackTriggered)
self.display.audioPlayer.repeat = Settings().value(
- self.parent().generalSettingsSection + \
- u'/audio repeat list',
- QtCore.QVariant(False)).toBool()
+ self.parent().generalSettingsSection + u'/audio repeat list', QtCore.QVariant(False)).toBool()
if Settings().value(
- self.parent().generalSettingsSection + \
- u'/audio start paused',
- QtCore.QVariant(True)).toBool():
+ self.parent().generalSettingsSection + u'/audio start paused', QtCore.QVariant(True)).toBool():
self.audioPauseItem.setChecked(True)
self.display.audioPlayer.pause()
else:
@@ -829,8 +740,7 @@
row = 0
text = []
for framenumber, frame in enumerate(self.serviceItem.get_frames()):
- self.previewListWidget.setRowCount(
- self.previewListWidget.rowCount() + 1)
+ self.previewListWidget.setRowCount(self.previewListWidget.rowCount() + 1)
item = QtGui.QTableWidgetItem()
slideHeight = 0
if self.serviceItem.is_text():
@@ -853,8 +763,7 @@
label = QtGui.QLabel()
label.setMargin(4)
if serviceItem.is_media():
- label.setAlignment(QtCore.Qt.AlignHCenter |
- QtCore.Qt.AlignVCenter)
+ label.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
else:
label.setScaledContents(True)
if self.serviceItem.is_command():
@@ -862,11 +771,9 @@
else:
# If current slide set background to image
if framenumber == slideno:
- self.serviceItem.bg_image_bytes = \
- self.imageManager.getImageBytes(frame[u'path'],
+ self.serviceItem.bg_image_bytes = self.imageManager.getImageBytes(frame[u'path'],
ImageSource.ImagePlugin)
- image = self.imageManager.getImage(frame[u'path'],
- ImageSource.ImagePlugin)
+ image = self.imageManager.getImage(frame[u'path'], ImageSource.ImagePlugin)
label.setPixmap(QtGui.QPixmap.fromImage(image))
self.previewListWidget.setCellWidget(framenumber, 0, label)
slideHeight = width * (1 / self.ratio)
@@ -898,12 +805,10 @@
# However opening a new item of the same type will automatically
# close the previous, so make sure we don't close the new one.
if old_item.is_command() and not serviceItem.is_command():
- Receiver.send_message(u'%s_stop' %
- old_item.name.lower(), [old_item, self.isLive])
+ Receiver.send_message(u'%s_stop' % old_item.name.lower(), [old_item, self.isLive])
if old_item.is_media() and not serviceItem.is_media():
self.onMediaClose()
- Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix,
- [serviceItem])
+ Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix, [serviceItem])
def __updatePreviewSelection(self, slideno):
"""
@@ -924,8 +829,7 @@
if not self.serviceItem:
return
if self.serviceItem.is_command():
- Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive, index])
+ Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive, index])
self.updatePreview()
else:
self.__checkUpdateSelectedSlide(index)
@@ -936,11 +840,9 @@
Allow the main display to blank the main display at startup time
"""
log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
- display_type = Settings().value(
- self.parent().generalSettingsSection + u'/screen blank',
+ display_type = Settings().value(self.parent().generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'')).toString()
- if self.screens.which_screen(self.window()) != \
- self.screens.which_screen(self.display):
+ if self.screens.which_screen(self.window()) != self.screens.which_screen(self.display):
# Order done to handle initial conversion
if display_type == u'themed':
self.onThemeDisplay(True)
@@ -977,12 +879,9 @@
self.themeScreen.setChecked(False)
self.desktopScreen.setChecked(False)
if checked:
- Settings().setValue(
- self.parent().generalSettingsSection + u'/screen blank',
- QtCore.QVariant(u'blanked'))
+ Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'blanked'))
else:
- Settings().remove(
- self.parent().generalSettingsSection + u'/screen blank')
+ Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
self.blankPlugin()
self.updatePreview()
@@ -998,12 +897,9 @@
self.themeScreen.setChecked(checked)
self.desktopScreen.setChecked(False)
if checked:
- Settings().setValue(
- self.parent().generalSettingsSection + u'/screen blank',
- QtCore.QVariant(u'themed'))
+ Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'themed'))
else:
- Settings().remove(
- self.parent().generalSettingsSection + u'/screen blank')
+ Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
self.blankPlugin()
self.updatePreview()
@@ -1019,12 +915,9 @@
self.themeScreen.setChecked(False)
self.desktopScreen.setChecked(checked)
if checked:
- Settings().setValue(
- self.parent().generalSettingsSection + u'/screen blank',
- QtCore.QVariant(u'hidden'))
+ Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'hidden'))
else:
- Settings().remove(
- self.parent().generalSettingsSection + u'/screen blank')
+ Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
self.hidePlugin(checked)
self.updatePreview()
@@ -1038,14 +931,12 @@
if hide_mode:
if not self.serviceItem.is_command():
Receiver.send_message(u'live_display_hide', hide_mode)
- Receiver.send_message(u'%s_blank'
- % self.serviceItem.name.lower(),
+ Receiver.send_message(u'%s_blank' % self.serviceItem.name.lower(),
[self.serviceItem, self.isLive, hide_mode])
else:
if not self.serviceItem.is_command():
Receiver.send_message(u'live_display_show')
- Receiver.send_message(u'%s_unblank'
- % self.serviceItem.name.lower(),
+ Receiver.send_message(u'%s_unblank' % self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
else:
if hide_mode:
@@ -1061,14 +952,12 @@
if self.serviceItem is not None:
if hide:
Receiver.send_message(u'live_display_hide', HideMode.Screen)
- Receiver.send_message(u'%s_hide'
- % self.serviceItem.name.lower(),
+ Receiver.send_message(u'%s_hide' % self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
else:
if not self.serviceItem.is_command():
Receiver.send_message(u'live_display_show')
- Receiver.send_message(u'%s_unblank'
- % self.serviceItem.name.lower(),
+ Receiver.send_message(u'%s_unblank' % self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
else:
if hide:
@@ -1092,8 +981,7 @@
if -1 < row < self.previewListWidget.rowCount():
if self.serviceItem.is_command():
if self.isLive and not start:
- Receiver.send_message(
- u'%s_slide' % self.serviceItem.name.lower(),
+ Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(),
[self.serviceItem, self.isLive, row])
else:
to_display = self.serviceItem.get_rendered_frame(row)
@@ -1109,8 +997,7 @@
self.updatePreview()
self.selectedRow = row
self.__checkUpdateSelectedSlide(row)
- Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
- row)
+ Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix, row)
def onSlideChange(self, row):
"""
@@ -1118,8 +1005,7 @@
"""
self.__checkUpdateSelectedSlide(row)
self.updatePreview()
- Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
- row)
+ Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix, row)
def updatePreview(self):
"""
@@ -1128,7 +1014,7 @@
"""
log.debug(u'updatePreview %s ' % self.screens.current[u'primary'])
if not self.screens.current[u'primary'] and self.serviceItem and \
- self.serviceItem.is_capable(ItemCapabilities.ProvidesOwnDisplay):
+ self.serviceItem.is_capable(ItemCapabilities.ProvidesOwnDisplay):
# Grab now, but try again in a couple of seconds if slide change
# is slow
QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
@@ -1142,8 +1028,7 @@
"""
winid = QtGui.QApplication.desktop().winId()
rect = self.screens.current[u'size']
- winimg = QtGui.QPixmap.grabWindow(winid, rect.x(),
- rect.y(), rect.width(), rect.height())
+ winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height())
self.slidePreview.setPixmap(winimg)
def onSlideSelectedNextAction(self, checked):
@@ -1159,8 +1044,7 @@
"""
if not self.serviceItem:
return
- Receiver.send_message(u'%s_next' % self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive])
+ Receiver.send_message(u'%s_next' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
if self.serviceItem.is_command() and self.isLive:
self.updatePreview()
else:
@@ -1187,8 +1071,7 @@
"""
if not self.serviceItem:
return
- Receiver.send_message(u'%s_previous' % self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive])
+ Receiver.send_message(u'%s_previous' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
if self.serviceItem.is_command() and self.isLive:
self.updatePreview()
else:
@@ -1197,8 +1080,7 @@
if self.slide_limits == SlideLimits.Wrap:
row = self.previewListWidget.rowCount() - 1
elif self.isLive and self.slide_limits == SlideLimits.Next:
- self.keypress_queue.append(
- ServiceItemAction.PreviousLastSlide)
+ self.keypress_queue.append(ServiceItemAction.PreviousLastSlide)
self._process_queue()
return
else:
@@ -1208,8 +1090,7 @@
def __checkUpdateSelectedSlide(self, row):
if row + 1 < self.previewListWidget.rowCount():
- self.previewListWidget.scrollToItem(
- self.previewListWidget.item(row + 1, 0))
+ self.previewListWidget.scrollToItem(self.previewListWidget.item(row + 1, 0))
self.previewListWidget.selectRow(row)
def onToggleLoop(self):
@@ -1226,8 +1107,7 @@
Start the timer loop running and store the timer id
"""
if self.previewListWidget.rowCount() > 1:
- self.timer_id = self.startTimer(
- int(self.delaySpinBox.value()) * 1000)
+ self.timer_id = self.startTimer(int(self.delaySpinBox.value()) * 1000)
def onStopLoop(self):
"""
@@ -1302,29 +1182,24 @@
From the preview display requires the service Item to be editied
"""
self.songEdit = True
- Receiver.send_message(u'%s_edit' % self.serviceItem.name.lower(),
- u'P:%s' % self.serviceItem.edit_id)
+ Receiver.send_message(u'%s_edit' % self.serviceItem.name.lower(), u'P:%s' % self.serviceItem.edit_id)
def onPreviewAddToService(self):
"""
From the preview display request the Item to be added to service
"""
if self.serviceItem:
- self.parent().serviceManagerContents.addServiceItem(
- self.serviceItem)
+ self.parent().serviceManagerContents.addServiceItem(self.serviceItem)
def onGoLiveClick(self):
"""
triggered by clicking the Preview slide items
"""
- if Settings().value(u'advanced/double click live',
- QtCore.QVariant(False)).toBool():
+ if Settings().value(u'advanced/double click live', QtCore.QVariant(False)).toBool():
# Live and Preview have issues if we have video or presentations
# playing in both at the same time.
if self.serviceItem.is_command():
- Receiver.send_message(u'%s_stop' %
- self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive])
+ Receiver.send_message(u'%s_stop' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
if self.serviceItem.is_media():
self.onMediaClose()
self.onGoLive()
@@ -1336,11 +1211,9 @@
row = self.previewListWidget.currentRow()
if -1 < row < self.previewListWidget.rowCount():
if self.serviceItem.from_service:
- Receiver.send_message('servicemanager_preview_live',
- u'%s:%s' % (self.serviceItem._uuid, row))
+ Receiver.send_message('servicemanager_preview_live', u'%s:%s' % (self.serviceItem._uuid, row))
else:
- self.parent().liveController.addServiceManagerItem(
- self.serviceItem, row)
+ self.parent().liveController.addServiceManagerItem(self.serviceItem, row)
def onMediaStart(self, item):
"""
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2012-12-07 06:04:15 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2012-12-10 18:08:26 +0000
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
@@ -32,12 +32,10 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
- SettingsManager, translate, check_item_selected, Receiver, MediaType, \
- ServiceItem, build_html, ServiceItemContext
+from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, SettingsManager, translate, \
+ check_item_selected, Receiver, MediaType, ServiceItem, build_html, ServiceItemContext
from openlp.core.lib.settings import Settings
-from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
- create_horizontal_adjusting_combo_box
+from openlp.core.lib.ui import UiStrings, critical_error_message_box, create_horizontal_adjusting_combo_box
from openlp.core.ui import DisplayController, Display, DisplayControllerType
from openlp.core.ui.media import get_media_players, set_media_players
from openlp.core.utils import locale_compare
@@ -67,25 +65,17 @@
self.displayController = DisplayController(parent)
self.displayController.controllerLayout = QtGui.QVBoxLayout()
self.plugin.mediaController.register_controller(self.displayController)
- self.plugin.mediaController.set_controls_visible(self.displayController,
- False)
- self.displayController.previewDisplay = Display(self.displayController,
- False, self.displayController)
+ self.plugin.mediaController.set_controls_visible(self.displayController, False)
+ self.displayController.previewDisplay = Display(self.displayController, False, self.displayController)
self.displayController.previewDisplay.hide()
- self.displayController.previewDisplay.setGeometry(
- QtCore.QRect(0, 0, 300, 300))
- self.displayController.previewDisplay.screen = \
- {u'size':self.displayController.previewDisplay.geometry()}
+ self.displayController.previewDisplay.setGeometry(QtCore.QRect(0, 0, 300, 300))
+ self.displayController.previewDisplay.screen = {u'size':self.displayController.previewDisplay.geometry()}
self.displayController.previewDisplay.setup()
- self.plugin.mediaController.setup_display(
- self.displayController.previewDisplay, False)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'video_background_replaced'),
- self.videobackgroundReplaced)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'mediaitem_media_rebuild'), self.rebuild_players)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'config_screen_changed'), self.displaySetup)
+ self.plugin.mediaController.setup_display(self.displayController.previewDisplay, False)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'video_background_replaced'), self.videobackgroundReplaced)
+ QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'mediaitem_media_rebuild'), self.rebuild_players)
+ QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'), self.displaySetup)
# Allow DnD from the desktop
self.listView.activateDnD()
@@ -96,8 +86,7 @@
self.resetAction.setText(UiStrings().ResetBG)
self.resetAction.setToolTip(UiStrings().ResetLiveBG)
self.automatic = UiStrings().Automatic
- self.displayTypeLabel.setText(
- translate('MediaPlugin.MediaItem', 'Use Player:'))
+ self.displayTypeLabel.setText(translate('MediaPlugin.MediaItem', 'Use Player:'))
self.rebuild_players()
def requiredIcons(self):
@@ -112,11 +101,10 @@
def addEndHeaderBar(self):
# Replace backgrounds do not work at present so remove functionality.
- self.replaceAction = self.toolbar.addToolbarAction(u'replaceAction',
- icon=u':/slides/slide_blank.png', triggers=self.onReplaceClick)
- self.resetAction = self.toolbar.addToolbarAction(u'resetAction',
- icon=u':/system/system_close.png', visible=False,
- triggers=self.onResetClick)
+ self.replaceAction = self.toolbar.addToolbarAction(u'replaceAction', icon=u':/slides/slide_blank.png',
+ triggers=self.onReplaceClick)
+ self.resetAction = self.toolbar.addToolbarAction(u'resetAction', icon=u':/system/system_close.png',
+ visible=False, triggers=self.onResetClick)
self.mediaWidget = QtGui.QWidget(self)
self.mediaWidget.setObjectName(u'mediaWidget')
self.displayLayout = QtGui.QFormLayout(self.mediaWidget)
@@ -124,15 +112,12 @@
self.displayLayout.setObjectName(u'displayLayout')
self.displayTypeLabel = QtGui.QLabel(self.mediaWidget)
self.displayTypeLabel.setObjectName(u'displayTypeLabel')
- self.displayTypeComboBox = create_horizontal_adjusting_combo_box(
- self.mediaWidget, u'displayTypeComboBox')
+ self.displayTypeComboBox = create_horizontal_adjusting_combo_box(self.mediaWidget, u'displayTypeComboBox')
self.displayTypeLabel.setBuddy(self.displayTypeComboBox)
- self.displayLayout.addRow(self.displayTypeLabel,
- self.displayTypeComboBox)
+ self.displayLayout.addRow(self.displayTypeLabel, self.displayTypeComboBox)
# Add the Media widget to the page layout
self.pageLayout.addWidget(self.mediaWidget)
- QtCore.QObject.connect(self.displayTypeComboBox,
- QtCore.SIGNAL(u'currentIndexChanged (int)'),
+ QtCore.QObject.connect(self.displayTypeComboBox, QtCore.SIGNAL(u'currentIndexChanged (int)'),
self.overridePlayerChanged)
def overridePlayerChanged(self, index):
@@ -171,19 +156,16 @@
service_item.shortname = service_item.title
(path, name) = os.path.split(filename)
service_item.add_from_command(path, name,CLAPPERBOARD)
- if self.plugin.liveController.mediaController.video(
- DisplayControllerType.Live, service_item,
+ if self.plugin.liveController.mediaController.video(DisplayControllerType.Live, service_item,
videoBehindText=True):
self.resetAction.setVisible(True)
else:
critical_error_message_box(UiStrings().LiveBGError,
- translate('MediaPlugin.MediaItem',
- 'There was no display item to amend.'))
+ translate('MediaPlugin.MediaItem', 'There was no display item to amend.'))
else:
critical_error_message_box(UiStrings().LiveBGError,
unicode(translate('MediaPlugin.MediaItem',
- 'There was a problem replacing your background, '
- 'the media file "%s" no longer exists.')) % filename)
+ 'There was a problem replacing your background, the media file "%s" no longer exists.')) % filename)
def generateSlideData(self, service_item, item=None, xmlVersion=False,
remote=False, context=ServiceItemContext.Live):
@@ -197,8 +179,7 @@
# File is no longer present
critical_error_message_box(
translate('MediaPlugin.MediaItem', 'Missing Media File'),
- unicode(translate('MediaPlugin.MediaItem',
- 'The file %s no longer exists.')) % filename)
+ unicode(translate('MediaPlugin.MediaItem', 'The file %s no longer exists.')) % filename)
return False
service_item.title = unicode(self.displayTypeComboBox.currentText())
service_item.shortname = service_item.title
@@ -213,8 +194,7 @@
service_item.add_capability(ItemCapabilities.RequiresMedia)
service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay)
if Settings().value(self.settingsSection + u'/media auto start',
- QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0]\
- == QtCore.Qt.Checked:
+ QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == QtCore.Qt.Checked:
service_item.will_auto_start = True
# force a non-existent theme
service_item.theme = -1
@@ -232,22 +212,19 @@
the settings
"""
self.populateDisplayTypes()
- self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
- 'Videos (%s);;Audio (%s);;%s (*)')) % (
+ self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem', 'Videos (%s);;Audio (%s);;%s (*)')) % (
u' '.join(self.plugin.mediaController.video_extensions_list),
- u' '.join(self.plugin.mediaController.audio_extensions_list),
- UiStrings().AllFiles)
+ u' '.join(self.plugin.mediaController.audio_extensions_list), UiStrings().AllFiles)
def displaySetup(self):
- self.plugin.mediaController.setup_display(
- self.displayController.previewDisplay, False)
+ self.plugin.mediaController.setup_display(self.displayController.previewDisplay, False)
def populateDisplayTypes(self):
"""
Load the combobox with the enabled media players,
allowing user to select a specific player if settings allow
"""
- # block signals to avoid unnecessary overridePlayerChanged Signales
+ # block signals to avoid unnecessary overridePlayerChanged Signals
# while combo box creation
self.displayTypeComboBox.blockSignals(True)
self.displayTypeComboBox.clear()
@@ -273,7 +250,7 @@
Remove a media item from the list.
"""
if check_item_selected(self.listView, translate('MediaPlugin.MediaItem',
- 'You must select a media file to delete.')):
+ 'You must select a media file to delete.')):
row_list = [item.row() for item in self.listView.selectedIndexes()]
row_list.sort(reverse=True)
for row in row_list:
@@ -284,8 +261,7 @@
def loadList(self, media):
# Sort the media by its filename considering language specific
# characters.
- media.sort(cmp=locale_compare,
- key=lambda filename: os.path.split(unicode(filename))[1])
+ media.sort(cmp=locale_compare, key=lambda filename: os.path.split(unicode(filename))[1])
for track in media:
track_info = QtCore.QFileInfo(track)
if not os.path.exists(track):
@@ -296,8 +272,7 @@
elif track_info.isFile():
filename = os.path.split(unicode(track))[1]
item_name = QtGui.QListWidgetItem(filename)
- if u'*.%s' % (filename.split(u'.')[-1].lower()) in \
- self.plugin.mediaController.audio_extensions_list:
+ if u'*.%s' % (filename.split(u'.')[-1].lower()) in self.plugin.mediaController.audio_extensions_list:
item_name.setIcon(AUDIO)
else:
item_name.setIcon(VIDEO)
@@ -312,8 +287,7 @@
def getList(self, type=MediaType.Audio):
media = SettingsManager.load_list(self.settingsSection, u'media')
- media.sort(cmp=locale_compare,
- key=lambda filename: os.path.split(unicode(filename))[1])
+ media.sort(cmp=locale_compare, key=lambda filename: os.path.split(unicode(filename))[1])
ext = []
if type == MediaType.Audio:
ext = self.plugin.mediaController.audio_extensions_list
=== modified file 'openlp/plugins/media/lib/mediatab.py'
--- openlp/plugins/media/lib/mediatab.py 2012-12-03 19:19:10 +0000
+++ openlp/plugins/media/lib/mediatab.py 2012-12-10 18:08:26 +0000
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
@@ -69,34 +69,24 @@
def retranslateUi(self):
self.advancedGroupBox.setTitle(UiStrings().Advanced)
- self.overridePlayerCheckBox.setText(
- translate('MediaPlugin.MediaTab',
- 'Allow media player to be overridden'))
- self.autoStartCheckBox.setText(
- translate('MediaPlugin.MediaTab',
- 'Start Live items automatically'))
+ self.overridePlayerCheckBox.setText(translate('MediaPlugin.MediaTab', 'Allow media player to be overridden'))
+ self.autoStartCheckBox.setText(translate('MediaPlugin.MediaTab', 'Start Live items automatically'))
def load(self):
- self.overridePlayerCheckBox.setChecked(Settings().value(
- self.settingsSection + u'/override player',
+ self.overridePlayerCheckBox.setChecked(Settings().value(self.settingsSection + u'/override player',
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0])
- self.autoStartCheckBox.setChecked(Settings().value(
- self.settingsSection + u'/media auto start',
+ self.autoStartCheckBox.setChecked(Settings().value(self.settingsSection + u'/media auto start',
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0])
def save(self):
override_changed = False
setting_key = self.settingsSection + u'/override player'
- if Settings().value(setting_key).toInt()[0] != \
- self.overridePlayerCheckBox.checkState():
- Settings().setValue(setting_key,
- QtCore.QVariant(self.overridePlayerCheckBox.checkState()))
+ if Settings().value(setting_key).toInt()[0] != self.overridePlayerCheckBox.checkState():
+ Settings().setValue(setting_key, QtCore.QVariant(self.overridePlayerCheckBox.checkState()))
override_changed = True
setting_key = self.settingsSection + u'/media auto start'
- if Settings().value(setting_key).toInt()[0] !=\
- self.autoStartCheckBox.checkState():
- Settings().setValue(setting_key,
- QtCore.QVariant(self.autoStartCheckBox.checkState()))
+ if Settings().value(setting_key).toInt()[0] != self.autoStartCheckBox.checkState():
+ Settings().setValue(setting_key, QtCore.QVariant(self.autoStartCheckBox.checkState()))
if override_changed:
self.parent.resetSupportedSuffixes()
Receiver.send_message(u'mediaitem_media_rebuild')
=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py 2012-12-03 19:19:10 +0000
+++ openlp/plugins/media/mediaplugin.py 2012-12-10 18:08:26 +0000
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
@@ -41,8 +41,7 @@
log.info(u'%s MediaPlugin loaded', __name__)
def __init__(self, plugin_helpers):
- Plugin.__init__(self, u'media', plugin_helpers,
- MediaMediaItem)
+ Plugin.__init__(self, u'media', plugin_helpers, MediaMediaItem)
self.weight = -6
self.iconPath = u':/plugins/plugin_media.png'
self.icon = build_icon(self.iconPath)
@@ -54,8 +53,7 @@
Create the settings Tab
"""
visible_name = self.getString(StringContent.VisibleName)
- self.settingsTab = MediaTab(parent, self.name, visible_name[u'title'],
- self.iconPath)
+ self.settingsTab = MediaTab(parent, self.name, visible_name[u'title'], self.iconPath)
def about(self):
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
@@ -84,8 +82,7 @@
u'delete': translate('MediaPlugin', 'Delete the selected media.'),
u'preview': translate('MediaPlugin', 'Preview the selected media.'),
u'live': translate('MediaPlugin', 'Send the selected media live.'),
- u'service': translate('MediaPlugin',
- 'Add the selected media to the service.')
+ u'service': translate('MediaPlugin', 'Add the selected media to the service.')
}
self.setPluginUiTextStrings(tooltips)
@@ -131,12 +128,10 @@
log.debug(u'Converting old setting to new setting')
new_players = []
if players:
- new_players = [player for player in players \
- if player != u'phonon']
+ new_players = [player for player in players if player != u'phonon']
new_players.insert(0, u'phonon')
self.mediaController.mediaPlayers[u'phonon'].isActive = True
- settings.setValue(u'players', \
- QtCore.QVariant(u','.join(new_players)))
+ settings.setValue(u'players', QtCore.QVariant(u','.join(new_players)))
self.settingsTab.load()
settings.remove(u'use phonon')
settings.endGroup()