diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 5ec87b1bc..3652bae20 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -357,7 +357,7 @@ class MediaManagerItem(QtGui.QWidget): self.trUtf8('No items selected...'), self.trUtf8('You must select one or more items')) else: - log.debug(self.PluginNameShort + u' Preview Requested') + log.debug(self.PluginNameShort + u' Preview requested') service_item = self.buildServiceItem() if service_item: service_item.fromPlugin = True @@ -369,7 +369,7 @@ class MediaManagerItem(QtGui.QWidget): self.trUtf8('No items selected...'), self.trUtf8('You must select one or more items')) else: - log.debug(self.PluginNameShort + u' Live Requested') + log.debug(self.PluginNameShort + u' Live requested') service_item = self.buildServiceItem() if service_item: service_item.fromPlugin = True @@ -381,7 +381,7 @@ class MediaManagerItem(QtGui.QWidget): self.trUtf8('No items selected...'), self.trUtf8('You must select one or more items')) else: - log.debug(self.PluginNameShort + u' Add Requested') + log.debug(self.PluginNameShort + u' Add requested') service_item = self.buildServiceItem() if service_item: service_item.fromPlugin = False diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 3d6198419..3cb38bfa0 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -43,9 +43,8 @@ class Renderer(object): self._rect = None self._debug = 0 self._right_margin = 64 # the amount of right indent - self._shadow_offset = 5 - self._shadow_offset_footer = 3 - self._outline_offset = 2 + self._display_shadow_size_footer = 0 + self._display_outline_size_footer = 0 self.theme_name = None self._theme = None self._bg_image_filename = None @@ -426,23 +425,25 @@ class Renderer(object): # dont allow alignment messing with footers if footer: align = 0 - shadow_offset = self._shadow_offset_footer + display_shadow_size = self._display_shadow_size_footer + display_outline_size = self._display_outline_size_footer else: align = self._theme.display_horizontalAlign - shadow_offset = self._shadow_offset + display_shadow_size = int(self._theme.display_shadow_size) + display_outline_size = int(self._theme.display_outline_size) for linenum in range(len(lines)): line = lines[linenum] #find out how wide line is w, h = self._get_extent_and_render(line, footer, tlcorner=(x, y), draw=False) if self._theme.display_shadow: - w += shadow_offset - h += shadow_offset + w += display_shadow_size + h += display_shadow_size if self._theme.display_outline: # pixels either side - w += 2 * self._outline_offset + w += 2 * display_outline_size # pixels top/bottom - h += 2 * self._outline_offset + h += 2 * display_outline_size if align == 0: # left align rightextent = x + w # shift right from last line's rh edge @@ -464,36 +465,36 @@ class Renderer(object): # now draw the text, and any outlines/shadows if self._theme.display_shadow: self._get_extent_and_render(line, footer, - tlcorner=(x + shadow_offset, y + shadow_offset), + tlcorner=(x + display_shadow_size, y + display_shadow_size), draw=True, color = self._theme.display_shadow_color) if self._theme.display_outline: self._get_extent_and_render(line, footer, - (x + self._outline_offset, y), draw=True, + (x + display_outline_size, y), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer, - (x, y + self._outline_offset), draw=True, + (x, y + display_outline_size), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer, - (x, y - self._outline_offset), draw=True, + (x, y - display_outline_size), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer, - (x - self._outline_offset, y), draw=True, + (x - display_outline_size, y), draw=True, color = self._theme.display_outline_color) - if self._outline_offset > 1: + if display_outline_size > 1: self._get_extent_and_render(line, footer, - (x + self._outline_offset, y + self._outline_offset), + (x + display_outline_size, y + display_outline_size), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer, - (x - self._outline_offset, y + self._outline_offset), + (x - display_outline_size, y + display_outline_size), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer, - (x + self._outline_offset, y - self._outline_offset), + (x + display_outline_size, y - display_outline_size), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer, - (x - self._outline_offset, y - self._outline_offset), + (x - display_outline_size, y - display_outline_size), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer,tlcorner=(x, y), @@ -578,7 +579,7 @@ class Renderer(object): painter.drawText(x, y + metrics.ascent(), line) painter.end() if self._theme.display_slideTransition: - # Print 2nd image with 50% weight + # Print 2nd image with 70% weight painter = QtGui.QPainter() painter.begin(self._frameOp) painter.setRenderHint(QtGui.QPainter.Antialiasing); diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index f8fe7d539..d1afa556b 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -112,6 +112,8 @@ class ServiceItem(object): for slide in self._raw_frames: slide[u'image'] = \ self.RenderManager.resize_image(slide[u'image']) + elif self.service_item_type == ServiceItemType.Command: + pass else: log.error(u'Invalid value renderer :%s' % self.service_item_type) diff --git a/openlp/core/lib/songxmlhandler.py b/openlp/core/lib/songxmlhandler.py index d079c305c..78c7b1e98 100644 --- a/openlp/core/lib/songxmlhandler.py +++ b/openlp/core/lib/songxmlhandler.py @@ -134,6 +134,7 @@ class SongXMLParser(object): ``xml`` The XML of the song to be parsed. """ + self.song_xml = None try: self.song_xml = ElementTree( element=XML(unicode(xml).encode('unicode-escape'))) diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py index 42743d1bd..6b12f50dc 100644 --- a/openlp/core/lib/themexmlhandler.py +++ b/openlp/core/lib/themexmlhandler.py @@ -65,8 +65,8 @@ blankthemexml=\ - True - False + True + False 0 0 0 @@ -238,7 +238,7 @@ class ThemeXML(object): background.appendChild(element) def add_display(self, shadow, shadow_color, outline, outline_color, - horizontal, vertical, wrap, transition): + horizontal, vertical, wrap, transition, shadow_pixel=5, outline_pixel=2): """ Add a Display options. @@ -272,12 +272,14 @@ class ThemeXML(object): # Shadow element = self.theme_xml.createElement(u'shadow') element.setAttribute(u'color', shadow_color) + element.setAttribute(u'size', unicode(shadow_pixel)) value = self.theme_xml.createTextNode(shadow) element.appendChild(value) background.appendChild(element) # Outline element = self.theme_xml.createElement(u'outline') element.setAttribute(u'color', outline_color) + element.setAttribute(u'size', unicode(outline_pixel)) value = self.theme_xml.createTextNode(outline) element.appendChild(value) background.appendChild(element) diff --git a/openlp/core/ui/alertform.py b/openlp/core/ui/alertform.py index fd4380700..96dc88dc5 100644 --- a/openlp/core/ui/alertform.py +++ b/openlp/core/ui/alertform.py @@ -99,4 +99,4 @@ class AlertForm(QtGui.QDialog): self.CancelButton.setText(self.trUtf8('Cancel')) def onDisplayClicked(self): - self.parent.mainDisplay.displayAlert(self.AlertEntryEditItem.text()) + self.parent.mainDisplay.displayAlert(unicode(self.AlertEntryEditItem.text())) diff --git a/openlp/core/ui/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py index ad5fbe65f..dffd1dedf 100644 --- a/openlp/core/ui/amendthemedialog.py +++ b/openlp/core/ui/amendthemedialog.py @@ -410,13 +410,13 @@ class Ui_AmendThemeDialog(object): self.OptionsLeftLayout.setSpacing(8) self.OptionsLeftLayout.setMargin(0) self.OptionsLeftLayout.setObjectName(u'OptionsLeftLayout') - self.ShadowGroupBox = QtGui.QGroupBox(self.OptionsLeftWidget) - self.ShadowGroupBox.setObjectName(u'ShadowGroupBox') - self.verticalLayout = QtGui.QVBoxLayout(self.ShadowGroupBox) + self.OutlineGroupBox = QtGui.QGroupBox(self.OptionsLeftWidget) + self.OutlineGroupBox.setObjectName(u'OutlineGroupBox') + self.verticalLayout = QtGui.QVBoxLayout(self.OutlineGroupBox) self.verticalLayout.setSpacing(8) self.verticalLayout.setMargin(8) self.verticalLayout.setObjectName(u'verticalLayout') - self.OutlineWidget = QtGui.QWidget(self.ShadowGroupBox) + self.OutlineWidget = QtGui.QWidget(self.OutlineGroupBox) self.OutlineWidget.setObjectName(u'OutlineWidget') self.OutlineLayout = QtGui.QFormLayout(self.OutlineWidget) self.OutlineLayout.setMargin(0) @@ -425,16 +425,30 @@ class Ui_AmendThemeDialog(object): self.OutlineCheckBox = QtGui.QCheckBox(self.OutlineWidget) self.OutlineCheckBox.setObjectName(u'OutlineCheckBox') self.OutlineLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.OutlineCheckBox) + self.OutlineSpinBox = QtGui.QSpinBox(self.OutlineWidget) + self.OutlineSpinBox.setObjectName("OutlineSpinBox") + self.OutlineSpinBox.setMaximum(10) + self.OutlineLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.OutlineSpinBox) + self.OutlineSpinBoxLabel = QtGui.QLabel(self.OutlineWidget) + self.OutlineSpinBoxLabel.setObjectName(u'OutlineSpinBoxLabel') + self.OutlineLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.OutlineSpinBoxLabel) self.OutlineColorLabel = QtGui.QLabel(self.OutlineWidget) self.OutlineColorLabel.setObjectName(u'OutlineColorLabel') - self.OutlineLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.OutlineColorLabel) + self.OutlineLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.OutlineColorLabel) self.OutlineColorPushButton = QtGui.QPushButton(self.OutlineWidget) self.OutlineColorPushButton.setObjectName(u'OutlineColorPushButton') - self.OutlineLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.OutlineColorPushButton) + self.OutlineLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.OutlineColorPushButton) self.OutlineEnabledLabel = QtGui.QLabel(self.OutlineWidget) self.OutlineEnabledLabel.setObjectName(u'OutlineEnabledLabel') self.OutlineLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.OutlineEnabledLabel) self.verticalLayout.addWidget(self.OutlineWidget) + self.OptionsLeftLayout.addWidget(self.OutlineGroupBox) + self.ShadowGroupBox = QtGui.QGroupBox(self.OptionsLeftWidget) + self.ShadowGroupBox.setObjectName(u'ShadowGroupBox') + self.verticalLayout = QtGui.QVBoxLayout(self.ShadowGroupBox) + self.verticalLayout.setSpacing(8) + self.verticalLayout.setMargin(8) + self.verticalLayout.setObjectName(u'verticalLayout') self.ShadowWidget = QtGui.QWidget(self.ShadowGroupBox) self.ShadowWidget.setObjectName(u'ShadowWidget') self.ShadowLayout = QtGui.QFormLayout(self.ShadowWidget) @@ -444,12 +458,19 @@ class Ui_AmendThemeDialog(object): self.ShadowCheckBox = QtGui.QCheckBox(self.ShadowWidget) self.ShadowCheckBox.setObjectName(u'ShadowCheckBox') self.ShadowLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.ShadowCheckBox) + self.ShadowSpinBox = QtGui.QSpinBox(self.OutlineWidget) + self.ShadowSpinBox.setObjectName("ShadowSpinBox") + self.ShadowSpinBox.setMaximum(10) + self.ShadowLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.ShadowSpinBox) + self.ShadowSpinBoxLabel = QtGui.QLabel(self.OutlineWidget) + self.ShadowSpinBoxLabel.setObjectName(u'ShadowSpinBoxLabel') + self.ShadowLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.ShadowSpinBoxLabel) self.ShadowColorLabel = QtGui.QLabel(self.ShadowWidget) self.ShadowColorLabel.setObjectName(u'ShadowColorLabel') - self.ShadowLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.ShadowColorLabel) + self.ShadowLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.ShadowColorLabel) self.ShadowColorPushButton = QtGui.QPushButton(self.ShadowWidget) self.ShadowColorPushButton.setObjectName(u'ShadowColorPushButton') - self.ShadowLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.ShadowColorPushButton) + self.ShadowLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.ShadowColorPushButton) self.ShadowEnabledLabel = QtGui.QLabel(self.ShadowWidget) self.ShadowEnabledLabel.setObjectName(u'ShadowEnabledLabel') self.ShadowLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.ShadowEnabledLabel) @@ -640,9 +661,14 @@ class Ui_AmendThemeDialog(object): self.ThemeTabWidget.setTabText( self.ThemeTabWidget.indexOf(self.FontFooterTab), self.trUtf8('Font Footer')) - self.ShadowGroupBox.setTitle(self.trUtf8('Shadow && Outline')) + self.OutlineGroupBox.setTitle(self.trUtf8('Outline')) + self.OutlineSpinBoxLabel.setText(self.trUtf8('Outline Size:')) + self.OutlineSpinBox.setSuffix(self.trUtf8('px')) self.OutlineColorLabel.setText(self.trUtf8('Outline Color:')) self.OutlineEnabledLabel.setText(self.trUtf8('Show Outline:')) + self.ShadowGroupBox.setTitle(self.trUtf8('Shadow')) + self.ShadowSpinBoxLabel.setText(self.trUtf8('Shadow Size:')) + self.ShadowSpinBox.setSuffix(self.trUtf8('px')) self.ShadowColorLabel.setText(self.trUtf8('Shadow Color:')) self.ShadowEnabledLabel.setText(self.trUtf8('Show Shadow:')) self.AlignmentGroupBox.setTitle(self.trUtf8('Alignment')) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index da56ce3c4..a00a25d72 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -121,8 +121,14 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.onFontFooterHeightSpinBoxChanged) QtCore.QObject.connect(self.OutlineCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged) + QtCore.QObject.connect(self.ShadowSpinBox, + QtCore.SIGNAL(u'editingFinished()'), + self.onShadowSpinBoxChanged) QtCore.QObject.connect(self.ShadowCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckBoxChanged) + QtCore.QObject.connect(self.OutlineSpinBox, + QtCore.SIGNAL(u'editingFinished()'), + self.onOutlineSpinBoxChanged) QtCore.QObject.connect(self.SlideTransitionCheckedBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onSlideTransitionCheckedBoxChanged) @@ -179,7 +185,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): unicode(self.theme.display_horizontalAlign), unicode(self.theme.display_verticalAlign), unicode(self.theme.display_wrapStyle), - unicode(self.theme.display_slideTransition)) + unicode(self.theme.display_slideTransition), + unicode(self.theme.display_shadow_size), + unicode(self.theme.display_outline_size)) theme = new_theme.extract_xml() pretty_theme = new_theme.extract_formatted_xml() if self.thememanager.saveTheme(theme_name, theme, pretty_theme, @@ -434,6 +442,16 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.stateChanging(self.theme) self.previewTheme() + def onOutlineSpinBoxChanged(self): + if self.theme.display_outline_size != self.OutlineSpinBox.value(): + self.theme.display_outline_size = self.OutlineSpinBox.value() + self.previewTheme() + + def onShadowSpinBoxChanged(self): + if self.theme.display_shadow_size != self.ShadowSpinBox.value(): + self.theme.display_shadow_size = self.ShadowSpinBox.value() + self.previewTheme() + def onOutlineColorPushButtonClicked(self): self.theme.display_outline_color = QtGui.QColorDialog.getColor( QtGui.QColor(self.theme.display_outline_color), self).name() @@ -565,6 +583,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): else: self.OutlineCheckBox.setChecked(False) self.OutlineColorPushButton.setEnabled(False) + self.OutlineSpinBox.setValue(int(self.theme.display_outline_size)) if self.theme.display_shadow: self.ShadowCheckBox.setChecked(True) @@ -572,6 +591,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): else: self.ShadowCheckBox.setChecked(False) self.ShadowColorPushButton.setEnabled(False) + self.ShadowSpinBox.setValue(int(self.theme.display_shadow_size)) if self.theme.display_slideTransition: self.SlideTransitionCheckedBox.setCheckState(QtCore.Qt.Checked) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 7a621a8ae..edbf41de8 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -234,8 +234,12 @@ class MainDisplay(DisplayWidget): ``text`` display text """ + log.debug(u'display alert called %s' % text) alertTab = self.parent.settingsForm.AlertsTab - alertframe = QtGui.QPixmap.fromImage(self.frame) + if isinstance(self.frame, QtGui.QImage): + alertframe = QtGui.QPixmap.fromImage(self.frame) + else: + alertframe = QtGui.QPixmap.fromImage(self.frame[u'main']) painter = QtGui.QPainter(alertframe) top = alertframe.rect().height() * 0.9 painter.fillRect( @@ -261,7 +265,10 @@ class MainDisplay(DisplayWidget): def timerEvent(self, event): if event.timerId() == self.timer_id: - self.display.setPixmap(QtGui.QPixmap.fromImage(self.frame)) + if isinstance(self.frame, QtGui.QImage): + self.display.setPixmap(QtGui.QPixmap.fromImage(self.frame)) + else: + self.display.setPixmap(QtGui.QPixmap.fromImage(self.frame[u'main'])) self.killTimer(self.timer_id) self.timer_id = 0 diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 21c0e4d2a..4b599a3e0 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -246,7 +246,7 @@ class SlideController(QtGui.QWidget): self.SlidePreview.sizePolicy().hasHeightForWidth()) self.SlidePreview.setSizePolicy(sizePolicy) self.SlidePreview.setFixedSize( - QtCore.QSize(self.settingsmanager.slidecontroller_image, 225)) + QtCore.QSize(self.settingsmanager.slidecontroller_image,self.settingsmanager.slidecontroller_image / 1.3 )) self.SlidePreview.setFrameShape(QtGui.QFrame.Box) self.SlidePreview.setFrameShadow(QtGui.QFrame.Plain) self.SlidePreview.setLineWidth(1) @@ -390,14 +390,12 @@ class SlideController(QtGui.QWidget): #If old item was a command tell it to stop if self.serviceItem and self.serviceItem.is_command(): self.onMediaStop() - if item.is_command(): - if self.isLive: - Receiver.send_message(u'%s_start' % item.name.lower(), \ - [item.title, item.service_item_path, - item.get_frame_title(), slideno, self.isLive]) - else: - if item.is_media(): - self.onMediaStart(item) + if item.is_media(): + self.onMediaStart(item) + elif item.is_command(): + Receiver.send_message(u'%s_start' % item.name.lower(), \ + [item.title, item.service_item_path, + item.get_frame_title(), slideno, self.isLive]) self.displayServiceManagerItems(item, slideno) def displayServiceManagerItems(self, serviceItem, slideno): @@ -475,7 +473,8 @@ class SlideController(QtGui.QWidget): if not self.serviceItem: return if self.serviceItem.is_command(): - Receiver.send_message(u'%s_first'% self.serviceItem.name.lower()) + Receiver.send_message(u'%s_first'% \ + self.serviceItem.name.lower(), self.isLive) self.updatePreview() else: self.PreviewListWidget.selectRow(0) @@ -504,17 +503,20 @@ class SlideController(QtGui.QWidget): row = self.PreviewListWidget.currentRow() self.selectedRow = 0 if row > -1 and row < self.PreviewListWidget.rowCount(): - if self.serviceItem.is_command(): - Receiver.send_message(u'%s_slide'% self.serviceItem.name.lower(), [row]) - if self.isLive: - self.updatePreview() + if self.serviceItem.is_command() and self.isLive: + Receiver.send_message(u'%s_slide'% \ + self.serviceItem.name.lower(), u'%s:%s' % (row, self.isLive)) + self.updatePreview() else: before = time.time() frame = self.serviceItem.get_rendered_frame(row) if isinstance(frame, QtGui.QImage): self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame)) else: - self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame[u'main'])) + if isinstance(frame[u'main'], basestring): + self.SlidePreview.setPixmap(QtGui.QPixmap(frame[u'main'])) + else: + self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame[u'main'])) log.log(15, u'Slide Rendering took %4s' % (time.time() - before)) if self.isLive: self.parent.mainDisplay.frameView(frame, True) @@ -553,7 +555,8 @@ class SlideController(QtGui.QWidget): if not self.serviceItem: return if self.serviceItem.is_command(): - Receiver.send_message(u'%s_next'% self.serviceItem.name.lower()) + Receiver.send_message(u'%s_next' % \ + self.serviceItem.name.lower(), self.isLive) self.updatePreview() else: row = self.PreviewListWidget.currentRow() + 1 @@ -570,7 +573,7 @@ class SlideController(QtGui.QWidget): return if self.serviceItem.is_command(): Receiver.send_message( - u'%s_previous'% self.serviceItem.name.lower()) + u'%s_previous'% self.serviceItem.name.lower(), self.isLive) self.updatePreview() else: row = self.PreviewListWidget.currentRow() - 1 @@ -586,7 +589,8 @@ class SlideController(QtGui.QWidget): if not self.serviceItem: return if self.serviceItem.is_command(): - Receiver.send_message(u'%s_last'% self.serviceItem.name.lower()) + Receiver.send_message(u'%s_last' % \ + self.serviceItem.name.lower(), self.isLive) self.updatePreview() else: self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount() - 1) @@ -628,11 +632,16 @@ class SlideController(QtGui.QWidget): self.serviceItem, row) def onMediaStart(self, item): - self.mediaObject.stop() - self.mediaObject.clearQueue() - file = os.path.join(item.service_item_path, item.get_frame_title()) - self.mediaObject.setCurrentSource(Phonon.MediaSource(file)) - self.onMediaPlay() + if self.isLive: + Receiver.send_message(u'%s_start' % item.name.lower(), \ + [item.title, item.service_item_path, + item.get_frame_title(), slideno, self.isLive]) + else: + self.mediaObject.stop() + self.mediaObject.clearQueue() + file = os.path.join(item.service_item_path, item.get_frame_title()) + self.mediaObject.setCurrentSource(Phonon.MediaSource(file)) + self.onMediaPlay() def onMediaPause(self): if self.isLive: diff --git a/openlp/plugins/bibles/forms/__init__.py b/openlp/plugins/bibles/forms/__init__.py index 30b9c5b1e..df109ab48 100644 --- a/openlp/plugins/bibles/forms/__init__.py +++ b/openlp/plugins/bibles/forms/__init__.py @@ -23,7 +23,6 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -from bibleimportform import BibleImportForm from importwizardform import ImportWizardForm -__all__ = ['BibleImportForm', 'ImportWizardForm'] +__all__ = ['ImportWizardForm'] diff --git a/openlp/plugins/bibles/forms/bibleimportwizard.py b/openlp/plugins/bibles/forms/bibleimportwizard.py index f0c12046b..119731d1e 100644 --- a/openlp/plugins/bibles/forms/bibleimportwizard.py +++ b/openlp/plugins/bibles/forms/bibleimportwizard.py @@ -46,14 +46,16 @@ class Ui_BibleImportWizard(object): self.TitleLabel = QtGui.QLabel(self.WelcomePage) self.TitleLabel.setObjectName(u'TitleLabel') self.WelcomeLayout.addWidget(self.TitleLabel) - spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + spacerItem = QtGui.QSpacerItem(20, 40, + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) self.WelcomeLayout.addItem(spacerItem) self.InformationLabel = QtGui.QLabel(self.WelcomePage) self.InformationLabel.setWordWrap(True) self.InformationLabel.setMargin(10) self.InformationLabel.setObjectName(u'InformationLabel') self.WelcomeLayout.addWidget(self.InformationLabel) - spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem1 = QtGui.QSpacerItem(20, 40, + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.WelcomeLayout.addItem(spacerItem1) BibleImportWizard.addPage(self.WelcomePage) self.SelectPage = QtGui.QWizardPage() @@ -75,7 +77,8 @@ class Ui_BibleImportWizard(object): self.FormatComboBox.addItem(u'') self.FormatComboBox.addItem(u'') self.FormatSelectLayout.addWidget(self.FormatComboBox) - spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem2 = QtGui.QSpacerItem(40, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.FormatSelectLayout.addItem(spacerItem2) self.SelectPageLayout.addLayout(self.FormatSelectLayout) self.FormatWidget = QtGui.QStackedWidget(self.SelectPage) @@ -83,20 +86,24 @@ class Ui_BibleImportWizard(object): self.OsisPage = QtGui.QWidget() self.OsisPage.setObjectName(u'OsisPage') self.OsisLayout = QtGui.QFormLayout(self.OsisPage) - self.OsisLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow) + self.OsisLayout.setFieldGrowthPolicy( + QtGui.QFormLayout.ExpandingFieldsGrow) self.OsisLayout.setMargin(0) self.OsisLayout.setSpacing(8) self.OsisLayout.setObjectName(u'OsisLayout') self.OsisBibleNameLabel = QtGui.QLabel(self.OsisPage) self.OsisBibleNameLabel.setIndent(0) self.OsisBibleNameLabel.setObjectName(u'OsisBibleNameLabel') - self.OsisLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.OsisBibleNameLabel) + self.OsisLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.OsisBibleNameLabel) self.OsisBibleNameEdit = QtGui.QLineEdit(self.OsisPage) self.OsisBibleNameEdit.setObjectName(u'OsisBibleNameEdit') - self.OsisLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.OsisBibleNameEdit) + self.OsisLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.OsisBibleNameEdit) self.OsisLocationLabel = QtGui.QLabel(self.OsisPage) self.OsisLocationLabel.setObjectName(u'OsisLocationLabel') - self.OsisLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.OsisLocationLabel) + self.OsisLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.OsisLocationLabel) self.OsisLocationLayout = QtGui.QHBoxLayout() self.OsisLocationLayout.setSpacing(8) self.OsisLocationLayout.setObjectName(u'OsisLocationLayout') @@ -106,24 +113,30 @@ class Ui_BibleImportWizard(object): self.OsisFileButton = QtGui.QToolButton(self.OsisPage) self.OsisFileButton.setMaximumSize(QtCore.QSize(32, 16777215)) icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(u':/imports/import_load.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon.addPixmap(QtGui.QPixmap(u':/imports/import_load.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.OsisFileButton.setIcon(icon) self.OsisFileButton.setObjectName(u'OsisFileButton') self.OsisLocationLayout.addWidget(self.OsisFileButton) - self.OsisLayout.setLayout(1, QtGui.QFormLayout.FieldRole, self.OsisLocationLayout) + self.OsisLayout.setLayout(1, QtGui.QFormLayout.FieldRole, + self.OsisLocationLayout) self.FormatWidget.addWidget(self.OsisPage) self.CsvPage = QtGui.QWidget() self.CsvPage.setObjectName(u'CsvPage') self.CsvSourceLayout = QtGui.QFormLayout(self.CsvPage) - self.CsvSourceLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow) - self.CsvSourceLayout.setLabelAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing) - self.CsvSourceLayout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.CsvSourceLayout.setFieldGrowthPolicy( + QtGui.QFormLayout.ExpandingFieldsGrow) + self.CsvSourceLayout.setLabelAlignment(QtCore.Qt.AlignBottom | + QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing) + self.CsvSourceLayout.setFormAlignment(QtCore.Qt.AlignLeading | + QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) self.CsvSourceLayout.setMargin(0) self.CsvSourceLayout.setSpacing(8) self.CsvSourceLayout.setObjectName(u'CsvSourceLayout') self.BooksLocationLabel = QtGui.QLabel(self.CsvPage) self.BooksLocationLabel.setObjectName(u'BooksLocationLabel') - self.CsvSourceLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.BooksLocationLabel) + self.CsvSourceLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.BooksLocationLabel) self.CsvBooksLayout = QtGui.QHBoxLayout() self.CsvBooksLayout.setSpacing(8) self.CsvBooksLayout.setObjectName(u'CsvBooksLayout') @@ -135,10 +148,12 @@ class Ui_BibleImportWizard(object): self.BooksFileButton.setIcon(icon) self.BooksFileButton.setObjectName(u'BooksFileButton') self.CsvBooksLayout.addWidget(self.BooksFileButton) - self.CsvSourceLayout.setLayout(0, QtGui.QFormLayout.FieldRole, self.CsvBooksLayout) + self.CsvSourceLayout.setLayout(0, QtGui.QFormLayout.FieldRole, + self.CsvBooksLayout) self.VerseLocationLabel = QtGui.QLabel(self.CsvPage) self.VerseLocationLabel.setObjectName(u'VerseLocationLabel') - self.CsvSourceLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.VerseLocationLabel) + self.CsvSourceLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.VerseLocationLabel) self.CsvVerseLayout = QtGui.QHBoxLayout() self.CsvVerseLayout.setSpacing(8) self.CsvVerseLayout.setObjectName(u'CsvVerseLayout') @@ -150,7 +165,8 @@ class Ui_BibleImportWizard(object): self.CsvVersesFileButton.setIcon(icon) self.CsvVersesFileButton.setObjectName(u'CsvVersesFileButton') self.CsvVerseLayout.addWidget(self.CsvVersesFileButton) - self.CsvSourceLayout.setLayout(1, QtGui.QFormLayout.FieldRole, self.CsvVerseLayout) + self.CsvSourceLayout.setLayout(1, QtGui.QFormLayout.FieldRole, + self.CsvVerseLayout) self.FormatWidget.addWidget(self.CsvPage) self.OpenSongPage = QtGui.QWidget() self.OpenSongPage.setObjectName(u'OpenSongPage') @@ -160,7 +176,8 @@ class Ui_BibleImportWizard(object): self.OpenSongLayout.setObjectName(u'OpenSongLayout') self.OpenSongFileLabel = QtGui.QLabel(self.OpenSongPage) self.OpenSongFileLabel.setObjectName(u'OpenSongFileLabel') - self.OpenSongLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.OpenSongFileLabel) + self.OpenSongLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.OpenSongFileLabel) self.OpenSongFileLayout = QtGui.QHBoxLayout() self.OpenSongFileLayout.setSpacing(8) self.OpenSongFileLayout.setObjectName(u'OpenSongFileLayout') @@ -171,7 +188,8 @@ class Ui_BibleImportWizard(object): self.OpenSongBrowseButton.setIcon(icon) self.OpenSongBrowseButton.setObjectName(u'OpenSongBrowseButton') self.OpenSongFileLayout.addWidget(self.OpenSongBrowseButton) - self.OpenSongLayout.setLayout(0, QtGui.QFormLayout.FieldRole, self.OpenSongFileLayout) + self.OpenSongLayout.setLayout(0, QtGui.QFormLayout.FieldRole, + self.OpenSongFileLayout) self.FormatWidget.addWidget(self.OpenSongPage) self.WebDownloadPage = QtGui.QWidget() self.WebDownloadPage.setObjectName(u'WebDownloadPage') @@ -189,22 +207,26 @@ class Ui_BibleImportWizard(object): self.DownloadOptionsLayout.setObjectName(u'DownloadOptionsLayout') self.LocationLabel = QtGui.QLabel(self.DownloadOptionsTab) self.LocationLabel.setObjectName(u'LocationLabel') - self.DownloadOptionsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.LocationLabel) + self.DownloadOptionsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.LocationLabel) self.LocationComboBox = QtGui.QComboBox(self.DownloadOptionsTab) self.LocationComboBox.setObjectName(u'LocationComboBox') self.LocationComboBox.addItem(u'') self.LocationComboBox.addItem(u'') - self.DownloadOptionsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.LocationComboBox) + self.DownloadOptionsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.LocationComboBox) self.BibleLabel = QtGui.QLabel(self.DownloadOptionsTab) self.BibleLabel.setObjectName(u'BibleLabel') - self.DownloadOptionsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.BibleLabel) + self.DownloadOptionsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.BibleLabel) self.BibleComboBox = QtGui.QComboBox(self.DownloadOptionsTab) self.BibleComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) self.BibleComboBox.setObjectName(u'BibleComboBox') self.BibleComboBox.addItem(u'') self.BibleComboBox.addItem(u'') self.BibleComboBox.addItem(u'') - self.DownloadOptionsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.BibleComboBox) + self.DownloadOptionsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.BibleComboBox) self.WebDownloadTabWidget.addTab(self.DownloadOptionsTab, u'') self.ProxyServerTab = QtGui.QWidget() self.ProxyServerTab.setObjectName(u'ProxyServerTab') @@ -212,22 +234,28 @@ class Ui_BibleImportWizard(object): self.ProxyServerLayout.setObjectName(u'ProxyServerLayout') self.AddressLabel = QtGui.QLabel(self.ProxyServerTab) self.AddressLabel.setObjectName(u'AddressLabel') - self.ProxyServerLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.AddressLabel) + self.ProxyServerLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.AddressLabel) self.AddressEdit = QtGui.QLineEdit(self.ProxyServerTab) self.AddressEdit.setObjectName(u'AddressEdit') - self.ProxyServerLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.AddressEdit) + self.ProxyServerLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.AddressEdit) self.UsernameLabel = QtGui.QLabel(self.ProxyServerTab) self.UsernameLabel.setObjectName(u'UsernameLabel') - self.ProxyServerLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.UsernameLabel) + self.ProxyServerLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.UsernameLabel) self.UsernameEdit = QtGui.QLineEdit(self.ProxyServerTab) self.UsernameEdit.setObjectName(u'UsernameEdit') - self.ProxyServerLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.UsernameEdit) + self.ProxyServerLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.UsernameEdit) self.PasswordLabel = QtGui.QLabel(self.ProxyServerTab) self.PasswordLabel.setObjectName(u'PasswordLabel') - self.ProxyServerLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.PasswordLabel) + self.ProxyServerLayout.setWidget(2, QtGui.QFormLayout.LabelRole, + self.PasswordLabel) self.PasswordEdit = QtGui.QLineEdit(self.ProxyServerTab) self.PasswordEdit.setObjectName(u'PasswordEdit') - self.ProxyServerLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.PasswordEdit) + self.ProxyServerLayout.setWidget(2, QtGui.QFormLayout.FieldRole, + self.PasswordEdit) self.WebDownloadTabWidget.addTab(self.ProxyServerTab, u'') self.WebDownloadLayout.addWidget(self.WebDownloadTabWidget) self.FormatWidget.addWidget(self.WebDownloadPage) @@ -241,22 +269,28 @@ class Ui_BibleImportWizard(object): self.LicenseDetailsLayout.setObjectName(u'LicenseDetailsLayout') self.VersionNameLabel = QtGui.QLabel(self.LicenseDetailsPage) self.VersionNameLabel.setObjectName(u'VersionNameLabel') - self.LicenseDetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.VersionNameLabel) + self.LicenseDetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.VersionNameLabel) self.VersionNameEdit = QtGui.QLineEdit(self.LicenseDetailsPage) self.VersionNameEdit.setObjectName(u'VersionNameEdit') - self.LicenseDetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.VersionNameEdit) + self.LicenseDetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.VersionNameEdit) self.CopyrightLabel = QtGui.QLabel(self.LicenseDetailsPage) self.CopyrightLabel.setObjectName(u'CopyrightLabel') - self.LicenseDetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.CopyrightLabel) + self.LicenseDetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.CopyrightLabel) self.CopyrightEdit = QtGui.QLineEdit(self.LicenseDetailsPage) self.CopyrightEdit.setObjectName(u'CopyrightEdit') - self.LicenseDetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.CopyrightEdit) + self.LicenseDetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.CopyrightEdit) self.PermissionLabel = QtGui.QLabel(self.LicenseDetailsPage) self.PermissionLabel.setObjectName(u'PermissionLabel') - self.LicenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.PermissionLabel) + self.LicenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole,\ + self.PermissionLabel) self.PermissionEdit = QtGui.QLineEdit(self.LicenseDetailsPage) self.PermissionEdit.setObjectName(u'PermissionEdit') - self.LicenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.PermissionEdit) + self.LicenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, + self.PermissionEdit) BibleImportWizard.addPage(self.LicenseDetailsPage) self.ImportPage = QtGui.QWizardPage() self.ImportPage.setObjectName(u'ImportPage') @@ -278,15 +312,23 @@ class Ui_BibleImportWizard(object): self.retranslateUi(BibleImportWizard) self.FormatWidget.setCurrentIndex(0) self.WebDownloadTabWidget.setCurrentIndex(0) - QtCore.QObject.connect(self.FormatComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.FormatWidget.setCurrentIndex) + QtCore.QObject.connect(self.FormatComboBox, + QtCore.SIGNAL(u'currentIndexChanged(int)'), + self.FormatWidget.setCurrentIndex) QtCore.QMetaObject.connectSlotsByName(BibleImportWizard) def retranslateUi(self, BibleImportWizard): BibleImportWizard.setWindowTitle(self.trUtf8('Bible Import Wizard')) - self.TitleLabel.setText(u'' + self.trUtf8('Welcome to the Bible Import Wizard') + u'') - self.InformationLabel.setText(self.trUtf8('This wizard will help you to import Bibles from a variety of formats. Click the next button below to start the process by selecting a format to import from.')) + self.TitleLabel.setText( + u'' + \ + self.trUtf8('Welcome to the Bible Import Wizard') + u'') + self.InformationLabel.setText( + self.trUtf8('This wizard will help you to import Bibles from a ' + 'variety of formats. Click the next button below to start the ' + 'process by selecting a format to import from.')) self.SelectPage.setTitle(self.trUtf8('Select Import Source')) - self.SelectPage.setSubTitle(self.trUtf8('Select the import format, and where to import from.')) + self.SelectPage.setSubTitle( + self.trUtf8('Select the import format, and where to import from.')) self.FormatLabel.setText(self.trUtf8('Format:')) self.FormatComboBox.setItemText(0, self.trUtf8('OSIS')) self.FormatComboBox.setItemText(1, self.trUtf8('CSV')) @@ -301,21 +343,24 @@ class Ui_BibleImportWizard(object): self.LocationComboBox.setItemText(0, self.trUtf8('Crosswalk')) self.LocationComboBox.setItemText(1, self.trUtf8('BibleGateway')) self.BibleLabel.setText(self.trUtf8('Bible:')) - self.BibleComboBox.setItemText(0, self.trUtf8('English Standard Version')) - self.BibleComboBox.setItemText(1, self.trUtf8('King James Version')) - self.BibleComboBox.setItemText(2, self.trUtf8('New International Version')) - self.WebDownloadTabWidget.setTabText(self.WebDownloadTabWidget.indexOf(self.DownloadOptionsTab), self.trUtf8('Download Options')) + self.WebDownloadTabWidget.setTabText( + self.WebDownloadTabWidget.indexOf(self.DownloadOptionsTab), + self.trUtf8('Download Options')) self.AddressLabel.setText(self.trUtf8('Server:')) self.UsernameLabel.setText(self.trUtf8('Username:')) self.PasswordLabel.setText(self.trUtf8('Password:')) - self.WebDownloadTabWidget.setTabText(self.WebDownloadTabWidget.indexOf(self.ProxyServerTab), self.trUtf8('Proxy Server (Optional)')) + self.WebDownloadTabWidget.setTabText( + self.WebDownloadTabWidget.indexOf(self.ProxyServerTab), + self.trUtf8('Proxy Server (Optional)')) self.LicenseDetailsPage.setTitle(self.trUtf8('License Details')) - self.LicenseDetailsPage.setSubTitle(self.trUtf8('Set up the Bible\'s license details.')) + self.LicenseDetailsPage.setSubTitle( + self.trUtf8('Set up the Bible\'s license details.')) self.VersionNameLabel.setText(self.trUtf8('Version Name:')) self.CopyrightLabel.setText(self.trUtf8('Copyright:')) self.PermissionLabel.setText(self.trUtf8('Permission:')) self.ImportPage.setTitle(self.trUtf8('Importing')) - self.ImportPage.setSubTitle(self.trUtf8('Please wait while your Bible is imported.')) + self.ImportPage.setSubTitle( + self.trUtf8('Please wait while your Bible is imported.')) self.ImportProgressLabel.setText(self.trUtf8('Ready.')) - self.ImportProgressBar.setFormat(u'%p') + #self.ImportProgressBar.setFormat(u'%p') diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 163096adc..4ba035554 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -30,7 +30,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, Receiver, str_to_bool, \ BaseListWithDnD -from openlp.plugins.bibles.forms import BibleImportForm, ImportWizardForm +from openlp.plugins.bibles.forms import ImportWizardForm from openlp.plugins.bibles.lib.manager import BibleMode class BibleListView(BaseListWithDnD): diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index a1828efa3..8cb90deaf 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -27,7 +27,7 @@ import logging from forms import EditCustomForm from openlp.core.lib import Plugin, build_icon -from openlp.plugins.custom.lib import CustomManager, CustomMediaItem +from openlp.plugins.custom.lib import CustomManager, CustomMediaItem, CustomTab class CustomPlugin(Plugin): @@ -51,6 +51,9 @@ class CustomPlugin(Plugin): self.edit_custom_form = EditCustomForm(self.custommanager) self.icon = build_icon(u':/media/media_custom.png') + def get_settings_tab(self): + return CustomTab(self.name) + def get_media_manager_item(self): # Create the CustomManagerItem object return CustomMediaItem(self, self.icon, self.name) diff --git a/openlp/plugins/custom/lib/__init__.py b/openlp/plugins/custom/lib/__init__.py index f780fc6b8..8141d7f58 100644 --- a/openlp/plugins/custom/lib/__init__.py +++ b/openlp/plugins/custom/lib/__init__.py @@ -25,3 +25,4 @@ from manager import CustomManager from mediaitem import CustomMediaItem +from customtab import CustomTab diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py new file mode 100644 index 000000000..642381f2f --- /dev/null +++ b/openlp/plugins/custom/lib/customtab.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2009 Raoul Snyman # +# Portions copyright (c) 2008-2009 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # +# Carsten Tinggaard # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from PyQt4 import QtCore, QtGui + +from openlp.core.lib import SettingsTab, str_to_bool + +class CustomTab(SettingsTab): + """ + CustomTab is the Custom settings tab in the settings dialog. + """ + def __init__(self, title, section=None): + SettingsTab.__init__(self, title, section) + + def setupUi(self): + self.setObjectName(u'CustomTab') + self.tabTitleVisible = self.trUtf8('Custom') + self.CustomLayout = QtGui.QFormLayout(self) + self.CustomLayout.setObjectName(u'CustomLayout') + self.CustomModeGroupBox = QtGui.QGroupBox(self) + self.CustomModeGroupBox.setObjectName(u'CustomModeGroupBox') + self.CustomModeLayout = QtGui.QVBoxLayout(self.CustomModeGroupBox) + self.CustomModeLayout.setSpacing(8) + self.CustomModeLayout.setMargin(8) + self.CustomModeLayout.setObjectName(u'CustomModeLayout') + self.DisplayFooterCheckBox = QtGui.QCheckBox(self.CustomModeGroupBox) + self.DisplayFooterCheckBox.setObjectName(u'DisplayFooterCheckBox') + self.CustomModeLayout.addWidget(self.DisplayFooterCheckBox) + self.CustomLayout.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.CustomModeGroupBox) + QtCore.QObject.connect(self.DisplayFooterCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), + self.onDisplayFooterCheckBoxChanged) + + def retranslateUi(self): + self.CustomModeGroupBox.setTitle(self.trUtf8('Custom Display')) + self.DisplayFooterCheckBox.setText( + self.trUtf8('Display Footer:')) + + def onDisplayFooterCheckBoxChanged(self, check_state): + self.displayFooter = False + # we have a set value convert to True/False + if check_state == QtCore.Qt.Checked: + self.displayFooter = True + + def load(self): + self.displayFooter = str_to_bool( + self.config.get_config(u'display footer', True)) + self.DisplayFooterCheckBox.setChecked(self.displayFooter) + + def save(self): + self.config.set_config(u'display footer', unicode(self.displayFooter)) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 995278f98..556c89918 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -27,7 +27,8 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import MediaManagerItem, SongXMLParser, BaseListWithDnD, Receiver +from openlp.core.lib import MediaManagerItem, SongXMLParser, BaseListWithDnD,\ +Receiver, str_to_bool class CustomListView(BaseListWithDnD): def __init__(self, parent=None): @@ -155,9 +156,13 @@ class CustomMediaItem(MediaManagerItem): verseList = songXML.get_verses() for verse in verseList: raw_slides.append(verse[1]) - raw_footer.append(title + u' '+ credit) service_item.title = title for slide in raw_slides: service_item.add_from_text(slide[:30], slide) + if str_to_bool(self.parent.config.get_config(u'display footer', True)) or \ + len(credit) > 0: + raw_footer.append(title + u' '+ credit) + else: + raw_footer.append(u'') service_item.raw_footer = raw_footer return True diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 833cac360..31e1a86c2 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -30,6 +30,122 @@ from PyQt4 import QtCore from openlp.core.lib import Receiver +class Controller(object): + """ + This is the Presentation listener who acts on events from the slide + controller and passes the messages on the the correct presentation handlers + """ + global log + log = logging.getLogger(u'Controller') + log.info(u'Controller loaded') + + def __init__(self, live): + self.isLive = live + log.info(u'%s controller loaded' % live) + + def addHandler(self, controller, file): + log.debug(u'Live = %s, addHandler %s' % (self.isLive, file)) + self.controller = controller + if self.controller.is_loaded(): + self.shutdown(None) + self.controller.load_presentation(file) + if self.isLive: + self.controller.start_presentation() + Receiver.send_message(u'live_slide_hide') + self.controller.slidenumber = 0 + + def activate(self): + log.debug(u'Live = %s, activate' % self.isLive) + if self.controller.is_active(): + return + if not self.controller.is_loaded(): + self.controller.load_presentation(self.controller.filepath) + if self.isLive: + self.controller.start_presentation() + if self.controller.slidenumber > 1: + self.controller.goto_slide(self.controller.slidenumber) + + def slide(self, slide, live): + log.debug(u'Live = %s, slide' % live) +# if not isLive: +# return + self.activate() + self.controller.goto_slide(int(slide) + 1) + self.controller.poll_slidenumber(live) + + def first(self, message): + """ + Based on the handler passed at startup triggers the first slide + """ + log.debug(u'Live = %s, first' % self.isLive) + print "first ", message + if not self.isLive: + return + self.activate() + self.controller.start_presentation() + self.controller.poll_slidenumber(self.isLive) + + def last(self, message): + """ + Based on the handler passed at startup triggers the first slide + """ + log.debug(u'Live = %s, last' % self.isLive) + print "last ", message + if not self.isLive: + return + self.activate() + self.controller.goto_slide(self.controller.get_slide_count()) + self.controller.poll_slidenumber(self.isLive) + + def next(self, message): + """ + Based on the handler passed at startup triggers the next slide event + """ + log.debug(u'Live = %s, next' % self.isLive) + print "next ", message + if not self.isLive: + return + self.activate() + self.controller.next_step() + self.controller.poll_slidenumber(self.isLive) + + def previous(self, message): + """ + Based on the handler passed at startup triggers the previous slide event + """ + log.debug(u'Live = %s, previous' % self.isLive) + if not self.isLive: + return + print "previous ", message + self.activate() + self.controller.previous_step() + self.controller.poll_slidenumber(self.isLive) + + def shutdown(self, message): + """ + Based on the handler passed at startup triggers slide show to shut down + """ + log.debug(u'Live = %s, shutdown' % self.isLive) + self.controller.close_presentation() + self.controller.slidenumber = 0 + #self.timer.stop() + + def blank(self): + if not self.isLive: + return + if not self.controller.is_loaded(): + return + if not self.controller.is_active(): + return + self.controller.blank_screen() + + def unblank(self): + if not self.is_live: + return + self.activate() + self.controller.unblank_screen() + + class MessageListener(object): """ This is the Presentation listener who acts on events from the slide @@ -41,8 +157,9 @@ class MessageListener(object): def __init__(self, controllers): self.controllers = controllers - self.handler = None - self.is_live = None + self.previewHandler = Controller(False) + self.liveHandler = Controller(True) + self.isLive = None # messages are sent from core.ui.slidecontroller QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'presentations_start'), self.startup) @@ -71,108 +188,84 @@ class MessageListener(object): Start of new presentation Save the handler as any new presentations start here """ - self.handler, file, self.is_live = self.decodeMessage(message) - self.controller = self.controllers[self.handler] - if self.controller.is_loaded(): - self.shutdown(None) - self.controller.load_presentation(file) - if self.is_live: - self.controller.start_presentation() - Receiver.send_message(u'live_slide_hide') - self.controller.slidenumber = 0 - self.timer.start() - - def activate(self): - if self.controller.is_active(): - return - if not self.controller.is_loaded(): - self.controller.load_presentation(self.controller.filepath) - self.controller.start_presentation() - if self.controller.slidenumber > 1: - self.controller.goto_slide(self.controller.slidenumber) + log.debug(u'Startup called with message %s' % message) + self.handler, file, isLive = self.decodeMessage(message) + if isLive: + self.liveHandler.addHandler(self.controllers[self.handler], file) + else: + self.previewHandler.addHandler(self.controllers[self.handler], file) def slide(self, message): - if not self.is_live: - return - self.activate() - if message: - self.controller.goto_slide(message[0]+1) - self.controller.poll_slidenumber(self.is_live) + slide, live = self.splitMessage(message) + if live: + self.liveHandler.slide(slide, live) + else: + self.previewHandler.slide(slide, live) def first(self, message): - """ - Based on the handler passed at startup triggers the first slide - """ - if not self.is_live: - return - self.activate() - self.controller.start_presentation() - self.controller.poll_slidenumber(self.is_live) + if self.isLive: + self.liveHandler.first(message) + else: + self.previewHandler.first(message) def last(self, message): - """ - Based on the handler passed at startup triggers the first slide - """ - if not self.is_live: - return - self.activate() - self.controller.goto_slide(self.controller.get_slide_count()) - self.controller.poll_slidenumber(self.is_live) + if self.isLive: + self.liveHandler.last(message) + else: + self.previewHandler.last(message) def next(self, message): - """ - Based on the handler passed at startup triggers the next slide event - """ - if not self.is_live: - return - self.activate() - self.controller.next_step() - self.controller.poll_slidenumber(self.is_live) + if self.isLive: + self.liveHandler.next(message) + else: + self.previewHandler.next(message) def previous(self, message): - """ - Based on the handler passed at startup triggers the previous slide event - """ - if not self.is_live: - return - self.activate() - self.controller.previous_step() - self.controller.poll_slidenumber(self.is_live) + if self.isLive: + self.liveHandler.previous(message) + else: + self.previewHandler.previous(message) def shutdown(self, message): - """ - Based on the handler passed at startup triggers slide show to shut down - """ - if self.is_live: + if self.isLive: + self.liveHandler.shutdown(message) Receiver.send_message(u'live_slide_show') - self.controller.close_presentation() - self.controller.slidenumber = 0 - self.timer.stop() + else: + self.previewHandler.shutdown(message) def blank(self): - if not self.is_live: - return - if not self.controller.is_loaded(): - return - if not self.controller.is_active(): - return - self.controller.blank_screen() + if self.isLive: + self.liveHandler.blank() + else: + self.previewHandler.blank() def unblank(self): - if not self.is_live: - return - self.activate() - self.controller.unblank_screen() + if self.isLive: + self.liveHandler.unblank() + else: + self.previewHandler.unblank() + + def splitMessage(self, message): + """ + Splits the selection messages + into it's component parts + + ``message`` + Message containing Presentaion handler name and file to be presented. + """ + bits = message.split(u':') + return bits[0], bits[1] def decodeMessage(self, message): """ - Splits the message from the SlideController into it's component parts + Splits the initial message from the SlideController + into it's component parts ``message`` Message containing Presentaion handler name and file to be presented. """ file = os.path.join(message[1], message[2]) - return message[0], file, message[3] + return message[0], file, message[4] def timeout(self): self.controller.poll_slidenumber(self.is_live) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index dc5b522b4..3d04c7cb1 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -336,14 +336,19 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): data = u'%s:%s' %(verse, subVerse) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data)) item.setText(afterText) - #number of lines has change + #number of lines has change so repaint the list moving the data if len(tempText.split(u'\n')) != len(afterText.split(u'\n')): tempList = {} + tempId = {} for row in range(0, self.VerseListWidget.count()): tempList[row] = self.VerseListWidget.item(row).text() + tempId[row] = self.VerseListWidget.item(row).\ + data(QtCore.Qt.UserRole) self.VerseListWidget.clear() for row in range (0, len(tempList)): - self.VerseListWidget.addItem(tempList[row]) + item = QtGui.QListWidgetItem(tempList[row]) + item.setData(QtCore.Qt.UserRole, tempId[row]) + self.VerseListWidget.addItem(item) self.VerseListWidget.repaint() self.VerseEditButton.setEnabled(False) self.VerseDeleteButton.setEnabled(False) diff --git a/version.txt b/version.txt index 1a4db8166..674a98ba1 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.9.0-688 +1.9.0-691