Head r1829

This commit is contained in:
Jon Tibble 2011-12-10 16:24:27 +00:00
commit 1184e198db
9 changed files with 74 additions and 66 deletions

View File

@ -113,10 +113,10 @@ sup {
document.getElementById('lyricsmain').style.visibility = lyrics; document.getElementById('lyricsmain').style.visibility = lyrics;
document.getElementById('image').style.visibility = lyrics; document.getElementById('image').style.visibility = lyrics;
outline = document.getElementById('lyricsoutline') outline = document.getElementById('lyricsoutline')
if(outline!=null) if(outline != null)
outline.style.visibility = lyrics; outline.style.visibility = lyrics;
shadow = document.getElementById('lyricsshadow') shadow = document.getElementById('lyricsshadow')
if(shadow!=null) if(shadow != null)
shadow.style.visibility = lyrics; shadow.style.visibility = lyrics;
document.getElementById('footer').style.visibility = lyrics; document.getElementById('footer').style.visibility = lyrics;
} }
@ -129,10 +129,28 @@ sup {
var match = /-webkit-text-fill-color:[^;\"]+/gi; var match = /-webkit-text-fill-color:[^;\"]+/gi;
if(timer != null) if(timer != null)
clearTimeout(timer); 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('lyricsmain', newtext);
text_fade('lyricsoutline', newtext); text_fade('lyricsoutline', newtext);
text_fade('lyricsshadow', newtext.replace(match, "")); text_fade('lyricsshadow', newtext.replace(match, ''));
if(text_opacity()==1) return; if(text_opacity() == 1) return;
timer = setTimeout(function(){ timer = setTimeout(function(){
show_text(newtext); show_text(newtext);
}, 100); }, 100);
@ -149,18 +167,18 @@ sup {
slides) still looks pretty and is zippy. slides) still looks pretty and is zippy.
*/ */
var text = document.getElementById(id); var text = document.getElementById(id);
if(text==null) return; if(text == null) return;
if(!transition){ if(!transition){
text.innerHTML = newtext; text.innerHTML = newtext;
return; return;
} }
if(newtext==text.innerHTML){ if(newtext == text.innerHTML){
text.style.opacity = parseFloat(text.style.opacity) + 0.3; 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; text.style.opacity = 1;
} else { } else {
text.style.opacity = parseFloat(text.style.opacity) - 0.3; text.style.opacity = parseFloat(text.style.opacity) - 0.3;
if(text.style.opacity<=0.1){ if(text.style.opacity <= 0.1){
text.innerHTML = newtext; text.innerHTML = newtext;
} }
} }
@ -172,7 +190,7 @@ sup {
} }
function show_text_complete(){ function show_text_complete(){
return (text_opacity()==1); return (text_opacity() == 1);
} }
</script> </script>
</head> </head>

View File

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

View File

@ -90,7 +90,7 @@ class PluginManager(object):
thisdepth = len(path.split(os.sep)) thisdepth = len(path.split(os.sep))
if thisdepth - startdepth > 2: if thisdepth - startdepth > 2:
# skip anything lower down # skip anything lower down
continue break
modulename = os.path.splitext(path)[0] modulename = os.path.splitext(path)[0]
prefix = os.path.commonprefix([self.basepath, path]) prefix = os.path.commonprefix([self.basepath, path])
# hack off the plugin base path # hack off the plugin base path
@ -113,7 +113,7 @@ class PluginManager(object):
plugin_objects.append(plugin) plugin_objects.append(plugin)
except TypeError: except TypeError:
log.exception(u'Failed to load plugin %s', unicode(p)) 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: for plugin in plugins_list:
if plugin.checkPreConditions(): if plugin.checkPreConditions():
log.debug(u'Plugin %s active', unicode(plugin.name)) log.debug(u'Plugin %s active', unicode(plugin.name))
@ -122,29 +122,13 @@ class PluginManager(object):
plugin.status = PluginStatus.Disabled plugin.status = PluginStatus.Disabled
self.plugins.append(plugin) 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. Create the plugins' media manager items.
``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.
""" """
for plugin in self.plugins: for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled: if plugin.status is not PluginStatus.Disabled:
plugin.mediaItem = plugin.getMediaManagerItem() plugin.createMediaManagerItem()
def hook_settings_tabs(self, settings_form=None): def hook_settings_tabs(self, settings_form=None):
""" """
@ -152,14 +136,12 @@ class PluginManager(object):
item, add it to the settings tab. item, add it to the settings tab.
Tabs are set for all plugins not just Active ones Tabs are set for all plugins not just Active ones
``settingsform`` ``settings_form``
Defaults to *None*. The settings form to add tabs to. Defaults to *None*. The settings form to add tabs to.
""" """
for plugin in self.plugins: for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled: if plugin.status is not PluginStatus.Disabled:
plugin.settings_tab = plugin.getSettingsTab(settings_form) plugin.createSettingsTab(settings_form)
else:
plugin.settings_tab = None
settings_form.plugins = self.plugins settings_form.plugins = self.plugins
def hook_import_menu(self, import_menu): def hook_import_menu(self, import_menu):
@ -225,7 +207,7 @@ class PluginManager(object):
def get_plugin_by_name(self, name): 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: for plugin in self.plugins:
if plugin.name == name: if plugin.name == name:

View File

@ -655,7 +655,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.pluginManager.hook_settings_tabs(self.settingsForm) self.pluginManager.hook_settings_tabs(self.settingsForm)
# Find and insert media manager items # Find and insert media manager items
log.info(u'hook media') 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. # Call the hook method to pull in import menus.
log.info(u'hook menus') log.info(u'hook menus')
self.pluginManager.hook_import_menu(self.fileImportMenu) self.pluginManager.hook_import_menu(self.fileImportMenu)

View File

@ -311,8 +311,13 @@ class MediaController(object):
isValid = self.check_file_type(controller, display) isValid = self.check_file_type(controller, display)
display.override[u'theme'] = u'' display.override[u'theme'] = u''
display.override[u'video'] = True display.override[u'video'] = True
controller.media_info.start_time = display.serviceItem.start_time if controller.media_info.is_background:
controller.media_info.end_time = display.serviceItem.end_time # 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: elif controller.previewDisplay:
display = controller.previewDisplay display = controller.previewDisplay
isValid = self.check_file_type(controller, display) isValid = self.check_file_type(controller, display)

View File

@ -52,12 +52,12 @@ class MediaPlugin(Plugin):
for ext in self.video_extensions_list: for ext in self.video_extensions_list:
self.serviceManager.supportedSuffixes(ext[2:]) self.serviceManager.supportedSuffixes(ext[2:])
def getSettingsTab(self, parent): def createSettingsTab(self, parent):
""" """
Create the settings Tab Create the settings Tab
""" """
visible_name = self.getString(StringContent.VisibleName) 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) self.mediaController.mediaPlayers, self.icon_path)
def about(self): def about(self):

View File

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

View File

@ -181,7 +181,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
plugin.status == PluginStatus.Active: plugin.status == PluginStatus.Active:
self.audioAddFromMediaButton.setVisible(True) self.audioAddFromMediaButton.setVisible(True)
self.mediaForm.populateFiles( self.mediaForm.populateFiles(
plugin.getMediaManagerItem().getList(MediaType.Audio)) plugin.mediaItem.getList(MediaType.Audio))
break break
def newSong(self): def newSong(self):

View File

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