From ea83bf26d7f6347352b061261be3d7b985dd4054 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 25 Jan 2011 19:34:17 +0100 Subject: [PATCH 1/2] --- openlp/plugins/songs/forms/songexportform.py | 45 +++++++++++++++++++- openlp/plugins/songs/lib/xml.py | 2 + 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index 3b9bf3ffd..e9904e0bb 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -30,7 +30,7 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import Receiver, translate +from openlp.core.lib import Receiver, SettingsManager, translate from openlp.core.ui import criticalErrorMessageBox from openlp.core.ui.wizard import OpenLPWizard from openlp.plugins.songs.lib.db import Song @@ -158,7 +158,43 @@ class SongExportForm(OpenLPWizard): self.selectedListWidget.setSortingEnabled(True) self.verticalLayout.addWidget(self.selectedListWidget) self.sourceLayout.addWidget(self.selectedGroupBox) + + """ + importLayout.setObjectName(obj_prefix + u'Layout') + filenameLabel = QtGui.QLabel(importWidget) + filenameLabel.setObjectName(obj_prefix + u'FilenameLabel') + fileLayout = QtGui.QHBoxLayout() + 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) + """ + + + self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout.setObjectName(u'horizontalLayout') + + self.pathLabel = QtGui.QLabel() + self.pathLabel.setObjectName(u'pathLabel') + self.horizontalLayout.addWidget(self.pathLabel) + + self.pathEdit = QtGui.QLineEdit(self.sourcePage) + self.pathEdit.setObjectName(u'pathEdit') + + self.horizontalLayout.addWidget(self.pathEdit) + + self.browseButton = QtGui.QPushButton(self.sourcePage) + self.browseButton.setObjectName(u'browseButton') + self.horizontalLayout.addWidget(self.browseButton) + + self.sourceLayout.addLayout(self.horizontalLayout) self.addPage(self.sourcePage) + + #TODO: Add save dialog and maybe a search box. def retranslateUi(self): @@ -266,9 +302,14 @@ class SongExportForm(OpenLPWizard): class, and then runs the ``do_export`` method of the exporter to do the actual exporting. """ + path = unicode(QtGui.QFileDialog.getExistingDirectory(self, translate( + 'SongsPlugin.ExportWizardForm', 'Selecte to Folder'), + SettingsManager.get_last_dir(self.plugin.settingsSection, 1), + options=QtGui.QFileDialog.ShowDirsOnly)) + SettingsManager.set_last_dir(self.plugin.settingsSection, path, 1) songs = [item.data(QtCore.Qt.UserRole).toPyObject() for item in self.selectedListWidget.selectedItems()] - exporter = OpenLyricsExport(self, songs, u'/tmp/') + exporter = OpenLyricsExport(self, songs, path) if exporter.do_export(): self.progressLabel.setText( translate('SongsPlugin.SongExportForm', 'Finished export.')) diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index cc2660874..d9446ec12 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -271,6 +271,8 @@ class OpenLyrics(object): verse[0][u'type'][0].lower(), verse[0][u'label']) element = \ self._add_text_to_element(u'verse', lyrics, None, verse_tag) + if verse[0].has_key(u'lang'): + element.set(u'lang', verse[0][u'lang']) element = self._add_text_to_element(u'lines', element) for line in unicode(verse[1]).split(u'\n'): self._add_text_to_element(u'line', element, line) From 98084cbe2f012f992ba519eb5601ab5a0e7ce77a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 25 Jan 2011 19:35:00 +0100 Subject: [PATCH 2/2] --- openlp/plugins/songs/forms/songexportform.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index e9904e0bb..cbf84115b 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -173,12 +173,11 @@ class SongExportForm(OpenLPWizard): browseButton.setObjectName(obj_prefix + u'BrowseButton') fileLayout.addWidget(browseButton) """ - self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(u'horizontalLayout') - self.pathLabel = QtGui.QLabel() + self.pathLabel = QtGui.QLabel(self.sourcePage) self.pathLabel.setObjectName(u'pathLabel') self.horizontalLayout.addWidget(self.pathLabel)