diff --git a/.eric4project/openlp.org 2.0.e4q b/.eric4project/openlp.org 2.0.e4q index 6279a779d..6909a9271 100644 --- a/.eric4project/openlp.org 2.0.e4q +++ b/.eric4project/openlp.org 2.0.e4q @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/.eric4project/openlp.org 2.0.e4t b/.eric4project/openlp.org 2.0.e4t index d85c5718e..ac9a81c5e 100644 --- a/.eric4project/openlp.org 2.0.e4t +++ b/.eric4project/openlp.org 2.0.e4t @@ -1,7 +1,7 @@ - + TODO: what is the tags for bridge, pre-chorus? diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index fd4838667..50eb5638b 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -44,10 +44,10 @@ class Plugin(object): Provides the Plugin with a handle to check if it can be loaded. * get_media_manager_item() Returns an instance of MediaManagerItem to be used in the Media Manager. - * get_import_menu_item() - Returns an item for the Import menu. - * get_export_menu_item() - Returns an item for the Export menu. + * add_import_menu_item(import_menu) + Add an item to the Import menu. + * add_export_menu_item(export_menu) + Add an item to the Export menu. * get_settings_tab() Returns an instance of SettingsTab to be used in the Settings dialog. * add_to_menu(menubar) @@ -103,13 +103,13 @@ class Plugin(object): """ pass - def get_import_menu_item(self): + def add_import_menu_item(self, import_menu): """ Create a menu item and add it to the "Import" menu. """ pass - def get_export_menu_item(self): + def add_export_menu_item(self, export_menu): """ Create a menu item and add it to the "Export" menu. """ diff --git a/openlp/core/pluginmanager.py b/openlp/core/pluginmanager.py index d340c5222..fd4dbc8d5 100644 --- a/openlp/core/pluginmanager.py +++ b/openlp/core/pluginmanager.py @@ -91,5 +91,9 @@ class PluginManager(object): mediatoolbox.addItem(media_manager_item, plugin.icon, media_manager_item.title) plugin.initialise() + def hook_import_menu(self, import_menu): + for plugin in self.plugins: + plugin.add_import_menu_item(import_menu) + def hook_handle_event(self, event): pass diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 8f2ed7444..c541b91b7 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -112,8 +112,9 @@ class MainWindow(object): self.FileMenu.setObjectName("FileMenu") self.FileImportMenu = QtGui.QMenu(self.FileMenu) self.FileImportMenu.setObjectName("FileImportMenu") - self.ImportSongMenu = QtGui.QMenu(self.FileImportMenu) - self.ImportSongMenu.setObjectName("ImportSongMenu") + # Call the hook method to pull in import menus. + self.plugin_manager.hook_import_menu(self.FileImportMenu) + # self.FileExportMenu = QtGui.QMenu(self.FileMenu) self.FileExportMenu.setObjectName("FileExportMenu") self.ExportSongMenu = QtGui.QMenu(self.FileExportMenu) @@ -331,12 +332,6 @@ class MainWindow(object): self.HelpOnlineHelpItem.setObjectName("HelpOnlineHelpItem") self.HelpWebSiteItem = QtGui.QAction(self.main_window) self.HelpWebSiteItem.setObjectName("HelpWebSiteItem") - self.ImportOpenSongItem = QtGui.QAction(self.main_window) - self.ImportOpenSongItem.setObjectName("ImportOpenSongItem") - self.ImportOpenlp1Item = QtGui.QAction(self.main_window) - self.ImportOpenlp1Item.setObjectName("ImportOpenlp1Item") - self.ImportOpenlp2Item = QtGui.QAction(self.main_window) - self.ImportOpenlp2Item.setObjectName("ImportOpenlp2Item") self.ExportOpenSongItem = QtGui.QAction(self.main_window) self.ExportOpenSongItem.setObjectName("ExportOpenSongItem") self.ExportOpenlp1Item = QtGui.QAction(self.main_window) @@ -358,10 +353,6 @@ class MainWindow(object): self.action_Preview_Pane.setObjectName("action_Preview_Pane") self.ModeLiveItem = QtGui.QAction(self.main_window) self.ModeLiveItem.setObjectName("ModeLiveItem") - self.ImportSongMenu.addAction(self.ImportOpenlp1Item) - self.ImportSongMenu.addAction(self.ImportOpenlp2Item) - self.ImportSongMenu.addAction(self.ImportOpenSongItem) - self.FileImportMenu.addAction(self.ImportSongMenu.menuAction()) self.FileImportMenu.addAction(self.ImportBibleItem) self.FileImportMenu.addAction(self.ImportThemeItem) self.FileImportMenu.addAction(self.ImportLanguageItem) @@ -434,7 +425,6 @@ class MainWindow(object): self.main_window.setWindowTitle(QtGui.QApplication.translate("main_window", "openlp.org 2.0", None, QtGui.QApplication.UnicodeUTF8)) self.FileMenu.setTitle(QtGui.QApplication.translate("main_window", "&File", None, QtGui.QApplication.UnicodeUTF8)) self.FileImportMenu.setTitle(QtGui.QApplication.translate("main_window", "&Import", None, QtGui.QApplication.UnicodeUTF8)) - self.ImportSongMenu.setTitle(QtGui.QApplication.translate("main_window", "&Song", None, QtGui.QApplication.UnicodeUTF8)) self.FileExportMenu.setTitle(QtGui.QApplication.translate("main_window", "&Export", None, QtGui.QApplication.UnicodeUTF8)) self.ExportSongMenu.setTitle(QtGui.QApplication.translate("main_window", "&Song", None, QtGui.QApplication.UnicodeUTF8)) self.OptionsMenu.setTitle(QtGui.QApplication.translate("main_window", "&Options", None, QtGui.QApplication.UnicodeUTF8)) @@ -509,13 +499,6 @@ class MainWindow(object): self.HelpAboutItem.setShortcut(QtGui.QApplication.translate("main_window", "Ctrl+F1", None, QtGui.QApplication.UnicodeUTF8)) self.HelpOnlineHelpItem.setText(QtGui.QApplication.translate("main_window", "&Online Help", None, QtGui.QApplication.UnicodeUTF8)) self.HelpWebSiteItem.setText(QtGui.QApplication.translate("main_window", "&Web Site", None, QtGui.QApplication.UnicodeUTF8)) - self.ImportOpenSongItem.setText(QtGui.QApplication.translate("main_window", "OpenSong", None, QtGui.QApplication.UnicodeUTF8)) - self.ImportOpenlp1Item.setText(QtGui.QApplication.translate("main_window", "openlp.org 1.0", None, QtGui.QApplication.UnicodeUTF8)) - self.ImportOpenlp1Item.setToolTip(QtGui.QApplication.translate("main_window", "Export songs in openlp.org 1.0 format", None, QtGui.QApplication.UnicodeUTF8)) - self.ImportOpenlp1Item.setStatusTip(QtGui.QApplication.translate("main_window", "Export songs in openlp.org 1.0 format", None, QtGui.QApplication.UnicodeUTF8)) - self.ImportOpenlp2Item.setText(QtGui.QApplication.translate("main_window", "OpenLP 2.0", None, QtGui.QApplication.UnicodeUTF8)) - self.ImportOpenlp2Item.setToolTip(QtGui.QApplication.translate("main_window", "Export songs in OpenLP 2.0 format", None, QtGui.QApplication.UnicodeUTF8)) - self.ImportOpenlp2Item.setStatusTip(QtGui.QApplication.translate("main_window", "Export songs in OpenLP 2.0 format", None, QtGui.QApplication.UnicodeUTF8)) self.ExportOpenSongItem.setText(QtGui.QApplication.translate("main_window", "OpenSong", None, QtGui.QApplication.UnicodeUTF8)) self.ExportOpenlp1Item.setText(QtGui.QApplication.translate("main_window", "openlp.org 1.0", None, QtGui.QApplication.UnicodeUTF8)) self.ExportOpenlp2Item.setText(QtGui.QApplication.translate("main_window", "OpenLP 2.0", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index ba03a98cd..e1431afba 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -22,7 +22,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.resources import * from openlp.core.lib import Plugin, MediaManagerItem -from forms import EditSongForm +from forms import EditSongForm, OpenLPImportForm class SongsPlugin(Plugin): def __init__(self): @@ -30,6 +30,7 @@ class SongsPlugin(Plugin): Plugin.__init__(self, 'Songs', '1.9.0') self.weight = -10 self.edit_song_form = EditSongForm() + self.openlp_import_form = OpenLPImportForm() # Create the plugin icon self.icon = QtGui.QIcon() self.icon.addPixmap(QtGui.QPixmap(':/media/media_song.png'), @@ -63,7 +64,6 @@ class SongsPlugin(Plugin): 'Add the selected song(s) to the service', ':/system/system_add.png', self.onSongAddClick, 'SongAddItem') ## Add the songlist widget ## - # Create the tab widget self.SongWidget = QtGui.QWidget(self.MediaManagerItem) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) @@ -72,7 +72,6 @@ class SongsPlugin(Plugin): sizePolicy.setHeightForWidth(self.SongWidget.sizePolicy().hasHeightForWidth()) self.SongWidget.setSizePolicy(sizePolicy) self.SongWidget.setObjectName('SongWidget') - self.SearchLayout = QtGui.QGridLayout(self.SongWidget) self.SearchLayout.setObjectName('SearchLayout') self.SearchTypeComboBox = QtGui.QComboBox(self.SongWidget) @@ -82,7 +81,6 @@ class SongsPlugin(Plugin): self.SearchTypeLabel.setObjectName('SearchTypeLabel') self.SearchTypeLabel.setText('Search Type:') self.SearchLayout.addWidget(self.SearchTypeLabel, 0, 0, 1, 1) - self.SearchTextLabel = QtGui.QLabel(self.SongWidget) self.SearchTextLabel.setObjectName('SearchTextLabel') self.SearchTextLabel.setText('Search Text:') @@ -94,17 +92,39 @@ class SongsPlugin(Plugin): self.SearchTextButton.setObjectName('SearchTextButton') self.SearchTextButton.setText('Search') self.SearchLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1) - # Add the song widget to the page layout self.MediaManagerItem.PageLayout.addWidget(self.SongWidget) - - self.listView = QtGui.QListWidget() - self.listView.setGeometry(QtCore.QRect(10, 100, 256, 591)) - self.listView.setObjectName("listView") - self.MediaManagerItem.PageLayout.addWidget(self.listView) - + self.SongListView = QtGui.QListWidget() + self.SongListView.setGeometry(QtCore.QRect(10, 100, 256, 591)) + self.SongListView.setObjectName("listView") + self.MediaManagerItem.PageLayout.addWidget(self.SongListView) return self.MediaManagerItem + def add_import_menu_item(self, import_menu): + self.ImportSongMenu = QtGui.QMenu(import_menu) + self.ImportSongMenu.setObjectName("ImportSongMenu") + self.ImportOpenSongItem = QtGui.QAction(import_menu) + self.ImportOpenSongItem.setObjectName("ImportOpenSongItem") + self.ImportOpenlp1Item = QtGui.QAction(import_menu) + self.ImportOpenlp1Item.setObjectName("ImportOpenlp1Item") + self.ImportOpenlp2Item = QtGui.QAction(import_menu) + self.ImportOpenlp2Item.setObjectName("ImportOpenlp2Item") + self.ImportSongMenu.addAction(self.ImportOpenlp1Item) + self.ImportSongMenu.addAction(self.ImportOpenlp2Item) + self.ImportSongMenu.addAction(self.ImportOpenSongItem) + import_menu.addAction(self.ImportSongMenu.menuAction()) + # Translations... + self.ImportSongMenu.setTitle(QtGui.QApplication.translate("main_window", "&Song", None, QtGui.QApplication.UnicodeUTF8)) + self.ImportOpenSongItem.setText(QtGui.QApplication.translate("main_window", "OpenSong", None, QtGui.QApplication.UnicodeUTF8)) + self.ImportOpenlp1Item.setText(QtGui.QApplication.translate("main_window", "openlp.org 1.0", None, QtGui.QApplication.UnicodeUTF8)) + self.ImportOpenlp1Item.setToolTip(QtGui.QApplication.translate("main_window", "Export songs in openlp.org 1.0 format", None, QtGui.QApplication.UnicodeUTF8)) + self.ImportOpenlp1Item.setStatusTip(QtGui.QApplication.translate("main_window", "Export songs in openlp.org 1.0 format", None, QtGui.QApplication.UnicodeUTF8)) + self.ImportOpenlp2Item.setText(QtGui.QApplication.translate("main_window", "OpenLP 2.0", None, QtGui.QApplication.UnicodeUTF8)) + self.ImportOpenlp2Item.setToolTip(QtGui.QApplication.translate("main_window", "Export songs in OpenLP 2.0 format", None, QtGui.QApplication.UnicodeUTF8)) + self.ImportOpenlp2Item.setStatusTip(QtGui.QApplication.translate("main_window", "Export songs in OpenLP 2.0 format", None, QtGui.QApplication.UnicodeUTF8)) + # Signals and slots + QtCore.QObject.connect(self.ImportOpenlp1Item, QtCore.SIGNAL("triggered()"), self.onImportOpenlp1ItemClick) + def initialise(self): self.SearchTypeComboBox.addItem("Lyrics") self.SearchTypeComboBox.addItem("Titles") @@ -127,3 +147,6 @@ class SongsPlugin(Plugin): def onSongAddClick(self): pass + + def onImportOpenlp1ItemClick(self): + self.openlp_import_form.show()