Added export songs menu to export menu.

bzr-revno: 238
This commit is contained in:
Raoul Snyman 2008-12-17 12:38:02 +00:00
parent f6cc0ecf94
commit 90c45ac148
3 changed files with 49 additions and 23 deletions

View File

@ -92,8 +92,20 @@ class PluginManager(object):
plugin.initialise() plugin.initialise()
def hook_import_menu(self, import_menu): def hook_import_menu(self, import_menu):
"""
Loop through all the plugins and give them an opportunity to add an item
to the import menu.
"""
for plugin in self.plugins: for plugin in self.plugins:
plugin.add_import_menu_item(import_menu) plugin.add_import_menu_item(import_menu)
def hook_export_menu(self, export_menu):
"""
Loop through all the plugins and give them an opportunity to add an item
to the export menu.
"""
for plugin in self.plugins:
plugin.add_export_menu_item(export_menu)
def hook_handle_event(self, event): def hook_handle_event(self, event):
pass pass

View File

@ -117,8 +117,9 @@ class MainWindow(object):
# #
self.FileExportMenu = QtGui.QMenu(self.FileMenu) self.FileExportMenu = QtGui.QMenu(self.FileMenu)
self.FileExportMenu.setObjectName("FileExportMenu") self.FileExportMenu.setObjectName("FileExportMenu")
self.ExportSongMenu = QtGui.QMenu(self.FileExportMenu) # Call the hook method to pull in export menus.
self.ExportSongMenu.setObjectName("ExportSongMenu") self.plugin_manager.hook_import_menu(self.FileExportMenu)
#
self.OptionsMenu = QtGui.QMenu(self.MenuBar) self.OptionsMenu = QtGui.QMenu(self.MenuBar)
self.OptionsMenu.setObjectName("OptionsMenu") self.OptionsMenu.setObjectName("OptionsMenu")
self.OptionsViewMenu = QtGui.QMenu(self.OptionsMenu) self.OptionsViewMenu = QtGui.QMenu(self.OptionsMenu)
@ -332,12 +333,6 @@ class MainWindow(object):
self.HelpOnlineHelpItem.setObjectName("HelpOnlineHelpItem") self.HelpOnlineHelpItem.setObjectName("HelpOnlineHelpItem")
self.HelpWebSiteItem = QtGui.QAction(self.main_window) self.HelpWebSiteItem = QtGui.QAction(self.main_window)
self.HelpWebSiteItem.setObjectName("HelpWebSiteItem") self.HelpWebSiteItem.setObjectName("HelpWebSiteItem")
self.ExportOpenSongItem = QtGui.QAction(self.main_window)
self.ExportOpenSongItem.setObjectName("ExportOpenSongItem")
self.ExportOpenlp1Item = QtGui.QAction(self.main_window)
self.ExportOpenlp1Item.setObjectName("ExportOpenlp1Item")
self.ExportOpenlp2Item = QtGui.QAction(self.main_window)
self.ExportOpenlp2Item.setObjectName("ExportOpenlp2Item")
self.LanguageTranslateItem = QtGui.QAction(self.main_window) self.LanguageTranslateItem = QtGui.QAction(self.main_window)
self.LanguageTranslateItem.setObjectName("LanguageTranslateItem") self.LanguageTranslateItem.setObjectName("LanguageTranslateItem")
self.LanguageEnglishItem = QtGui.QAction(self.main_window) self.LanguageEnglishItem = QtGui.QAction(self.main_window)
@ -356,10 +351,6 @@ class MainWindow(object):
self.FileImportMenu.addAction(self.ImportBibleItem) self.FileImportMenu.addAction(self.ImportBibleItem)
self.FileImportMenu.addAction(self.ImportThemeItem) self.FileImportMenu.addAction(self.ImportThemeItem)
self.FileImportMenu.addAction(self.ImportLanguageItem) self.FileImportMenu.addAction(self.ImportLanguageItem)
self.ExportSongMenu.addAction(self.ExportOpenlp1Item)
self.ExportSongMenu.addAction(self.ExportOpenlp2Item)
self.ExportSongMenu.addAction(self.ExportOpenSongItem)
self.FileExportMenu.addAction(self.ExportSongMenu.menuAction())
self.FileExportMenu.addAction(self.ExportBibleItem) self.FileExportMenu.addAction(self.ExportBibleItem)
self.FileExportMenu.addAction(self.ExportThemeItem) self.FileExportMenu.addAction(self.ExportThemeItem)
self.FileExportMenu.addAction(self.ExportLanguageItem) self.FileExportMenu.addAction(self.ExportLanguageItem)
@ -411,22 +402,15 @@ class MainWindow(object):
QtCore.QObject.connect(self.ServiceManagerDock, QtCore.SIGNAL("visibilityChanged(bool)"), self.ViewServiceManagerItem.setChecked) QtCore.QObject.connect(self.ServiceManagerDock, QtCore.SIGNAL("visibilityChanged(bool)"), self.ViewServiceManagerItem.setChecked)
QtCore.QObject.connect(self.ThemeManagerDock, QtCore.SIGNAL("visibilityChanged(bool)"), self.ViewThemeManagerItem.setChecked) QtCore.QObject.connect(self.ThemeManagerDock, QtCore.SIGNAL("visibilityChanged(bool)"), self.ViewThemeManagerItem.setChecked)
QtCore.QMetaObject.connectSlotsByName(self.main_window) QtCore.QMetaObject.connectSlotsByName(self.main_window)
QtCore.QObject.connect(self.HelpAboutItem, QtCore.SIGNAL("triggered()"), self.onHelpAboutItemClicked) QtCore.QObject.connect(self.HelpAboutItem, QtCore.SIGNAL("triggered()"), self.onHelpAboutItemClicked)
QtCore.QObject.connect(self.ToolsAlertItem, QtCore.SIGNAL("triggered()"), self.onToolsAlertItemClicked) QtCore.QObject.connect(self.ToolsAlertItem, QtCore.SIGNAL("triggered()"), self.onToolsAlertItemClicked)
QtCore.QObject.connect(self.OptionsSettingsItem, QtCore.SIGNAL("triggered()"), self.onOptionsSettingsItemClicked) QtCore.QObject.connect(self.OptionsSettingsItem, QtCore.SIGNAL("triggered()"), self.onOptionsSettingsItemClicked)
#QtCore.QObject.connect(self.SongEditItem, QtCore.SIGNAL("clicked()"), self.onSongEditItemClicked)
#QtCore.QObject.connect(self.ImportOpenlp1Item, QtCore.SIGNAL("triggered()"), self.onImportOpenlp1ItemClicked)
#QtCore.QObject.connect(self.ExportOpenlp1Item, QtCore.SIGNAL("triggered()"), self.onExportOpenlp1ItemClicked)
#QtCore.QObject.connect(self.ImportOpenSongItem, QtCore.SIGNAL("triggered()"), self.onImportOpenSongItemClicked)
#QtCore.QObject.connect(self.ExportOpenSongItem, QtCore.SIGNAL("triggered()"), self.onExportOpenSongItemClicked)
def retranslateUi(self): def retranslateUi(self):
self.main_window.setWindowTitle(QtGui.QApplication.translate("main_window", "openlp.org 2.0", None, QtGui.QApplication.UnicodeUTF8)) 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.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.FileImportMenu.setTitle(QtGui.QApplication.translate("main_window", "&Import", None, QtGui.QApplication.UnicodeUTF8))
self.FileExportMenu.setTitle(QtGui.QApplication.translate("main_window", "&Export", 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)) self.OptionsMenu.setTitle(QtGui.QApplication.translate("main_window", "&Options", None, QtGui.QApplication.UnicodeUTF8))
self.OptionsViewMenu.setTitle(QtGui.QApplication.translate("main_window", "&View", None, QtGui.QApplication.UnicodeUTF8)) self.OptionsViewMenu.setTitle(QtGui.QApplication.translate("main_window", "&View", None, QtGui.QApplication.UnicodeUTF8))
self.ViewModeMenu.setTitle(QtGui.QApplication.translate("main_window", "M&ode", None, QtGui.QApplication.UnicodeUTF8)) self.ViewModeMenu.setTitle(QtGui.QApplication.translate("main_window", "M&ode", None, QtGui.QApplication.UnicodeUTF8))
@ -499,9 +483,6 @@ class MainWindow(object):
self.HelpAboutItem.setShortcut(QtGui.QApplication.translate("main_window", "Ctrl+F1", None, QtGui.QApplication.UnicodeUTF8)) 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.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.HelpWebSiteItem.setText(QtGui.QApplication.translate("main_window", "&Web Site", 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))
self.LanguageTranslateItem.setText(QtGui.QApplication.translate("main_window", "&Translate", None, QtGui.QApplication.UnicodeUTF8)) self.LanguageTranslateItem.setText(QtGui.QApplication.translate("main_window", "&Translate", None, QtGui.QApplication.UnicodeUTF8))
self.LanguageTranslateItem.setStatusTip(QtGui.QApplication.translate("main_window", "Translate the interface to your language", None, QtGui.QApplication.UnicodeUTF8)) self.LanguageTranslateItem.setStatusTip(QtGui.QApplication.translate("main_window", "Translate the interface to your language", None, QtGui.QApplication.UnicodeUTF8))
self.LanguageEnglishItem.setText(QtGui.QApplication.translate("main_window", "English", None, QtGui.QApplication.UnicodeUTF8)) self.LanguageEnglishItem.setText(QtGui.QApplication.translate("main_window", "English", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -22,7 +22,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.resources import * from openlp.core.resources import *
from openlp.core.lib import Plugin, MediaManagerItem from openlp.core.lib import Plugin, MediaManagerItem
from forms import EditSongForm, OpenLPImportForm, OpenSongImportForm from forms import EditSongForm, OpenLPImportForm, OpenSongImportForm, \
OpenLPExportForm, OpenSongExportForm
class SongsPlugin(Plugin): class SongsPlugin(Plugin):
def __init__(self): def __init__(self):
@ -32,6 +33,8 @@ class SongsPlugin(Plugin):
self.edit_song_form = EditSongForm() self.edit_song_form = EditSongForm()
self.openlp_import_form = OpenLPImportForm() self.openlp_import_form = OpenLPImportForm()
self.opensong_import_form = OpenSongImportForm() self.opensong_import_form = OpenSongImportForm()
self.openlp_export_form = OpenLPExportForm()
self.opensong_export_form = OpenSongExportForm()
# Create the plugin icon # Create the plugin icon
self.icon = QtGui.QIcon() self.icon = QtGui.QIcon()
self.icon.addPixmap(QtGui.QPixmap(':/media/media_song.png'), self.icon.addPixmap(QtGui.QPixmap(':/media/media_song.png'),
@ -110,6 +113,7 @@ class SongsPlugin(Plugin):
self.ImportOpenlp1Item.setObjectName("ImportOpenlp1Item") self.ImportOpenlp1Item.setObjectName("ImportOpenlp1Item")
self.ImportOpenlp2Item = QtGui.QAction(import_menu) self.ImportOpenlp2Item = QtGui.QAction(import_menu)
self.ImportOpenlp2Item.setObjectName("ImportOpenlp2Item") self.ImportOpenlp2Item.setObjectName("ImportOpenlp2Item")
# Add to menus
self.ImportSongMenu.addAction(self.ImportOpenlp1Item) self.ImportSongMenu.addAction(self.ImportOpenlp1Item)
self.ImportSongMenu.addAction(self.ImportOpenlp2Item) self.ImportSongMenu.addAction(self.ImportOpenlp2Item)
self.ImportSongMenu.addAction(self.ImportOpenSongItem) self.ImportSongMenu.addAction(self.ImportOpenSongItem)
@ -128,6 +132,29 @@ class SongsPlugin(Plugin):
QtCore.QObject.connect(self.ImportOpenlp2Item, QtCore.SIGNAL("triggered()"), self.onImportOpenlp1ItemClick) QtCore.QObject.connect(self.ImportOpenlp2Item, QtCore.SIGNAL("triggered()"), self.onImportOpenlp1ItemClick)
QtCore.QObject.connect(self.ImportOpenSongItem, QtCore.SIGNAL("triggered()"), self.onImportOpenSongItemClick) QtCore.QObject.connect(self.ImportOpenSongItem, QtCore.SIGNAL("triggered()"), self.onImportOpenSongItemClick)
def add_export_menu_item(self, export_menu):
self.ExportSongMenu = QtGui.QMenu(export_menu)
self.ExportSongMenu.setObjectName("ExportSongMenu")
self.ExportOpenSongItem = QtGui.QAction(export_menu)
self.ExportOpenSongItem.setObjectName("ExportOpenSongItem")
self.ExportOpenlp1Item = QtGui.QAction(export_menu)
self.ExportOpenlp1Item.setObjectName("ExportOpenlp1Item")
self.ExportOpenlp2Item = QtGui.QAction(export_menu)
self.ExportOpenlp2Item.setObjectName("ExportOpenlp2Item")
# Add to menus
self.ExportSongMenu.addAction(self.ExportOpenlp1Item)
self.ExportSongMenu.addAction(self.ExportOpenlp2Item)
self.ExportSongMenu.addAction(self.ExportOpenSongItem)
export_menu.addAction(self.ExportSongMenu.menuAction())
# Translations...
self.ExportSongMenu.setTitle(QtGui.QApplication.translate("main_window", "&Song", 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))
# Signals and slots
QtCore.QObject.connect(self.ExportOpenlp1Item, QtCore.SIGNAL("triggered()"), self.onExportOpenlp1ItemClicked)
QtCore.QObject.connect(self.ExportOpenSongItem, QtCore.SIGNAL("triggered()"), self.onExportOpenSongItemClicked)
def initialise(self): def initialise(self):
self.SearchTypeComboBox.addItem("Lyrics") self.SearchTypeComboBox.addItem("Lyrics")
self.SearchTypeComboBox.addItem("Titles") self.SearchTypeComboBox.addItem("Titles")
@ -156,3 +183,9 @@ class SongsPlugin(Plugin):
def onImportOpenSongItemClick(self): def onImportOpenSongItemClick(self):
self.opensong_import_form.show() self.opensong_import_form.show()
def onExportOpenlp1ItemClicked(self):
self.openlp_export_form.show()
def onExportOpenSongItemClicked(self):
self.opensong_export_form.show()