Added the song import menu items, and made the openlp.org 1.0 item show an import form.

bzr-revno: 233
This commit is contained in:
Raoul Snyman 2008-12-16 22:00:32 +00:00
parent fc4e947be0
commit b7008f7b62
6 changed files with 49 additions and 39 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE UserProject SYSTEM "UserProject-4.0.dtd"> <!DOCTYPE UserProject SYSTEM "UserProject-4.0.dtd">
<!-- eric4 user project file for project openlp.org 2.0 --> <!-- eric4 user project file for project openlp.org 2.0 -->
<!-- Saved: 2008-12-14, 22:42:29 --> <!-- Saved: 2008-12-16, 23:58:55 -->
<!-- Copyright (C) 2008 Raoul Snyman, raoulsnyman@openlp.org --> <!-- Copyright (C) 2008 Raoul Snyman, raoulsnyman@openlp.org -->
<UserProject version="4.0"> <UserProject version="4.0">
</UserProject> </UserProject>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Tasks SYSTEM "Tasks-4.2.dtd"> <!DOCTYPE Tasks SYSTEM "Tasks-4.2.dtd">
<!-- eric4 tasks file for project openlp.org 2.0 --> <!-- eric4 tasks file for project openlp.org 2.0 -->
<!-- Saved: 2008-12-14, 22:42:29 --> <!-- Saved: 2008-12-16, 23:58:55 -->
<Tasks version="4.2"> <Tasks version="4.2">
<Task priority="1" completed="False" bugfix="False"> <Task priority="1" completed="False" bugfix="False">
<Summary>TODO: what is the tags for bridge, pre-chorus?</Summary> <Summary>TODO: what is the tags for bridge, pre-chorus?</Summary>

View File

@ -44,10 +44,10 @@ class Plugin(object):
Provides the Plugin with a handle to check if it can be loaded. Provides the Plugin with a handle to check if it can be loaded.
* get_media_manager_item() * get_media_manager_item()
Returns an instance of MediaManagerItem to be used in the Media Manager. Returns an instance of MediaManagerItem to be used in the Media Manager.
* get_import_menu_item() * add_import_menu_item(import_menu)
Returns an item for the Import menu. Add an item to the Import menu.
* get_export_menu_item() * add_export_menu_item(export_menu)
Returns an item for the Export menu. Add an item to the Export menu.
* get_settings_tab() * get_settings_tab()
Returns an instance of SettingsTab to be used in the Settings dialog. Returns an instance of SettingsTab to be used in the Settings dialog.
* add_to_menu(menubar) * add_to_menu(menubar)
@ -103,13 +103,13 @@ class Plugin(object):
""" """
pass 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. Create a menu item and add it to the "Import" menu.
""" """
pass 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. Create a menu item and add it to the "Export" menu.
""" """

View File

@ -91,5 +91,9 @@ class PluginManager(object):
mediatoolbox.addItem(media_manager_item, plugin.icon, media_manager_item.title) mediatoolbox.addItem(media_manager_item, plugin.icon, media_manager_item.title)
plugin.initialise() 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): def hook_handle_event(self, event):
pass pass

View File

@ -112,8 +112,9 @@ class MainWindow(object):
self.FileMenu.setObjectName("FileMenu") self.FileMenu.setObjectName("FileMenu")
self.FileImportMenu = QtGui.QMenu(self.FileMenu) self.FileImportMenu = QtGui.QMenu(self.FileMenu)
self.FileImportMenu.setObjectName("FileImportMenu") self.FileImportMenu.setObjectName("FileImportMenu")
self.ImportSongMenu = QtGui.QMenu(self.FileImportMenu) # Call the hook method to pull in import menus.
self.ImportSongMenu.setObjectName("ImportSongMenu") self.plugin_manager.hook_import_menu(self.FileImportMenu)
#
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) self.ExportSongMenu = QtGui.QMenu(self.FileExportMenu)
@ -331,12 +332,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.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 = QtGui.QAction(self.main_window)
self.ExportOpenSongItem.setObjectName("ExportOpenSongItem") self.ExportOpenSongItem.setObjectName("ExportOpenSongItem")
self.ExportOpenlp1Item = QtGui.QAction(self.main_window) self.ExportOpenlp1Item = QtGui.QAction(self.main_window)
@ -358,10 +353,6 @@ class MainWindow(object):
self.action_Preview_Pane.setObjectName("action_Preview_Pane") self.action_Preview_Pane.setObjectName("action_Preview_Pane")
self.ModeLiveItem = QtGui.QAction(self.main_window) self.ModeLiveItem = QtGui.QAction(self.main_window)
self.ModeLiveItem.setObjectName("ModeLiveItem") 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.ImportBibleItem)
self.FileImportMenu.addAction(self.ImportThemeItem) self.FileImportMenu.addAction(self.ImportThemeItem)
self.FileImportMenu.addAction(self.ImportLanguageItem) 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.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.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.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.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))
@ -509,13 +499,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.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.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.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.ExportOpenlp2Item.setText(QtGui.QApplication.translate("main_window", "OpenLP 2.0", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -22,7 +22,7 @@ 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 from forms import EditSongForm, OpenLPImportForm
class SongsPlugin(Plugin): class SongsPlugin(Plugin):
def __init__(self): def __init__(self):
@ -30,6 +30,7 @@ class SongsPlugin(Plugin):
Plugin.__init__(self, 'Songs', '1.9.0') Plugin.__init__(self, 'Songs', '1.9.0')
self.weight = -10 self.weight = -10
self.edit_song_form = EditSongForm() self.edit_song_form = EditSongForm()
self.openlp_import_form = OpenLPImportForm()
# 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'),
@ -63,7 +64,6 @@ class SongsPlugin(Plugin):
'Add the selected song(s) to the service', ':/system/system_add.png', 'Add the selected song(s) to the service', ':/system/system_add.png',
self.onSongAddClick, 'SongAddItem') self.onSongAddClick, 'SongAddItem')
## Add the songlist widget ## ## Add the songlist widget ##
# Create the tab widget # Create the tab widget
self.SongWidget = QtGui.QWidget(self.MediaManagerItem) self.SongWidget = QtGui.QWidget(self.MediaManagerItem)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
@ -72,7 +72,6 @@ class SongsPlugin(Plugin):
sizePolicy.setHeightForWidth(self.SongWidget.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.SongWidget.sizePolicy().hasHeightForWidth())
self.SongWidget.setSizePolicy(sizePolicy) self.SongWidget.setSizePolicy(sizePolicy)
self.SongWidget.setObjectName('SongWidget') self.SongWidget.setObjectName('SongWidget')
self.SearchLayout = QtGui.QGridLayout(self.SongWidget) self.SearchLayout = QtGui.QGridLayout(self.SongWidget)
self.SearchLayout.setObjectName('SearchLayout') self.SearchLayout.setObjectName('SearchLayout')
self.SearchTypeComboBox = QtGui.QComboBox(self.SongWidget) self.SearchTypeComboBox = QtGui.QComboBox(self.SongWidget)
@ -82,7 +81,6 @@ class SongsPlugin(Plugin):
self.SearchTypeLabel.setObjectName('SearchTypeLabel') self.SearchTypeLabel.setObjectName('SearchTypeLabel')
self.SearchTypeLabel.setText('Search Type:') self.SearchTypeLabel.setText('Search Type:')
self.SearchLayout.addWidget(self.SearchTypeLabel, 0, 0, 1, 1) self.SearchLayout.addWidget(self.SearchTypeLabel, 0, 0, 1, 1)
self.SearchTextLabel = QtGui.QLabel(self.SongWidget) self.SearchTextLabel = QtGui.QLabel(self.SongWidget)
self.SearchTextLabel.setObjectName('SearchTextLabel') self.SearchTextLabel.setObjectName('SearchTextLabel')
self.SearchTextLabel.setText('Search Text:') self.SearchTextLabel.setText('Search Text:')
@ -94,17 +92,39 @@ class SongsPlugin(Plugin):
self.SearchTextButton.setObjectName('SearchTextButton') self.SearchTextButton.setObjectName('SearchTextButton')
self.SearchTextButton.setText('Search') self.SearchTextButton.setText('Search')
self.SearchLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1) self.SearchLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1)
# Add the song widget to the page layout # Add the song widget to the page layout
self.MediaManagerItem.PageLayout.addWidget(self.SongWidget) self.MediaManagerItem.PageLayout.addWidget(self.SongWidget)
self.SongListView = QtGui.QListWidget()
self.listView = QtGui.QListWidget() self.SongListView.setGeometry(QtCore.QRect(10, 100, 256, 591))
self.listView.setGeometry(QtCore.QRect(10, 100, 256, 591)) self.SongListView.setObjectName("listView")
self.listView.setObjectName("listView") self.MediaManagerItem.PageLayout.addWidget(self.SongListView)
self.MediaManagerItem.PageLayout.addWidget(self.listView)
return self.MediaManagerItem 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): def initialise(self):
self.SearchTypeComboBox.addItem("Lyrics") self.SearchTypeComboBox.addItem("Lyrics")
self.SearchTypeComboBox.addItem("Titles") self.SearchTypeComboBox.addItem("Titles")
@ -127,3 +147,6 @@ class SongsPlugin(Plugin):
def onSongAddClick(self): def onSongAddClick(self):
pass pass
def onImportOpenlp1ItemClick(self):
self.openlp_import_form.show()