diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index d5fd1e861..ad26bb2d4 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -183,6 +183,9 @@ class MainDisplay(DisplayWidget): The slide text to be displayed """ log.debug(u'text') + # Wait for the webview to update before displayiong text. + while not self.loaded: + Receiver.send_message(u'openlp_process_events') self.frame.evaluateJavaScript(u'show_text("%s")' % \ slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')) return self.preview() @@ -234,8 +237,11 @@ class MainDisplay(DisplayWidget): Display an image, as is. """ if image: - js = u'show_image("data:image/png;base64,%s");' % \ - image_to_byte(image) + if isinstance(image, QtGui.QImage): + js = u'show_image("data:image/png;base64,%s");' % \ + image_to_byte(image) + else: + js = u'show_image("data:image/png;base64,%s");' % image else: js = u'show_image("");' self.frame.evaluateJavaScript(js) @@ -246,7 +252,7 @@ class MainDisplay(DisplayWidget): Used after Image plugin has changed the background """ log.debug(u'resetImage') - self.displayImage(self.serviceItem.bg_frame) + self.displayImage(self.serviceItem.bg_image_bytes) def resetVideo(self): """ diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 0d158d042..10f1ee92e 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -343,7 +343,7 @@ class Ui_MainWindow(object): Set up the translation system """ MainWindow.mainTitle = translate('OpenLP.MainWindow', 'OpenLP 2.0') - MainWindow.language = translate('OpenLP.MainWindow', 'English') +# MainWindow.language = translate('OpenLP.MainWindow', 'English') MainWindow.setWindowTitle(MainWindow.mainTitle) self.FileMenu.setTitle(translate('OpenLP.MainWindow', '&File')) self.FileImportMenu.setTitle(translate('OpenLP.MainWindow', '&Import')) diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index f118c64b0..000328d50 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -82,7 +82,8 @@ class LanguageManager(object): """ translator = QtCore.QTranslator() translator.load(qm_file) - return translator.translate('OpenLP.MainWindow', 'English') + return translator.translate('OpenLP.MainWindow', 'English', + 'Please add the name of your language here') @staticmethod def get_language(): @@ -107,15 +108,13 @@ class LanguageManager(object): ``action`` The language menu option """ - if action is None: - action_name = u'en' - else: + language = u'en' + if action: action_name = u'%s' % action.objectName() - qm_list = LanguageManager.get_qm_list() - if LanguageManager.auto_language: - language = u'[%s]' % qm_list[action_name] - else: + qm_list = LanguageManager.get_qm_list() language = u'%s' % qm_list[action_name] + if LanguageManager.auto_language: + language = u'[%s]' % language QtCore.QSettings().setValue( u'general/language', QtCore.QVariant(language)) log.info(u'Language file: \'%s\' written to conf file' % language) @@ -132,9 +131,11 @@ class LanguageManager(object): LanguageManager.__qm_list__ = {} qm_files = LanguageManager.find_qm_files() for counter, qmf in enumerate(qm_files): - name = unicode(qmf).split(u'.')[0] - LanguageManager.__qm_list__[u'%#2i %s' % (counter + 1, - LanguageManager.language_name(qmf))] = name + reg_ex = QtCore.QRegExp("^.*i18n/(.*).qm") + if reg_ex.exactMatch(qmf): + name = u'%s' % reg_ex.cap(1) + LanguageManager.__qm_list__[u'%#2i %s' % (counter + 1, + LanguageManager.language_name(qmf))] = name @staticmethod def get_qm_list(): diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index ae9938ab4..8d02ec285 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -629,7 +629,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.song.alternate_title = unicode(self.AlternativeEdit.text()) self.song.copyright = unicode(self.CopyrightEditItem.text()) self.song.search_title = self.song.title + u'@' + \ - unicode(self.AlternativeEdit.text()) + self.song.alternate_title self.song.comments = unicode(self.CommentsEdit.toPlainText()) self.song.verse_order = unicode(self.VerseOrderEdit.text()) self.song.ccli_number = unicode(self.CCLNumberEdit.text()) @@ -669,7 +669,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): unicode(self.VerseListWidget.item(i, 0).text())) + u' ' if (bits[1] > u'1') and (bits[0][0] not in multiple): multiple.append(bits[0][0]) - self.song.search_lyrics = text + self.song.search_lyrics = text.lower() self.song.lyrics = unicode(sxml.extract_xml(), u'utf-8') for verse in multiple: self.song.verse_order = re.sub(u'([' + verse.upper() + @@ -682,4 +682,4 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def processTitle(self): log.debug(u'processTitle') self.song.search_title = re.sub(r'[\'"`,;:(){}?]+', u'', - unicode(self.song.search_title)) + unicode(self.song.search_title)).lower() diff --git a/openlp/plugins/songs/forms/songimportwizard.py b/openlp/plugins/songs/forms/songimportwizard.py index 0fb36cfe7..bad85676f 100644 --- a/openlp/plugins/songs/forms/songimportwizard.py +++ b/openlp/plugins/songs/forms/songimportwizard.py @@ -30,8 +30,8 @@ from openlp.core.lib import build_icon, translate class Ui_SongImportWizard(object): def setupUi(self, songImportWizard): - openIcon = build_icon(u':/general/general_open.png') - deleteIcon = build_icon(u':/general/general_delete.png') + self.openIcon = build_icon(u':/general/general_open.png') + self.deleteIcon = build_icon(u':/general/general_delete.png') songImportWizard.setObjectName(u'songImportWizard') songImportWizard.resize(550, 386) songImportWizard.setModal(True) @@ -88,16 +88,6 @@ class Ui_SongImportWizard(object): self.formatComboBox.sizePolicy().hasHeightForWidth()) self.formatComboBox.setSizePolicy(sizePolicy) self.formatComboBox.setObjectName(u'formatComboBox') - self.formatComboBox.addItem(u'') - self.formatComboBox.addItem(u'') - self.formatComboBox.addItem(u'') - self.formatComboBox.addItem(u'') - self.formatComboBox.addItem(u'') - self.formatComboBox.addItem(u'') - self.formatComboBox.addItem(u'') - self.formatComboBox.addItem(u'') - self.formatComboBox.addItem(u'') -# self.formatComboBox.addItem(u'') self.formatLayout.addWidget(self.formatComboBox) self.formatSpacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) @@ -106,362 +96,28 @@ class Ui_SongImportWizard(object): self.formatStackedWidget = QtGui.QStackedWidget(self.sourcePage) self.formatStackedWidget.setObjectName(u'FormatStackedWidget') # OpenLP 2.0 - self.openLP2Page = QtGui.QWidget() - self.openLP2Page.setObjectName(u'openLP2Page') - self.openLP2Layout = QtGui.QFormLayout(self.openLP2Page) - self.openLP2Layout.setMargin(0) - self.openLP2Layout.setSpacing(8) - self.openLP2Layout.setObjectName(u'openLP2Layout') - self.openLP2FilenameLabel = QtGui.QLabel(self.openLP2Page) - self.openLP2FilenameLabel.setObjectName(u'openLP2FilenameLabel') - self.openLP2Layout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.openLP2FilenameLabel) - self.openLP2FileLayout = QtGui.QHBoxLayout() - self.openLP2FileLayout.setSpacing(8) - self.openLP2FileLayout.setObjectName(u'openLP2FileLayout') - self.openLP2FilenameEdit = QtGui.QLineEdit(self.openLP2Page) - self.openLP2FilenameEdit.setObjectName(u'openLP2FilenameEdit') - self.openLP2FileLayout.addWidget(self.openLP2FilenameEdit) - self.openLP2BrowseButton = QtGui.QToolButton(self.openLP2Page) - self.openLP2BrowseButton.setIcon(openIcon) - self.openLP2BrowseButton.setObjectName(u'openLP2BrowseButton') - self.openLP2FileLayout.addWidget(self.openLP2BrowseButton) - self.openLP2Layout.setLayout(0, QtGui.QFormLayout.FieldRole, - self.openLP2FileLayout) - self.formatStackedWidget.addWidget(self.openLP2Page) + self.addSingleFileSelectItem(u'openLP2') # openlp.org 1.x - self.openLP1Page = QtGui.QWidget() - self.openLP1Page.setObjectName(u'openLP1Page') - self.openLP1Layout = QtGui.QVBoxLayout(self.openLP1Page) - self.openLP1Layout.setMargin(0) - self.openLP1Layout.setSpacing(0) - self.openLP1Layout.setObjectName(u'openLP1Layout') - self.openLP1DisabledWidget = QtGui.QWidget(self.openLP1Page) - self.openLP1DisabledLayout = QtGui.QVBoxLayout(self.openLP1DisabledWidget) - self.openLP1DisabledLayout.setMargin(0) - self.openLP1DisabledLayout.setSpacing(8) - self.openLP1DisabledLayout.setObjectName(u'openLP1DisabledLayout') - self.openLP1DisabledLabel = QtGui.QLabel(self.openLP1DisabledWidget) - self.openLP1DisabledLabel.setWordWrap(True) - self.openLP1DisabledLabel.setObjectName(u'openLP1DisabledLabel') - self.openLP1DisabledLayout.addWidget(self.openLP1DisabledLabel) - self.openLP1DisabledWidget.setVisible(False) - self.openLP1Layout.addWidget(self.openLP1DisabledWidget) - self.openLP1ImportWidget = QtGui.QWidget(self.openLP1Page) - self.openLP1ImportLayout = QtGui.QFormLayout(self.openLP1ImportWidget) - self.openLP1ImportLayout.setMargin(0) - self.openLP1ImportLayout.setSpacing(8) - self.openLP1ImportLayout.setObjectName(u'openLP1ImportLayout') - self.openLP1FilenameLabel = QtGui.QLabel(self.openLP1ImportWidget) - self.openLP1FilenameLabel.setObjectName(u'openLP1FilenameLabel') - self.openLP1ImportLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.openLP1FilenameLabel) - self.openLP1FileLayout = QtGui.QHBoxLayout() - self.openLP1FileLayout.setSpacing(8) - self.openLP1FileLayout.setObjectName(u'openLP1FileLayout') - self.openLP1FilenameEdit = QtGui.QLineEdit(self.openLP1ImportWidget) - self.openLP1FilenameEdit.setObjectName(u'openLP1FilenameEdit') - self.openLP1FileLayout.addWidget(self.openLP1FilenameEdit) - self.openLP1BrowseButton = QtGui.QToolButton(self.openLP1ImportWidget) - self.openLP1BrowseButton.setIcon(openIcon) - self.openLP1BrowseButton.setObjectName(u'openLP1BrowseButton') - self.openLP1FileLayout.addWidget(self.openLP1BrowseButton) - self.openLP1ImportLayout.setLayout(0, QtGui.QFormLayout.FieldRole, - self.openLP1FileLayout) - self.openLP1Layout.addWidget(self.openLP1ImportWidget) - self.formatStackedWidget.addWidget(self.openLP1Page) + self.addSingleFileSelectItem(u'openLP1', None, True) # OpenLyrics - self.openLyricsPage = QtGui.QWidget() - self.openLyricsPage.setObjectName(u'OpenLyricsPage') - self.openLyricsLayout = QtGui.QVBoxLayout(self.openLyricsPage) - self.openLyricsLayout.setSpacing(8) - self.openLyricsLayout.setMargin(0) - self.openLyricsLayout.setObjectName(u'OpenLyricsLayout') - self.openLyricsDisabledLabel = QtGui.QLabel(self.openLyricsPage) - self.openLyricsDisabledLabel.setWordWrap(True) - self.openLyricsDisabledLabel.setObjectName(u'openLyricsDisabledLabel') - self.openLyricsLayout.addWidget(self.openLyricsDisabledLabel) - # Commented out for future use. - #self.openLyricsFileListWidget = QtGui.QListWidget(self.openLyricsPage) - #self.openLyricsFileListWidget.setSelectionMode( - # QtGui.QAbstractItemView.ExtendedSelection) - #self.openLyricsFileListWidget.setObjectName(u'OpenLyricsFileListWidget') - #self.openLyricsLayout.addWidget(self.openLyricsFileListWidget) - #self.openLyricsButtonLayout = QtGui.QHBoxLayout() - #self.openLyricsButtonLayout.setSpacing(8) - #self.openLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout') - #self.openLyricsAddButton = QtGui.QPushButton(self.openLyricsPage) - #self.openLyricsAddButton.setIcon(openIcon) - #self.openLyricsAddButton.setObjectName(u'OpenLyricsAddButton') - #self.openLyricsButtonLayout.addWidget(self.openLyricsAddButton) - #self.openLyricsButtonSpacer = QtGui.QSpacerItem(40, 20, - # QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - #self.openLyricsButtonLayout.addItem(self.openLyricsButtonSpacer) - #self.openLyricsRemoveButton = QtGui.QPushButton(self.openLyricsPage) - #self.openLyricsRemoveButton.setIcon(deleteIcon) - #self.openLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton') - #self.openLyricsButtonLayout.addWidget(self.openLyricsRemoveButton) - #self.openLyricsLayout.addLayout(self.openLyricsButtonLayout) - self.formatStackedWidget.addWidget(self.openLyricsPage) + self.addMultiFileSelectItem(u'openLyrics', u'OpenLyrics', True) + # set OpenLyrics to disabled by default + self.openLyricsDisabledWidget.setVisible(True) + self.openLyricsImportWidget.setVisible(False) # Open Song - self.openSongPage = QtGui.QWidget() - self.openSongPage.setObjectName(u'OpenSongPage') - self.openSongLayout = QtGui.QVBoxLayout(self.openSongPage) - self.openSongLayout.setSpacing(8) - self.openSongLayout.setMargin(0) - self.openSongLayout.setObjectName(u'OpenSongLayout') - self.openSongFileListWidget = QtGui.QListWidget(self.openSongPage) - self.openSongFileListWidget.setSelectionMode( - QtGui.QAbstractItemView.ExtendedSelection) - self.openSongFileListWidget.setObjectName(u'OpenSongFileListWidget') - self.openSongLayout.addWidget(self.openSongFileListWidget) - self.openSongButtonLayout = QtGui.QHBoxLayout() - self.openSongButtonLayout.setSpacing(8) - self.openSongButtonLayout.setObjectName(u'OpenSongButtonLayout') - self.openSongAddButton = QtGui.QPushButton(self.openSongPage) - self.openSongAddButton.setIcon(openIcon) - self.openSongAddButton.setObjectName(u'OpenSongAddButton') - self.openSongButtonLayout.addWidget(self.openSongAddButton) - self.openSongButtonSpacer = QtGui.QSpacerItem(40, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.openSongButtonLayout.addItem(self.openSongButtonSpacer) - self.openSongRemoveButton = QtGui.QPushButton(self.openSongPage) - self.openSongRemoveButton.setIcon(deleteIcon) - self.openSongRemoveButton.setObjectName(u'OpenSongRemoveButton') - self.openSongButtonLayout.addWidget(self.openSongRemoveButton) - self.openSongLayout.addLayout(self.openSongButtonLayout) - self.formatStackedWidget.addWidget(self.openSongPage) + self.addMultiFileSelectItem(u'openSong', u'OpenSong') # Words of Worship - self.wordsOfWorshipPage = QtGui.QWidget() - self.wordsOfWorshipPage.setObjectName(u'wordsOfWorshipPage') - self.wordsOfWorshipLayout = QtGui.QVBoxLayout(self.wordsOfWorshipPage) - self.wordsOfWorshipLayout.setSpacing(8) - self.wordsOfWorshipLayout.setMargin(0) - self.wordsOfWorshipLayout.setObjectName(u'wordsOfWorshipLayout') - self.wordsOfWorshipFileListWidget = QtGui.QListWidget( - self.wordsOfWorshipPage) - self.wordsOfWorshipFileListWidget.setSelectionMode( - QtGui.QAbstractItemView.ExtendedSelection) - self.wordsOfWorshipFileListWidget.setObjectName( - u'wordsOfWorshipFileListWidget') - self.wordsOfWorshipLayout.addWidget(self.wordsOfWorshipFileListWidget) - self.wordsOfWorshipButtonLayout = QtGui.QHBoxLayout() - self.wordsOfWorshipButtonLayout.setSpacing(8) - self.wordsOfWorshipButtonLayout.setObjectName( - u'wordsOfWorshipButtonLayout') - self.wordsOfWorshipAddButton = QtGui.QPushButton( - self.wordsOfWorshipPage) - self.wordsOfWorshipAddButton.setIcon(openIcon) - self.wordsOfWorshipAddButton.setObjectName(u'wordsOfWorshipAddButton') - self.wordsOfWorshipButtonLayout.addWidget(self.wordsOfWorshipAddButton) - self.wordsOfWorshipButtonSpacer = QtGui.QSpacerItem(40, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.wordsOfWorshipButtonLayout.addItem(self.wordsOfWorshipButtonSpacer) - self.wordsOfWorshipRemoveButton = QtGui.QPushButton( - self.wordsOfWorshipPage) - self.wordsOfWorshipRemoveButton.setIcon(deleteIcon) - self.wordsOfWorshipRemoveButton.setObjectName( - u'wordsOfWorshipRemoveButton') - self.wordsOfWorshipButtonLayout.addWidget( - self.wordsOfWorshipRemoveButton) - self.wordsOfWorshipLayout.addLayout(self.wordsOfWorshipButtonLayout) - self.formatStackedWidget.addWidget(self.wordsOfWorshipPage) + self.addMultiFileSelectItem(u'wordsOfWorship') # CCLI File import - self.ccliPage = QtGui.QWidget() - self.ccliPage.setObjectName(u'ccliPage') - self.ccliLayout = QtGui.QVBoxLayout(self.ccliPage) - self.ccliLayout.setSpacing(8) - self.ccliLayout.setMargin(0) - self.ccliLayout.setObjectName(u'ccliLayout') - self.ccliFileListWidget = QtGui.QListWidget(self.ccliPage) - self.ccliFileListWidget.setSelectionMode( - QtGui.QAbstractItemView.ExtendedSelection) - self.ccliFileListWidget.setObjectName(u'ccliFileListWidget') - self.ccliLayout.addWidget(self.ccliFileListWidget) - self.ccliButtonLayout = QtGui.QHBoxLayout() - self.ccliButtonLayout.setSpacing(8) - self.ccliButtonLayout.setObjectName(u'ccliButtonLayout') - self.ccliAddButton = QtGui.QPushButton(self.ccliPage) - self.ccliAddButton.setIcon(openIcon) - self.ccliAddButton.setObjectName(u'ccliAddButton') - self.ccliButtonLayout.addWidget(self.ccliAddButton) - self.ccliButtonSpacer = QtGui.QSpacerItem(40, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.ccliButtonLayout.addItem(self.ccliButtonSpacer) - self.ccliRemoveButton = QtGui.QPushButton(self.ccliPage) - self.ccliRemoveButton.setIcon(deleteIcon) - self.ccliRemoveButton.setObjectName(u'ccliRemoveButton') - self.ccliButtonLayout.addWidget(self.ccliRemoveButton) - self.ccliLayout.addLayout(self.ccliButtonLayout) - self.formatStackedWidget.addWidget(self.ccliPage) + self.addMultiFileSelectItem(u'ccli') # Songs of Fellowship - self.songsOfFellowshipPage = QtGui.QWidget() - self.songsOfFellowshipPage.setObjectName(u'songsOfFellowshipPage') - self.songsOfFellowshipLayout = QtGui.QVBoxLayout( - self.songsOfFellowshipPage) - self.songsOfFellowshipLayout.setMargin(0) - self.songsOfFellowshipLayout.setSpacing(0) - self.songsOfFellowshipLayout.setObjectName(u'songsOfFellowshipLayout') - self.songsOfFellowshipDisabledWidget = QtGui.QWidget( - self.songsOfFellowshipPage) - self.songsOfFellowshipDisabledWidget.setVisible(False) - self.songsOfFellowshipDisabledWidget.setObjectName( - u'songsOfFellowshipDisabledWidget') - self.songsOfFellowshipDisabledLayout = QtGui.QVBoxLayout( - self.songsOfFellowshipDisabledWidget) - self.songsOfFellowshipDisabledLayout.setMargin(0) - self.songsOfFellowshipDisabledLayout.setSpacing(8) - self.songsOfFellowshipDisabledLayout.setObjectName( - u'songsOfFellowshipDisabledLayout') - self.songsOfFellowshipDisabledLabel = QtGui.QLabel( - self.songsOfFellowshipDisabledWidget) - self.songsOfFellowshipDisabledLabel.setWordWrap(True) - self.songsOfFellowshipDisabledLabel.setObjectName( - u'songsOfFellowshipDisabledLabel') - self.songsOfFellowshipDisabledLayout.addWidget( - self.songsOfFellowshipDisabledLabel) - self.songsOfFellowshipLayout.addWidget( - self.songsOfFellowshipDisabledWidget) - self.songsOfFellowshipImportWidget = QtGui.QWidget( - self.songsOfFellowshipPage) - self.songsOfFellowshipImportWidget.setObjectName( - u'songsOfFellowshipImportWidget') - self.songsOfFellowshipImportLayout = QtGui.QVBoxLayout( - self.songsOfFellowshipImportWidget) - self.songsOfFellowshipImportLayout.setMargin(0) - self.songsOfFellowshipImportLayout.setSpacing(8) - self.songsOfFellowshipImportLayout.setObjectName( - u'songsOfFellowshipImportLayout') - self.songsOfFellowshipFileListWidget = QtGui.QListWidget( - self.songsOfFellowshipImportWidget) - self.songsOfFellowshipFileListWidget.setSelectionMode( - QtGui.QAbstractItemView.ExtendedSelection) - self.songsOfFellowshipFileListWidget.setObjectName( - u'songsOfFellowshipFileListWidget') - self.songsOfFellowshipImportLayout.addWidget( - self.songsOfFellowshipFileListWidget) - self.songsOfFellowshipButtonLayout = QtGui.QHBoxLayout() - self.songsOfFellowshipButtonLayout.setSpacing(8) - self.songsOfFellowshipButtonLayout.setObjectName( - u'songsOfFellowshipButtonLayout') - self.songsOfFellowshipAddButton = QtGui.QPushButton( - self.songsOfFellowshipImportWidget) - self.songsOfFellowshipAddButton.setIcon(openIcon) - self.songsOfFellowshipAddButton.setObjectName( - u'songsOfFellowshipAddButton') - self.songsOfFellowshipButtonLayout.addWidget( - self.songsOfFellowshipAddButton) - self.songsOfFellowshipButtonSpacer = QtGui.QSpacerItem(40, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.songsOfFellowshipButtonLayout.addItem( - self.songsOfFellowshipButtonSpacer) - self.songsOfFellowshipRemoveButton = QtGui.QPushButton( - self.songsOfFellowshipImportWidget) - self.songsOfFellowshipRemoveButton.setIcon(deleteIcon) - self.songsOfFellowshipRemoveButton.setObjectName( - u'songsOfFellowshipRemoveButton') - self.songsOfFellowshipButtonLayout.addWidget( - self.songsOfFellowshipRemoveButton) - self.songsOfFellowshipImportLayout.addLayout( - self.songsOfFellowshipButtonLayout) - self.songsOfFellowshipLayout.addWidget( - self.songsOfFellowshipImportWidget) - self.formatStackedWidget.addWidget(self.songsOfFellowshipPage) + self.addMultiFileSelectItem(u'songsOfFellowship', None, True) # Generic Document/Presentation import - self.genericPage = QtGui.QWidget() - self.genericPage.setObjectName(u'genericPage') - self.genericLayout = QtGui.QVBoxLayout(self.genericPage) - self.genericLayout.setMargin(0) - self.genericLayout.setSpacing(0) - self.genericLayout.setObjectName(u'genericLayout') - self.genericDisabledWidget = QtGui.QWidget(self.genericPage) - self.genericDisabledWidget.setObjectName(u'genericDisabledWidget') - self.genericDisabledLayout = QtGui.QVBoxLayout(self.genericDisabledWidget) - self.genericDisabledLayout.setMargin(0) - self.genericDisabledLayout.setSpacing(8) - self.genericDisabledLayout.setObjectName(u'genericDisabledLayout') - self.genericDisabledLabel = QtGui.QLabel(self.genericDisabledWidget) - self.genericDisabledLabel.setWordWrap(True) - self.genericDisabledLabel.setObjectName(u'genericDisabledLabel') - self.genericDisabledWidget.setVisible(False) - self.genericDisabledLayout.addWidget(self.genericDisabledLabel) - self.genericLayout.addWidget(self.genericDisabledWidget) - self.genericImportWidget = QtGui.QWidget(self.genericPage) - self.genericImportWidget.setObjectName(u'genericImportWidget') - self.genericImportLayout = QtGui.QVBoxLayout(self.genericImportWidget) - self.genericImportLayout.setMargin(0) - self.genericImportLayout.setSpacing(8) - self.genericImportLayout.setObjectName(u'genericImportLayout') - self.genericFileListWidget = QtGui.QListWidget(self.genericImportWidget) - self.genericFileListWidget.setSelectionMode( - QtGui.QAbstractItemView.ExtendedSelection) - self.genericFileListWidget.setObjectName(u'genericFileListWidget') - self.genericImportLayout.addWidget(self.genericFileListWidget) - self.genericButtonLayout = QtGui.QHBoxLayout() - self.genericButtonLayout.setSpacing(8) - self.genericButtonLayout.setObjectName(u'genericButtonLayout') - self.genericAddButton = QtGui.QPushButton(self.genericImportWidget) - self.genericAddButton.setIcon(openIcon) - self.genericAddButton.setObjectName(u'genericAddButton') - self.genericButtonLayout.addWidget(self.genericAddButton) - self.genericButtonSpacer = QtGui.QSpacerItem(40, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.genericButtonLayout.addItem(self.genericButtonSpacer) - self.genericRemoveButton = QtGui.QPushButton(self.genericImportWidget) - self.genericRemoveButton.setIcon(deleteIcon) - self.genericRemoveButton.setObjectName(u'genericRemoveButton') - self.genericButtonLayout.addWidget(self.genericRemoveButton) - self.genericImportLayout.addLayout(self.genericButtonLayout) - self.genericLayout.addWidget(self.genericImportWidget) - self.formatStackedWidget.addWidget(self.genericPage) + self.addMultiFileSelectItem(u'generic', None, True) # EasyWorship - self.ewPage = QtGui.QWidget() - self.ewPage.setObjectName(u'ewPage') - self.ewLayout = QtGui.QFormLayout(self.ewPage) - self.ewLayout.setMargin(0) - self.ewLayout.setSpacing(8) - self.ewLayout.setObjectName(u'ewLayout') - self.ewFilenameLabel = QtGui.QLabel(self.ewPage) - self.ewFilenameLabel.setObjectName(u'ewFilenameLabel') - self.ewLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.ewFilenameLabel) - self.ewFileLayout = QtGui.QHBoxLayout() - self.ewFileLayout.setSpacing(8) - self.ewFileLayout.setObjectName(u'ewFileLayout') - self.ewFilenameEdit = QtGui.QLineEdit(self.ewPage) - self.ewFilenameEdit.setObjectName(u'ewFilenameEdit') - self.ewFileLayout.addWidget(self.ewFilenameEdit) - self.ewBrowseButton = QtGui.QToolButton(self.ewPage) - self.ewBrowseButton.setIcon(openIcon) - self.ewBrowseButton.setObjectName(u'ewBrowseButton') - self.ewFileLayout.addWidget(self.ewBrowseButton) - self.ewLayout.setLayout(0, QtGui.QFormLayout.FieldRole, - self.ewFileLayout) - self.formatStackedWidget.addWidget(self.ewPage) + self.addSingleFileSelectItem(u'ew') # Commented out for future use. -# self.csvPage = QtGui.QWidget() -# self.csvPage.setObjectName(u'CSVPage') -# self.csvLayout = QtGui.QFormLayout(self.csvPage) -# self.csvLayout.setMargin(0) -# self.csvLayout.setSpacing(8) -# self.csvLayout.setObjectName(u'CSVLayout') -# self.csvFilenameLabel = QtGui.QLabel(self.csvPage) -# self.csvFilenameLabel.setObjectName(u'CSVFilenameLabel') -# self.csvLayout.setWidget(0, QtGui.QFormLayout.LabelRole, -# self.csvFilenameLabel) -# self.csvFileLayout = QtGui.QHBoxLayout() -# self.csvFileLayout.setSpacing(8) -# self.csvFileLayout.setObjectName(u'CSVFileLayout') -# self.csvFilenameEdit = QtGui.QLineEdit(self.csvPage) -# self.csvFilenameEdit.setObjectName(u'CSVFilenameEdit') -# self.csvFileLayout.addWidget(self.csvFilenameEdit) -# self.csvBrowseButton = QtGui.QToolButton(self.csvPage) -# self.csvBrowseButton.setIcon(openIcon) -# self.csvBrowseButton.setObjectName(u'CSVBrowseButton') -# self.csvFileLayout.addWidget(self.csvBrowseButton) -# self.csvLayout.setLayout(0, QtGui.QFormLayout.FieldRole, -# self.csvFileLayout) -# self.formatStackedWidget.addWidget(self.csvPage) +# self.addSingleFileSelectItem(u'csv', u'CSV') self.sourceLayout.addWidget(self.formatStackedWidget) songImportWizard.addPage(self.sourcePage) self.importPage = QtGui.QWizardPage() @@ -593,3 +249,123 @@ class Ui_SongImportWizard(object): translate('SongsPlugin.ImportWizardForm', 'Ready.')) self.importProgressBar.setFormat( translate('SongsPlugin.ImportWizardForm', '%p%')) + + def addSingleFileSelectItem(self, prefix, obj_prefix=None, + can_disable=False): + if not obj_prefix: + obj_prefix = prefix + page = QtGui.QWidget() + page.setObjectName(obj_prefix + u'Page') + if can_disable: + importWidget = self.disablableWidget(page, prefix, obj_prefix) + else: + importWidget = page + importLayout = QtGui.QFormLayout(importWidget) + importLayout.setMargin(0) + importLayout.setSpacing(8) + if can_disable: + importLayout.setObjectName(obj_prefix + u'ImportLayout') + else: + importLayout.setObjectName(obj_prefix + u'Layout') + filenameLabel = QtGui.QLabel(importWidget) + filenameLabel.setObjectName(obj_prefix + u'FilenameLabel') + importLayout.setWidget(0, QtGui.QFormLayout.LabelRole, filenameLabel) + fileLayout = QtGui.QHBoxLayout() + fileLayout.setSpacing(8) + fileLayout.setObjectName(obj_prefix + u'FileLayout') + filenameEdit = QtGui.QLineEdit(importWidget) + filenameEdit.setObjectName(obj_prefix + u'FilenameEdit') + fileLayout.addWidget(filenameEdit) + browseButton = QtGui.QToolButton(importWidget) + browseButton.setIcon(self.openIcon) + browseButton.setObjectName(obj_prefix + u'BrowseButton') + fileLayout.addWidget(browseButton) + importLayout.setLayout(0, QtGui.QFormLayout.FieldRole, fileLayout) + self.formatStackedWidget.addWidget(page) + setattr(self, prefix + u'Page', page) + setattr(self, prefix + u'FilenameLabel', filenameLabel) + setattr(self, prefix + u'FileLayout', fileLayout) + setattr(self, prefix + u'FilenameEdit', filenameEdit) + setattr(self, prefix + u'BrowseButton', browseButton) + if can_disable: + setattr(self, prefix + u'ImportLayout', importLayout) + else: + setattr(self, prefix + u'Layout', importLayout) + self.formatComboBox.addItem(u'') + + def addMultiFileSelectItem(self, prefix, obj_prefix=None, + can_disable=False): + if not obj_prefix: + obj_prefix = prefix + page = QtGui.QWidget() + page.setObjectName(obj_prefix + u'Page') + if can_disable: + importWidget = self.disablableWidget(page, prefix, obj_prefix) + else: + importWidget = page + importLayout = QtGui.QVBoxLayout(importWidget) + importLayout.setMargin(0) + importLayout.setSpacing(8) + if can_disable: + importLayout.setObjectName(obj_prefix + u'ImportLayout') + else: + importLayout.setObjectName(obj_prefix + u'Layout') + fileListWidget = QtGui.QListWidget(importWidget) + fileListWidget.setSelectionMode( + QtGui.QAbstractItemView.ExtendedSelection) + fileListWidget.setObjectName(obj_prefix + u'FileListWidget') + importLayout.addWidget(fileListWidget) + buttonLayout = QtGui.QHBoxLayout() + buttonLayout.setSpacing(8) + buttonLayout.setObjectName(obj_prefix + u'ButtonLayout') + addButton = QtGui.QPushButton(importWidget) + addButton.setIcon(self.openIcon) + addButton.setObjectName(obj_prefix + u'AddButton') + buttonLayout.addWidget(addButton) + buttonSpacer = QtGui.QSpacerItem(40, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + buttonLayout.addItem(buttonSpacer) + removeButton = QtGui.QPushButton(importWidget) + removeButton.setIcon(self.deleteIcon) + removeButton.setObjectName(obj_prefix + u'RemoveButton') + buttonLayout.addWidget(removeButton) + importLayout.addLayout(buttonLayout) + self.formatStackedWidget.addWidget(page) + setattr(self, prefix + u'Page', page) + setattr(self, prefix + u'FileListWidget', fileListWidget) + setattr(self, prefix + u'ButtonLayout', buttonLayout) + setattr(self, prefix + u'ButtonSpacer', buttonSpacer) + setattr(self, prefix + u'AddButton', addButton) + setattr(self, prefix + u'RemoveButton', removeButton) + if can_disable: + setattr(self, prefix + u'ImportLayout', importLayout) + else: + setattr(self, prefix + u'Layout', importLayout) + self.formatComboBox.addItem(u'') + + def disablableWidget(self, page, prefix, obj_prefix): + layout = QtGui.QVBoxLayout(page) + layout.setMargin(0) + layout.setSpacing(0) + layout.setObjectName(obj_prefix + u'Layout') + disabledWidget = QtGui.QWidget(page) + disabledWidget.setVisible(False) + disabledWidget.setObjectName(obj_prefix + u'DisabledWidget') + disabledLayout = QtGui.QVBoxLayout(disabledWidget) + disabledLayout.setMargin(0) + disabledLayout.setSpacing(8) + disabledLayout.setObjectName(obj_prefix + u'DisabledLayout') + disabledLabel = QtGui.QLabel(disabledWidget) + disabledLabel.setWordWrap(True) + disabledLabel.setObjectName(obj_prefix + u'DisabledLabel') + disabledLayout.addWidget(disabledLabel) + layout.addWidget(disabledWidget) + importWidget = QtGui.QWidget(page) + importWidget.setObjectName(obj_prefix + u'ImportWidget') + layout.addWidget(importWidget) + setattr(self, prefix + u'Layout', layout) + setattr(self, prefix + u'DisabledWidget', disabledWidget) + setattr(self, prefix + u'DisabledLayout', disabledLayout) + setattr(self, prefix + u'DisabledLabel', disabledLabel) + setattr(self, prefix + u'ImportWidget', importWidget) + return importWidget diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 9f14698ee..008dae2d7 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -166,13 +166,13 @@ class SongMediaItem(MediaManagerItem): if search_type == 0: log.debug(u'Titles Search') search_results = self.parent.manager.get_all_objects(Song, - Song.search_title.like(u'%' + search_keywords + u'%'), + Song.search_title.like(u'%' + search_keywords.lower() + u'%'), Song.search_title.asc()) self.displayResultsSong(search_results) elif search_type == 1: log.debug(u'Lyrics Search') search_results = self.parent.manager.get_all_objects(Song, - Song.search_lyrics.like(u'%' + search_keywords + u'%'), + Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'), Song.search_lyrics.asc()) self.displayResultsSong(search_results) elif search_type == 2: diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index dcf4ed8d8..d2e0698b3 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -55,6 +55,7 @@ class SongImport(QtCore.QObject): self.set_defaults() QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_stop_import'), self.stop_import) + def set_defaults(self): """ Create defaults for properties - call this before each song @@ -262,8 +263,8 @@ class SongImport(QtCore.QObject): log.info(u'commiting song %s to database', self.title) song = Song() song.title = self.title - song.search_title = self.remove_punctuation(self.title) \ - + '@' + self.alternate_title + song.search_title = self.remove_punctuation(self.title).lower() \ + + '@' + self.remove_punctuation(self.alternate_title).lower() song.song_number = self.song_number song.search_lyrics = u'' verses_changed_to_other = {} @@ -291,6 +292,7 @@ class SongImport(QtCore.QObject): versetag = newversetag sxml.add_verse_to_lyrics(versetype, versetag[1:], versetext) song.search_lyrics += u' ' + self.remove_punctuation(versetext) + song.search_lyrics = song.search_lyrics.lower() song.lyrics = unicode(sxml.extract_xml(), u'utf-8') for i, current_verse_tag in enumerate(self.verse_order_list): if verses_changed_to_other.has_key(current_verse_tag): diff --git a/openlp/plugins/songs/lib/test/test3.opensong b/openlp/plugins/songs/lib/test/test3.opensong old mode 100755 new mode 100644 diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index c1fe3a91a..8180c9a52 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -63,7 +63,7 @@ class SongsPlugin(Plugin): log.info(u'Songs Initialising') Plugin.initialise(self) self.mediaItem.displayResultsSong( - self.manager.get_all_objects(Song, order_by_ref=Song.title)) + self.manager.get_all_objects(Song, order_by_ref=Song.search_title)) def getMediaManagerItem(self): """ diff --git a/resources/openlp.desktop b/resources/openlp.desktop index d84f69297..684119773 100755 --- a/resources/openlp.desktop +++ b/resources/openlp.desktop @@ -1,11 +1,21 @@ -#!/usr/bin/env xdg-open [Desktop Entry] +Categories=AudioVideo; +Comment[de]= +Comment= Encoding=UTF-8 -Name=OpenLP -GenericName=Church lyrics projection Exec=openlp +GenericName[de]=Church lyrics projection +GenericName=Church lyrics projection Icon=openlp +MimeType= +Name[de]=OpenLP +Name=OpenLP +Path= StartupNotify=true Terminal=false +TerminalOptions= Type=Application -Categories=AudioVideo; +X-DBUS-ServiceName= +X-DBUS-StartupType= +X-KDE-SubstituteUID=false +X-KDE-Username= diff --git a/scripts/translation_utils.py b/scripts/translation_utils.py index 4704c4dc5..424e977bd 100755 --- a/scripts/translation_utils.py +++ b/scripts/translation_utils.py @@ -157,6 +157,21 @@ def run(command): print_verbose(u'Output:\n%s' % process.readAllStandardOutput()) print u' Done.' +def update_export_at_pootle(source_filename): + """ + This is needed because of database and exported *.ts file can be out of sync + + ``source_filename`` + The file to sync. + + """ + language = source_filename[:-3] + REVIEW_URL = u'http://pootle.projecthq.biz/%s/openlp/review.html' % language + print_verbose(u'Accessing: %s' % (REVIEW_URL)) + page = urllib.urlopen(REVIEW_URL) + page.close() + + def download_file(source_filename, dest_filename): """ Download a file and save it to disk. @@ -183,11 +198,13 @@ def download_translations(): page = urllib.urlopen(SERVER_URL) soup = BeautifulSoup(page) languages = soup.findAll(text=re.compile(r'.*\.ts')) - for language in languages: + for language_file in languages: + update_export_at_pootle(language_file) + for language_file in languages: filename = os.path.join(os.path.abspath(u'..'), u'resources', u'i18n', - language) + language_file) print_verbose(u'Get Translation File: %s' % filename) - download_file(language, filename) + download_file(language_file, filename) print u' Done.' def prepare_project():