forked from openlp/openlp
head
This commit is contained in:
commit
b53ed99eea
@ -30,7 +30,7 @@
|
|||||||
The :mod:`listpreviewwidget` is a widget that lists the slides in the slide controller.
|
The :mod:`listpreviewwidget` is a widget that lists the slides in the slide controller.
|
||||||
It is based on a QTableWidget but represents its contents in list form.
|
It is based on a QTableWidget but represents its contents in list form.
|
||||||
"""
|
"""
|
||||||
|
from __future__ import division
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import ImageSource, Registry, ServiceItem
|
from openlp.core.lib import ImageSource, Registry, ServiceItem
|
||||||
@ -76,7 +76,7 @@ class ListPreviewWidget(QtGui.QTableWidget):
|
|||||||
else:
|
else:
|
||||||
# Sort out image heights.
|
# Sort out image heights.
|
||||||
for framenumber in range(len(self.service_item.get_frames())):
|
for framenumber in range(len(self.service_item.get_frames())):
|
||||||
height = self.viewport().width() / self.screen_ratio
|
height = self.viewport().width() // self.screen_ratio
|
||||||
self.setRowHeight(framenumber, height)
|
self.setRowHeight(framenumber, height)
|
||||||
|
|
||||||
def screen_size_changed(self, screen_ratio):
|
def screen_size_changed(self, screen_ratio):
|
||||||
@ -101,7 +101,7 @@ class ListPreviewWidget(QtGui.QTableWidget):
|
|||||||
for framenumber, frame in enumerate(self.service_item.get_frames()):
|
for framenumber, frame in enumerate(self.service_item.get_frames()):
|
||||||
self.setRowCount(self.slide_count() + 1)
|
self.setRowCount(self.slide_count() + 1)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtGui.QTableWidgetItem()
|
||||||
slideHeight = 0
|
slide_height = 0
|
||||||
if self.service_item.is_text():
|
if self.service_item.is_text():
|
||||||
if frame[u'verseTag']:
|
if frame[u'verseTag']:
|
||||||
# These tags are already translated.
|
# These tags are already translated.
|
||||||
@ -125,12 +125,12 @@ class ListPreviewWidget(QtGui.QTableWidget):
|
|||||||
image = self.image_manager.get_image(frame[u'path'], ImageSource.ImagePlugin)
|
image = self.image_manager.get_image(frame[u'path'], ImageSource.ImagePlugin)
|
||||||
label.setPixmap(QtGui.QPixmap.fromImage(image))
|
label.setPixmap(QtGui.QPixmap.fromImage(image))
|
||||||
self.setCellWidget(framenumber, 0, label)
|
self.setCellWidget(framenumber, 0, label)
|
||||||
slideHeight = width / self.screen_ratio
|
slide_height = width // self.screen_ratio
|
||||||
row += 1
|
row += 1
|
||||||
text.append(unicode(row))
|
text.append(unicode(row))
|
||||||
self.setItem(framenumber, 0, item)
|
self.setItem(framenumber, 0, item)
|
||||||
if slideHeight:
|
if slide_height:
|
||||||
self.setRowHeight(framenumber, slideHeight)
|
self.setRowHeight(framenumber, slide_height)
|
||||||
self.setVerticalHeaderLabels(text)
|
self.setVerticalHeaderLabels(text)
|
||||||
if self.service_item.is_text():
|
if self.service_item.is_text():
|
||||||
self.resizeRowsToContents()
|
self.resizeRowsToContents()
|
||||||
|
@ -288,7 +288,7 @@ class MainDisplay(Display):
|
|||||||
self.image(path)
|
self.image(path)
|
||||||
# Update the preview frame.
|
# Update the preview frame.
|
||||||
if self.is_live:
|
if self.is_live:
|
||||||
self.live_controller.updatePreview()
|
self.live_controller.update_preview()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def image(self, path):
|
def image(self, path):
|
||||||
|
@ -669,7 +669,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
Check and display message if screen blank on setup.
|
Check and display message if screen blank on setup.
|
||||||
"""
|
"""
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
self.live_controller.mainDisplaySetBackground()
|
self.live_controller.main_display_set_background()
|
||||||
if settings.value(u'%s/screen blank' % self.general_settings_section):
|
if settings.value(u'%s/screen blank' % self.general_settings_section):
|
||||||
if settings.value(u'%s/blank warning' % self.general_settings_section):
|
if settings.value(u'%s/blank warning' % self.general_settings_section):
|
||||||
QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'OpenLP Main Display Blanked'),
|
QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'OpenLP Main Display Blanked'),
|
||||||
|
@ -31,7 +31,7 @@ The actual plugin view form
|
|||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import PluginStatus, Registry, translate
|
from openlp.core.lib import PluginStatus, Registry, translate
|
||||||
from plugindialog import Ui_PluginViewDialog
|
from plugindialog import Ui_PluginViewDialog
|
||||||
|
@ -1267,7 +1267,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||||||
newItem.merge(item[u'service_item'])
|
newItem.merge(item[u'service_item'])
|
||||||
item[u'service_item'] = newItem
|
item[u'service_item'] = newItem
|
||||||
self.repaint_service_list(item_count + 1, 0)
|
self.repaint_service_list(item_count + 1, 0)
|
||||||
self.live_controller.replaceServiceManagerItem(newItem)
|
self.live_controller.replace_service_manager_item(newItem)
|
||||||
self.set_modified()
|
self.set_modified()
|
||||||
|
|
||||||
def add_service_item(self, item, rebuild=False, expand=None, replace=False, repaint=True, selected=False):
|
def add_service_item(self, item, rebuild=False, expand=None, replace=False, repaint=True, selected=False):
|
||||||
@ -1289,7 +1289,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||||||
item.merge(self.service_items[sitem][u'service_item'])
|
item.merge(self.service_items[sitem][u'service_item'])
|
||||||
self.service_items[sitem][u'service_item'] = item
|
self.service_items[sitem][u'service_item'] = item
|
||||||
self.repaint_service_list(sitem, child)
|
self.repaint_service_list(sitem, child)
|
||||||
self.live_controller.replaceServiceManagerItem(item)
|
self.live_controller.replace_service_manager_item(item)
|
||||||
else:
|
else:
|
||||||
item.render()
|
item.render()
|
||||||
# nothing selected for dnd
|
# nothing selected for dnd
|
||||||
@ -1312,7 +1312,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||||||
self.repaint_service_list(self.drop_position, -1)
|
self.repaint_service_list(self.drop_position, -1)
|
||||||
# if rebuilding list make sure live is fixed.
|
# if rebuilding list make sure live is fixed.
|
||||||
if rebuild:
|
if rebuild:
|
||||||
self.live_controller.replaceServiceManagerItem(item)
|
self.live_controller.replace_service_manager_item(item)
|
||||||
self.drop_position = 0
|
self.drop_position = 0
|
||||||
self.set_modified()
|
self.set_modified()
|
||||||
|
|
||||||
@ -1323,7 +1323,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||||||
self.application.set_busy_cursor()
|
self.application.set_busy_cursor()
|
||||||
item, child = self.find_service_item()
|
item, child = self.find_service_item()
|
||||||
if self.service_items[item][u'service_item'].is_valid:
|
if self.service_items[item][u'service_item'].is_valid:
|
||||||
self.preview_controller.addServiceManagerItem(self.service_items[item][u'service_item'], child)
|
self.preview_controller.add_service_manager_item(self.service_items[item][u'service_item'], child)
|
||||||
else:
|
else:
|
||||||
critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
|
critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
|
||||||
translate('OpenLP.ServiceManager',
|
translate('OpenLP.ServiceManager',
|
||||||
@ -1361,12 +1361,12 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||||||
child = row
|
child = row
|
||||||
self.application.set_busy_cursor()
|
self.application.set_busy_cursor()
|
||||||
if self.service_items[item][u'service_item'].is_valid:
|
if self.service_items[item][u'service_item'].is_valid:
|
||||||
self.live_controller.addServiceManagerItem(self.service_items[item][u'service_item'], child)
|
self.live_controller.add_service_manager_item(self.service_items[item][u'service_item'], child)
|
||||||
if Settings().value(self.main_window.general_settings_section + u'/auto preview'):
|
if Settings().value(self.main_window.general_settings_section + u'/auto preview'):
|
||||||
item += 1
|
item += 1
|
||||||
if self.service_items and item < len(self.service_items) and \
|
if self.service_items and item < len(self.service_items) and \
|
||||||
self.service_items[item][u'service_item'].is_capable(ItemCapabilities.CanPreview):
|
self.service_items[item][u'service_item'].is_capable(ItemCapabilities.CanPreview):
|
||||||
self.preview_controller.addServiceManagerItem(self.service_items[item][u'service_item'], 0)
|
self.preview_controller.add_service_manager_item(self.service_items[item][u'service_item'], 0)
|
||||||
next_item = self.service_manager_list.topLevelItem(item)
|
next_item = self.service_manager_list.topLevelItem(item)
|
||||||
self.service_manager_list.setCurrentItem(next_item)
|
self.service_manager_list.setCurrentItem(next_item)
|
||||||
self.live_controller.preview_widget.setFocus()
|
self.live_controller.preview_widget.setFocus()
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
"""
|
"""
|
||||||
The :mod:`slidecontroller` module contains the most important part of OpenLP - the slide controller
|
The :mod:`slidecontroller` module contains the most important part of OpenLP - the slide controller
|
||||||
"""
|
"""
|
||||||
|
from __future__ import division
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import copy
|
import copy
|
||||||
@ -93,7 +94,7 @@ class SlideController(DisplayController):
|
|||||||
Registry().register_function(u'bootstrap_post_set_up', self.screen_size_changed)
|
Registry().register_function(u'bootstrap_post_set_up', self.screen_size_changed)
|
||||||
self.screens = ScreenList()
|
self.screens = ScreenList()
|
||||||
try:
|
try:
|
||||||
self.ratio = float(self.screens.current[u'size'].width()) / float(self.screens.current[u'size'].height())
|
self.ratio = self.screens.current[u'size'].width() / self.screens.current[u'size'].height()
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
self.ratio = 1
|
self.ratio = 1
|
||||||
self.loop_list = [
|
self.loop_list = [
|
||||||
@ -194,15 +195,15 @@ class SlideController(DisplayController):
|
|||||||
self.toolbar.add_toolbar_widget(self.hide_menu)
|
self.toolbar.add_toolbar_widget(self.hide_menu)
|
||||||
self.blank_screen = create_action(self, u'blankScreen',
|
self.blank_screen = create_action(self, u'blankScreen',
|
||||||
text=translate('OpenLP.SlideController', 'Blank Screen'), icon=u':/slides/slide_blank.png',
|
text=translate('OpenLP.SlideController', 'Blank Screen'), icon=u':/slides/slide_blank.png',
|
||||||
checked=False, can_shortcuts=True, category=self.category, triggers=self.onBlankDisplay)
|
checked=False, can_shortcuts=True, category=self.category, triggers=self.on_blank_display)
|
||||||
self.theme_screen = create_action(self, u'themeScreen',
|
self.theme_screen = create_action(self, u'themeScreen',
|
||||||
text=translate('OpenLP.SlideController', 'Blank to Theme'), icon=u':/slides/slide_theme.png',
|
text=translate('OpenLP.SlideController', 'Blank to Theme'), icon=u':/slides/slide_theme.png',
|
||||||
checked=False, can_shortcuts=True, category=self.category,
|
checked=False, can_shortcuts=True, category=self.category,
|
||||||
triggers=self.onThemeDisplay)
|
triggers=self.on_theme_display)
|
||||||
self.desktop_screen = create_action(self, u'desktopScreen',
|
self.desktop_screen = create_action(self, u'desktopScreen',
|
||||||
text=translate('OpenLP.SlideController', 'Show Desktop'), icon=u':/slides/slide_desktop.png',
|
text=translate('OpenLP.SlideController', 'Show Desktop'), icon=u':/slides/slide_desktop.png',
|
||||||
checked=False, can_shortcuts=True, category=self.category,
|
checked=False, can_shortcuts=True, category=self.category,
|
||||||
triggers=self.onHideDisplay)
|
triggers=self.on_hide_display)
|
||||||
self.hide_menu.setDefaultAction(self.blank_screen)
|
self.hide_menu.setDefaultAction(self.blank_screen)
|
||||||
self.hide_menu.menu().addAction(self.blank_screen)
|
self.hide_menu.menu().addAction(self.blank_screen)
|
||||||
self.hide_menu.menu().addAction(self.theme_screen)
|
self.hide_menu.menu().addAction(self.theme_screen)
|
||||||
@ -230,10 +231,10 @@ class SlideController(DisplayController):
|
|||||||
self.toolbar.add_toolbar_widget(self.play_slides_menu)
|
self.toolbar.add_toolbar_widget(self.play_slides_menu)
|
||||||
self.play_slides_loop = create_action(self, u'playSlidesLoop', text=UiStrings().PlaySlidesInLoop,
|
self.play_slides_loop = create_action(self, u'playSlidesLoop', text=UiStrings().PlaySlidesInLoop,
|
||||||
icon=u':/media/media_time.png', checked=False, can_shortcuts=True,
|
icon=u':/media/media_time.png', checked=False, can_shortcuts=True,
|
||||||
category=self.category, triggers=self.onPlaySlidesLoop)
|
category=self.category, triggers=self.on_play_slides_loop)
|
||||||
self.play_slides_once = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd,
|
self.play_slides_once = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd,
|
||||||
icon=u':/media/media_time.png', checked=False, can_shortcuts=True,
|
icon=u':/media/media_time.png', checked=False, can_shortcuts=True,
|
||||||
category=self.category, triggers=self.onPlaySlidesOnce)
|
category=self.category, triggers=self.on_play_slides_once)
|
||||||
if Settings().value(self.main_window.advanced_settings_section + u'/slide limits') == SlideLimits.Wrap:
|
if Settings().value(self.main_window.advanced_settings_section + u'/slide limits') == SlideLimits.Wrap:
|
||||||
self.play_slides_menu.setDefaultAction(self.play_slides_loop)
|
self.play_slides_menu.setDefaultAction(self.play_slides_loop)
|
||||||
else:
|
else:
|
||||||
@ -249,12 +250,12 @@ class SlideController(DisplayController):
|
|||||||
self.toolbar.add_toolbar_widget(self.delay_spin_box)
|
self.toolbar.add_toolbar_widget(self.delay_spin_box)
|
||||||
else:
|
else:
|
||||||
self.toolbar.add_toolbar_action(u'goLive', icon=u':/general/general_live.png',
|
self.toolbar.add_toolbar_action(u'goLive', icon=u':/general/general_live.png',
|
||||||
tooltip=translate('OpenLP.SlideController', 'Move to live.'), triggers=self.onGoLive)
|
tooltip=translate('OpenLP.SlideController', 'Move to live.'), triggers=self.on_go_live)
|
||||||
self.toolbar.add_toolbar_action(u'addToService', icon=u':/general/general_add.png',
|
self.toolbar.add_toolbar_action(u'addToService', icon=u':/general/general_add.png',
|
||||||
tooltip=translate('OpenLP.SlideController', 'Add to Service.'), triggers=self.onPreviewAddToService)
|
tooltip=translate('OpenLP.SlideController', 'Add to Service.'), triggers=self.on_preview_add_to_service)
|
||||||
self.toolbar.addSeparator()
|
self.toolbar.addSeparator()
|
||||||
self.toolbar.add_toolbar_action(u'editSong', icon=u':/general/general_edit.png',
|
self.toolbar.add_toolbar_action(u'editSong', icon=u':/general/general_edit.png',
|
||||||
tooltip=translate('OpenLP.SlideController', 'Edit and reload song preview.'), triggers=self.onEditSong)
|
tooltip=translate('OpenLP.SlideController', 'Edit and reload song preview.'), triggers=self.on_edit_song)
|
||||||
self.controller_layout.addWidget(self.toolbar)
|
self.controller_layout.addWidget(self.toolbar)
|
||||||
# Build the Media Toolbar
|
# Build the Media Toolbar
|
||||||
self.media_controller.register_controller(self)
|
self.media_controller.register_controller(self)
|
||||||
@ -272,7 +273,7 @@ class SlideController(DisplayController):
|
|||||||
icon=u':/slides/media_playback_pause.png', text=translate('OpenLP.SlideController', 'Pause Audio'),
|
icon=u':/slides/media_playback_pause.png', text=translate('OpenLP.SlideController', 'Pause Audio'),
|
||||||
tooltip=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,
|
||||||
can_shortcuts=True, triggers=self.onAudioPauseClicked)
|
can_shortcuts=True, triggers=self.set_audio_pause_clicked)
|
||||||
self.audio_menu = QtGui.QMenu(translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
|
self.audio_menu = QtGui.QMenu(translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
|
||||||
self.audio_pause_item.setMenu(self.audio_menu)
|
self.audio_pause_item.setMenu(self.audio_menu)
|
||||||
self.audio_pause_item.setParent(self.toolbar)
|
self.audio_pause_item.setParent(self.toolbar)
|
||||||
@ -281,7 +282,7 @@ class SlideController(DisplayController):
|
|||||||
self.nextTrackItem = create_action(self, u'nextTrackItem', text=UiStrings().NextTrack,
|
self.nextTrackItem = create_action(self, u'nextTrackItem', text=UiStrings().NextTrack,
|
||||||
icon=u':/slides/media_playback_next.png',
|
icon=u':/slides/media_playback_next.png',
|
||||||
tooltip=translate('OpenLP.SlideController', 'Go to next audio track.'),
|
tooltip=translate('OpenLP.SlideController', 'Go to next audio track.'),
|
||||||
category=self.category, can_shortcuts=True, triggers=self.onNextTrackClicked)
|
category=self.category, can_shortcuts=True, triggers=self.on_next_track_clicked)
|
||||||
self.audio_menu.addAction(self.nextTrackItem)
|
self.audio_menu.addAction(self.nextTrackItem)
|
||||||
self.trackMenu = self.audio_menu.addMenu(translate('OpenLP.SlideController', 'Tracks'))
|
self.trackMenu = self.audio_menu.addMenu(translate('OpenLP.SlideController', 'Tracks'))
|
||||||
self.audio_time_label = QtGui.QLabel(u' 00:00 ', self.toolbar)
|
self.audio_time_label = QtGui.QLabel(u' 00:00 ', self.toolbar)
|
||||||
@ -348,10 +349,10 @@ class SlideController(DisplayController):
|
|||||||
can_shortcuts=True,
|
can_shortcuts=True,
|
||||||
context=QtCore.Qt.WidgetWithChildrenShortcut,
|
context=QtCore.Qt.WidgetWithChildrenShortcut,
|
||||||
category=self.category if s.get(u'configurable') else None,
|
category=self.category if s.get(u'configurable') else None,
|
||||||
triggers=self._slideShortcutActivated) for s in shortcuts])
|
triggers=self._slide_shortcut_activated) for s in shortcuts])
|
||||||
self.shortcutTimer.timeout.connect(self._slideShortcutActivated)
|
self.shortcutTimer.timeout.connect(self._slide_shortcut_activated)
|
||||||
# Signals
|
# Signals
|
||||||
self.preview_widget.clicked.connect(self.onSlideSelected)
|
self.preview_widget.clicked.connect(self.on_slide_selected)
|
||||||
if self.is_live:
|
if self.is_live:
|
||||||
# Need to use event as called across threads and UI is updated
|
# Need to use event as called across threads and UI is updated
|
||||||
QtCore.QObject.connect(self, QtCore.SIGNAL(u'slidecontroller_toggle_display'), self.toggle_display)
|
QtCore.QObject.connect(self, QtCore.SIGNAL(u'slidecontroller_toggle_display'), self.toggle_display)
|
||||||
@ -359,11 +360,11 @@ class SlideController(DisplayController):
|
|||||||
self.toolbar.set_widget_visible(self.loop_list, False)
|
self.toolbar.set_widget_visible(self.loop_list, False)
|
||||||
self.toolbar.set_widget_visible(self.wide_menu, False)
|
self.toolbar.set_widget_visible(self.wide_menu, False)
|
||||||
else:
|
else:
|
||||||
self.preview_widget.doubleClicked.connect(self.onGoLiveClick)
|
self.preview_widget.doubleClicked.connect(self.on_preview_add_to_service)
|
||||||
self.toolbar.set_widget_visible([u'editSong'], False)
|
self.toolbar.set_widget_visible([u'editSong'], False)
|
||||||
if self.is_live:
|
if self.is_live:
|
||||||
self.setLiveHotkeys(self)
|
self.set_live_hotkeys(self)
|
||||||
self.__addActionsToWidget(self.controller)
|
self.__add_actions_to_widget(self.controller)
|
||||||
else:
|
else:
|
||||||
self.controller.addActions([self.nextItem, self.previous_item])
|
self.controller.addActions([self.nextItem, self.previous_item])
|
||||||
Registry().register_function(u'slidecontroller_%s_stop_loop' % self.type_prefix, self.on_stop_loop)
|
Registry().register_function(u'slidecontroller_%s_stop_loop' % self.type_prefix, self.on_stop_loop)
|
||||||
@ -378,7 +379,7 @@ class SlideController(DisplayController):
|
|||||||
QtCore.QObject.connect(self, QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.type_prefix),
|
QtCore.QObject.connect(self, QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.type_prefix),
|
||||||
self.on_slide_selected_previous)
|
self.on_slide_selected_previous)
|
||||||
|
|
||||||
def _slideShortcutActivated(self):
|
def _slide_shortcut_activated(self):
|
||||||
"""
|
"""
|
||||||
Called, when a shortcut has been activated to jump to a chorus, verse,
|
Called, when a shortcut has been activated to jump to a chorus, verse,
|
||||||
etc.
|
etc.
|
||||||
@ -425,7 +426,7 @@ class SlideController(DisplayController):
|
|||||||
self.shortcutTimer.stop()
|
self.shortcutTimer.stop()
|
||||||
self.current_shortcut = u''
|
self.current_shortcut = u''
|
||||||
self.preview_widget.change_slide(self.slideList[matches[0]])
|
self.preview_widget.change_slide(self.slideList[matches[0]])
|
||||||
self.slideSelected()
|
self.slide_selected()
|
||||||
elif sender_name != u'shortcutTimer':
|
elif sender_name != u'shortcutTimer':
|
||||||
# Start the time as we did not have any match.
|
# Start the time as we did not have any match.
|
||||||
self.shortcutTimer.start(350)
|
self.shortcutTimer.start(350)
|
||||||
@ -435,28 +436,28 @@ class SlideController(DisplayController):
|
|||||||
# We had more than one match for example "V1" and "V10", but
|
# We had more than one match for example "V1" and "V10", but
|
||||||
# "V1" was the slide we wanted to go.
|
# "V1" was the slide we wanted to go.
|
||||||
self.preview_widget.change_slide(self.slideList[self.current_shortcut])
|
self.preview_widget.change_slide(self.slideList[self.current_shortcut])
|
||||||
self.slideSelected()
|
self.slide_selected()
|
||||||
# Reset the shortcut.
|
# Reset the shortcut.
|
||||||
self.current_shortcut = u''
|
self.current_shortcut = u''
|
||||||
|
|
||||||
def setLiveHotkeys(self, parent=None):
|
def set_live_hotkeys(self, parent=None):
|
||||||
"""
|
"""
|
||||||
Set the live hotkeys
|
Set the live hotkeys
|
||||||
"""
|
"""
|
||||||
self.previousService = create_action(parent, u'previousService',
|
self.previousService = create_action(parent, u'previousService',
|
||||||
text=translate('OpenLP.SlideController', 'Previous Service'),
|
text=translate('OpenLP.SlideController', 'Previous Service'),
|
||||||
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut, category=self.category,
|
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut, category=self.category,
|
||||||
triggers=self.servicePrevious)
|
triggers=self.service_previous)
|
||||||
self.nextService = create_action(parent, 'nextService',
|
self.nextService = create_action(parent, 'nextService',
|
||||||
text=translate('OpenLP.SlideController', 'Next Service'),
|
text=translate('OpenLP.SlideController', 'Next Service'),
|
||||||
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut, category=self.category,
|
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut, category=self.category,
|
||||||
triggers=self.serviceNext)
|
triggers=self.service_next)
|
||||||
self.escapeItem = create_action(parent, 'escapeItem',
|
self.escapeItem = create_action(parent, 'escapeItem',
|
||||||
text=translate('OpenLP.SlideController', 'Escape Item'),
|
text=translate('OpenLP.SlideController', 'Escape Item'),
|
||||||
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut, category=self.category,
|
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut, category=self.category,
|
||||||
triggers=self.liveEscape)
|
triggers=self.live_escape)
|
||||||
|
|
||||||
def liveEscape(self):
|
def live_escape(self):
|
||||||
"""
|
"""
|
||||||
If you press ESC on the live screen it should close the display temporarily.
|
If you press ESC on the live screen it should close the display temporarily.
|
||||||
"""
|
"""
|
||||||
@ -468,24 +469,24 @@ class SlideController(DisplayController):
|
|||||||
Toggle the display settings triggered from remote messages.
|
Toggle the display settings triggered from remote messages.
|
||||||
"""
|
"""
|
||||||
if action == u'blank' or action == u'hide':
|
if action == u'blank' or action == u'hide':
|
||||||
self.onBlankDisplay(True)
|
self.on_blank_display(True)
|
||||||
elif action == u'theme':
|
elif action == u'theme':
|
||||||
self.onThemeDisplay(True)
|
self.on_theme_display(True)
|
||||||
elif action == u'desktop':
|
elif action == u'desktop':
|
||||||
self.onHideDisplay(True)
|
self.on_hide_display(True)
|
||||||
elif action == u'show':
|
elif action == u'show':
|
||||||
self.onBlankDisplay(False)
|
self.on_blank_display(False)
|
||||||
self.onThemeDisplay(False)
|
self.on_theme_display(False)
|
||||||
self.onHideDisplay(False)
|
self.on_hide_display(False)
|
||||||
|
|
||||||
def servicePrevious(self):
|
def service_previous(self):
|
||||||
"""
|
"""
|
||||||
Live event to select the previous service item from the service manager.
|
Live event to select the previous service item from the service manager.
|
||||||
"""
|
"""
|
||||||
self.keypress_queue.append(ServiceItemAction.Previous)
|
self.keypress_queue.append(ServiceItemAction.Previous)
|
||||||
self._process_queue()
|
self._process_queue()
|
||||||
|
|
||||||
def serviceNext(self):
|
def service_next(self):
|
||||||
"""
|
"""
|
||||||
Live event to select the next service item from the service manager.
|
Live event to select the next service item from the service manager.
|
||||||
"""
|
"""
|
||||||
@ -520,11 +521,11 @@ class SlideController(DisplayController):
|
|||||||
self.display = MainDisplay(self, self.is_live, self)
|
self.display = MainDisplay(self, self.is_live, self)
|
||||||
self.display.setup()
|
self.display.setup()
|
||||||
if self.is_live:
|
if self.is_live:
|
||||||
self.__addActionsToWidget(self.display)
|
self.__add_actions_to_widget(self.display)
|
||||||
self.display.audio_player.connectSlot(QtCore.SIGNAL(u'tick(qint64)'), self.on_audio_time_remaining)
|
self.display.audio_player.connectSlot(QtCore.SIGNAL(u'tick(qint64)'), self.on_audio_time_remaining)
|
||||||
# The SlidePreview's ratio.
|
# The SlidePreview's ratio.
|
||||||
try:
|
try:
|
||||||
self.ratio = float(self.screens.current[u'size'].width()) / float(self.screens.current[u'size'].height())
|
self.ratio = self.screens.current[u'size'].width() / self.screens.current[u'size'].height()
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
self.ratio = 1
|
self.ratio = 1
|
||||||
self.media_controller.setup_display(self.display, False)
|
self.media_controller.setup_display(self.display, False)
|
||||||
@ -538,7 +539,7 @@ class SlideController(DisplayController):
|
|||||||
if self.service_item:
|
if self.service_item:
|
||||||
self.refresh_service_item()
|
self.refresh_service_item()
|
||||||
|
|
||||||
def __addActionsToWidget(self, widget):
|
def __add_actions_to_widget(self, widget):
|
||||||
"""
|
"""
|
||||||
Add actions to the widget specified by `widget`
|
Add actions to the widget specified by `widget`
|
||||||
"""
|
"""
|
||||||
@ -553,7 +554,7 @@ class SlideController(DisplayController):
|
|||||||
splitters is moved or when the screen size is changed. Note, that this
|
splitters is moved or when the screen size is changed. Note, that this
|
||||||
method is (also) called frequently from the mainwindow *paintEvent*.
|
method is (also) called frequently from the mainwindow *paintEvent*.
|
||||||
"""
|
"""
|
||||||
if self.ratio < float(self.preview_frame.width()) / float(self.preview_frame.height()):
|
if self.ratio < self.preview_frame.width() / self.preview_frame.height():
|
||||||
# We have to take the height as limit.
|
# We have to take the height as limit.
|
||||||
max_height = self.preview_frame.height() - self.grid.margin() * 2
|
max_height = self.preview_frame.height() - self.grid.margin() * 2
|
||||||
self.slide_preview.setFixedSize(QtCore.QSize(max_height * self.ratio, max_height))
|
self.slide_preview.setFixedSize(QtCore.QSize(max_height * self.ratio, max_height))
|
||||||
@ -567,9 +568,9 @@ class SlideController(DisplayController):
|
|||||||
self.preview_display.setFixedSize(QtCore.QSize(max_width, max_width / self.ratio))
|
self.preview_display.setFixedSize(QtCore.QSize(max_width, max_width / self.ratio))
|
||||||
self.preview_display.screen = {
|
self.preview_display.screen = {
|
||||||
u'size': self.preview_display.geometry()}
|
u'size': self.preview_display.geometry()}
|
||||||
self.onControllerSizeChanged(self.controller.width())
|
self.on_controller_size_changed(self.controller.width())
|
||||||
|
|
||||||
def onControllerSizeChanged(self, width):
|
def on_controller_size_changed(self, width):
|
||||||
"""
|
"""
|
||||||
Change layout of display control buttons on controller size change
|
Change layout of display control buttons on controller size change
|
||||||
"""
|
"""
|
||||||
@ -585,14 +586,15 @@ class SlideController(DisplayController):
|
|||||||
self.toolbar.set_widget_visible(self.wide_menu, False)
|
self.toolbar.set_widget_visible(self.wide_menu, False)
|
||||||
self.toolbar.set_widget_visible(self.narrow_menu)
|
self.toolbar.set_widget_visible(self.narrow_menu)
|
||||||
|
|
||||||
def onSongBarHandler(self):
|
def on_song_bar_handler(self):
|
||||||
"""
|
"""
|
||||||
Some song handler
|
Some song handler
|
||||||
"""
|
"""
|
||||||
request = self.sender().text()
|
request = self.sender().text()
|
||||||
slide_no = self.slideList[request]
|
slide_no = self.slideList[request]
|
||||||
self.__updatePreviewSelection(slide_no)
|
width = self.main_window.controlSplitter.sizes()[self.split]
|
||||||
self.slideSelected()
|
self.preview_widget.replace_service_item(self.service_item, width, slide_no)
|
||||||
|
self.slide_selected()
|
||||||
|
|
||||||
def receive_spin_delay(self):
|
def receive_spin_delay(self):
|
||||||
"""
|
"""
|
||||||
@ -680,45 +682,45 @@ class SlideController(DisplayController):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'add_service_item live = %s' % self.is_live)
|
log.debug(u'add_service_item live = %s' % self.is_live)
|
||||||
item.render()
|
item.render()
|
||||||
slideno = 0
|
slide_no = 0
|
||||||
if self.song_edit:
|
if self.song_edit:
|
||||||
slideno = self.selected_row
|
slide_no = self.selected_row
|
||||||
self.song_edit = False
|
self.song_edit = False
|
||||||
self._process_item(item, slideno)
|
self._process_item(item, slide_no)
|
||||||
|
|
||||||
def replaceServiceManagerItem(self, item):
|
def replace_service_manager_item(self, item):
|
||||||
"""
|
"""
|
||||||
Replacement item following a remote edit
|
Replacement item following a remote edit
|
||||||
"""
|
"""
|
||||||
if item == self.service_item:
|
if item == self.service_item:
|
||||||
self._process_item(item, self.preview_widget.current_slide_number())
|
self._process_item(item, self.preview_widget.current_slide_number())
|
||||||
|
|
||||||
def addServiceManagerItem(self, item, slideno):
|
def add_service_manager_item(self, item, slide_no):
|
||||||
"""
|
"""
|
||||||
Method to install the service item into the controller and
|
Method to install the service item into the controller and
|
||||||
request the correct toolbar for the plugin.
|
request the correct toolbar for the plugin.
|
||||||
Called by ServiceManager
|
Called by ServiceManager
|
||||||
"""
|
"""
|
||||||
log.debug(u'addServiceManagerItem live = %s' % self.is_live)
|
log.debug(u'add_service_manager_item live = %s' % self.is_live)
|
||||||
# If no valid slide number is specified we take the first one, but we
|
# If no valid slide number is specified we take the first one, but we remember the initial value to see if we
|
||||||
# remember the initial value to see if we should reload the song or not
|
# should reload the song or not
|
||||||
slidenum = slideno
|
slidenum = slide_no
|
||||||
if slideno == -1:
|
if slide_no == -1:
|
||||||
slidenum = 0
|
slidenum = 0
|
||||||
# If service item is the same as the current one, only change slide
|
# If service item is the same as the current one, only change slide
|
||||||
if slideno >= 0 and item == self.service_item:
|
if slide_no >= 0 and item == self.service_item:
|
||||||
self.preview_widget.change_slide(slidenum)
|
self.preview_widget.change_slide(slidenum)
|
||||||
self.slideSelected()
|
self.slide_selected()
|
||||||
else:
|
else:
|
||||||
self._process_item(item, slidenum)
|
self._process_item(item, slidenum)
|
||||||
if self.is_live and item.auto_play_slides_loop and item.timed_slide_interval > 0:
|
if self.is_live and item.auto_play_slides_loop and item.timed_slide_interval > 0:
|
||||||
self.play_slides_loop.setChecked(item.auto_play_slides_loop)
|
self.play_slides_loop.setChecked(item.auto_play_slides_loop)
|
||||||
self.delay_spin_box.setValue(int(item.timed_slide_interval))
|
self.delay_spin_box.setValue(int(item.timed_slide_interval))
|
||||||
self.onPlaySlidesLoop()
|
self.on_play_slides_loop()
|
||||||
elif self.is_live and item.auto_play_slides_once and item.timed_slide_interval > 0:
|
elif self.is_live and item.auto_play_slides_once and item.timed_slide_interval > 0:
|
||||||
self.play_slides_once.setChecked(item.auto_play_slides_once)
|
self.play_slides_once.setChecked(item.auto_play_slides_once)
|
||||||
self.delay_spin_box.setValue(int(item.timed_slide_interval))
|
self.delay_spin_box.setValue(int(item.timed_slide_interval))
|
||||||
self.onPlaySlidesOnce()
|
self.on_play_slides_once()
|
||||||
|
|
||||||
def _process_item(self, service_item, slideno):
|
def _process_item(self, service_item, slideno):
|
||||||
"""
|
"""
|
||||||
@ -731,13 +733,13 @@ class SlideController(DisplayController):
|
|||||||
# take a copy not a link to the servicemanager copy.
|
# take a copy not a link to the servicemanager copy.
|
||||||
self.service_item = copy.copy(service_item)
|
self.service_item = copy.copy(service_item)
|
||||||
if old_item and self.is_live and old_item.is_capable(ItemCapabilities.ProvidesOwnDisplay):
|
if old_item and self.is_live and old_item.is_capable(ItemCapabilities.ProvidesOwnDisplay):
|
||||||
self._resetBlank()
|
self._reset_blank()
|
||||||
Registry().execute(u'%s_start' % service_item.name.lower(), [service_item, self.is_live, self.hide_mode(), slideno])
|
Registry().execute(u'%s_start' % service_item.name.lower(), [service_item, self.is_live, self.hide_mode(), slideno])
|
||||||
self.slideList = {}
|
self.slideList = {}
|
||||||
if self.is_live:
|
if self.is_live:
|
||||||
self.song_menu.menu().clear()
|
self.song_menu.menu().clear()
|
||||||
self.display.audio_player.reset()
|
self.display.audio_player.reset()
|
||||||
self.setAudioItemsVisibility(False)
|
self.set_audio_items_visibility(False)
|
||||||
self.audio_pause_item.setChecked(False)
|
self.audio_pause_item.setChecked(False)
|
||||||
# If the current item has background audio
|
# If the current item has background audio
|
||||||
if self.service_item.is_capable(ItemCapabilities.HasBackgroundAudio):
|
if self.service_item.is_capable(ItemCapabilities.HasBackgroundAudio):
|
||||||
@ -747,7 +749,7 @@ class SlideController(DisplayController):
|
|||||||
for counter in range(len(self.service_item.background_audio)):
|
for counter in range(len(self.service_item.background_audio)):
|
||||||
action = self.trackMenu.addAction(os.path.basename(self.service_item.background_audio[counter]))
|
action = self.trackMenu.addAction(os.path.basename(self.service_item.background_audio[counter]))
|
||||||
action.setData(counter)
|
action.setData(counter)
|
||||||
action.triggered.connect(self.onTrackTriggered)
|
action.triggered.connect(self.on_track_triggered)
|
||||||
self.display.audio_player.repeat = Settings().value(
|
self.display.audio_player.repeat = Settings().value(
|
||||||
self.main_window.general_settings_section + u'/audio repeat list')
|
self.main_window.general_settings_section + u'/audio repeat list')
|
||||||
if Settings().value(self.main_window.general_settings_section + u'/audio start paused'):
|
if Settings().value(self.main_window.general_settings_section + u'/audio start paused'):
|
||||||
@ -755,12 +757,10 @@ class SlideController(DisplayController):
|
|||||||
self.display.audio_player.pause()
|
self.display.audio_player.pause()
|
||||||
else:
|
else:
|
||||||
self.display.audio_player.play()
|
self.display.audio_player.play()
|
||||||
self.setAudioItemsVisibility(True)
|
self.set_audio_items_visibility(True)
|
||||||
row = 0
|
row = 0
|
||||||
text = []
|
|
||||||
width = self.main_window.controlSplitter.sizes()[self.split]
|
width = self.main_window.controlSplitter.sizes()[self.split]
|
||||||
for framenumber, frame in enumerate(self.service_item.get_frames()):
|
for framenumber, frame in enumerate(self.service_item.get_frames()):
|
||||||
slideHeight = 0
|
|
||||||
if self.service_item.is_text():
|
if self.service_item.is_text():
|
||||||
if frame[u'verseTag']:
|
if frame[u'verseTag']:
|
||||||
# These tags are already translated.
|
# These tags are already translated.
|
||||||
@ -771,12 +771,11 @@ class SlideController(DisplayController):
|
|||||||
if verse_def not in self.slideList:
|
if verse_def not in self.slideList:
|
||||||
self.slideList[verse_def] = framenumber
|
self.slideList[verse_def] = framenumber
|
||||||
if self.is_live:
|
if self.is_live:
|
||||||
self.song_menu.menu().addAction(verse_def, self.onSongBarHandler)
|
self.song_menu.menu().addAction(verse_def, self.on_song_bar_handler)
|
||||||
else:
|
else:
|
||||||
row += 1
|
row += 1
|
||||||
self.slideList[unicode(row)] = row - 1
|
self.slideList[unicode(row)] = row - 1
|
||||||
else:
|
else:
|
||||||
slideHeight = width * (1 / self.ratio)
|
|
||||||
row += 1
|
row += 1
|
||||||
self.slideList[unicode(row)] = row - 1
|
self.slideList[unicode(row)] = row - 1
|
||||||
# If current slide set background to image
|
# If current slide set background to image
|
||||||
@ -791,8 +790,8 @@ class SlideController(DisplayController):
|
|||||||
if not self.service_item.is_image():
|
if not self.service_item.is_image():
|
||||||
self.display.build_html(self.service_item)
|
self.display.build_html(self.service_item)
|
||||||
if service_item.is_media():
|
if service_item.is_media():
|
||||||
self.onMediaStart(service_item)
|
self.on_media_start(service_item)
|
||||||
self.slideSelected(True)
|
self.slide_selected(True)
|
||||||
if old_item:
|
if old_item:
|
||||||
# Close the old item after the new one is opened
|
# Close the old item after the new one is opened
|
||||||
# This avoids the service theme/desktop flashing on screen
|
# This avoids the service theme/desktop flashing on screen
|
||||||
@ -801,7 +800,7 @@ class SlideController(DisplayController):
|
|||||||
if old_item.is_command() and not service_item.is_command():
|
if old_item.is_command() and not service_item.is_command():
|
||||||
Registry().execute(u'%s_stop' % old_item.name.lower(), [old_item, self.is_live])
|
Registry().execute(u'%s_stop' % old_item.name.lower(), [old_item, self.is_live])
|
||||||
if old_item.is_media() and not service_item.is_media():
|
if old_item.is_media() and not service_item.is_media():
|
||||||
self.onMediaClose()
|
self.on_media_close()
|
||||||
Registry().execute(u'slidecontroller_%s_started' % self.type_prefix, [service_item])
|
Registry().execute(u'slidecontroller_%s_started' % self.type_prefix, [service_item])
|
||||||
|
|
||||||
# Screen event methods
|
# Screen event methods
|
||||||
@ -814,49 +813,49 @@ class SlideController(DisplayController):
|
|||||||
return
|
return
|
||||||
if self.service_item.is_command():
|
if self.service_item.is_command():
|
||||||
Registry().execute(u'%s_slide' % self.service_item.name.lower(), [self.service_item, self.is_live, index])
|
Registry().execute(u'%s_slide' % self.service_item.name.lower(), [self.service_item, self.is_live, index])
|
||||||
self.updatePreview()
|
self.update_preview()
|
||||||
else:
|
else:
|
||||||
self.preview_widget.change_slide(index)
|
self.preview_widget.change_slide(index)
|
||||||
self.slideSelected()
|
self.slide_selected()
|
||||||
|
|
||||||
def mainDisplaySetBackground(self):
|
def main_display_set_background(self):
|
||||||
"""
|
"""
|
||||||
Allow the main display to blank the main display at startup time
|
Allow the main display to blank the main display at startup time
|
||||||
"""
|
"""
|
||||||
log.debug(u'mainDisplaySetBackground live = %s' % self.is_live)
|
log.debug(u'main_display_set_background live = %s' % self.is_live)
|
||||||
display_type = Settings().value(self.main_window.general_settings_section + u'/screen blank')
|
display_type = Settings().value(self.main_window.general_settings_section + u'/screen blank')
|
||||||
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
|
# Order done to handle initial conversion
|
||||||
if display_type == u'themed':
|
if display_type == u'themed':
|
||||||
self.onThemeDisplay(True)
|
self.on_theme_display(True)
|
||||||
elif display_type == u'hidden':
|
elif display_type == u'hidden':
|
||||||
self.onHideDisplay(True)
|
self.on_hide_display(True)
|
||||||
elif display_type == u'blanked':
|
elif display_type == u'blanked':
|
||||||
self.onBlankDisplay(True)
|
self.on_blank_display(True)
|
||||||
else:
|
else:
|
||||||
Registry().execute(u'live_display_show')
|
Registry().execute(u'live_display_show')
|
||||||
else:
|
else:
|
||||||
self.liveEscape()
|
self.live_escape()
|
||||||
|
|
||||||
def on_slide_blank(self):
|
def on_slide_blank(self):
|
||||||
"""
|
"""
|
||||||
Handle the slidecontroller blank event
|
Handle the slidecontroller blank event
|
||||||
"""
|
"""
|
||||||
self.onBlankDisplay(True)
|
self.on_blank_display(True)
|
||||||
|
|
||||||
def on_slide_unblank(self):
|
def on_slide_unblank(self):
|
||||||
"""
|
"""
|
||||||
Handle the slidecontroller unblank event
|
Handle the slidecontroller unblank event
|
||||||
"""
|
"""
|
||||||
self.onBlankDisplay(False)
|
self.on_blank_display(False)
|
||||||
|
|
||||||
def onBlankDisplay(self, checked=None):
|
def on_blank_display(self, checked=None):
|
||||||
"""
|
"""
|
||||||
Handle the blank screen button actions
|
Handle the blank screen button actions
|
||||||
"""
|
"""
|
||||||
if checked is None:
|
if checked is None:
|
||||||
checked = self.blank_screen.isChecked()
|
checked = self.blank_screen.isChecked()
|
||||||
log.debug(u'onBlankDisplay %s' % checked)
|
log.debug(u'on_blank_display %s' % checked)
|
||||||
self.hide_menu.setDefaultAction(self.blank_screen)
|
self.hide_menu.setDefaultAction(self.blank_screen)
|
||||||
self.blank_screen.setChecked(checked)
|
self.blank_screen.setChecked(checked)
|
||||||
self.theme_screen.setChecked(False)
|
self.theme_screen.setChecked(False)
|
||||||
@ -865,17 +864,17 @@ class SlideController(DisplayController):
|
|||||||
Settings().setValue(self.main_window.general_settings_section + u'/screen blank', u'blanked')
|
Settings().setValue(self.main_window.general_settings_section + u'/screen blank', u'blanked')
|
||||||
else:
|
else:
|
||||||
Settings().remove(self.main_window.general_settings_section + u'/screen blank')
|
Settings().remove(self.main_window.general_settings_section + u'/screen blank')
|
||||||
self.blankPlugin()
|
self.blank_plugin()
|
||||||
self.updatePreview()
|
self.update_preview()
|
||||||
self.onToggleLoop()
|
self.on_toggle_loop()
|
||||||
|
|
||||||
def onThemeDisplay(self, checked=None):
|
def on_theme_display(self, checked=None):
|
||||||
"""
|
"""
|
||||||
Handle the Theme screen button
|
Handle the Theme screen button
|
||||||
"""
|
"""
|
||||||
if checked is None:
|
if checked is None:
|
||||||
checked = self.theme_screen.isChecked()
|
checked = self.theme_screen.isChecked()
|
||||||
log.debug(u'onThemeDisplay %s' % checked)
|
log.debug(u'on_theme_display %s' % checked)
|
||||||
self.hide_menu.setDefaultAction(self.theme_screen)
|
self.hide_menu.setDefaultAction(self.theme_screen)
|
||||||
self.blank_screen.setChecked(False)
|
self.blank_screen.setChecked(False)
|
||||||
self.theme_screen.setChecked(checked)
|
self.theme_screen.setChecked(checked)
|
||||||
@ -884,17 +883,17 @@ class SlideController(DisplayController):
|
|||||||
Settings().setValue(self.main_window.general_settings_section + u'/screen blank', u'themed')
|
Settings().setValue(self.main_window.general_settings_section + u'/screen blank', u'themed')
|
||||||
else:
|
else:
|
||||||
Settings().remove(self.main_window.general_settings_section + u'/screen blank')
|
Settings().remove(self.main_window.general_settings_section + u'/screen blank')
|
||||||
self.blankPlugin()
|
self.blank_plugin()
|
||||||
self.updatePreview()
|
self.update_preview()
|
||||||
self.onToggleLoop()
|
self.on_toggle_loop()
|
||||||
|
|
||||||
def onHideDisplay(self, checked=None):
|
def on_hide_display(self, checked=None):
|
||||||
"""
|
"""
|
||||||
Handle the Hide screen button
|
Handle the Hide screen button
|
||||||
"""
|
"""
|
||||||
if checked is None:
|
if checked is None:
|
||||||
checked = self.desktop_screen.isChecked()
|
checked = self.desktop_screen.isChecked()
|
||||||
log.debug(u'onHideDisplay %s' % checked)
|
log.debug(u'on_hide_display %s' % checked)
|
||||||
self.hide_menu.setDefaultAction(self.desktop_screen)
|
self.hide_menu.setDefaultAction(self.desktop_screen)
|
||||||
self.blank_screen.setChecked(False)
|
self.blank_screen.setChecked(False)
|
||||||
self.theme_screen.setChecked(False)
|
self.theme_screen.setChecked(False)
|
||||||
@ -903,16 +902,16 @@ class SlideController(DisplayController):
|
|||||||
Settings().setValue(self.main_window.general_settings_section + u'/screen blank', u'hidden')
|
Settings().setValue(self.main_window.general_settings_section + u'/screen blank', u'hidden')
|
||||||
else:
|
else:
|
||||||
Settings().remove(self.main_window.general_settings_section + u'/screen blank')
|
Settings().remove(self.main_window.general_settings_section + u'/screen blank')
|
||||||
self.hidePlugin(checked)
|
self.hide_plugin(checked)
|
||||||
self.updatePreview()
|
self.update_preview()
|
||||||
self.onToggleLoop()
|
self.on_toggle_loop()
|
||||||
|
|
||||||
def blankPlugin(self):
|
def blank_plugin(self):
|
||||||
"""
|
"""
|
||||||
Blank/Hide the display screen within a plugin if required.
|
Blank/Hide the display screen within a plugin if required.
|
||||||
"""
|
"""
|
||||||
hide_mode = self.hide_mode()
|
hide_mode = self.hide_mode()
|
||||||
log.debug(u'blankPlugin %s ', hide_mode)
|
log.debug(u'blank_plugin %s ', hide_mode)
|
||||||
if self.service_item is not None:
|
if self.service_item is not None:
|
||||||
if hide_mode:
|
if hide_mode:
|
||||||
if not self.service_item.is_command():
|
if not self.service_item.is_command():
|
||||||
@ -929,11 +928,11 @@ class SlideController(DisplayController):
|
|||||||
else:
|
else:
|
||||||
Registry().execute(u'live_display_show')
|
Registry().execute(u'live_display_show')
|
||||||
|
|
||||||
def hidePlugin(self, hide):
|
def hide_plugin(self, hide):
|
||||||
"""
|
"""
|
||||||
Tell the plugin to hide the display screen.
|
Tell the plugin to hide the display screen.
|
||||||
"""
|
"""
|
||||||
log.debug(u'hidePlugin %s ', hide)
|
log.debug(u'hide_plugin %s ', hide)
|
||||||
if self.service_item is not None:
|
if self.service_item is not None:
|
||||||
if hide:
|
if hide:
|
||||||
Registry().execute(u'live_display_hide', HideMode.Screen)
|
Registry().execute(u'live_display_hide', HideMode.Screen)
|
||||||
@ -948,13 +947,13 @@ class SlideController(DisplayController):
|
|||||||
else:
|
else:
|
||||||
Registry().execute(u'live_display_show')
|
Registry().execute(u'live_display_show')
|
||||||
|
|
||||||
def onSlideSelected(self):
|
def on_slide_selected(self):
|
||||||
"""
|
"""
|
||||||
Slide selected in controller
|
Slide selected in controller
|
||||||
"""
|
"""
|
||||||
self.slideSelected()
|
self.slide_selected()
|
||||||
|
|
||||||
def slideSelected(self, start=False):
|
def slide_selected(self, start=False):
|
||||||
"""
|
"""
|
||||||
Generate the preview when you click on a slide.
|
Generate the preview when you click on a slide.
|
||||||
if this is the Live Controller also display on the screen
|
if this is the Live Controller also display on the screen
|
||||||
@ -977,7 +976,7 @@ class SlideController(DisplayController):
|
|||||||
self.display.image(to_display)
|
self.display.image(to_display)
|
||||||
# reset the store used to display first image
|
# reset the store used to display first image
|
||||||
self.service_item.bg_image_bytes = None
|
self.service_item.bg_image_bytes = None
|
||||||
self.updatePreview()
|
self.update_preview()
|
||||||
self.selected_row = row
|
self.selected_row = row
|
||||||
self.preview_widget.change_slide(row)
|
self.preview_widget.change_slide(row)
|
||||||
Registry().execute(u'slidecontroller_%s_changed' % self.type_prefix, row)
|
Registry().execute(u'slidecontroller_%s_changed' % self.type_prefix, row)
|
||||||
@ -988,14 +987,14 @@ class SlideController(DisplayController):
|
|||||||
The slide has been changed. Update the slidecontroller accordingly
|
The slide has been changed. Update the slidecontroller accordingly
|
||||||
"""
|
"""
|
||||||
self.preview_widget.change_slide(row)
|
self.preview_widget.change_slide(row)
|
||||||
self.updatePreview()
|
self.update_preview()
|
||||||
Registry().execute(u'slidecontroller_%s_changed' % self.type_prefix, row)
|
Registry().execute(u'slidecontroller_%s_changed' % self.type_prefix, row)
|
||||||
|
|
||||||
def updatePreview(self):
|
def update_preview(self):
|
||||||
"""
|
"""
|
||||||
This updates the preview frame, for example after changing a slide or using *Blank to Theme*.
|
This updates the preview frame, for example after changing a slide or using *Blank to Theme*.
|
||||||
"""
|
"""
|
||||||
log.debug(u'updatePreview %s ' % self.screens.current[u'primary'])
|
log.debug(u'update_preview %s ' % self.screens.current[u'primary'])
|
||||||
if not self.screens.current[u'primary'] and self.service_item and \
|
if not self.screens.current[u'primary'] and self.service_item and \
|
||||||
self.service_item.is_capable(ItemCapabilities.ProvidesOwnDisplay):
|
self.service_item.is_capable(ItemCapabilities.ProvidesOwnDisplay):
|
||||||
# Grab now, but try again in a couple of seconds if slide change is slow
|
# Grab now, but try again in a couple of seconds if slide change is slow
|
||||||
@ -1031,7 +1030,7 @@ class SlideController(DisplayController):
|
|||||||
return
|
return
|
||||||
Registry().execute(u'%s_next' % self.service_item.name.lower(), [self.service_item, self.is_live])
|
Registry().execute(u'%s_next' % self.service_item.name.lower(), [self.service_item, self.is_live])
|
||||||
if self.service_item.is_command() and self.is_live:
|
if self.service_item.is_command() and self.is_live:
|
||||||
self.updatePreview()
|
self.update_preview()
|
||||||
else:
|
else:
|
||||||
row = self.preview_widget.current_slide_number() + 1
|
row = self.preview_widget.current_slide_number() + 1
|
||||||
if row == self.preview_widget.slide_count():
|
if row == self.preview_widget.slide_count():
|
||||||
@ -1039,7 +1038,7 @@ class SlideController(DisplayController):
|
|||||||
if self.slide_limits == SlideLimits.Wrap:
|
if self.slide_limits == SlideLimits.Wrap:
|
||||||
row = 0
|
row = 0
|
||||||
elif self.is_live and self.slide_limits == SlideLimits.Next:
|
elif self.is_live and self.slide_limits == SlideLimits.Next:
|
||||||
self.serviceNext()
|
self.service_next()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
row = self.preview_widget.slide_count() - 1
|
row = self.preview_widget.slide_count() - 1
|
||||||
@ -1048,7 +1047,7 @@ class SlideController(DisplayController):
|
|||||||
else:
|
else:
|
||||||
row = self.preview_widget.slide_count() - 1
|
row = self.preview_widget.slide_count() - 1
|
||||||
self.preview_widget.change_slide(row)
|
self.preview_widget.change_slide(row)
|
||||||
self.slideSelected()
|
self.slide_selected()
|
||||||
|
|
||||||
def on_slide_selected_previous(self):
|
def on_slide_selected_previous(self):
|
||||||
"""
|
"""
|
||||||
@ -1058,7 +1057,7 @@ class SlideController(DisplayController):
|
|||||||
return
|
return
|
||||||
Registry().execute(u'%s_previous' % self.service_item.name.lower(), [self.service_item, self.is_live])
|
Registry().execute(u'%s_previous' % self.service_item.name.lower(), [self.service_item, self.is_live])
|
||||||
if self.service_item.is_command() and self.is_live:
|
if self.service_item.is_command() and self.is_live:
|
||||||
self.updatePreview()
|
self.update_preview()
|
||||||
else:
|
else:
|
||||||
row = self.preview_widget.current_slide_number() - 1
|
row = self.preview_widget.current_slide_number() - 1
|
||||||
if row == -1:
|
if row == -1:
|
||||||
@ -1071,19 +1070,19 @@ class SlideController(DisplayController):
|
|||||||
else:
|
else:
|
||||||
row = 0
|
row = 0
|
||||||
self.preview_widget.change_slide(row)
|
self.preview_widget.change_slide(row)
|
||||||
self.slideSelected()
|
self.slide_selected()
|
||||||
|
|
||||||
def onToggleLoop(self):
|
def on_toggle_loop(self):
|
||||||
"""
|
"""
|
||||||
Toggles the loop state.
|
Toggles the loop state.
|
||||||
"""
|
"""
|
||||||
hide_mode = self.hide_mode()
|
hide_mode = self.hide_mode()
|
||||||
if hide_mode is None and (self.play_slides_loop.isChecked() or self.play_slides_once.isChecked()):
|
if hide_mode is None and (self.play_slides_loop.isChecked() or self.play_slides_once.isChecked()):
|
||||||
self.onStartLoop()
|
self.on_start_loop()
|
||||||
else:
|
else:
|
||||||
self.on_stop_loop()
|
self.on_stop_loop()
|
||||||
|
|
||||||
def onStartLoop(self):
|
def on_start_loop(self):
|
||||||
"""
|
"""
|
||||||
Start the timer loop running and store the timer id
|
Start the timer loop running and store the timer id
|
||||||
"""
|
"""
|
||||||
@ -1098,7 +1097,7 @@ class SlideController(DisplayController):
|
|||||||
self.killTimer(self.timer_id)
|
self.killTimer(self.timer_id)
|
||||||
self.timer_id = 0
|
self.timer_id = 0
|
||||||
|
|
||||||
def onPlaySlidesLoop(self, checked=None):
|
def on_play_slides_loop(self, checked=None):
|
||||||
"""
|
"""
|
||||||
Start or stop 'Play Slides in Loop'
|
Start or stop 'Play Slides in Loop'
|
||||||
"""
|
"""
|
||||||
@ -1106,7 +1105,7 @@ class SlideController(DisplayController):
|
|||||||
checked = self.play_slides_loop.isChecked()
|
checked = self.play_slides_loop.isChecked()
|
||||||
else:
|
else:
|
||||||
self.play_slides_loop.setChecked(checked)
|
self.play_slides_loop.setChecked(checked)
|
||||||
log.debug(u'onPlaySlidesLoop %s' % checked)
|
log.debug(u'on_play_slides_loop %s' % checked)
|
||||||
if checked:
|
if checked:
|
||||||
self.play_slides_loop.setIcon(build_icon(u':/media/media_stop.png'))
|
self.play_slides_loop.setIcon(build_icon(u':/media/media_stop.png'))
|
||||||
self.play_slides_loop.setText(UiStrings().StopPlaySlidesInLoop)
|
self.play_slides_loop.setText(UiStrings().StopPlaySlidesInLoop)
|
||||||
@ -1117,9 +1116,9 @@ class SlideController(DisplayController):
|
|||||||
else:
|
else:
|
||||||
self.play_slides_loop.setIcon(build_icon(u':/media/media_time.png'))
|
self.play_slides_loop.setIcon(build_icon(u':/media/media_time.png'))
|
||||||
self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)
|
self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)
|
||||||
self.onToggleLoop()
|
self.on_toggle_loop()
|
||||||
|
|
||||||
def onPlaySlidesOnce(self, checked=None):
|
def on_play_slides_once(self, checked=None):
|
||||||
"""
|
"""
|
||||||
Start or stop 'Play Slides to End'
|
Start or stop 'Play Slides to End'
|
||||||
"""
|
"""
|
||||||
@ -1127,7 +1126,7 @@ class SlideController(DisplayController):
|
|||||||
checked = self.play_slides_once.isChecked()
|
checked = self.play_slides_once.isChecked()
|
||||||
else:
|
else:
|
||||||
self.play_slides_once.setChecked(checked)
|
self.play_slides_once.setChecked(checked)
|
||||||
log.debug(u'onPlaySlidesOnce %s' % checked)
|
log.debug(u'on_play_slides_once %s' % checked)
|
||||||
if checked:
|
if checked:
|
||||||
self.play_slides_once.setIcon(build_icon(u':/media/media_stop.png'))
|
self.play_slides_once.setIcon(build_icon(u':/media/media_stop.png'))
|
||||||
self.play_slides_once.setText(UiStrings().StopPlaySlidesToEnd)
|
self.play_slides_once.setText(UiStrings().StopPlaySlidesToEnd)
|
||||||
@ -1138,15 +1137,15 @@ class SlideController(DisplayController):
|
|||||||
else:
|
else:
|
||||||
self.play_slides_once.setIcon(build_icon(u':/media/media_time'))
|
self.play_slides_once.setIcon(build_icon(u':/media/media_time'))
|
||||||
self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)
|
self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)
|
||||||
self.onToggleLoop()
|
self.on_toggle_loop()
|
||||||
|
|
||||||
def setAudioItemsVisibility(self, visible):
|
def set_audio_items_visibility(self, visible):
|
||||||
"""
|
"""
|
||||||
Set the visibility of the audio stuff
|
Set the visibility of the audio stuff
|
||||||
"""
|
"""
|
||||||
self.toolbar.set_widget_visible(self.audio_list, visible)
|
self.toolbar.set_widget_visible(self.audio_list, visible)
|
||||||
|
|
||||||
def onAudioPauseClicked(self, checked):
|
def set_audio_pause_clicked(self, checked):
|
||||||
"""
|
"""
|
||||||
Pause the audio player
|
Pause the audio player
|
||||||
"""
|
"""
|
||||||
@ -1164,7 +1163,7 @@ class SlideController(DisplayController):
|
|||||||
if event.timerId() == self.timer_id:
|
if event.timerId() == self.timer_id:
|
||||||
self.on_slide_selected_next(self.play_slides_loop.isChecked())
|
self.on_slide_selected_next(self.play_slides_loop.isChecked())
|
||||||
|
|
||||||
def onEditSong(self):
|
def on_edit_song(self):
|
||||||
"""
|
"""
|
||||||
From the preview display requires the service Item to be editied
|
From the preview display requires the service Item to be editied
|
||||||
"""
|
"""
|
||||||
@ -1173,14 +1172,14 @@ class SlideController(DisplayController):
|
|||||||
if new_item:
|
if new_item:
|
||||||
self.add_service_item(new_item)
|
self.add_service_item(new_item)
|
||||||
|
|
||||||
def onPreviewAddToService(self):
|
def on_preview_add_to_service(self):
|
||||||
"""
|
"""
|
||||||
From the preview display request the Item to be added to service
|
From the preview display request the Item to be added to service
|
||||||
"""
|
"""
|
||||||
if self.service_item:
|
if self.service_item:
|
||||||
self.service_manager.add_service_item(self.service_item)
|
self.service_manager.add_service_item(self.service_item)
|
||||||
|
|
||||||
def onGoLiveClick(self):
|
def on_go_live_click(self):
|
||||||
"""
|
"""
|
||||||
triggered by clicking the Preview slide items
|
triggered by clicking the Preview slide items
|
||||||
"""
|
"""
|
||||||
@ -1190,10 +1189,10 @@ class SlideController(DisplayController):
|
|||||||
if self.service_item.is_command():
|
if self.service_item.is_command():
|
||||||
Registry().execute(u'%s_stop' % self.service_item.name.lower(), [self.service_item, self.is_live])
|
Registry().execute(u'%s_stop' % self.service_item.name.lower(), [self.service_item, self.is_live])
|
||||||
if self.service_item.is_media():
|
if self.service_item.is_media():
|
||||||
self.onMediaClose()
|
self.on_media_close()
|
||||||
self.onGoLive()
|
self.on_go_live()
|
||||||
|
|
||||||
def onGoLive(self):
|
def on_go_live(self):
|
||||||
"""
|
"""
|
||||||
If preview copy slide item to live controller from Preview Controller
|
If preview copy slide item to live controller from Preview Controller
|
||||||
"""
|
"""
|
||||||
@ -1202,41 +1201,41 @@ class SlideController(DisplayController):
|
|||||||
if self.service_item.from_service:
|
if self.service_item.from_service:
|
||||||
self.service_manager.preview_live(self.service_item.unique_identifier, row)
|
self.service_manager.preview_live(self.service_item.unique_identifier, row)
|
||||||
else:
|
else:
|
||||||
self.live_controller.addServiceManagerItem(self.service_item, row)
|
self.live_controller.add_service_manager_item(self.service_item, row)
|
||||||
|
|
||||||
def onMediaStart(self, item):
|
def on_media_start(self, item):
|
||||||
"""
|
"""
|
||||||
Respond to the arrival of a media service item
|
Respond to the arrival of a media service item
|
||||||
"""
|
"""
|
||||||
log.debug(u'SlideController onMediaStart')
|
log.debug(u'SlideController on_media_start')
|
||||||
self.media_controller.video(self.controller_type, item, self.hide_mode())
|
self.media_controller.video(self.controller_type, item, self.hide_mode())
|
||||||
if not self.is_live:
|
if not self.is_live:
|
||||||
self.preview_display.show()
|
self.preview_display.show()
|
||||||
self.slide_preview.hide()
|
self.slide_preview.hide()
|
||||||
|
|
||||||
def onMediaClose(self):
|
def on_media_close(self):
|
||||||
"""
|
"""
|
||||||
Respond to a request to close the Video
|
Respond to a request to close the Video
|
||||||
"""
|
"""
|
||||||
log.debug(u'SlideController onMediaClose')
|
log.debug(u'SlideController on_media_close')
|
||||||
self.media_controller.media_reset(self)
|
self.media_controller.media_reset(self)
|
||||||
self.preview_display.hide()
|
self.preview_display.hide()
|
||||||
self.slide_preview.show()
|
self.slide_preview.show()
|
||||||
|
|
||||||
def _resetBlank(self):
|
def _reset_blank(self):
|
||||||
"""
|
"""
|
||||||
Used by command items which provide their own displays to reset the
|
Used by command items which provide their own displays to reset the
|
||||||
screen hide attributes
|
screen hide attributes
|
||||||
"""
|
"""
|
||||||
hide_mode = self.hide_mode()
|
hide_mode = self.hide_mode()
|
||||||
if hide_mode == HideMode.Blank:
|
if hide_mode == HideMode.Blank:
|
||||||
self.onBlankDisplay(True)
|
self.on_blank_display(True)
|
||||||
elif hide_mode == HideMode.Theme:
|
elif hide_mode == HideMode.Theme:
|
||||||
self.onThemeDisplay(True)
|
self.on_theme_display(True)
|
||||||
elif hide_mode == HideMode.Screen:
|
elif hide_mode == HideMode.Screen:
|
||||||
self.onHideDisplay(True)
|
self.on_hide_display(True)
|
||||||
else:
|
else:
|
||||||
self.hidePlugin(False)
|
self.hide_plugin(False)
|
||||||
|
|
||||||
def hide_mode(self):
|
def hide_mode(self):
|
||||||
"""
|
"""
|
||||||
@ -1253,7 +1252,7 @@ class SlideController(DisplayController):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def onNextTrackClicked(self):
|
def on_next_track_clicked(self):
|
||||||
"""
|
"""
|
||||||
Go to the next track when next is clicked
|
Go to the next track when next is clicked
|
||||||
"""
|
"""
|
||||||
@ -1268,7 +1267,7 @@ class SlideController(DisplayController):
|
|||||||
seconds %= 60
|
seconds %= 60
|
||||||
self.audio_time_label.setText(u' %02d:%02d ' % (minutes, seconds))
|
self.audio_time_label.setText(u' %02d:%02d ' % (minutes, seconds))
|
||||||
|
|
||||||
def onTrackTriggered(self):
|
def on_track_triggered(self):
|
||||||
"""
|
"""
|
||||||
Start playing a track
|
Start playing a track
|
||||||
"""
|
"""
|
||||||
|
@ -178,8 +178,8 @@ class Ui_ThemeWizard(object):
|
|||||||
self.lineSpacingLabel = QtGui.QLabel(self.mainAreaPage)
|
self.lineSpacingLabel = QtGui.QLabel(self.mainAreaPage)
|
||||||
self.lineSpacingLabel.setObjectName(u'LineSpacingLabel')
|
self.lineSpacingLabel.setObjectName(u'LineSpacingLabel')
|
||||||
self.lineSpacingSpinBox = QtGui.QSpinBox(self.mainAreaPage)
|
self.lineSpacingSpinBox = QtGui.QSpinBox(self.mainAreaPage)
|
||||||
self.lineSpacingSpinBox.setMinimum(-50)
|
self.lineSpacingSpinBox.setMinimum(-250)
|
||||||
self.lineSpacingSpinBox.setMaximum(50)
|
self.lineSpacingSpinBox.setMaximum(250)
|
||||||
self.lineSpacingSpinBox.setObjectName(u'LineSpacingSpinBox')
|
self.lineSpacingSpinBox.setObjectName(u'LineSpacingSpinBox')
|
||||||
self.mainAreaLayout.addRow(self.lineSpacingLabel, self.lineSpacingSpinBox)
|
self.mainAreaLayout.addRow(self.lineSpacingLabel, self.lineSpacingSpinBox)
|
||||||
self.outlineCheckBox = QtGui.QCheckBox(self.mainAreaPage)
|
self.outlineCheckBox = QtGui.QCheckBox(self.mainAreaPage)
|
||||||
|
@ -346,9 +346,9 @@ def get_uno_instance(resolver):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'get UNO Desktop Openoffice - resolve')
|
log.debug(u'get UNO Desktop Openoffice - resolve')
|
||||||
if UNO_CONNECTION_TYPE == u'pipe':
|
if UNO_CONNECTION_TYPE == u'pipe':
|
||||||
return resolver.resolve(u'uno:pipe,name=openlp_pipe; urp;StarOffice.ComponentContext')
|
return resolver.resolve(u'uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext')
|
||||||
else:
|
else:
|
||||||
return resolver.resolve(u'uno:socket,host=localhost,port=2002; urp;StarOffice.ComponentContext')
|
return resolver.resolve(u'uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext')
|
||||||
|
|
||||||
|
|
||||||
def format_time(text, local_time):
|
def format_time(text, local_time):
|
||||||
|
@ -473,7 +473,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
This boolean is set to True when the list in the interface should be reloaded after saving the new images
|
This boolean is set to True when the list in the interface should be reloaded after saving the new images
|
||||||
"""
|
"""
|
||||||
for filename in images_list:
|
for filename in images_list:
|
||||||
if type(filename) is not str and type(filename) is not unicode:
|
if not isinstance(filename, basestring):
|
||||||
continue
|
continue
|
||||||
log.debug(u'Adding new image: %s', filename)
|
log.debug(u'Adding new image: %s', filename)
|
||||||
imageFile = ImageFilenames()
|
imageFile = ImageFilenames()
|
||||||
|
@ -80,15 +80,15 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
Build the list of file extensions to be used in the Open file dialog.
|
Build the list of file extensions to be used in the Open file dialog.
|
||||||
"""
|
"""
|
||||||
file_type = u''
|
file_type_list = u''
|
||||||
for controller in self.controllers:
|
for controller in self.controllers:
|
||||||
if self.controllers[controller].enabled():
|
if self.controllers[controller].enabled():
|
||||||
file_types = self.controllers[controller].supports + self.controllers[controller].also_supports
|
file_types = self.controllers[controller].supports + self.controllers[controller].also_supports
|
||||||
for file_type in file_types:
|
for file_type in file_types:
|
||||||
if file_type.find(file_type) == -1:
|
if file_type.find(file_type) == -1:
|
||||||
file_type += u'*.%s ' % file_type
|
file_type_list += u'*.%s ' % file_type
|
||||||
self.service_manager.supported_suffixes(file_type)
|
self.service_manager.supported_suffixes(file_type)
|
||||||
self.on_new_file_masks = translate('PresentationPlugin.MediaItem', 'Presentations (%s)') % file_type
|
self.on_new_file_masks = translate('PresentationPlugin.MediaItem', 'Presentations (%s)') % file_type_list
|
||||||
|
|
||||||
def required_icons(self):
|
def required_icons(self):
|
||||||
"""
|
"""
|
||||||
|
@ -98,9 +98,9 @@ OPTIONAL_MODULES = [
|
|||||||
w = sys.stdout.write
|
w = sys.stdout.write
|
||||||
|
|
||||||
def check_vers(version, required, text):
|
def check_vers(version, required, text):
|
||||||
if type(version) is not str:
|
if not isinstance(version, str):
|
||||||
version = '.'.join(map(str, version))
|
version = '.'.join(map(str, version))
|
||||||
if type(required) is not str:
|
if not isinstance(required, str):
|
||||||
required = '.'.join(map(str, required))
|
required = '.'.join(map(str, required))
|
||||||
w(' %s >= %s ... ' % (text, required))
|
w(' %s >= %s ... ' % (text, required))
|
||||||
if LooseVersion(version) >= LooseVersion(required):
|
if LooseVersion(version) >= LooseVersion(required):
|
||||||
|
1
tests/interfaces/openlp_plugins/bibles/__init__.py
Normal file
1
tests/interfaces/openlp_plugins/bibles/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
__author__ = 'tim'
|
73
tests/interfaces/openlp_plugins/bibles/test_lib_http.py
Normal file
73
tests/interfaces/openlp_plugins/bibles/test_lib_http.py
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
"""
|
||||||
|
Package to test the openlp.plugin.bible.lib.https package.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from unittest import TestCase
|
||||||
|
from mock import MagicMock
|
||||||
|
|
||||||
|
from openlp.core.lib import Registry
|
||||||
|
from openlp.plugins.bibles.lib.http import BGExtract, CWExtract
|
||||||
|
|
||||||
|
|
||||||
|
class TestBibleHTTP(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
"""
|
||||||
|
Set up the Registry
|
||||||
|
"""
|
||||||
|
Registry.create()
|
||||||
|
Registry().register(u'service_list', MagicMock())
|
||||||
|
Registry().register(u'application', MagicMock())
|
||||||
|
|
||||||
|
def bible_gateway_extract_books_test(self):
|
||||||
|
"""
|
||||||
|
Test the Bible Gateway retrieval of book list for NIV bible
|
||||||
|
"""
|
||||||
|
# GIVEN: A new Bible Gateway extraction class
|
||||||
|
handler = BGExtract()
|
||||||
|
|
||||||
|
# WHEN: The Books list is called
|
||||||
|
books = handler.get_books_from_http(u'NIV')
|
||||||
|
|
||||||
|
# THEN: We should get back a valid service item
|
||||||
|
assert len(books) == 66, u'The bible should not have had any books added or removed'
|
||||||
|
|
||||||
|
def bible_gateway_extract_verse_test(self):
|
||||||
|
"""
|
||||||
|
Test the Bible Gateway retrieval of verse list for NIV bible John 3
|
||||||
|
"""
|
||||||
|
# GIVEN: A new Bible Gateway extraction class
|
||||||
|
handler = BGExtract()
|
||||||
|
|
||||||
|
# WHEN: The Books list is called
|
||||||
|
results = handler.get_bible_chapter(u'NIV', u'John', 3)
|
||||||
|
|
||||||
|
# THEN: We should get back a valid service item
|
||||||
|
assert len(results.verselist) == 36, u'The book of John should not have had any verses added or removed'
|
||||||
|
|
||||||
|
def crosswalk_extract_books_test(self):
|
||||||
|
"""
|
||||||
|
Test Crosswalk retrieval of book list for NIV bible
|
||||||
|
"""
|
||||||
|
# GIVEN: A new Bible Gateway extraction class
|
||||||
|
handler = CWExtract()
|
||||||
|
|
||||||
|
# WHEN: The Books list is called
|
||||||
|
books = handler.get_books_from_http(u'niv')
|
||||||
|
|
||||||
|
# THEN: We should get back a valid service item
|
||||||
|
assert len(books) == 66, u'The bible should not have had any books added or removed'
|
||||||
|
|
||||||
|
def crosswalk_extract_verse_test(self):
|
||||||
|
"""
|
||||||
|
Test Crosswalk retrieval of verse list for NIV bible John 3
|
||||||
|
"""
|
||||||
|
# GIVEN: A new Bible Gateway extraction class
|
||||||
|
handler = CWExtract()
|
||||||
|
|
||||||
|
# WHEN: The Books list is called
|
||||||
|
results = handler.get_bible_chapter(u'niv', u'john', 3)
|
||||||
|
|
||||||
|
# THEN: We should get back a valid service item
|
||||||
|
assert len(results.verselist) == 36, u'The book of John should not have had any verses added or removed'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user