From 62643d7d5e3d94660fe5085b7d5b5c70194f85a9 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 11 Dec 2010 10:40:52 +0100 Subject: [PATCH 1/2] string change, close file, MarkType --- openlp/plugins/songs/lib/songbeamerimport.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/lib/songbeamerimport.py b/openlp/plugins/songs/lib/songbeamerimport.py index 4980c2cff..30d29c1be 100644 --- a/openlp/plugins/songs/lib/songbeamerimport.py +++ b/openlp/plugins/songs/lib/songbeamerimport.py @@ -32,6 +32,7 @@ import os import chardet import codecs +from openlp.core.lib import translate from openlp.plugins.songs.lib.songimport import SongImport log = logging.getLogger(__name__) @@ -54,7 +55,8 @@ class SongBeamerTypes(object): u'Pre-Bridge': u'O', u'Pre-Coda': u'O', u'Unbekannt': u'O', - u'Unknown': u'O' + u'Unknown': u'O', + u'Unbenannt': u'O' } @@ -100,6 +102,7 @@ class SongBeamerImport(SongImport): detect_file.close() infile = codecs.open(file, u'r', details['encoding']) self.songData = infile.readlines() + infile.close() else: return False for line in self.songData: @@ -127,8 +130,9 @@ class SongBeamerImport(SongImport): self.replace_html_tags() self.add_verse(self.current_verse, self.current_verse_type) self.finish() - self.import_wizard.incrementProgressBar( - "Importing %s" % (self.file_name)) + self.import_wizard.incrementProgressBar(u'%s %s...' % + (translate('SongsPlugin.SongBeamerImport', 'Importing'), + self.file_name)) return True def replace_html_tags(self): @@ -263,6 +267,9 @@ class SongBeamerImport(SongImport): pass elif tag_val[0] == u'#Version': pass + elif tag_val[0] == u'#VerseOrder': + # TODO: add the verse order. + pass def check_verse_marks(self, line): """ From ce0abd19bd1439bbb912e7b34a00e5298fdbfc2e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 11 Dec 2010 10:53:30 +0100 Subject: [PATCH 2/2] string change, close file, MarkType --- openlp/plugins/bibles/lib/manager.py | 20 +++++++++++++++++++- openlp/plugins/bibles/lib/openlp1.py | 2 +- openlp/plugins/songs/lib/importer.py | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 794c9c5f7..8d554b16b 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -35,9 +35,14 @@ from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta from csvbible import CSVBible from http import HTTPBible -from openlp1 import OpenLP1Bible from opensong import OpenSongBible from osis import OSISBible +# Imports that might fail. +try: + from openlp1 import OpenLP1Bible + has_openlp1 = True +except ImportError: + has_openlp1 = False log = logging.getLogger(__name__) @@ -57,6 +62,7 @@ class BibleFormat(object): plus a few helper functions to facilitate generic handling of Bible types for importing. """ + _format_availability = {} Unknown = -1 OSIS = 0 CSV = 1 @@ -98,6 +104,18 @@ class BibleFormat(object): BibleFormat.OpenLP1 ] + @staticmethod + def set_availability(format, available): + BibleFormat._format_availability[format] = available + + @staticmethod + def get_availability(format): + return BibleFormat._format_availability.get(format, True) + +BibleFormat.set_availability(BibleFormat.OpenLP1, has_openlp1) + +__all__ = [u'BibleFormat'] + class BibleManager(object): """ diff --git a/openlp/plugins/bibles/lib/openlp1.py b/openlp/plugins/bibles/lib/openlp1.py index 7f8a8d17e..4b12ba52d 100755 --- a/openlp/plugins/bibles/lib/openlp1.py +++ b/openlp/plugins/bibles/lib/openlp1.py @@ -25,7 +25,7 @@ ############################################################################### import logging -import sqlite +import sqlitse from PyQt4 import QtCore diff --git a/openlp/plugins/songs/lib/importer.py b/openlp/plugins/songs/lib/importer.py index 63d19b95c..2d249b4de 100644 --- a/openlp/plugins/songs/lib/importer.py +++ b/openlp/plugins/songs/lib/importer.py @@ -53,7 +53,7 @@ class SongFormat(object): plus a few helper functions to facilitate generic handling of song types for importing. """ - _format_availability = {} + format_availability = {} Unknown = -1 OpenLP2 = 0 OpenLP1 = 1