r1302 + merge clash

This commit is contained in:
Tim Bentley 2011-02-15 18:56:14 +00:00
commit e5239697f0
26 changed files with 185 additions and 142 deletions

View File

@ -252,7 +252,6 @@ class MediaManagerItem(QtGui.QWidget):
self.pageLayout.addWidget(self.listView)
# define and add the context menu
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
name_string = self.plugin.getString(StringContent.Name)
if self.hasEditIcon:
self.listView.addAction(
context_menu_action(

View File

@ -335,37 +335,39 @@ class Plugin(QtCore.QObject):
"""
return self.textStrings[name]
def setPluginTextStrings(self):
def setPluginUiTextStrings(self, tooltips):
"""
Called to define all translatable texts of the plugin
"""
## Load Action ##
self._setSingularTextString(StringContent.Load,
UiStrings.Load, UiStrings.LoadANew)
self.__setNameTextString(StringContent.Load,
UiStrings.Load, tooltips[u'load'])
## Import Action ##
self.__setNameTextString(StringContent.Import,
UiStrings.Import, tooltips[u'import'])
## New Action ##
self._setSingularTextString(StringContent.New,
UiStrings.Add, UiStrings.AddANew)
self.__setNameTextString(StringContent.New,
UiStrings.Add, tooltips[u'new'])
## Edit Action ##
self._setSingularTextString(StringContent.Edit,
UiStrings.Edit, UiStrings.EditSelect)
self.__setNameTextString(StringContent.Edit,
UiStrings.Edit, tooltips[u'edit'])
## Delete Action ##
self._setSingularTextString(StringContent.Delete,
UiStrings.Delete, UiStrings.DeleteSelect)
self.__setNameTextString(StringContent.Delete,
UiStrings.Delete, tooltips[u'delete'])
## Preview Action ##
self._setSingularTextString(StringContent.Preview,
UiStrings.Preview, UiStrings.PreviewSelect)
self.__setNameTextString(StringContent.Preview,
UiStrings.Preview, tooltips[u'preview'])
## Send Live Action ##
self._setSingularTextString(StringContent.Live,
UiStrings.Live, UiStrings.SendSelectLive)
self.__setNameTextString(StringContent.Live,
UiStrings.Live, tooltips[u'live'])
## Add to Service Action ##
self._setSingularTextString(StringContent.Service,
UiStrings.Service, UiStrings.AddSelectService)
self.__setNameTextString(StringContent.Service,
UiStrings.Service, tooltips[u'service'])
def _setSingularTextString(self, name, title, tooltip):
def __setNameTextString(self, name, title, tooltip):
"""
Utility method for creating a plugin's textStrings. This method makes
use of the singular name of the plugin object so must only be called
after this has been set.
"""
self.textStrings[name] = { u'title': title, u'tooltip': tooltip %
self.getString(StringContent.Name)[u'singular']}
self.textStrings[name] = {u'title': title, u'tooltip': tooltip}

View File

@ -436,7 +436,6 @@ class ServiceItem(object):
"""
Returns the start and finish time for a media item
"""
tooltip = None
start = None
end = None
if self.start_time != 0:

View File

@ -178,9 +178,9 @@ class HorizontalType(object):
"""
Return a string representation of a horizontal type.
"""
if horizontal_type == Horizontal.Right:
if horizontal_type == HorizontalType.Right:
return u'right'
elif horizontal_type == Horizontal.Center:
elif horizontal_type == HorizontalType.Center:
return u'center'
else:
return u'left'

View File

@ -41,42 +41,29 @@ class UiStrings(object):
# These strings should need a good reason to be retranslated elsewhere.
# Should some/more/less of these have an & attached?
Add = translate('OpenLP.Ui', '&Add')
AddANew = unicode(translate('OpenLP.Ui', 'Add a new %s.'))
AddSelectService = unicode(translate('OpenLP.Ui',
'Add the selected %s to the service.'))
Advanced = translate('OpenLP.Ui', 'Advanced')
AllFiles = translate('OpenLP.Ui', 'All Files')
Authors = translate('OpenLP.Ui', 'Authors')
CreateANew = unicode(translate('OpenLP.Ui', 'Create a new %s.'))
CopyToHtml = translate('OpenLP.Ui', 'Copy to Html')
CopyToText = translate('OpenLP.Ui', 'Copy to Text')
CreateService = translate('OpenLP.Ui', 'Create a new service.')
Delete = translate('OpenLP.Ui', '&Delete')
DeleteSelect = unicode(translate('OpenLP.Ui', 'Delete the selected %s.'))
DeleteType = unicode(translate('OpenLP.Ui', 'Delete %s'))
Edit = translate('OpenLP.Ui', '&Edit')
EditSelect = unicode(translate('OpenLP.Ui', 'Edit the selected %s.'))
EditType = unicode(translate('OpenLP.Ui', 'Edit %s'))
Error = translate('OpenLP.Ui', 'Error')
ExportType = unicode(translate('OpenLP.Ui', 'Export %s'))
Import = translate('OpenLP.Ui', 'Import')
ImportType = unicode(translate('OpenLP.Ui', 'Import %s'))
LengthTime = unicode(translate('OpenLP.Ui', 'Length %s'))
Live = translate('OpenLP.Ui', 'Live')
Load = translate('OpenLP.Ui', 'Load')
LoadANew = unicode(translate('OpenLP.Ui', 'Load a new %s.'))
New = translate('OpenLP.Ui', 'New')
NewType = unicode(translate('OpenLP.Ui', 'New %s'))
NewService = translate('OpenLP.Ui', 'New Service')
OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0')
OpenType = unicode(translate('OpenLP.Ui', 'Open %s'))
OpenService = translate('OpenLP.Ui', 'Open Service')
Preview = translate('OpenLP.Ui', 'Preview')
PreviewSelect = unicode(translate('OpenLP.Ui', 'Preview the selected %s.'))
ReplaceBG = translate('OpenLP.Ui', 'Replace Background')
ReplaceLiveBG = translate('OpenLP.Ui', 'Replace Live Background')
ResetBG = translate('OpenLP.Ui', 'Reset Background')
ResetLiveBG = translate('OpenLP.Ui', 'Reset Live Background')
SaveType = unicode(translate('OpenLP.Ui', 'Save %s'))
SendSelectLive = unicode(translate('OpenLP.Ui',
'Send the selected %s live.'))
SaveService = translate('OpenLP.Ui', 'Save Service')
Service = translate('OpenLP.Ui', 'Service')
StartTimeCode = unicode(translate('OpenLP.Ui', 'Start %s'))
Theme = translate('OpenLP.Ui', 'Theme')

View File

@ -319,17 +319,16 @@ class Ui_MainWindow(object):
self.themeManagerDock.setWindowTitle(
translate('OpenLP.MainWindow', 'Theme Manager'))
self.FileNewItem.setText(translate('OpenLP.MainWindow', '&New'))
self.FileNewItem.setToolTip(UiStrings.NewType % UiStrings.Service)
self.FileNewItem.setStatusTip(
UiStrings.CreateANew % UiStrings.Service.toLower())
self.FileNewItem.setToolTip(UiStrings.NewService)
self.FileNewItem.setStatusTip(UiStrings.CreateService)
self.FileNewItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+N'))
self.FileOpenItem.setText(translate('OpenLP.MainWindow', '&Open'))
self.FileOpenItem.setToolTip(UiStrings.OpenType % UiStrings.Service)
self.FileOpenItem.setToolTip(UiStrings.OpenService)
self.FileOpenItem.setStatusTip(
translate('OpenLP.MainWindow', 'Open an existing service.'))
self.FileOpenItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+O'))
self.FileSaveItem.setText(translate('OpenLP.MainWindow', '&Save'))
self.FileSaveItem.setToolTip(UiStrings.SaveType % UiStrings.Service)
self.FileSaveItem.setToolTip(UiStrings.SaveService)
self.FileSaveItem.setStatusTip(
translate('OpenLP.MainWindow', 'Save the current service to disk.'))
self.FileSaveItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+S'))

View File

@ -24,7 +24,6 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import datetime
import os
from PyQt4 import QtCore, QtGui

View File

@ -96,18 +96,14 @@ class ServiceManager(QtGui.QWidget):
# Create the top toolbar
self.toolbar = OpenLPToolbar(self)
self.toolbar.addToolbarButton(
UiStrings.NewType % UiStrings.Service,
u':/general/general_new.png',
UiStrings.CreateANew % UiStrings.Service.toLower(),
self.onNewServiceClicked)
UiStrings.NewService, u':/general/general_new.png',
UiStrings.CreateService, self.onNewServiceClicked)
self.toolbar.addToolbarButton(
UiStrings.OpenType % UiStrings.Service,
u':/general/general_open.png',
UiStrings.OpenService, u':/general/general_open.png',
translate('OpenLP.ServiceManager', 'Load an existing service'),
self.onLoadServiceClicked)
self.toolbar.addToolbarButton(
UiStrings.SaveType % UiStrings.Service,
u':/general/general_save.png',
UiStrings.SaveService, u':/general/general_save.png',
translate('OpenLP.ServiceManager', 'Save this service'),
self.saveFile)
self.toolbar.addSeparator()
@ -469,7 +465,7 @@ class ServiceManager(QtGui.QWidget):
save the file.
"""
fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow,
UiStrings.SaveType % UiStrings.Service,
UiStrings.SaveService,
SettingsManager.get_last_dir(
self.mainwindow.serviceSettingsSection),
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)')))

View File

@ -36,7 +36,6 @@ class Ui_SettingsDialog(object):
settingsDialog.setWindowIcon(
build_icon(u':/system/system_settings.png'))
self.settingsLayout = QtGui.QVBoxLayout(settingsDialog)
margins = self.settingsLayout.contentsMargins()
self.settingsLayout.setObjectName(u'settingsLayout')
self.settingsTabWidget = QtGui.QTabWidget(settingsDialog)
self.settingsTabWidget.setObjectName(u'settingsTabWidget')

View File

@ -483,7 +483,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
Background Image button pushed.
"""
images_filter = get_images_filter()
images_filter = '%s;;%s (*.*) (*)' % (images_filter, UiStrings.AllFiles)
images_filter = u'%s;;%s (*.*) (*)' % (
images_filter, UiStrings.AllFiles)
filename = QtGui.QFileDialog.getOpenFileName(self,
translate('OpenLP.ThemeForm', 'Select Image'), u'',
images_filter)

View File

@ -63,28 +63,28 @@ class ThemeManager(QtGui.QWidget):
self.layout.setObjectName(u'layout')
self.toolbar = OpenLPToolbar(self)
self.toolbar.addToolbarButton(
UiStrings.NewType % UiStrings.Theme,
translate('OpenLP.ThemeManager', 'New Theme'),
u':/themes/theme_new.png',
UiStrings.CreateANew % UiStrings.Theme.toLower(),
translate('OpenLP.ThemeManager', 'Create a new theme.'),
self.onAddTheme)
self.toolbar.addToolbarButton(
UiStrings.EditType % UiStrings.Theme,
translate('OpenLP.ThemeManager', 'Edit Theme'),
u':/themes/theme_edit.png',
translate('OpenLP.ThemeManager', 'Edit a theme.'),
self.onEditTheme)
self.deleteToolbarAction = self.toolbar.addToolbarButton(
UiStrings.DeleteType % UiStrings.Theme,
translate('OpenLP.ThemeManager', 'Delete Theme'),
u':/general/general_delete.png',
translate('OpenLP.ThemeManager', 'Delete a theme.'),
self.onDeleteTheme)
self.toolbar.addSeparator()
self.toolbar.addToolbarButton(
UiStrings.ImportType % UiStrings.Theme,
translate('OpenLP.ThemeManager', 'Import Theme'),
u':/general/general_import.png',
translate('OpenLP.ThemeManager', 'Import a theme.'),
self.onImportTheme)
self.toolbar.addToolbarButton(
UiStrings.ExportType % UiStrings.Theme,
translate('OpenLP.ThemeManager', 'Export Theme'),
u':/general/general_export.png',
translate('OpenLP.ThemeManager', 'Export a theme.'),
self.onExportTheme)
@ -314,7 +314,6 @@ class ThemeManager(QtGui.QWidget):
translate('OpenLP.ThemeManager',
'You must select a theme to edit.')):
item = self.themeListWidget.currentItem()
themeName = unicode(item.text())
theme = self.getThemeData(
unicode(item.data(QtCore.Qt.UserRole).toString()))
if theme.background_type == u'image':
@ -406,8 +405,8 @@ class ThemeManager(QtGui.QWidget):
files = QtGui.QFileDialog.getOpenFileNames(self,
translate('OpenLP.ThemeManager', 'Select Theme Import File'),
SettingsManager.get_last_dir(self.settingsSection),
translate('OpenLP.ThemeManager', 'Theme v1 (*.theme);;'
'Theme v2 (*.otz);;%s (*.*)') % UiStrings.AllFiles)
unicode(translate('OpenLP.ThemeManager', 'Theme v1 (*.theme);;'
'Theme v2 (*.otz);;%s (*.*)')) % UiStrings.AllFiles)
log.info(u'New Themes %s', unicode(files))
if files:
for file in files:

View File

@ -29,7 +29,6 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.ui import UiStrings
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
log = logging.getLogger(__name__)
@ -129,9 +128,15 @@ class BiblePlugin(Plugin):
u'title': translate('BiblesPlugin', 'Bibles', 'container title')
}
# Middle Header Bar
## Import Action ##
self.textStrings[StringContent.Import] = {
u'title': UiStrings.Import,
u'tooltip': translate('BiblesPlugin', 'Import a Bible')
tooltips = {
u'load': u'',
u'import': translate('BiblesPlugin', 'Import a Bible'),
u'new': translate('BiblesPlugin', 'Add a new Bible'),
u'edit': translate('BiblesPlugin', 'Edit the selected Bible'),
u'delete': translate('BiblesPlugin', 'Delete the selected Bible'),
u'preview': translate('BiblesPlugin', 'Preview the selected Bible'),
u'live': translate('BiblesPlugin', 'Send the selected Bible live'),
u'service': translate('BiblesPlugin',
'Add the selected Bible to the service')
}
Plugin.setPluginTextStrings(self)
self.setPluginUiTextStrings(tooltips)

View File

@ -30,6 +30,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
translate
from openlp.core.lib.searchedit import SearchEdit
from openlp.core.lib.ui import UiStrings, add_widget_completer, \
media_item_combo_box, critical_error_message_box
from openlp.plugins.bibles.forms import BibleImportForm
@ -37,6 +38,14 @@ from openlp.plugins.bibles.lib import get_reference_match
log = logging.getLogger(__name__)
class BibleSearch(object):
"""
Enumeration class for the different search methods for the "quick search".
"""
Reference = 1
Text = 2
class BibleMediaItem(MediaManagerItem):
"""
This is the custom media manager item for Bibles.
@ -83,18 +92,17 @@ class BibleMediaItem(MediaManagerItem):
u'quickSecondComboBox')
self.quickSecondLabel.setBuddy(self.quickSecondComboBox)
self.quickLayout.addRow(self.quickSecondLabel, self.quickSecondComboBox)
self.quickSearchTypeLabel = QtGui.QLabel(self.quickTab)
self.quickSearchTypeLabel.setObjectName(u'quickSearchTypeLabel')
self.quickSearchComboBox = media_item_combo_box(self.quickTab,
u'quickSearchComboBox')
self.quickSearchTypeLabel.setBuddy(self.quickSearchComboBox)
self.quickLayout.addRow(self.quickSearchTypeLabel,
self.quickSearchComboBox)
self.quickSearchLabel = QtGui.QLabel(self.quickTab)
self.quickSearchLabel.setObjectName(u'quickSearchLabel')
self.quickSearchEdit = QtGui.QLineEdit(self.quickTab)
self.quickSearchEdit = SearchEdit(self.quickTab)
self.quickSearchEdit.setObjectName(u'quickSearchEdit')
self.quickSearchLabel.setBuddy(self.quickSearchEdit)
self.quickSearchEdit.setSearchTypes([
(BibleSearch.Reference, u':/bibles/bibles_search_reference.png',
translate('BiblesPlugin.MediaItem', 'Scripture Reference')),
(BibleSearch.Text, u':/bibles/bibles_search_text.png',
translate('BiblesPlugin.MediaItem', 'Text Search'))
])
self.quickLayout.addRow(self.quickSearchLabel, self.quickSearchEdit)
self.quickClearLabel = QtGui.QLabel(self.quickTab)
self.quickClearLabel.setObjectName(u'quickClearLabel')
@ -196,8 +204,8 @@ class BibleMediaItem(MediaManagerItem):
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromVerse)
QtCore.QObject.connect(self.advancedToChapter,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedToChapter)
QtCore.QObject.connect(self.quickSearchComboBox,
QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
QtCore.QObject.connect(self.quickSearchEdit,
QtCore.SIGNAL(u'searchTypeChanged(int)'), self.updateAutoCompleter)
QtCore.QObject.connect(self.quickVersionComboBox,
QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
# Buttons
@ -231,8 +239,6 @@ class BibleMediaItem(MediaManagerItem):
translate('BiblesPlugin.MediaItem', 'Version:'))
self.quickSecondLabel.setText(
translate('BiblesPlugin.MediaItem', 'Second:'))
self.quickSearchTypeLabel.setText(
translate('BiblesPlugin.MediaItem', 'Search type:'))
self.quickSearchLabel.setText(
translate('BiblesPlugin.MediaItem', 'Find:'))
self.quickSearchButton.setText(
@ -257,10 +263,6 @@ class BibleMediaItem(MediaManagerItem):
translate('BiblesPlugin.MediaItem', 'Results:'))
self.advancedSearchButton.setText(
translate('BiblesPlugin.MediaItem', 'Search'))
self.quickSearchComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Verse Search'))
self.quickSearchComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Text Search'))
self.quickClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Clear'))
self.quickClearComboBox.addItem(
@ -358,11 +360,11 @@ class BibleMediaItem(MediaManagerItem):
"""
This updates the bible book completion list for the search field. The
completion depends on the bible. It is only updated when we are doing a
verse search, otherwise the auto completion list is removed.
reference search, otherwise the auto completion list is removed.
"""
books = []
# We have to do a 'Verse Search'.
if self.quickSearchComboBox.currentIndex() == 0:
# We have to do a 'Reference Search'.
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
bibles = self.parent.manager.get_bibles()
bible = unicode(self.quickVersionComboBox.currentText())
if bible:
@ -491,7 +493,7 @@ class BibleMediaItem(MediaManagerItem):
def onQuickSearchButton(self):
"""
Does a quick search and saves the search results. Quick search can
either be "Verse Search" or "Text Search".
either be "Reference Search" or "Text Search".
"""
log.debug(u'Quick Search Button pressed')
self.quickSearchButton.setEnabled(False)
@ -499,8 +501,8 @@ class BibleMediaItem(MediaManagerItem):
bible = unicode(self.quickVersionComboBox.currentText())
second_bible = unicode(self.quickSecondComboBox.currentText())
text = unicode(self.quickSearchEdit.text())
if self.quickSearchComboBox.currentIndex() == 0:
# We are doing a 'Verse Search'.
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
# We are doing a 'Reference Search'.
self.search_results = self.parent.manager.get_verses(bible, text)
if second_bible and self.search_results:
self.second_search_results = self.parent.manager.get_verses(

View File

@ -30,7 +30,6 @@ from forms import EditCustomForm
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.db import Manager
from openlp.core.lib.ui import UiStrings
from openlp.plugins.custom.lib import CustomMediaItem, CustomTab
from openlp.plugins.custom.lib.db import CustomSlide, init_schema
@ -106,13 +105,20 @@ class CustomPlugin(Plugin):
u'title': translate('CustomsPlugin', 'Custom', 'container title')
}
# Middle Header Bar
## Import Action ##
self.textStrings[StringContent.Import] = {
u'title': UiStrings.Import,
u'tooltip': translate('CustomsPlugin',
'Import a Custom')
tooltips = {
u'load': translate('CustomsPlugin', 'Load a new Custom'),
u'import': translate('CustomsPlugin', 'Import a Custom'),
u'new': translate('CustomsPlugin', 'Add a new Custom'),
u'edit': translate('CustomsPlugin', 'Edit the selected Custom'),
u'delete': translate('CustomsPlugin', 'Delete the selected Custom'),
u'preview': translate('CustomsPlugin',
'Preview the selected Custom'),
u'live': translate('CustomsPlugin',
'Send the selected Custom live'),
u'service': translate('CustomsPlugin',
'Add the selected Custom to the service')
}
Plugin.setPluginTextStrings(self)
self.setPluginUiTextStrings(tooltips)
def finalise(self):
"""

View File

@ -69,4 +69,15 @@ class ImagePlugin(Plugin):
u'title': translate('ImagePlugin', 'Images', 'container title')
}
# Middle Header Bar
Plugin.setPluginTextStrings(self)
tooltips = {
u'load': translate('ImagePlugin', 'Load a new Image'),
u'import': u'',
u'new': translate('ImagePlugin', 'Add a new Image'),
u'edit': translate('ImagePlugin', 'Edit the selected Image'),
u'delete': translate('ImagePlugin', 'Delete the selected Image'),
u'preview': translate('ImagePlugin', 'Preview the selected Image'),
u'live': translate('ImagePlugin', 'Send the selected Image live'),
u'service': translate('ImagePlugin',
'Add the selected Image to the service')
}
self.setPluginUiTextStrings(tooltips)

View File

@ -95,4 +95,15 @@ class MediaPlugin(Plugin):
u'title': translate('MediaPlugin', 'Media', 'container title')
}
# Middle Header Bar
Plugin.setPluginTextStrings(self)
tooltips = {
u'load': translate('MediaPlugin', 'Load a new Media'),
u'import': u'',
u'new': translate('MediaPlugin', 'Add a new Media'),
u'edit': translate('MediaPlugin', 'Edit the selected Media'),
u'delete': translate('MediaPlugin', 'Delete the selected Media'),
u'preview': translate('MediaPlugin', 'Preview the selected Media'),
u'live': translate('MediaPlugin', 'Send the selected Media live'),
u'service': translate('MediaPlugin',
'Add the selected Media to the service')
}
self.setPluginUiTextStrings(tooltips)

View File

@ -167,4 +167,18 @@ class PresentationPlugin(Plugin):
'container title')
}
# Middle Header Bar
Plugin.setPluginTextStrings(self)
tooltips = {
u'load': translate('PresentationPlugin', 'Load a new Presentation'),
u'import': u'',
u'new': u'',
u'edit': u'',
u'delete': translate('PresentationPlugin',
'Delete the selected Presentation'),
u'preview': translate('PresentationPlugin',
'Preview the selected Presentation'),
u'live': translate('PresentationPlugin',
'Send the selected Presentation live'),
u'service': translate('PresentationPlugin',
'Add the selected Presentation to the service')
}
self.setPluginUiTextStrings(tooltips)

View File

@ -161,6 +161,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def newSong(self):
log.debug(u'New Song')
self.song = None
self.initialise()
self.songTabWidget.setCurrentIndex(0)
self.titleEdit.setText(u'')

View File

@ -480,7 +480,7 @@ class SongImportForm(OpenLPWizard):
The file extension filters. It should contain the file descriptions
as well as the file extensions. For example::
u'SongBeamer files (*.sng)'
u'SongBeamer Files (*.sng)'
"""
if filters:
filters += u';;'
@ -609,7 +609,7 @@ class SongImportForm(OpenLPWizard):
'Select Songs of Fellowship Files'),
self.songsOfFellowshipFileListWidget, u'%s (*.rtf)'
% translate('SongsPlugin.ImportWizardForm',
'Songs Of Felloship Song Files')
'Songs Of Fellowship Song Files')
)
def onSongsOfFellowshipRemoveButtonClicked(self):
@ -659,7 +659,7 @@ class SongImportForm(OpenLPWizard):
translate('SongsPlugin.ImportWizardForm',
'Select SongBeamer Files'),
self.songBeamerFileListWidget, u'%s (*.sng)' %
translate('SongsPlugin.ImportWizardForm', 'SongBeamer files')
translate('SongsPlugin.ImportWizardForm', 'SongBeamer Files')
)
def onSongBeamerRemoveButtonClicked(self):

View File

@ -457,7 +457,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onTopicDeleteButtonClick(self):
"""
Delete the Book is the Book is not attached to any songs.
Delete the Book if the Book is not attached to any songs.
"""
self._deleteItem(Topic, self.topicsListWidget, self.resetTopics,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'),
@ -470,7 +470,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onBookDeleteButtonClick(self):
"""
Delete the Book is the Book is not attached to any songs.
Delete the Book if the Book is not attached to any songs.
"""
self._deleteItem(Book, self.booksListWidget, self.resetBooks,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'),

View File

@ -68,11 +68,11 @@ class SongFormat(object):
CCLI = 5
SongsOfFellowship = 6
Generic = 7
#CSV = 8
EasiSlides = 8
EasyWorship = 9
SongBeamer = 10
SongShowPlus = 11
#CSV = 12
@staticmethod
def get_class(format):

View File

@ -42,7 +42,7 @@ CHORUS = 20
TOPIC = 29
COMMENTS = 30
VERSE_ORDER = 31
SONG_BOOK = 35
SONG_BOOK = 35
SONG_NUMBER = 36
CUSTOM_VERSE = 37
@ -50,32 +50,32 @@ log = logging.getLogger(__name__)
class SongShowPlusImport(SongImport):
"""
The :class:`SongShowPlusImport` class provides the ability to import song
The :class:`SongShowPlusImport` class provides the ability to import song
files from SongShow Plus.
**SongShow Plus Song File Format:**
The SongShow Plus song file format is as follows:
* Each piece of data in the song file has some information that precedes
* Each piece of data in the song file has some information that precedes
it.
* The general format of this data is as follows:
4 Bytes, forming a 32 bit number, a key if you will, this describes what
4 Bytes, forming a 32 bit number, a key if you will, this describes what
the data is (see blockKey below)
4 Bytes, forming a 32 bit number, which is the number of bytes until the
4 Bytes, forming a 32 bit number, which is the number of bytes until the
next block starts
1 Byte, which tells how namy bytes follows
1 or 4 Bytes, describes how long the string is, if its 1 byte, the string
1 or 4 Bytes, describes how long the string is, if its 1 byte, the string
is less than 255
The next bytes are the actuall data.
The next block of data follows on.
This description does differ for verses. Which includes extra bytes
stating the verse type or number. In some cases a "custom" verse is used,
in that case, this block will in include 2 strings, with the associated
string length descriptors. The first string is the name of the verse, the
This description does differ for verses. Which includes extra bytes
stating the verse type or number. In some cases a "custom" verse is used,
in that case, this block will in include 2 strings, with the associated
string length descriptors. The first string is the name of the verse, the
second is the verse content.
The file is ended with four null bytes.
Valid extensions for a SongShow Plus song file are:
@ -98,7 +98,7 @@ class SongShowPlusImport(SongImport):
if kwargs.has_key(u'filenames'):
self.import_source = kwargs[u'filenames']
log.debug(self.import_source)
def do_import(self):
"""
Receive a single file or a list of files to import.
@ -107,38 +107,36 @@ class SongShowPlusImport(SongImport):
self.import_wizard.progressBar.setMaximum(len(self.import_source))
for file in self.import_source:
author = u''
copyright = u''
self.sspVerseOrderList = []
otherCount = 0
otherList = {}
file_name = os.path.split(file)[1]
self.import_wizard.incrementProgressBar(
u'Importing %s' % (file_name), 0)
u'Importing %s' % (file_name), 0)
songData = open(file, 'rb')
while (1):
blockKey, = struct.unpack("I",songData.read(4))
blockKey, = struct.unpack("I", songData.read(4))
# The file ends with 4 NUL's
if blockKey == 0:
break
nextBlockStarts, = struct.unpack("I",songData.read(4))
nextBlockStarts, = struct.unpack("I", songData.read(4))
if blockKey == VERSE or blockKey == CHORUS:
null, verseNo, = struct.unpack("BB",songData.read(2))
null, verseNo, = struct.unpack("BB", songData.read(2))
elif blockKey == CUSTOM_VERSE:
null, verseNameLength, = struct.unpack("BB",
null, verseNameLength, = struct.unpack("BB",
songData.read(2))
verseName = songData.read(verseNameLength)
lengthDescriptorSize, = struct.unpack("B",songData.read(1))
lengthDescriptorSize, = struct.unpack("B", songData.read(1))
# Detect if/how long the length descriptor is
if lengthDescriptorSize == 12:
lengthDescriptor, = struct.unpack("I",songData.read(4))
lengthDescriptor, = struct.unpack("I", songData.read(4))
elif lengthDescriptorSize == 2:
lengthDescriptor = 1
elif lengthDescriptorSize == 9:
lengthDescriptor = 0
else:
lengthDescriptor, = struct.unpack("B",songData.read(1))
else:
lengthDescriptor, = struct.unpack("B", songData.read(1))
data = songData.read(lengthDescriptor)
if blockKey == TITLE:
self.title = unicode(data, u'cp1252')
elif blockKey == AUTHOR:
@ -146,17 +144,17 @@ class SongShowPlusImport(SongImport):
for author in authors:
if author.find(",") !=-1:
authorParts = author.split(", ")
author = authorParts[1] + " " + authorParts[0]
self.parse_author(unicode(author, u'cp1252'))
author = authorParts[1] + " " + authorParts[0]
self.parse_author(unicode(author, u'cp1252'))
elif blockKey == COPYRIGHT:
self.add_copyright(unicode(data, u'cp1252'))
elif blockKey == CCLI_NO:
self.ccli_number = int(data)
elif blockKey == VERSE:
self.add_verse(unicode(data, u'cp1252'),
self.add_verse(unicode(data, u'cp1252'),
"V%s" % verseNo)
elif blockKey == CHORUS:
self.add_verse(unicode(data, u'cp1252'),
self.add_verse(unicode(data, u'cp1252'),
"C%s" % verseNo)
elif blockKey == TOPIC:
self.topics.append(unicode(data, u'cp1252'))
@ -182,9 +180,9 @@ class SongShowPlusImport(SongImport):
self.import_wizard.incrementProgressBar(
u'Importing %s' % (file_name))
return True
def toOpenLPVerseTag(self, verseName):
if verseName.find(" ")!=-1:
if verseName.find(" ") !=-1:
verseParts = verseName.split(" ")
verseType = verseParts[0]
verseNumber = verseParts[1]
@ -203,7 +201,7 @@ class SongShowPlusImport(SongImport):
elif verseType == "bridge":
verseTag = "B"
else:
if not self.otherList.has_key(verseName):
if not self.otherList.has_key(verseName):
self.otherCount = self.otherCount + 1
self.otherList[verseName] = str(self.otherCount)
verseTag = "O"

View File

@ -228,7 +228,18 @@ class SongsPlugin(Plugin):
u'title': translate('SongsPlugin', 'Songs', 'container title')
}
# Middle Header Bar
Plugin.setPluginTextStrings(self)
tooltips = {
u'load': u'',
u'import': u'',
u'new': translate('SongsPlugin', 'Add a new Song'),
u'edit': translate('SongsPlugin', 'Edit the selected Song'),
u'delete': translate('SongsPlugin', 'Delete the selected Song'),
u'preview': translate('SongsPlugin', 'Preview the selected Song'),
u'live': translate('SongsPlugin', 'Send the selected Song live'),
u'service': translate('SongsPlugin',
'Add the selected Song to the service')
}
self.setPluginUiTextStrings(tooltips)
def finalise(self):
"""

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

View File

@ -21,6 +21,10 @@
<file>song_topic_edit.png</file>
<file>song_book_edit.png</file>
</qresource>
<qresource prefix="bibles">
<file>bibles_search_text.png</file>
<file>bibles_search_reference.png</file>
</qresource>
<qresource prefix="plugins">
<file>plugin_alerts.png</file>
<file>plugin_bibles.png</file>