← Back to team overview

openlp-core team mailing list archive

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

 

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

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol-hush/openlp/trivial/+merge/57183

Hello,

- disable/enable the next button if a bible/song importer is not available [0]
- fixed song importers being available even though they should not.

Description:
Using the try/except in oooimport prevented an exception being raised. However, this exception will be caught in the importer (which then make sure the "import" is not available:

try:
    from oooimport import OooImport
    HAS_OOO = True
except ImportError:
    HAS_OOO = False


[0] http://img3.imageshack.us/i/bildschirmfoto110420111.png/
-- 
https://code.launchpad.net/~googol-hush/openlp/trivial/+merge/57183
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/trivial into lp:openlp.
=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py	2011-04-11 15:07:26 +0000
@@ -85,8 +85,18 @@
         """
         OpenLPWizard.setupUi(self, image)
         QtCore.QObject.connect(self.formatComboBox,
-            QtCore.SIGNAL(u'currentIndexChanged(int)'), self.selectStack,
-            QtCore.SLOT(u'setCurrentIndex(int)'))
+            QtCore.SIGNAL(u'currentIndexChanged(int)'),
+            self.onCurrentIndexChanged)
+
+    def onCurrentIndexChanged(self, index):
+        """
+        Called when the format combo box's index changed. We have to check if
+        the import is available and accordingly to disable or enable the next
+        button.
+        """
+        self.selectStack.setCurrentIndex(index)
+        next_button = self.button(QtGui.QWizard.NextButton)
+        next_button.setEnabled(BibleFormat.get_availability(index))
 
     def customInit(self):
         """

=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/songs/forms/songimportform.py	2011-04-11 15:07:26 +0000
@@ -66,7 +66,17 @@
         self.formatStack.setCurrentIndex(0)
         QtCore.QObject.connect(self.formatComboBox,
             QtCore.SIGNAL(u'currentIndexChanged(int)'),
-            self.formatStack.setCurrentIndex)
+            self.onCurrentIndexChanged)
+
+    def onCurrentIndexChanged(self, index):
+        """
+        Called when the format combo box's index changed. We have to check if
+        the import is available and accordingly to disable or enable the next
+        button.
+        """
+        self.formatStack.setCurrentIndex(index)
+        next_button = self.button(QtGui.QWizard.NextButton)
+        next_button.setEnabled(SongFormat.get_availability(index))
 
     def customInit(self):
         """

=== modified file 'openlp/plugins/songs/lib/oooimport.py'
--- openlp/plugins/songs/lib/oooimport.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/songs/lib/oooimport.py	2011-04-11 15:07:26 +0000
@@ -39,12 +39,8 @@
     PAGE_AFTER = 5
     PAGE_BOTH = 6
 else:
-    try:
-        import uno
-        from com.sun.star.style.BreakType import PAGE_BEFORE, PAGE_AFTER, \
-            PAGE_BOTH
-    except ImportError:
-        pass
+    import uno
+    from com.sun.star.style.BreakType import PAGE_BEFORE, PAGE_AFTER, PAGE_BOTH
 
 class OooImport(SongImport):
     """


Follow ups