← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol-hush/openlp/fixes into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol-hush/openlp/fixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)


- fixed progress bar (bible openlp1 import)
- fixed Bug #688647  (Bible Import code requires SQLITE package to be avaliable)
- fixed "reject" method (the import would not stop, if currentId() == 2/3)
- some songbeamer import tweaks
-- 
https://code.launchpad.net/~googol-hush/openlp/fixes/+merge/43429
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/fixes into lp:openlp.
=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py	2010-12-10 17:25:40 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py	2010-12-11 20:06:14 +0000
@@ -77,6 +77,12 @@
         QtGui.QWizard.__init__(self, parent)
         self.setupUi(self)
         self.registerFields()
+        if not BibleFormat.get_availability(BibleFormat.OpenLP1):
+            self.openlp1Page.setVisible(False)
+            self.openlp1LocationLabel.setVisible(False)
+            self.openlp1LocationEdit.setVisible(False)
+            self.openlp1FileButton.setVisible(False)
+            self.openlp1DisabledLabel.setVisible(True)
         self.finishButton = self.button(QtGui.QWizard.FinishButton)
         self.cancelButton = self.button(QtGui.QWizard.CancelButton)
         self.manager = manager
@@ -102,9 +108,6 @@
         QtCore.QObject.connect(self.openlp1FileButton,
             QtCore.SIGNAL(u'clicked()'),
             self.onOpenlp1FileButtonClicked)
-        QtCore.QObject.connect(self.cancelButton,
-            QtCore.SIGNAL(u'clicked(bool)'),
-            self.onCancelButtonClicked)
         QtCore.QObject.connect(self,
             QtCore.SIGNAL(u'currentIdChanged(int)'),
             self.onCurrentIdChanged)
@@ -123,8 +126,7 @@
         log.debug('Import canceled by user.')
         if self.currentId() == 3:
             Receiver.send_message(u'bibles_stop_import')
-        else:
-            self.done(QtGui.QDialog.Rejected)
+        self.done(QtGui.QDialog.Rejected)
 
     def validateCurrentPage(self):
         """

=== modified file 'openlp/plugins/bibles/forms/bibleimportwizard.py'
--- openlp/plugins/bibles/forms/bibleimportwizard.py	2010-12-09 18:01:04 +0000
+++ openlp/plugins/bibles/forms/bibleimportwizard.py	2010-12-11 20:06:14 +0000
@@ -279,6 +279,11 @@
         self.openlp1LocationLayout.addWidget(self.openlp1FileButton)
         self.openlp1Layout.setLayout(1, QtGui.QFormLayout.FieldRole,
             self.openlp1LocationLayout)
+        self.openlp1DisabledLabel = QtGui.QLabel(self.openlp1Page)
+        self.openlp1DisabledLabel.setObjectName(u'openlp1DisabledLabel')
+        self.openlp1DisabledLabel.setVisible(False)
+        self.openlp1DisabledLabel.setWordWrap(True)
+        self.openlp1Layout.addWidget(self.openlp1DisabledLabel)
         self.formatWidget.addWidget(self.openlp1Page)
         self.selectPageLayout.addWidget(self.formatWidget)
         bibleImportWizard.addPage(self.selectPage)
@@ -417,3 +422,8 @@
         self.importProgressLabel.setText(
             translate('BiblesPlugin.ImportWizardForm', 'Ready.'))
         self.importProgressBar.setFormat(u'%p%')
+        self.openlp1DisabledLabel.setText(
+            translate('BiblesPlugin.ImportWizardForm', 'The openlp.org 1.x '
+            'importer has been disabled due to a missing Python module. If '
+            'you want to use this importer, you will need to install the '
+            '"python-sqlite" module.'))

=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py	2010-12-08 17:56:29 +0000
+++ openlp/plugins/bibles/lib/manager.py	2010-12-11 20:06:14 +0000
@@ -35,9 +35,14 @@
 
 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 @@
     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,13 @@
             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)
 
 class BibleManager(object):
     """
@@ -339,3 +352,7 @@
         """
         for bible in self.db_cache:
             self.db_cache[bible].finalise()
+
+BibleFormat.set_availability(BibleFormat.OpenLP1, has_openlp1)
+
+__all__ = [u'BibleFormat']

=== modified file 'openlp/plugins/bibles/lib/openlp1.py'
--- openlp/plugins/bibles/lib/openlp1.py	2010-12-09 13:35:17 +0000
+++ openlp/plugins/bibles/lib/openlp1.py	2010-12-11 20:06:14 +0000
@@ -62,6 +62,7 @@
         # Create all books.
         cursor.execute(u'SELECT id, testament_id, name, abbreviation FROM book')
         books = cursor.fetchall()
+        self.wizard.importProgressBar.setMaximum(len(books) + 1)
         for book in books:
             if self.stop_import_flag:
                 connection.close()

=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py	2010-12-08 23:33:38 +0000
+++ openlp/plugins/songs/forms/songimportform.py	2010-12-11 20:06:14 +0000
@@ -136,8 +136,7 @@
         log.debug('Import canceled by user.')
         if self.currentId() == 2:
             Receiver.send_message(u'songs_stop_import')
-        else:
-            self.done(QtGui.QDialog.Rejected)
+        self.done(QtGui.QDialog.Rejected)
 
     def validateCurrentPage(self):
         """

=== modified file 'openlp/plugins/songs/forms/songimportwizard.py'
--- openlp/plugins/songs/forms/songimportwizard.py	2010-09-30 05:04:43 +0000
+++ openlp/plugins/songs/forms/songimportwizard.py	2010-12-11 20:06:14 +0000
@@ -350,7 +350,7 @@
         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)

=== modified file 'openlp/plugins/songs/lib/songbeamerimport.py'
--- openlp/plugins/songs/lib/songbeamerimport.py	2010-12-09 17:44:18 +0000
+++ openlp/plugins/songs/lib/songbeamerimport.py	2010-12-11 20:06:14 +0000
@@ -32,6 +32,7 @@
 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 @@
         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 @@
                     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 @@
                     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 @@
             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):
         """


Follow ups