This commit is contained in:
Tim Bentley 2011-12-11 14:32:43 +00:00
commit 48971f90ef
55 changed files with 6718 additions and 5280 deletions

View File

@ -191,10 +191,10 @@ def validate_thumb(file_path, thumb_path):
``thumb_path``
The path to the thumb.
"""
if not os.path.exists(unicode(thumb_path)):
if not os.path.exists(thumb_path):
return False
image_date = os.stat(unicode(file_path)).st_mtime
thumb_date = os.stat(unicode(thumb_path)).st_mtime
image_date = os.stat(file_path).st_mtime
thumb_date = os.stat(thumb_path).st_mtime
return image_date <= thumb_date
def resize_image(image_path, width, height, background=u'#000000'):

View File

@ -113,10 +113,10 @@ sup {
document.getElementById('lyricsmain').style.visibility = lyrics;
document.getElementById('image').style.visibility = lyrics;
outline = document.getElementById('lyricsoutline')
if(outline!=null)
if(outline != null)
outline.style.visibility = lyrics;
shadow = document.getElementById('lyricsshadow')
if(shadow!=null)
if(shadow != null)
shadow.style.visibility = lyrics;
document.getElementById('footer').style.visibility = lyrics;
}
@ -129,10 +129,28 @@ sup {
var match = /-webkit-text-fill-color:[^;\"]+/gi;
if(timer != null)
clearTimeout(timer);
/*
QtWebkit bug with outlines and justify causing outline alignment
problems. (Bug 859950) Surround each word with a <span> to workaround,
but only in this scenario.
*/
var txt = document.getElementById('lyricsmain');
if(window.getComputedStyle(txt).textAlign == 'justify'){
var outline = document.getElementById('lyricsoutline');
if(outline != null)
txt = outline;
if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){
newtext = newtext.replace(/(\s|&nbsp;)+(?![^<]*>)/g,
function(match) {
return '</span>' + match + '<span>';
});
newtext = '<span>' + newtext + '</span>';
}
}
text_fade('lyricsmain', newtext);
text_fade('lyricsoutline', newtext);
text_fade('lyricsshadow', newtext.replace(match, ""));
if(text_opacity()==1) return;
text_fade('lyricsshadow', newtext.replace(match, ''));
if(text_opacity() == 1) return;
timer = setTimeout(function(){
show_text(newtext);
}, 100);
@ -149,18 +167,18 @@ sup {
slides) still looks pretty and is zippy.
*/
var text = document.getElementById(id);
if(text==null) return;
if(text == null) return;
if(!transition){
text.innerHTML = newtext;
return;
}
if(newtext==text.innerHTML){
if(newtext == text.innerHTML){
text.style.opacity = parseFloat(text.style.opacity) + 0.3;
if(text.style.opacity>0.7)
if(text.style.opacity > 0.7)
text.style.opacity = 1;
} else {
text.style.opacity = parseFloat(text.style.opacity) - 0.3;
if(text.style.opacity<=0.1){
if(text.style.opacity <= 0.1){
text.innerHTML = newtext;
}
}
@ -172,7 +190,7 @@ sup {
}
function show_text_complete(){
return (text_opacity()==1);
return (text_opacity() == 1);
}
</script>
</head>

View File

@ -104,7 +104,7 @@ class ListWidgetWithDnD(QtGui.QListWidget):
elif os.path.isdir(localFile):
listing = os.listdir(localFile)
for file in listing:
files.append(os.path.join(localFile,file))
Receiver.send_message(u'%s_dnd' % self.mimeDataText,files)
files.append(os.path.join(localFile, file))
Receiver.send_message(u'%s_dnd' % self.mimeDataText, files)
else:
event.ignore()

View File

@ -91,8 +91,9 @@ class Plugin(QtCore.QObject):
``checkPreConditions()``
Provides the Plugin with a handle to check if it can be loaded.
``getMediaManagerItem()``
Returns an instance of MediaManagerItem to be used in the Media Manager.
``createMediaManagerItem()``
Creates a new instance of MediaManagerItem to be used in the Media
Manager.
``addImportMenuItem(import_menu)``
Add an item to the Import menu.
@ -100,8 +101,8 @@ class Plugin(QtCore.QObject):
``addExportMenuItem(export_menu)``
Add an item to the Export menu.
``getSettingsTab()``
Returns an instance of SettingsTabItem to be used in the Settings
``createSettingsTab()``
Creates a new instance of SettingsTabItem to be used in the Settings
dialog.
``addToMenu(menubar)``
@ -156,10 +157,10 @@ class Plugin(QtCore.QObject):
self.icon = None
self.media_item_class = media_item_class
self.settings_tab_class = settings_tab_class
self.settings_tab = None
self.mediaItem = None
self.weight = 0
self.status = PluginStatus.Inactive
# Set up logging
self.log = logging.getLogger(self.name)
self.previewController = plugin_helpers[u'preview']
self.liveController = plugin_helpers[u'live']
self.renderer = plugin_helpers[u'renderer']
@ -178,7 +179,7 @@ class Plugin(QtCore.QObject):
Provides the Plugin with a handle to check if it can be loaded.
Failing Preconditions does not stop a settings Tab being created
Returns True or False.
Returns ``True`` or ``False``.
"""
return True
@ -210,15 +211,14 @@ class Plugin(QtCore.QObject):
"""
return self.status == PluginStatus.Active
def getMediaManagerItem(self):
def createMediaManagerItem(self):
"""
Construct a MediaManagerItem object with all the buttons and things
you need, and return it for integration into openlp.org.
you need, and return it for integration into OpenLP.
"""
if self.media_item_class:
return self.media_item_class(self.mediadock.media_dock, self,
self.icon)
return None
self.mediaItem = self.media_item_class(self.mediadock.media_dock,
self, self.icon)
def addImportMenuItem(self, importMenu):
"""
@ -247,16 +247,15 @@ class Plugin(QtCore.QObject):
"""
pass
def getSettingsTab(self, parent):
def createSettingsTab(self, parent):
"""
Create a tab for the settings window to display the configurable
options for this plugin to the user.
Create a tab for the settings window to display the configurable options
for this plugin to the user.
"""
if self.settings_tab_class:
return self.settings_tab_class(parent, self.name,
self.settings_tab = self.settings_tab_class(parent, self.name,
self.getString(StringContent.VisibleName)[u'title'],
self.icon_path)
return None
def addToMenu(self, menubar):
"""

View File

@ -90,7 +90,7 @@ class PluginManager(object):
thisdepth = len(path.split(os.sep))
if thisdepth - startdepth > 2:
# skip anything lower down
continue
break
modulename = os.path.splitext(path)[0]
prefix = os.path.commonprefix([self.basepath, path])
# hack off the plugin base path
@ -113,7 +113,7 @@ class PluginManager(object):
plugin_objects.append(plugin)
except TypeError:
log.exception(u'Failed to load plugin %s', unicode(p))
plugins_list = sorted(plugin_objects, self.order_by_weight)
plugins_list = sorted(plugin_objects, key=lambda plugin: plugin.weight)
for plugin in plugins_list:
if plugin.checkPreConditions():
log.debug(u'Plugin %s active', unicode(plugin.name))
@ -122,29 +122,13 @@ class PluginManager(object):
plugin.status = PluginStatus.Disabled
self.plugins.append(plugin)
def order_by_weight(self, x, y):
def hook_media_manager(self):
"""
Sort two plugins and order them by their weight.
``x``
The first plugin.
``y``
The second plugin.
"""
return cmp(x.weight, y.weight)
def hook_media_manager(self, mediadock):
"""
Loop through all the plugins. If a plugin has a valid media manager
item, add it to the media manager.
``mediatoolbox``
The Media Manager itself.
Create the plugins' media manager items.
"""
for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled:
plugin.mediaItem = plugin.getMediaManagerItem()
plugin.createMediaManagerItem()
def hook_settings_tabs(self, settings_form=None):
"""
@ -152,14 +136,12 @@ class PluginManager(object):
item, add it to the settings tab.
Tabs are set for all plugins not just Active ones
``settingsform``
``settings_form``
Defaults to *None*. The settings form to add tabs to.
"""
for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled:
plugin.settings_tab = plugin.getSettingsTab(settings_form)
else:
plugin.settings_tab = None
plugin.createSettingsTab(settings_form)
settings_form.plugins = self.plugins
def hook_import_menu(self, import_menu):
@ -225,7 +207,7 @@ class PluginManager(object):
def get_plugin_by_name(self, name):
"""
Return the plugin which has a name with value ``name``
Return the plugin which has a name with value ``name``.
"""
for plugin in self.plugins:
if plugin.name == name:

View File

@ -65,7 +65,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self.downloadCanceled = False
self.downloading = unicode(translate('OpenLP.FirstTimeWizard',
'Downloading %s...'))
QtCore.QObject.connect(self.cancelButton,QtCore.SIGNAL('clicked()'),
QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
self.onCancelButtonClicked)
QtCore.QObject.connect(self.noInternetFinishButton,
QtCore.SIGNAL('clicked()'), self.onNoInternetFinishButtonClicked)

View File

@ -29,7 +29,6 @@ The :mod:`maindisplay` module provides the functionality to display screens
and play multimedia within OpenLP.
"""
import logging
import os
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
from PyQt4.phonon import Phonon

View File

@ -35,8 +35,7 @@ from datetime import datetime
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, \
PluginManager, Receiver, translate, ImageManager, PluginStatus, \
SettingsManager
PluginManager, Receiver, translate, ImageManager, PluginStatus
from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \
icon_action, shortcut_action
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
@ -44,7 +43,7 @@ from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
ShortcutListForm, FormattingTagForm
from openlp.core.ui.media import MediaController
from openlp.core.utils import AppLocation, add_actions, LanguageManager, \
get_application_version, delete_file
get_application_version
from openlp.core.utils.actions import ActionList, CategoryOrder
from openlp.core.ui.firsttimeform import FirstTimeForm
from openlp.core.ui import ScreenList
@ -177,92 +176,100 @@ class Ui_MainWindow(object):
self.themeManagerDock)
# Create the menu items
action_list = ActionList.get_instance()
action_list.add_category(UiStrings().File, CategoryOrder.standardMenu)
action_list.add_category(unicode(UiStrings().File),
CategoryOrder.standardMenu)
self.fileNewItem = shortcut_action(mainWindow, u'fileNewItem',
[QtGui.QKeySequence(u'Ctrl+N')],
self.serviceManagerContents.onNewServiceClicked,
u':/general/general_new.png', category=UiStrings().File)
u':/general/general_new.png', category=unicode(UiStrings().File))
self.fileOpenItem = shortcut_action(mainWindow, u'fileOpenItem',
[QtGui.QKeySequence(u'Ctrl+O')],
self.serviceManagerContents.onLoadServiceClicked,
u':/general/general_open.png', category=UiStrings().File)
u':/general/general_open.png', category=unicode(UiStrings().File))
self.fileSaveItem = shortcut_action(mainWindow, u'fileSaveItem',
[QtGui.QKeySequence(u'Ctrl+S')],
self.serviceManagerContents.saveFile,
u':/general/general_save.png', category=UiStrings().File)
u':/general/general_save.png', category=unicode(UiStrings().File))
self.fileSaveAsItem = shortcut_action(mainWindow, u'fileSaveAsItem',
[QtGui.QKeySequence(u'Ctrl+Shift+S')],
self.serviceManagerContents.saveFileAs, category=UiStrings().File)
self.serviceManagerContents.saveFileAs,
category=unicode(UiStrings().File))
self.printServiceOrderItem = shortcut_action(mainWindow,
u'printServiceItem', [QtGui.QKeySequence(u'Ctrl+P')],
self.serviceManagerContents.printServiceOrder,
category=UiStrings().File)
category=unicode(UiStrings().File))
self.fileExitItem = shortcut_action(mainWindow, u'fileExitItem',
[QtGui.QKeySequence(u'Alt+F4')], mainWindow.close,
u':/system/system_exit.png', category=UiStrings().File)
action_list.add_category(UiStrings().Import, CategoryOrder.standardMenu)
u':/system/system_exit.png', category=unicode(UiStrings().File))
action_list.add_category(unicode(UiStrings().Import),
CategoryOrder.standardMenu)
self.importThemeItem = base_action(
mainWindow, u'importThemeItem', UiStrings().Import)
mainWindow, u'importThemeItem', unicode(UiStrings().Import))
self.importLanguageItem = base_action(
mainWindow, u'importLanguageItem')#, UiStrings().Import)
action_list.add_category(UiStrings().Export, CategoryOrder.standardMenu)
mainWindow, u'importLanguageItem')#, unicode(UiStrings().Import))
action_list.add_category(unicode(UiStrings().Export),
CategoryOrder.standardMenu)
self.exportThemeItem = base_action(
mainWindow, u'exportThemeItem', UiStrings().Export)
mainWindow, u'exportThemeItem', unicode(UiStrings().Export))
self.exportLanguageItem = base_action(
mainWindow, u'exportLanguageItem')#, UiStrings().Export)
action_list.add_category(UiStrings().View, CategoryOrder.standardMenu)
mainWindow, u'exportLanguageItem')#, unicode(UiStrings().Export))
action_list.add_category(unicode(UiStrings().View),
CategoryOrder.standardMenu)
self.viewMediaManagerItem = shortcut_action(mainWindow,
u'viewMediaManagerItem', [QtGui.QKeySequence(u'F8')],
self.toggleMediaManager, u':/system/system_mediamanager.png',
self.mediaManagerDock.isVisible(), UiStrings().View)
self.mediaManagerDock.isVisible(), unicode(UiStrings().View))
self.viewThemeManagerItem = shortcut_action(mainWindow,
u'viewThemeManagerItem', [QtGui.QKeySequence(u'F10')],
self.toggleThemeManager, u':/system/system_thememanager.png',
self.themeManagerDock.isVisible(), UiStrings().View)
self.themeManagerDock.isVisible(), unicode(UiStrings().View))
self.viewServiceManagerItem = shortcut_action(mainWindow,
u'viewServiceManagerItem', [QtGui.QKeySequence(u'F9')],
self.toggleServiceManager, u':/system/system_servicemanager.png',
self.serviceManagerDock.isVisible(), UiStrings().View)
self.serviceManagerDock.isVisible(), unicode(UiStrings().View))
self.viewPreviewPanel = shortcut_action(mainWindow,
u'viewPreviewPanel', [QtGui.QKeySequence(u'F11')],
self.setPreviewPanelVisibility, checked=previewVisible,
category=UiStrings().View)
category=unicode(UiStrings().View))
self.viewLivePanel = shortcut_action(mainWindow, u'viewLivePanel',
[QtGui.QKeySequence(u'F12')], self.setLivePanelVisibility,
checked=liveVisible, category=UiStrings().View)
checked=liveVisible, category=unicode(UiStrings().View))
self.lockPanel = shortcut_action(mainWindow, u'lockPanel',
None, self.setLockPanel,
checked=panelLocked, category=None)
action_list.add_category(UiStrings().ViewMode,
action_list.add_category(unicode(UiStrings().ViewMode),
CategoryOrder.standardMenu)
self.modeDefaultItem = checkable_action(
mainWindow, u'modeDefaultItem', category=UiStrings().ViewMode)
mainWindow, u'modeDefaultItem',
category=unicode(UiStrings().ViewMode))
self.modeSetupItem = checkable_action(
mainWindow, u'modeSetupItem', category=UiStrings().ViewMode)
mainWindow, u'modeSetupItem',
category=unicode(UiStrings().ViewMode))
self.modeLiveItem = checkable_action(
mainWindow, u'modeLiveItem', True, UiStrings().ViewMode)
mainWindow, u'modeLiveItem', True, unicode(UiStrings().ViewMode))
self.modeGroup = QtGui.QActionGroup(mainWindow)
self.modeGroup.addAction(self.modeDefaultItem)
self.modeGroup.addAction(self.modeSetupItem)
self.modeGroup.addAction(self.modeLiveItem)
self.modeDefaultItem.setChecked(True)
action_list.add_category(UiStrings().Tools, CategoryOrder.standardMenu)
action_list.add_category(unicode(UiStrings().Tools),
CategoryOrder.standardMenu)
self.toolsAddToolItem = icon_action(mainWindow, u'toolsAddToolItem',
u':/tools/tools_add.png', category=UiStrings().Tools)
u':/tools/tools_add.png', category=unicode(UiStrings().Tools))
self.toolsOpenDataFolder = icon_action(mainWindow,
u'toolsOpenDataFolder', u':/general/general_open.png',
category=UiStrings().Tools)
category=unicode(UiStrings().Tools))
self.toolsFirstTimeWizard = icon_action(mainWindow,
u'toolsFirstTimeWizard', u':/general/general_revert.png',
category=UiStrings().Tools)
category=unicode(UiStrings().Tools))
self.updateThemeImages = base_action(mainWindow,
u'updateThemeImages', category=UiStrings().Tools)
action_list.add_category(UiStrings().Settings,
u'updateThemeImages', category=unicode(UiStrings().Tools))
action_list.add_category(unicode(UiStrings().Settings),
CategoryOrder.standardMenu)
self.settingsPluginListItem = shortcut_action(mainWindow,
u'settingsPluginListItem', [QtGui.QKeySequence(u'Alt+F7')],
self.onPluginItemClicked, u':/system/settings_plugin_list.png',
category=UiStrings().Settings)
category=unicode(UiStrings().Settings))
# i18n Language Items
self.autoLanguageItem = checkable_action(mainWindow,
u'autoLanguageItem', LanguageManager.auto_language)
@ -279,35 +286,38 @@ class Ui_MainWindow(object):
self.settingsShortcutsItem = icon_action(mainWindow,
u'settingsShortcutsItem',
u':/system/system_configure_shortcuts.png',
category=UiStrings().Settings)
category=unicode(UiStrings().Settings))
# Formatting Tags were also known as display tags.
self.formattingTagItem = icon_action(mainWindow,
u'displayTagItem', u':/system/tag_editor.png',
category=UiStrings().Settings)
category=unicode(UiStrings().Settings))
self.settingsConfigureItem = icon_action(mainWindow,
u'settingsConfigureItem', u':/system/system_settings.png',
category=UiStrings().Settings)
category=unicode(UiStrings().Settings))
self.settingsImportItem = base_action(mainWindow,
u'settingsImportItem', category=UiStrings().Settings)
u'settingsImportItem', category=unicode(UiStrings().Settings))
self.settingsExportItem = base_action(mainWindow,
u'settingsExportItem', category=UiStrings().Settings)
action_list.add_category(UiStrings().Help, CategoryOrder.standardMenu)
u'settingsExportItem', category=unicode(UiStrings().Settings))
action_list.add_category(unicode(UiStrings().Help),
CategoryOrder.standardMenu)
self.aboutItem = shortcut_action(mainWindow, u'aboutItem',
[QtGui.QKeySequence(u'Ctrl+F1')], self.onAboutItemClicked,
u':/system/system_about.png', category=UiStrings().Help)
u':/system/system_about.png', category=unicode(UiStrings().Help))
if os.name == u'nt':
self.localHelpFile = os.path.join(
AppLocation.get_directory(AppLocation.AppDir), 'OpenLP.chm')
self.offlineHelpItem = shortcut_action(
mainWindow, u'offlineHelpItem', [QtGui.QKeySequence(u'F1')],
self.onOfflineHelpClicked,
u':/system/system_help_contents.png', category=UiStrings().Help)
u':/system/system_help_contents.png',
category=unicode(UiStrings().Help))
self.onlineHelpItem = shortcut_action(
mainWindow, u'onlineHelpItem',
[QtGui.QKeySequence(u'Alt+F1')], self.onOnlineHelpClicked,
u':/system/system_online_help.png', category=UiStrings().Help)
u':/system/system_online_help.png',
category=unicode(UiStrings().Help))
self.webSiteItem = base_action(
mainWindow, u'webSiteItem', category=UiStrings().Help)
mainWindow, u'webSiteItem', category=unicode(UiStrings().Help))
add_actions(self.fileImportMenu, (self.settingsImportItem, None,
self.importThemeItem, self.importLanguageItem))
add_actions(self.fileExportMenu, (self.settingsExportItem, None,
@ -504,7 +514,8 @@ class Ui_MainWindow(object):
self.toolsFirstTimeWizard.setText(
translate('OpenLP.MainWindow', 'Re-run First Time Wizard'))
self.toolsFirstTimeWizard.setStatusTip(translate('OpenLP.MainWindow',
'Re-run the First Time Wizard, importing songs, Bibles and themes.'))
'Re-run the First Time Wizard, importing songs, Bibles and '
'themes.'))
self.updateThemeImages.setText(
translate('OpenLP.MainWindow', 'Update Theme Images'))
self.updateThemeImages.setStatusTip(
@ -655,7 +666,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.pluginManager.hook_settings_tabs(self.settingsForm)
# Find and insert media manager items
log.info(u'hook media')
self.pluginManager.hook_media_manager(self.mediaDockManager)
self.pluginManager.hook_media_manager()
# Call the hook method to pull in import menus.
log.info(u'hook menus')
self.pluginManager.hook_import_menu(self.fileImportMenu)
@ -720,7 +731,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
args = []
for a in self.arguments:
args.extend([a])
self.serviceManagerContents.loadFile(unicode(args[0]))
filename = args[0]
if not isinstance(filename, unicode):
filename = unicode(filename, sys.getfilesystemencoding())
self.serviceManagerContents.loadFile(filename)
elif QtCore.QSettings().value(
self.generalSettingsSection + u'/auto open',
QtCore.QVariant(False)).toBool():
@ -1312,7 +1326,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
settings.value(u'preview splitter geometry').toByteArray())
self.controlSplitter.restoreState(
settings.value(u'mainwindow splitter geometry').toByteArray())
settings.endGroup()
def saveSettings(self):
@ -1388,6 +1401,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
maxRecentFiles = QtCore.QSettings().value(u'advanced/max recent files',
QtCore.QVariant(20)).toInt()[0]
if filename:
# Add some cleanup to reduce duplication in the recent file list
filename = os.path.abspath(filename)
# abspath() only capitalises the drive letter if it wasn't provided
# in the given filename which then causes duplication.
if filename[1:3] == ':\\':
filename = filename[0].upper() + filename[1:]
position = self.recentFiles.indexOf(filename)
if position != -1:
self.recentFiles.removeAt(position)

View File

@ -26,13 +26,12 @@
###############################################################################
import logging
import sys, os,time
from PyQt4 import QtCore, QtGui, QtWebKit
import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, Receiver, translate
from openlp.core.lib.mediaplayer import MediaPlayer
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui.media import MediaState, MediaInfo, MediaType
from openlp.core.utils import AppLocation
@ -136,8 +135,9 @@ class MediaController(object):
savedPlayers = playerSettings.split(u',')
invalidMediaPlayers = [mediaPlayer for mediaPlayer in savedPlayers \
if not mediaPlayer in self.mediaPlayers]
if len(invalidMediaPlayers)>0:
[savedPlayers.remove(invalidPlayer) for invalidPlayer in invalidMediaPlayers]
if len(invalidMediaPlayers) > 0:
for invalidPlayer in invalidMediaPlayers:
savedPlayers.remove(invalidPlayer)
newPlayerSetting = u','.join(savedPlayers)
QtCore.QSettings().setValue(u'media/players',
QtCore.QVariant(newPlayerSetting))
@ -206,15 +206,15 @@ class MediaController(object):
controller.mediabar = OpenLPToolbar(controller)
controller.mediabar.addToolbarButton(
u'media_playback_play', u':/slides/media_playback_start.png',
translate('OpenLP.SlideController', 'Start playing media'),
translate('OpenLP.SlideController', 'Start playing media.'),
controller.sendToPlugins)
controller.mediabar.addToolbarButton(
u'media_playback_pause', u':/slides/media_playback_pause.png',
translate('OpenLP.SlideController', 'Pause playing media'),
translate('OpenLP.SlideController', 'Pause playing media.'),
controller.sendToPlugins)
controller.mediabar.addToolbarButton(
u'media_playback_stop', u':/slides/media_playback_stop.png',
translate('OpenLP.SlideController', 'Stop playing media'),
translate('OpenLP.SlideController', 'Stop playing media.'),
controller.sendToPlugins)
# Build the seekSlider.
controller.seekSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
@ -223,7 +223,7 @@ class MediaController(object):
'OpenLP.SlideController', 'Video position.'))
controller.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
controller.seekSlider.setObjectName(u'seek_slider')
controller.mediabar.addToolbarWidget(u'Seek Slider',
controller.mediabar.addToolbarWidget(u'Seek Slider',
controller.seekSlider)
# Build the volumeSlider.
controller.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
@ -236,7 +236,7 @@ class MediaController(object):
controller.volumeSlider.setValue(controller.media_info.volume)
controller.volumeSlider.setGeometry(QtCore.QRect(90, 160, 221, 24))
controller.volumeSlider.setObjectName(u'volume_slider')
controller.mediabar.addToolbarWidget(u'Audio Volume',
controller.mediabar.addToolbarWidget(u'Audio Volume',
controller.volumeSlider)
control_panel.addWidget(controller.mediabar)
controller.mediabar.setVisible(False)
@ -255,7 +255,7 @@ class MediaController(object):
def setup_display(self, display):
"""
After a new display is configured, all media related widget will be
After a new display is configured, all media related widget will be
created too
"""
# clean up possible running old media files
@ -276,13 +276,13 @@ class MediaController(object):
def set_controls_visible(self, controller, value):
# Generic controls
controller.mediabar.setVisible(value)
# Special controls: Here media type specific Controls will be enabled
# Special controls: Here media type specific Controls will be enabled
# (e.g. for DVD control, ...)
# TODO
def resize(self, controller, display, player):
"""
After Mainwindow changes or Splitter moved all related media widgets
After Mainwindow changes or Splitter moved all related media widgets
have to be resized
"""
player.resize(display)
@ -311,8 +311,13 @@ class MediaController(object):
isValid = self.check_file_type(controller, display)
display.override[u'theme'] = u''
display.override[u'video'] = True
controller.media_info.start_time = display.serviceItem.start_time
controller.media_info.end_time = display.serviceItem.end_time
if controller.media_info.is_background:
# ignore start/end time
controller.media_info.start_time = 0
controller.media_info.end_time = 0
else:
controller.media_info.start_time = display.serviceItem.start_time
controller.media_info.end_time = display.serviceItem.end_time
elif controller.previewDisplay:
display = controller.previewDisplay
isValid = self.check_file_type(controller, display)
@ -346,7 +351,7 @@ class MediaController(object):
def check_file_type(self, controller, display):
"""
Used to choose the right media Player type from the prioritized Player list
Select the correct media Player type from the prioritized Player list
"""
playerSettings = str(QtCore.QSettings().value(u'media/players',
QtCore.QVariant(u'webkit')).toString())
@ -356,17 +361,19 @@ class MediaController(object):
if self.overridenPlayer != '':
usedPlayers = [self.overridenPlayer]
if controller.media_info.file_info.isFile():
suffix = u'*.%s' % controller.media_info.file_info.suffix().toLower()
suffix = u'*.%s' % \
controller.media_info.file_info.suffix().toLower()
for title in usedPlayers:
player = self.mediaPlayers[title]
if suffix in player.video_extensions_list:
if not controller.media_info.is_background or \
controller.media_info.is_background and player.canBackground:
self.resize(controller, display, player)
if player.load(display):
self.curDisplayMediaPlayer[display] = player
controller.media_info.media_type = MediaType.Video
return True
controller.media_info.is_background and \
player.canBackground:
self.resize(controller, display, player)
if player.load(display):
self.curDisplayMediaPlayer[display] = player
controller.media_info.media_type = MediaType.Video
return True
if suffix in player.audio_extensions_list:
if player.load(display):
self.curDisplayMediaPlayer[display] = player
@ -387,7 +394,7 @@ class MediaController(object):
def video_play(self, msg, status=True):
"""
Responds to the request to play a loaded video
``msg``
First element is the controller which should be used
"""
@ -399,7 +406,8 @@ class MediaController(object):
return False
if status:
display.frame.evaluateJavaScript(u'show_blank("desktop");')
self.curDisplayMediaPlayer[display].set_visible(display, True)
self.curDisplayMediaPlayer[display].set_visible(display,
True)
if controller.isLive:
if controller.hideMenu.defaultAction().isChecked():
controller.hideMenu.defaultAction().trigger()

View File

@ -29,7 +29,6 @@ import logging
import mimetypes
from datetime import datetime
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon
from openlp.core.lib import Receiver

View File

@ -27,9 +27,6 @@
import logging
from PyQt4 import QtCore, QtGui, QtWebKit
from openlp.core.lib import OpenLPToolbar, translate
from openlp.core.lib.mediaplayer import MediaPlayer
from openlp.core.ui.media import MediaState

View File

@ -402,6 +402,9 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
settings.endGroup()
def update_song_usage(self):
# Only continue when we include the song's text.
if not self.slideTextCheckBox.isChecked():
return
for index, item in enumerate(self.serviceManager.serviceItems):
# Trigger Audit requests
Receiver.send_message(u'print_service_started',

View File

@ -177,9 +177,9 @@ class ServiceManager(QtGui.QWidget):
self.serviceManagerList.moveTop.setObjectName(u'moveTop')
action_list = ActionList.get_instance()
action_list.add_category(
UiStrings().Service, CategoryOrder.standardToolbar)
unicode(UiStrings().Service), CategoryOrder.standardToolbar)
action_list.add_action(
self.serviceManagerList.moveTop, UiStrings().Service)
self.serviceManagerList.moveTop, unicode(UiStrings().Service))
self.serviceManagerList.moveUp = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move &up'),
u':/services/service_up.png',
@ -188,7 +188,7 @@ class ServiceManager(QtGui.QWidget):
self.onServiceUp, shortcuts=[QtCore.Qt.Key_PageUp])
self.serviceManagerList.moveUp.setObjectName(u'moveUp')
action_list.add_action(
self.serviceManagerList.moveUp, UiStrings().Service)
self.serviceManagerList.moveUp, unicode(UiStrings().Service))
self.serviceManagerList.moveDown = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move &down'),
u':/services/service_down.png',
@ -197,7 +197,7 @@ class ServiceManager(QtGui.QWidget):
self.onServiceDown, shortcuts=[QtCore.Qt.Key_PageDown])
self.serviceManagerList.moveDown.setObjectName(u'moveDown')
action_list.add_action(
self.serviceManagerList.moveDown, UiStrings().Service)
self.serviceManagerList.moveDown, unicode(UiStrings().Service))
self.serviceManagerList.moveBottom = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move to &bottom'),
u':/services/service_bottom.png',
@ -206,7 +206,7 @@ class ServiceManager(QtGui.QWidget):
self.onServiceEnd, shortcuts=[QtCore.Qt.Key_End])
self.serviceManagerList.moveBottom.setObjectName(u'moveBottom')
action_list.add_action(
self.serviceManagerList.moveBottom, UiStrings().Service)
self.serviceManagerList.moveBottom, unicode(UiStrings().Service))
self.serviceManagerList.down = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move &down'),
None,
@ -241,7 +241,7 @@ class ServiceManager(QtGui.QWidget):
self.onExpandAll, shortcuts=[QtCore.Qt.Key_Plus])
self.serviceManagerList.expand.setObjectName(u'expand')
action_list.add_action(
self.serviceManagerList.expand, UiStrings().Service)
self.serviceManagerList.expand, unicode(UiStrings().Service))
self.serviceManagerList.collapse = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', '&Collapse all'),
u':/services/service_collapse_all.png',
@ -250,7 +250,7 @@ class ServiceManager(QtGui.QWidget):
self.onCollapseAll, shortcuts=[QtCore.Qt.Key_Minus])
self.serviceManagerList.collapse.setObjectName(u'collapse')
action_list.add_action(
self.serviceManagerList.collapse, UiStrings().Service)
self.serviceManagerList.collapse, unicode(UiStrings().Service))
self.orderToolbar.addSeparator()
self.serviceManagerList.makeLive = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Go Live'),
@ -260,7 +260,7 @@ class ServiceManager(QtGui.QWidget):
shortcuts=[QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return])
self.serviceManagerList.makeLive.setObjectName(u'orderToolbar')
action_list.add_action(
self.serviceManagerList.makeLive, UiStrings().Service)
self.serviceManagerList.makeLive, unicode(UiStrings().Service))
self.layout.addWidget(self.orderToolbar)
# Connect up our signals and slots
QtCore.QObject.connect(self.themeComboBox,

View File

@ -27,12 +27,10 @@
import os
import logging
import time
import copy
from collections import deque
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon
from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
translate, build_icon, ServiceItem, build_html, PluginManager, ServiceItem
@ -68,7 +66,8 @@ class Controller(QtGui.QWidget):
created from within other plugins
This function is needed to catch the current controller
"""
sender = self.sender().objectName() if self.sender().objectName() else self.sender().text()
sender = self.sender().objectName() if self.sender().objectName() \
else self.sender().text()
controller = self
Receiver.send_message('%s' % sender, [controller, args])
@ -188,18 +187,20 @@ class SlideController(Controller):
translate('OpenLP.SlideController', 'Hide'), self.toolbar))
self.blankScreen = shortcut_action(self.hideMenu, u'blankScreen',
[QtCore.Qt.Key_Period], self.onBlankDisplay,
u':/slides/slide_blank.png', False, UiStrings().LiveToolbar)
u':/slides/slide_blank.png', False,
unicode(UiStrings().LiveToolbar))
self.blankScreen.setText(
translate('OpenLP.SlideController', 'Blank Screen'))
self.themeScreen = shortcut_action(self.hideMenu, u'themeScreen',
[QtGui.QKeySequence(u'T')], self.onThemeDisplay,
u':/slides/slide_theme.png', False, UiStrings().LiveToolbar)
u':/slides/slide_theme.png', False,
unicode(UiStrings().LiveToolbar))
self.themeScreen.setText(
translate('OpenLP.SlideController', 'Blank to Theme'))
self.desktopScreen = shortcut_action(self.hideMenu,
u'desktopScreen', [QtGui.QKeySequence(u'D')],
self.onHideDisplay, u':/slides/slide_desktop.png', False,
UiStrings().LiveToolbar)
unicode(UiStrings().LiveToolbar))
self.desktopScreen.setText(
translate('OpenLP.SlideController', 'Show Desktop'))
self.hideMenu.setDefaultAction(self.blankScreen)
@ -219,11 +220,13 @@ class SlideController(Controller):
self.toolbar))
self.playSlidesLoop = shortcut_action(self.playSlidesMenu,
u'playSlidesLoop', [], self.onPlaySlidesLoop,
u':/media/media_time.png', False, UiStrings().LiveToolbar)
u':/media/media_time.png', False,
unicode(UiStrings().LiveToolbar))
self.playSlidesLoop.setText(UiStrings().PlaySlidesInLoop)
self.playSlidesOnce = shortcut_action(self.playSlidesMenu,
u'playSlidesOnce', [], self.onPlaySlidesOnce,
u':/media/media_time.png', False, UiStrings().LiveToolbar)
u':/media/media_time.png', False,
unicode(UiStrings().LiveToolbar))
self.playSlidesOnce.setText(UiStrings().PlaySlidesToEnd)
if QtCore.QSettings().value(self.parent().generalSettingsSection +
u'/enable slide loop', QtCore.QVariant(True)).toBool():
@ -321,7 +324,7 @@ class SlideController(Controller):
self.shortcutTimer.setSingleShot(True)
self.verseShortcut = shortcut_action(self, u'verseShortcut',
[QtGui.QKeySequence(u'V')], self.slideShortcutActivated,
category=UiStrings().LiveToolbar,
category=unicode(UiStrings().LiveToolbar),
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.verseShortcut.setText(translate(
'OpenLP.SlideController', 'Go to "Verse"'))
@ -357,37 +360,37 @@ class SlideController(Controller):
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.chorusShortcut = shortcut_action(self, u'chorusShortcut',
[QtGui.QKeySequence(u'C')], self.slideShortcutActivated,
category=UiStrings().LiveToolbar,
category=unicode(UiStrings().LiveToolbar),
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.chorusShortcut.setText(translate(
'OpenLP.SlideController', 'Go to "Chorus"'))
self.bridgeShortcut = shortcut_action(self, u'bridgeShortcut',
[QtGui.QKeySequence(u'B')], self.slideShortcutActivated,
category=UiStrings().LiveToolbar,
category=unicode(UiStrings().LiveToolbar),
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.bridgeShortcut.setText(translate(
'OpenLP.SlideController', 'Go to "Bridge"'))
self.preChorusShortcut = shortcut_action(self, u'preChorusShortcut',
[QtGui.QKeySequence(u'P')], self.slideShortcutActivated,
category=UiStrings().LiveToolbar,
category=unicode(UiStrings().LiveToolbar),
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.preChorusShortcut.setText(translate(
'OpenLP.SlideController', 'Go to "Pre-Chorus"'))
self.introShortcut = shortcut_action(self, u'introShortcut',
[QtGui.QKeySequence(u'I')], self.slideShortcutActivated,
category=UiStrings().LiveToolbar,
category=unicode(UiStrings().LiveToolbar),
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.introShortcut.setText(translate(
'OpenLP.SlideController', 'Go to "Intro"'))
self.endingShortcut = shortcut_action(self, u'endingShortcut',
[QtGui.QKeySequence(u'E')], self.slideShortcutActivated,
category=UiStrings().LiveToolbar,
category=unicode(UiStrings().LiveToolbar),
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.endingShortcut.setText(translate(
'OpenLP.SlideController', 'Go to "Ending"'))
self.otherShortcut = shortcut_action(self, u'otherShortcut',
[QtGui.QKeySequence(u'O')], self.slideShortcutActivated,
category=UiStrings().LiveToolbar,
category=unicode(UiStrings().LiveToolbar),
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.otherShortcut.setText(translate(
'OpenLP.SlideController', 'Go to "Other"'))
@ -541,24 +544,24 @@ class SlideController(Controller):
self.nextItem.setObjectName(u'nextItemLive')
action_list = ActionList.get_instance()
action_list.add_category(
UiStrings().LiveToolbar, CategoryOrder.standardToolbar)
unicode(UiStrings().LiveToolbar), CategoryOrder.standardToolbar)
action_list.add_action(self.previousItem)
action_list.add_action(self.nextItem)
self.previousService = shortcut_action(parent, u'previousService',
[QtCore.Qt.Key_Left], self.servicePrevious,
category=UiStrings().LiveToolbar,
category=unicode(UiStrings().LiveToolbar),
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.previousService.setText(
translate('OpenLP.SlideController', 'Previous Service'))
self.nextService = shortcut_action(parent, 'nextService',
[QtCore.Qt.Key_Right], self.serviceNext,
category=UiStrings().LiveToolbar,
category=unicode(UiStrings().LiveToolbar),
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.nextService.setText(
translate('OpenLP.SlideController', 'Next Service'))
self.escapeItem = shortcut_action(parent, 'escapeItem',
[QtCore.Qt.Key_Escape], self.liveEscape,
category=UiStrings().LiveToolbar,
category=unicode(UiStrings().LiveToolbar),
context=QtCore.Qt.WidgetWithChildrenShortcut)
self.escapeItem.setText(
translate('OpenLP.SlideController', 'Escape Item'))
@ -573,7 +576,6 @@ class SlideController(Controller):
"""
self.keypress_queue.append(u'previous')
self._process_queue()
def serviceNext(self):
"""
@ -581,21 +583,20 @@ class SlideController(Controller):
"""
self.keypress_queue.append(u'next')
self._process_queue()
def _process_queue(self):
"""
Process the service item request queue. The key presses can arrive
faster than the processing so implement a FIFO queue.
Process the service item request queue. The key presses can arrive
faster than the processing so implement a FIFO queue.
"""
if len(self.keypress_queue):
while len(self.keypress_queue) and not self.keypress_loop:
self.keypress_loop = True
self.keypress_loop = True
if self.keypress_queue.popleft() == u'previous':
Receiver.send_message('servicemanager_previous_item')
Receiver.send_message('servicemanager_previous_item')
else:
Receiver.send_message('servicemanager_next_item')
self.keypress_loop = False
def screenSizeChanged(self):
"""
@ -640,11 +641,12 @@ class SlideController(Controller):
self.previewFrame.height()):
# We have to take the height as limit.
max_height = self.previewFrame.height() - self.grid.margin() * 2
self.slidePreview.setFixedSize(QtCore.QSize(max_height * self.ratio,
max_height))
self.previewDisplay.setFixedSize(QtCore.QSize(max_height * self.ratio,
max_height))
self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()}
self.slidePreview.setFixedSize(QtCore.QSize(
max_height * self.ratio, max_height))
self.previewDisplay.setFixedSize(QtCore.QSize(
max_height * self.ratio, max_height))
self.previewDisplay.screen = {
u'size': self.previewDisplay.geometry()}
else:
# We have to take the width as limit.
max_width = self.previewFrame.width() - self.grid.margin() * 2
@ -652,7 +654,8 @@ class SlideController(Controller):
max_width / self.ratio))
self.previewDisplay.setFixedSize(QtCore.QSize(max_width,
max_width / self.ratio))
self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()}
self.previewDisplay.screen = {
u'size': self.previewDisplay.geometry()}
# Make sure that the frames have the correct size.
self.previewListWidget.setColumnWidth(0,
self.previewListWidget.viewport().size().width())

View File

@ -28,7 +28,6 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box
class Ui_ThemeLayoutDialog(object):

View File

@ -29,9 +29,6 @@ from PyQt4 import QtGui, QtCore
from themelayoutdialog import Ui_ThemeLayoutDialog
from openlp.core.lib import translate
from openlp.core.lib.ui import UiStrings, critical_error_message_box
class ThemeLayoutForm(QtGui.QDialog, Ui_ThemeLayoutDialog):
"""
The exception dialog

View File

@ -217,8 +217,6 @@ class ActionList(object):
The weight specifies how important a category is. However, this only
has an impact on the order the categories are displayed.
"""
if category is not None:
category = unicode(category)
if category not in self.categories:
self.categories.append(category)
action.defaultShortcuts = action.shortcuts()
@ -226,7 +224,7 @@ class ActionList(object):
self.categories[category].actions.append(action)
else:
self.categories[category].actions.add(action, weight)
if category is None:
if not category:
# Stop here, as this action is not configurable.
return
# Load the shortcut from the config.
@ -250,8 +248,6 @@ class ActionList(object):
The name (unicode string) of the category, which contains the
action. Defaults to None.
"""
if category is not None:
category = unicode(category)
if category not in self.categories:
return
self.categories[category].actions.remove(action)

View File

@ -149,7 +149,7 @@ class AlertsPlugin(Plugin):
Plugin.initialise(self)
self.toolsAlertItem.setVisible(True)
action_list = ActionList.get_instance()
action_list.add_action(self.toolsAlertItem, UiStrings().Tools)
action_list.add_action(self.toolsAlertItem, unicode(UiStrings().Tools))
def finalise(self):
"""

View File

@ -192,7 +192,7 @@ class AlertsTab(SettingsTab):
settings.setValue(u'location', QtCore.QVariant(self.location))
settings.endGroup()
if self.changed:
Receiver.send_message(u'update_display_css')
Receiver.send_message(u'update_display_css')
self.changed = False
def updateDisplay(self):

View File

@ -55,9 +55,11 @@ class BiblePlugin(Plugin):
Plugin.initialise(self)
self.importBibleItem.setVisible(True)
action_list = ActionList.get_instance()
action_list.add_action(self.importBibleItem, UiStrings().Import)
action_list.add_action(self.importBibleItem,
unicode(UiStrings().Import))
# Do not add the action to the list yet.
#action_list.add_action(self.exportBibleItem, UiStrings().Export)
#action_list.add_action(self.exportBibleItem,
# unicode(UiStrings().Export))
# Set to invisible until we can export bibles
self.exportBibleItem.setVisible(False)
if len(self.manager.old_bible_databases):
@ -71,7 +73,8 @@ class BiblePlugin(Plugin):
self.manager.finalise()
Plugin.finalise(self)
action_list = ActionList.get_instance()
action_list.remove_action(self.importBibleItem, UiStrings().Import)
action_list.remove_action(self.importBibleItem,
unicode(UiStrings().Import))
self.importBibleItem.setVisible(False)
#action_list.remove_action(self.exportBibleItem, UiStrings().Export)
self.exportBibleItem.setVisible(False)

View File

@ -72,7 +72,8 @@ class VerseReferenceList(object):
continue
prev = index - 1
if self.verse_list[prev][u'version'] != verse[u'version']:
result = u'%s (%s)' % (result, self.verse_list[prev][u'version'])
result = u'%s (%s)' % (result,
self.verse_list[prev][u'version'])
result = result + u', '
if self.verse_list[prev][u'book'] != verse[u'book']:
result = u'%s%s %s:' % (result, verse[u'book'],

View File

@ -30,7 +30,8 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, translate
from openlp.core.lib.ui import critical_error_message_box, find_and_set_in_combo_box
from openlp.core.lib.ui import critical_error_message_box, \
find_and_set_in_combo_box
from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser
from openlp.plugins.custom.lib.db import CustomSlide
from editcustomdialog import Ui_CustomEditDialog

View File

@ -127,13 +127,13 @@ class ImageMediaItem(MediaManagerItem):
self.plugin.formparent.incrementProgressBar()
filename = os.path.split(unicode(imageFile))[1]
thumb = os.path.join(self.servicePath, filename)
if not os.path.exists(imageFile):
if not os.path.exists(unicode(imageFile)):
icon = build_icon(u':/general/general_delete.png')
else:
if validate_thumb(imageFile, thumb):
if validate_thumb(unicode(imageFile), thumb):
icon = build_icon(thumb)
else:
icon = create_thumb(imageFile, thumb)
icon = create_thumb(unicode(imageFile), thumb)
item_name = QtGui.QListWidgetItem(filename)
item_name.setIcon(icon)
item_name.setToolTip(imageFile)

View File

@ -30,7 +30,6 @@ import os
import locale
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
SettingsManager, translate, check_item_selected, Receiver, MediaType, \
@ -139,7 +138,8 @@ class MediaMediaItem(MediaManagerItem):
# Add the Media widget to the page layout
self.pageLayout.addWidget(self.mediaWidget)
QtCore.QObject.connect(self.displayTypeComboBox,
QtCore.SIGNAL(u'currentIndexChanged (int)'), self.overridePlayerChanged)
QtCore.SIGNAL(u'currentIndexChanged (int)'),
self.overridePlayerChanged)
def overridePlayerChanged(self, index):
Receiver.send_message(u'media_override_player', \

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate, Receiver
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.lib.ui import UiStrings
class MediaTab(SettingsTab):
"""

View File

@ -26,7 +26,6 @@
###############################################################################
import logging
import os
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.plugins.media.lib import MediaMediaItem, MediaTab
@ -53,12 +52,12 @@ class MediaPlugin(Plugin):
for ext in self.video_extensions_list:
self.serviceManager.supportedSuffixes(ext[2:])
def getSettingsTab(self, parent):
def createSettingsTab(self, parent):
"""
Create the settings Tab
"""
visible_name = self.getString(StringContent.VisibleName)
return MediaTab(parent, self.name, visible_name[u'title'],
self.settings_tab = MediaTab(parent, self.name, visible_name[u'title'],
self.mediaController.mediaPlayers, self.icon_path)
def about(self):

View File

@ -285,7 +285,8 @@ class PresentationMediaItem(MediaManagerItem):
critical_error_message_box(
translate('PresentationPlugin.MediaItem',
'Missing Presentation'),
unicode(translate('PresentationPlugin.MediaItem',
unicode(translate(
'PresentationPlugin.MediaItem',
'The Presentation %s is incomplete,'
' please reload.')) % filename)
return False

View File

@ -57,13 +57,13 @@ class PresentationPlugin(Plugin):
self.icon_path = u':/plugins/plugin_presentations.png'
self.icon = build_icon(self.icon_path)
def getSettingsTab(self, parent):
def createSettingsTab(self, parent):
"""
Create the settings Tab
"""
visible_name = self.getString(StringContent.VisibleName)
return PresentationTab(parent, self.name, visible_name[u'title'],
self.controllers, self.icon_path)
self.settings_tab = PresentationTab(parent, self.name,
visible_name[u'title'], self.controllers, self.icon_path)
def initialise(self):
"""
@ -94,11 +94,11 @@ class PresentationPlugin(Plugin):
controller.kill()
Plugin.finalise(self)
def getMediaManagerItem(self):
def createMediaManagerItem(self):
"""
Create the Media Manager List
"""
return PresentationMediaItem(
self.mediaItem = PresentationMediaItem(
self.mediadock.media_dock, self, self.icon, self.controllers)
def registerControllers(self, controller):

View File

@ -181,7 +181,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
plugin.status == PluginStatus.Active:
self.audioAddFromMediaButton.setVisible(True)
self.mediaForm.populateFiles(
plugin.getMediaManagerItem().getList(MediaType.Audio))
plugin.mediaItem.getList(MediaType.Audio))
break
def newSong(self):
@ -330,8 +330,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.topicsListView.addItem(topic_name)
self.audioListWidget.clear()
for media in self.song.media_files:
media_file = QtGui.QListWidgetItem(os.path.split(media.file_name)[1])
media_file.setData(QtCore.Qt.UserRole, QtCore.QVariant(media.file_name))
media_file = QtGui.QListWidgetItem(
os.path.split(media.file_name)[1])
media_file.setData(QtCore.Qt.UserRole,
QtCore.QVariant(media.file_name))
self.audioListWidget.addItem(media_file)
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
# Hide or show the preview button.
@ -720,7 +722,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
"""
if self.mediaForm.exec_():
for filename in self.mediaForm.getSelectedFiles():
item = QtGui.QListWidgetItem(os.path.split(unicode(filename))[1])
item = QtGui.QListWidgetItem(
os.path.split(unicode(filename))[1])
item.setData(QtCore.Qt.UserRole, filename)
self.audioListWidget.addItem(item)
@ -875,7 +878,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
os.remove(audio)
except:
log.exception('Could not remove file: %s', audio)
pass
if not files:
try:
os.rmdir(save_path)

View File

@ -30,7 +30,7 @@ song databases into the current installation database.
"""
import logging
from sqlalchemy import create_engine, MetaData
from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.orm import class_mapper, mapper, relation, scoped_session, \
sessionmaker
from sqlalchemy.orm.exc import UnmappedClassError
@ -39,46 +39,11 @@ from openlp.core.lib import translate
from openlp.core.lib.db import BaseModel
from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib import clean_song
from openlp.plugins.songs.lib.db import Author, Book, Song, Topic #, MediaFile
from openlp.plugins.songs.lib.db import Author, Book, Song, Topic, MediaFile
from songimport import SongImport
log = logging.getLogger(__name__)
class OldAuthor(BaseModel):
"""
Author model
"""
pass
class OldBook(BaseModel):
"""
Book model
"""
pass
class OldMediaFile(BaseModel):
"""
MediaFile model
"""
pass
class OldSong(BaseModel):
"""
Song model
"""
pass
class OldTopic(BaseModel):
"""
Topic model
"""
pass
class OpenLPSongImport(SongImport):
"""
The :class:`OpenLPSongImport` class provides OpenLP with the ability to
@ -101,6 +66,41 @@ class OpenLPSongImport(SongImport):
"""
Run the import for an OpenLP version 2 song database.
"""
class OldAuthor(BaseModel):
"""
Author model
"""
pass
class OldBook(BaseModel):
"""
Book model
"""
pass
class OldMediaFile(BaseModel):
"""
MediaFile model
"""
pass
class OldSong(BaseModel):
"""
Song model
"""
pass
class OldTopic(BaseModel):
"""
Topic model
"""
pass
if not self.importSource.endswith(u'.sqlite'):
self.logError(self.importSource,
translate('SongsPlugin.OpenLPSongImport',
@ -121,6 +121,7 @@ class OpenLPSongImport(SongImport):
source_topics_table = source_meta.tables[u'topics']
source_authors_songs_table = source_meta.tables[u'authors_songs']
source_songs_topics_table = source_meta.tables[u'songs_topics']
source_media_files_songs_table = None
if has_media_files:
source_media_files_table = source_meta.tables[u'media_files']
source_media_files_songs_table = \
@ -137,13 +138,16 @@ class OpenLPSongImport(SongImport):
secondary=source_songs_topics_table)
}
if has_media_files:
if source_media_files_songs_table:
if isinstance(source_media_files_songs_table, Table):
song_props['media_files'] = relation(OldMediaFile,
backref='songs',
secondary=source_media_files_songs_table)
else:
song_props['media_files'] = relation(OldMediaFile,
backref='songs')
backref='songs',
foreign_keys=[source_media_files_table.c.song_id],
primaryjoin=source_songs_table.c.id == \
source_media_files_table.c.song_id)
try:
class_mapper(OldAuthor)
except UnmappedClassError:

View File

@ -127,7 +127,7 @@ class SofImport(OooImport):
self.processParagraphText(text)
self.newSong()
text = u''
text += self.process_textportion(textportion)
text += self.processTextPortion(textportion)
if textportion.BreakType in (PAGE_AFTER, PAGE_BOTH):
self.processParagraphText(text)
self.newSong()
@ -202,8 +202,8 @@ class SofImport(OooImport):
if boldtext.isdigit() and self.songNumber == '':
self.addSongNumber(boldtext)
return u''
text = self.uncapText(text)
if self.title == u'':
text = self.uncap_text(text)
self.addTitle(text)
return text
if text.strip().startswith(u'('):
@ -242,8 +242,12 @@ class SofImport(OooImport):
self.songBook = u'Songs of Fellowship 2'
elif int(song_no) <= 1690:
self.songBook = u'Songs of Fellowship 3'
else:
elif int(song_no) <= 2200:
self.songBook = u'Songs of Fellowship 4'
elif int(song_no) <= 2710:
self.songBook = u'Songs of Fellowship 5'
else:
self.songBook = u'Songs of Fellowship Other'
def addTitle(self, text):
"""

View File

@ -31,7 +31,6 @@ backend for the Songs plugin
from sqlalchemy import Column, Table, types
from sqlalchemy.sql.expression import func
from migrate import changeset
from migrate.changeset.constraint import ForeignKeyConstraint
__version__ = 2

View File

@ -74,9 +74,10 @@ class SongsPlugin(Plugin):
self.songExportItem.setVisible(True)
self.toolsReindexItem.setVisible(True)
action_list = ActionList.get_instance()
action_list.add_action(self.songImportItem, UiStrings().Import)
action_list.add_action(self.songExportItem, UiStrings().Export)
action_list.add_action(self.toolsReindexItem, UiStrings().Tools)
action_list.add_action(self.songImportItem, unicode(UiStrings().Import))
action_list.add_action(self.songExportItem, unicode(UiStrings().Export))
action_list.add_action(self.toolsReindexItem,
unicode(UiStrings().Tools))
def addImportMenuItem(self, import_menu):
"""
@ -269,7 +270,10 @@ class SongsPlugin(Plugin):
self.songExportItem.setVisible(False)
self.toolsReindexItem.setVisible(False)
action_list = ActionList.get_instance()
action_list.remove_action(self.songImportItem, UiStrings().Import)
action_list.remove_action(self.songExportItem, UiStrings().Export)
action_list.remove_action(self.toolsReindexItem, UiStrings().Tools)
action_list.remove_action(self.songImportItem,
unicode(UiStrings().Import))
action_list.remove_action(self.songExportItem,
unicode(UiStrings().Export))
action_list.remove_action(self.toolsReindexItem,
unicode(UiStrings().Tools))
Plugin.finalise(self)

View File

@ -30,7 +30,6 @@ backend for the SongsUsage plugin
"""
from sqlalchemy import Column, Table, types
from migrate import changeset
__version__ = 1

View File

@ -136,11 +136,11 @@ class SongUsagePlugin(Plugin):
self.setButtonState()
action_list = ActionList.get_instance()
action_list.add_action(self.songUsageStatus,
translate('SongUsagePlugin', 'Song Usage'))
unicode(translate('SongUsagePlugin', 'Song Usage')))
action_list.add_action(self.songUsageDelete,
translate('SongUsagePlugin', 'Song Usage'))
unicode(translate('SongUsagePlugin', 'Song Usage')))
action_list.add_action(self.songUsageReport,
translate('SongUsagePlugin', 'Song Usage'))
unicode(translate('SongUsagePlugin', 'Song Usage')))
self.songUsageDeleteForm = SongUsageDeleteForm(self.manager,
self.formparent)
self.songUsageDetailForm = SongUsageDetailForm(self, self.formparent)
@ -157,11 +157,11 @@ class SongUsagePlugin(Plugin):
self.songUsageMenu.menuAction().setVisible(False)
action_list = ActionList.get_instance()
action_list.remove_action(self.songUsageStatus,
translate('SongUsagePlugin', 'Song Usage'))
unicode(translate('SongUsagePlugin', 'Song Usage')))
action_list.remove_action(self.songUsageDelete,
translate('SongUsagePlugin', 'Song Usage'))
unicode(translate('SongUsagePlugin', 'Song Usage')))
action_list.remove_action(self.songUsageReport,
translate('SongUsagePlugin', 'Song Usage'))
unicode(translate('SongUsagePlugin', 'Song Usage')))
self.songUsageActiveButton.hide()
# stop any events being processed
self.songUsageActive = False

View File

@ -10,8 +10,9 @@ Homepage: http://openlp.org/
Package: openlp
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, python-qt4,
python-qt4-phonon, python-sqlalchemy, python-chardet, python-beautifulsoup,
python-lxml, python-sqlite, python-enchant, python-mako, python-migrate
python-qt4-phonon, python-qt4-gl, python-sqlalchemy, python-chardet,
python-beautifulsoup, python-lxml, python-sqlite, python-enchant,
python-mako, python-migrate
Conflicts: python-openlp
Description: Church lyrics projection application
OpenLP is free church presentation software, or lyrics projection software,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff