← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/ooo-fix into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/ooo-fix into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)


Fix the song plugin's dependence on OOo.
-- 
https://code.launchpad.net/~raoul-snyman/openlp/ooo-fix/+merge/28465
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/ooo-fix into lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2010-06-24 19:04:18 +0000
+++ openlp/core/lib/__init__.py	2010-06-24 21:00:43 +0000
@@ -159,6 +159,7 @@
     painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
     return new_image
 
+<<<<<<< TREE
 def check_item_selected(list_widget, message):
     """
     Check if a list item is selected so an action may be performed on it
@@ -175,6 +176,24 @@
         return False
     return True
 
+=======
+def check_item_selected(list_widget, message):
+    """
+    Check if a list item is selected so an action may be performed on it
+
+    ``list_widget``
+        The list to check for selected items
+
+    ``message``
+        The message to give the user if no item is selected
+    """
+    if not list_widget.selectedIndexes():
+        QtGui.QMessageBox.information(self,
+            translate('MediaManagerItem', 'No Items Selected'), message)
+        return False
+    return True
+
+>>>>>>> MERGE-SOURCE
 
 class ThemeLevel(object):
     """

=== modified file 'openlp/plugins/songs/lib/__init__.py'
--- openlp/plugins/songs/lib/__init__.py	2010-06-21 16:43:59 +0000
+++ openlp/plugins/songs/lib/__init__.py	2010-06-24 21:00:43 +0000
@@ -94,6 +94,10 @@
 from manager import SongManager
 from songstab import SongsTab
 from mediaitem import SongMediaItem
-from sofimport import SofImport
-from oooimport import OooImport
-from songimport import SongImport
\ No newline at end of file
+from songimport import SongImport
+try:
+    from sofimport import SofImport
+    from oooimport import OooImport
+except ImportError:
+    pass
+

=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py	2010-06-23 17:37:01 +0000
+++ openlp/plugins/songs/songsplugin.py	2010-06-24 21:00:43 +0000
@@ -29,8 +29,13 @@
 
 from openlp.core.lib import Plugin, build_icon, PluginStatus, Receiver, \
     translate
-from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab, \
-    SofImport, OooImport
+from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab
+
+try:
+    from openlp.plugins.songs.lib import SofImport, OooImport
+    OOo_available = True
+except ImportError:
+    OOo_available = False
 
 log = logging.getLogger(__name__)
 
@@ -95,46 +100,48 @@
         self.SongImportItem.setToolTip(translate('SongsPlugin',
             'Import songs using the import wizard.'))
         import_menu.addAction(self.SongImportItem)
-        # Songs of Fellowship import menu item - will be removed and the
-        # functionality will be contained within the import wizard
-        self.ImportSofItem = QtGui.QAction(import_menu)
-        self.ImportSofItem.setObjectName(u'ImportSofItem')
-        self.ImportSofItem.setText(
-            translate('SongsPlugin',
-                'Songs of Fellowship (temp menu item)'))
-        self.ImportSofItem.setToolTip(
-            translate('SongsPlugin',
-                'Import songs from the VOLS1_2.RTF, sof3words' \
-                + '.rtf and sof4words.rtf supplied with the music books'))
-        self.ImportSofItem.setStatusTip(
-            translate('SongsPlugin',
-                'Import songs from the VOLS1_2.RTF, sof3words' \
-                + '.rtf and sof4words.rtf supplied with the music books'))
-        import_menu.addAction(self.ImportSofItem)
-        # OpenOffice.org import menu item - will be removed and the
-        # functionality will be contained within the import wizard
-        self.ImportOooItem = QtGui.QAction(import_menu)
-        self.ImportOooItem.setObjectName(u'ImportOooItem')
-        self.ImportOooItem.setText(
-            translate('SongsPlugin',
-                'Generic Document/Presentation Import '
-                '(temp menu item)'))
-        self.ImportOooItem.setToolTip(
-            translate('SongsPlugin',
-                'Import songs from '
-                'Word/Writer/Powerpoint/Impress'))
-        self.ImportOooItem.setStatusTip(
-            translate('SongsPlugin',
-                'Import songs from '
-                'Word/Writer/Powerpoint/Impress'))
-        import_menu.addAction(self.ImportOooItem)
         # Signals and slots
         QtCore.QObject.connect(self.SongImportItem,
             QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked)
-        QtCore.QObject.connect(self.ImportSofItem,
-            QtCore.SIGNAL(u'triggered()'), self.onImportSofItemClick)
-        QtCore.QObject.connect(self.ImportOooItem,
-            QtCore.SIGNAL(u'triggered()'), self.onImportOooItemClick)
+        if OOo_available:
+            # Songs of Fellowship import menu item - will be removed and the
+            # functionality will be contained within the import wizard
+            self.ImportSofItem = QtGui.QAction(import_menu)
+            self.ImportSofItem.setObjectName(u'ImportSofItem')
+            self.ImportSofItem.setText(
+                translate('SongsPlugin',
+                    'Songs of Fellowship (temp menu item)'))
+            self.ImportSofItem.setToolTip(
+                translate('SongsPlugin',
+                    'Import songs from the VOLS1_2.RTF, sof3words' \
+                    + '.rtf and sof4words.rtf supplied with the music books'))
+            self.ImportSofItem.setStatusTip(
+                translate('SongsPlugin',
+                    'Import songs from the VOLS1_2.RTF, sof3words' \
+                    + '.rtf and sof4words.rtf supplied with the music books'))
+            import_menu.addAction(self.ImportSofItem)
+            # OpenOffice.org import menu item - will be removed and the
+            # functionality will be contained within the import wizard
+            self.ImportOooItem = QtGui.QAction(import_menu)
+            self.ImportOooItem.setObjectName(u'ImportOooItem')
+            self.ImportOooItem.setText(
+                translate('SongsPlugin',
+                    'Generic Document/Presentation Import '
+                    '(temp menu item)'))
+            self.ImportOooItem.setToolTip(
+                translate('SongsPlugin',
+                    'Import songs from '
+                    'Word/Writer/Powerpoint/Impress'))
+            self.ImportOooItem.setStatusTip(
+                translate('SongsPlugin',
+                    'Import songs from '
+                    'Word/Writer/Powerpoint/Impress'))
+            import_menu.addAction(self.ImportOooItem)
+            # Signals and slots
+            QtCore.QObject.connect(self.ImportSofItem,
+                QtCore.SIGNAL(u'triggered()'), self.onImportSofItemClick)
+            QtCore.QObject.connect(self.ImportOooItem,
+                QtCore.SIGNAL(u'triggered()'), self.onImportOooItemClick)
 
     def add_export_menu_item(self, export_menu):
         """


Follow ups