Rewrote Plugin methods to match Python standards, fixed a few other things here and there.

bzr-revno: 219
This commit is contained in:
Raoul Snyman 2008-12-14 15:49:54 +00:00
parent 40e52dd4ff
commit 508a542d6f
22 changed files with 1554 additions and 1375 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-07, 01:02:37 --> <!-- Saved: 2008-12-14, 17:46:43 -->
<!-- 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-07, 01:02:37 --> <!-- Saved: 2008-12-14, 17:46:43 -->
<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>
@ -21,4 +21,94 @@
<Linenumber>523</Linenumber> <Linenumber>523</Linenumber>
</Resource> </Resource>
</Task> </Task>
<Task priority="1" completed="False" bugfix="False">
<Summary>TODO: Song: Logging - not all, but enough</Summary>
<Description></Description>
<Created>2008-12-07, 10:06:59</Created>
<Resource>
<Filename>openlp/plugins/songs/songxml.py</Filename>
<Linenumber>39</Linenumber>
</Resource>
</Task>
<Task priority="1" completed="False" bugfix="False">
<Summary>TODO: Song: Handle OpenLP2 format</Summary>
<Description></Description>
<Created>2008-12-07, 10:06:59</Created>
<Resource>
<Filename>openlp/plugins/songs/songxml.py</Filename>
<Linenumber>40</Linenumber>
</Resource>
</Task>
<Task priority="1" completed="False" bugfix="False">
<Summary>TODO: Song: Import OpenLP1</Summary>
<Description></Description>
<Created>2008-12-07, 10:06:59</Created>
<Resource>
<Filename>openlp/plugins/songs/songxml.py</Filename>
<Linenumber>41</Linenumber>
</Resource>
</Task>
<Task priority="1" completed="False" bugfix="False">
<Summary>TODO: Song: Export OpenLP1</Summary>
<Description></Description>
<Created>2008-12-07, 10:07:00</Created>
<Resource>
<Filename>openlp/plugins/songs/songxml.py</Filename>
<Linenumber>42</Linenumber>
</Resource>
</Task>
<Task priority="1" completed="False" bugfix="False">
<Summary>TODO: Song: Export Song to CCLI</Summary>
<Description></Description>
<Created>2008-12-07, 10:07:00</Created>
<Resource>
<Filename>openlp/plugins/songs/songxml.py</Filename>
<Linenumber>43</Linenumber>
</Resource>
</Task>
<Task priority="1" completed="False" bugfix="False">
<Summary>TODO: Song: Export Song to OpenSong</Summary>
<Description></Description>
<Created>2008-12-07, 10:07:00</Created>
<Resource>
<Filename>openlp/plugins/songs/songxml.py</Filename>
<Linenumber>44</Linenumber>
</Resource>
</Task>
<Task priority="1" completed="False" bugfix="False">
<Summary>TODO: Song: Import ChangingSong</Summary>
<Description></Description>
<Created>2008-12-07, 10:07:00</Created>
<Resource>
<Filename>openlp/plugins/songs/songxml.py</Filename>
<Linenumber>45</Linenumber>
</Resource>
</Task>
<Task priority="1" completed="False" bugfix="False">
<Summary>TODO: Song: Export ChangingSong</Summary>
<Description></Description>
<Created>2008-12-07, 10:07:00</Created>
<Resource>
<Filename>openlp/plugins/songs/songxml.py</Filename>
<Linenumber>46</Linenumber>
</Resource>
</Task>
<Task priority="1" completed="False" bugfix="False">
<Summary>TODO: what is the tags for bridge, pre-chorus?</Summary>
<Description></Description>
<Created>2008-12-07, 10:07:00</Created>
<Resource>
<Filename>openlp/plugins/songs/songxml.py</Filename>
<Linenumber>149</Linenumber>
</Resource>
</Task>
<Task priority="1" completed="False" bugfix="False">
<Summary>TODO: check font formatting</Summary>
<Description></Description>
<Created>2008-12-07, 10:07:00</Created>
<Resource>
<Filename>openlp/plugins/songs/songxml.py</Filename>
<Linenumber>534</Linenumber>
</Resource>
</Task>
</Tasks> </Tasks>

View File

@ -62,7 +62,7 @@ The "songs" table has the following columns:
* comments * comments
* ccli_number * ccli_number
* song_number * song_number
* theme * theme_name
* search_title * search_title
* search_lyrics * search_lyrics

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Project SYSTEM "Project-4.4.dtd"> <!DOCTYPE Project SYSTEM "Project-4.4.dtd">
<!-- eric4 project file for project openlp.org 2.0 --> <!-- eric4 project file for project openlp.org 2.0 -->
<!-- Saved: 2008-12-07, 01:02:26 --> <!-- Saved: 2008-12-13, 19:19:42 -->
<!-- Copyright (C) 2008 Raoul Snyman, raoulsnyman@openlp.org --> <!-- Copyright (C) 2008 Raoul Snyman, raoulsnyman@openlp.org -->
<Project version="4.4"> <Project version="4.4">
<ProgLanguage mixed="0">Python</ProgLanguage> <ProgLanguage mixed="0">Python</ProgLanguage>
@ -21,14 +21,7 @@
<Source>openlp/__init__.py</Source> <Source>openlp/__init__.py</Source>
<Source>demo.py</Source> <Source>demo.py</Source>
<Source>openlp/core/settingsmanager.py</Source> <Source>openlp/core/settingsmanager.py</Source>
<Source>openlp/plugins/biblemanager/test/__init__.py</Source>
<Source>openlp/plugins/biblemanager/test/test_bibleManager.py</Source>
<Source>openlp/plugins/__init__.py</Source> <Source>openlp/plugins/__init__.py</Source>
<Source>openlp/libraries/pptviewlib/ppttest.py</Source>
<Source>openlp/plugins/biblemanager/test/test_bibleManagerAPI.py</Source>
<Source>openlp/plugins/biblemanager/test/test_bibleManagerCSV.py</Source>
<Source>openlp/plugins/mediamanageritem.py</Source>
<Source>openlp/plugins/biblemanager/test/test_bibleManagerOSIS.py</Source>
<Source>openlp/core/pluginmanager.py</Source> <Source>openlp/core/pluginmanager.py</Source>
<Source>openlp/core/ui/__init__.py</Source> <Source>openlp/core/ui/__init__.py</Source>
<Source>openlp/core/ui/mainwindow.py</Source> <Source>openlp/core/ui/mainwindow.py</Source>
@ -39,7 +32,6 @@
<Source>openlp/plugins/songs/songsplugin.py</Source> <Source>openlp/plugins/songs/songsplugin.py</Source>
<Source>openlp/plugins/songs/__init__.py</Source> <Source>openlp/plugins/songs/__init__.py</Source>
<Source>openlp/plugins/songs/forms/__init__.py</Source> <Source>openlp/plugins/songs/forms/__init__.py</Source>
<Source>openlp/plugins/songs/songxml.py</Source>
<Source>openlp/plugins/songs/forms/openlpimportform.py</Source> <Source>openlp/plugins/songs/forms/openlpimportform.py</Source>
<Source>openlp/plugins/songs/forms/editsongform.py</Source> <Source>openlp/plugins/songs/forms/editsongform.py</Source>
<Source>openlp/plugins/songs/forms/opensongexportform.py</Source> <Source>openlp/plugins/songs/forms/opensongexportform.py</Source>
@ -85,6 +77,20 @@
<Source>openlp/plugins/bibles/lib/__init__.py</Source> <Source>openlp/plugins/bibles/lib/__init__.py</Source>
<Source>openlp/plugins/bibles/forms/__init__.py</Source> <Source>openlp/plugins/bibles/forms/__init__.py</Source>
<Source>openlp/plugins/bibles/lib/biblecommon.py</Source> <Source>openlp/plugins/bibles/lib/biblecommon.py</Source>
<Source>openlp/plugins/songs/lib/__init__.py</Source>
<Source>openlp/plugins/songs/lib/songxml.py</Source>
<Source>openlp/plugins/songs/lib/models.py</Source>
<Source>openlp/plugins/bibles/test/__init__.py</Source>
<Source>openlp/plugins/bibles/test/test_bibleManagerAPI.py</Source>
<Source>openlp/plugins/bibles/test/test_bibleManager.py</Source>
<Source>openlp/plugins/bibles/test/test_bibleManagerOSIS.py</Source>
<Source>openlp/plugins/bibles/test/test_bibleManagerCSV.py</Source>
<Source>openlp/plugins/presentations/lib/pptview.py</Source>
<Source>openlp/plugins/presentations/lib/impresscom.py</Source>
<Source>openlp/plugins/presentations/lib/powerpoint.py</Source>
<Source>openlp/plugins/presentations/lib/pptviewlib/ppttest.py</Source>
<Source>openlp/plugins/presentations/__init__.py</Source>
<Source>openlp/plugins/presentations/presentationplugin.py</Source>
</Sources> </Sources>
<Forms> <Forms>
<Form>resources/forms/bibleimport.ui</Form> <Form>resources/forms/bibleimport.ui</Form>

View File

@ -20,9 +20,10 @@ Place, Suite 330, Boston, MA 02111-1307 USA
""" """
import sys import sys
import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
import logging
logging.basicConfig(level=logging.DEBUG, logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
datefmt='%m-%d %H:%M', datefmt='%m-%d %H:%M',

View File

@ -32,14 +32,14 @@ class MediaManagerItem(QtGui.QWidget):
""" """
QtGui.QWidget.__init__(self) QtGui.QWidget.__init__(self)
if type(icon) is QtGui.QIcon: if type(icon) is QtGui.QIcon:
self.Icon = icon self.icon = icon
elif type(icon) is types.StringType: elif type(icon) is types.StringType:
self.Icon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)), self.icon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
QtGui.QIcon.Normal, QtGui.QIcon.Off) QtGui.QIcon.Normal, QtGui.QIcon.Off)
else: else:
self.Icon = None self.icon = None
if title is not None: if title is not None:
self.Title = title self.title = title
self.Toolbar = None self.Toolbar = None
#self.ToolbarButtons = [] #self.ToolbarButtons = []

View File

@ -17,30 +17,43 @@ You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
""" """
__version__ = "$Revision: $"
from openlp.core.lib import PluginConfig # $Source$
import logging import logging
from openlp.core.lib import PluginConfig
class Plugin(object): class Plugin(object):
""" """
Base class for openlp plugins to inherit from. Base class for openlp plugins to inherit from.
Basic attributes are: Basic attributes are:
* Name * name
The name that should appear in the plugins list. The name that should appear in the plugins list.
* Version * version
The version number of this iteration of the plugin. The version number of this iteration of the plugin.
* MediaManagerItem * icon
An instance of the MediaManagerItem class, used in the Media Manager. An instance of QIcon, which holds an icon for this plugin.
* SettingsTab * config
An instance of the SettingsTab class, used in the Settings dialog. An instance of PluginConfig, which allows plugins to read and write to
* ImportMenuItem openlp.org's configuration. This is pre-instantiated.
A menu item to be placed in the Import menu. * log
* ExportMenuItem A log object used to log debugging messages. This is pre-instantiated.
A menu item to be placed in the Export menu.
Hook functions: Hook functions:
* 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.
* get_settings_tab()
Returns an instance of SettingsTab to be used in the Settings dialog.
* add_to_menu(menubar)
A method to add a menu item to anywhere in the menu, given the menu bar.
* handle_event(event)
A method use to handle events, given an Event object.
* about() * about()
Used in the plugin manager, when a person clicks on the 'About' button. Used in the plugin manager, when a person clicks on the 'About' button.
* save(data) * save(data)
@ -52,12 +65,8 @@ class Plugin(object):
* render(theme, screen_number) * render(theme, screen_number)
A method used to render something to the screen, given the current theme A method used to render something to the screen, given the current theme
and screen number. and screen number.
* addToMenu(menubar)
A method to add a menu item to anywhere in the menu, given the menu bar.
* handleEvent(event)
A method use to handle events, given an Event object.
""" """
global log
def __init__(self, name=None, version=None): def __init__(self, name=None, version=None):
""" """
This is the constructor for the plugin object. This provides an easy This is the constructor for the plugin object. This provides an easy
@ -69,17 +78,53 @@ class Plugin(object):
... ...
""" """
if name is not None: if name is not None:
self.Name = name self.name = name
else: else:
self.Name = 'Plugin' self.name = 'Plugin'
if version is not None: if version is not None:
self.Version = version self.version = version
self.config = PluginConfig(self.Name) self.icon = None
#self.MediaManagerItem = None self.config = PluginConfig(self.name)
self.SettingsTab = None self.weight = 0
self.ImportMenuItem = None # Set up logging
self.ExportMenuItem = None self.log = logging.getLogger(self.name)
self.Weight = 0
def get_media_manager_item(self):
"""
Construct a MediaManagerItem object with all the buttons and things you
need, and return it for integration into openlp.org.
"""
pass
def get_import_menu_item(self):
"""
Create a menu item and add it to the "Import" menu.
"""
pass
def get_export_menu_item(self):
"""
Create a menu item and add it to the "Export" menu.
"""
pass
def get_settings_tab(self):
"""
Create a menu item and add it to the "Import" menu.
"""
pass
def add_to_menu(self, menubar):
"""
Add menu items to the menu, given the menubar.
"""
pass
def handle_event(self, event):
"""
Handle the event contained in the event object.
"""
pass
def about(self): def about(self):
""" """
@ -108,30 +153,8 @@ class Plugin(object):
""" """
pass pass
def getMediaManagerItem(self): def initalise(self):
""" """
Construct a MediaManagerItem object with all the buttons and things you Called by the plugin Manager to initialise anything it needs.
need, and return it for integration into openlp.org.
"""
pass
def addToMenu(self, menubar):
"""
Add menu items to the menu, given the menubar.
"""
pass
def handleEvent(self, event):
"""
Handle the event contained in the event object.
"""
pass
def getName(self):
return self.Name
def initalise_ui(self):
"""
Called by the plugin Manager to setup any UI features on creation after the UI has been created,
""" """
pass pass

View File

@ -73,22 +73,22 @@ class PluginManager(object):
for p in self.plugin_classes: for p in self.plugin_classes:
plugin = p() plugin = p()
plugin_objects.append(plugin) plugin_objects.append(plugin)
self.plugins = sorted(plugin_objects, self.orderByWeight) self.plugins = sorted(plugin_objects, self.order_by_weight)
def orderByWeight(self, x, y): def order_by_weight(self, x, y):
return cmp(x.Weight, y.Weight) return cmp(x.weight, y.weight)
def hookMediaManager(self, mediatoolbox): def hook_media_manager(self, mediatoolbox):
""" """
Loop through all the plugins. If a plugin has a valid media manager item, Loop through all the plugins. If a plugin has a valid media manager item,
add it to the media manager. add it to the media manager.
""" """
for plugin in self.plugins: for plugin in self.plugins:
media_manager_item = plugin.getMediaManagerItem() media_manager_item = plugin.get_media_manager_item()
if media_manager_item is not None: if media_manager_item is not None:
log.debug('Inserting media manager item from %s' % plugin.Name) log.debug('Inserting media manager item from %s' % plugin.name)
mediatoolbox.addItem(media_manager_item, plugin.Icon, media_manager_item.Title) mediatoolbox.addItem(media_manager_item, plugin.icon, media_manager_item.title)
plugin.initalise_ui() plugin.initalise()
def hookHandleEvent(self, event): def hook_handle_event(self, event):
pass pass

View File

@ -161,7 +161,7 @@ class MainWindow(object):
self.MediaToolBox.setObjectName("MediaToolBox") self.MediaToolBox.setObjectName("MediaToolBox")
# This is where we will eventually get the Plugin Manager to pull in # This is where we will eventually get the Plugin Manager to pull in
# the media manager items. # the media manager items.
self.plugin_manager.hookMediaManager(self.MediaToolBox) self.plugin_manager.hook_media_manager(self.MediaToolBox)
# End adding media manager items. # End adding media manager items.
self.MediaManagerLayout.addWidget(self.MediaToolBox) self.MediaManagerLayout.addWidget(self.MediaToolBox)
self.MediaManagerDock.setWidget(self.MediaManagerContents) self.MediaManagerDock.setWidget(self.MediaManagerContents)

View File

@ -18,14 +18,14 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
""" """
import logging
from PyQt4 import QtCore, QtGui 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 openlp.plugins.bibles.lib import BibleManager
from openlp.plugins.bibles.lib.biblemanager import BibleManager from openlp.plugins.bibles.forms import BibleImportForm
from openlp.plugins.bibles.forms.bibleimportform import BibleImportForm
import logging
class BiblePlugin(Plugin): class BiblePlugin(Plugin):
global log global log
@ -34,24 +34,24 @@ class BiblePlugin(Plugin):
def __init__(self): def __init__(self):
# Call the parent constructor # Call the parent constructor
Plugin.__init__(self, 'Bible', '1.9.0') Plugin.__init__(self, 'Bible', '1.9.0')
self.Weight = -9 self.weight = -9
# Create the plugin icon
self.icon = QtGui.QIcon()
self.icon.addPixmap(QtGui.QPixmap(':/media/media_verse.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
#Register the bible Manager #Register the bible Manager
self.biblemanager = BibleManager(self.config) self.biblemanager = BibleManager(self.config)
self.searchresults = {} # place to store the search results self.searchresults = {} # place to store the search results
def getMediaManagerItem(self): def get_media_manager_item(self):
# Create the plugin icon
self.Icon = QtGui.QIcon()
self.Icon.addPixmap(QtGui.QPixmap(':/media/media_verse.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
# Create the MediaManagerItem object # Create the MediaManagerItem object
self.MediaManagerItem = MediaManagerItem(self.Icon, 'Bible Verses') self.MediaManagerItem = MediaManagerItem(self.icon, 'Bible Verses')
# Add a toolbar # Add a toolbar
self.MediaManagerItem.addToolbar() self.MediaManagerItem.addToolbar()
# Create buttons for the toolbar # Create buttons for the toolbar
## New Bible Button ## ## New Bible Button ##
self.MediaManagerItem.addToolbarButton('New Bible', 'Register a new Bible', self.MediaManagerItem.addToolbarButton('New Bible', 'Register a new Bible',
':/bibles/bible_new.png', self.onBibleNewClick, 'BibleNewItem') ':/themes/theme_import.png', self.onBibleNewClick, 'BibleNewItem')
## Separator Line ## ## Separator Line ##
self.MediaManagerItem.addToolbarSeparator() self.MediaManagerItem.addToolbarSeparator()
## Preview Bible Button ## ## Preview Bible Button ##
@ -182,12 +182,14 @@ class BiblePlugin(Plugin):
QtCore.QObject.connect(self.AdvancedFromChapter, QtCore.SIGNAL("activated(int)"), self.onAdvancedFromChapter) QtCore.QObject.connect(self.AdvancedFromChapter, QtCore.SIGNAL("activated(int)"), self.onAdvancedFromChapter)
QtCore.QObject.connect(self.AdvancedFromVerse, QtCore.SIGNAL("activated(int)"), self.onAdvancedFromVerse) QtCore.QObject.connect(self.AdvancedFromVerse, QtCore.SIGNAL("activated(int)"), self.onAdvancedFromVerse)
QtCore.QObject.connect(self.AdvancedToChapter, QtCore.SIGNAL("activated(int)"), self.onAdvancedToChapter) QtCore.QObject.connect(self.AdvancedToChapter, QtCore.SIGNAL("activated(int)"), self.onAdvancedToChapter)
self._initialiseForm()
QtCore.QObject.connect(self.AdvancedSearchButton, QtCore.SIGNAL("pressed()"), self.onAdvancedSearchButton) QtCore.QObject.connect(self.AdvancedSearchButton, QtCore.SIGNAL("pressed()"), self.onAdvancedSearchButton)
QtCore.QObject.connect(self.QuickSearchButton, QtCore.SIGNAL("pressed()"), self.onQuickSearchButton) QtCore.QObject.connect(self.QuickSearchButton, QtCore.SIGNAL("pressed()"), self.onQuickSearchButton)
return self.MediaManagerItem return self.MediaManagerItem
def initalise_ui(self): def initalise(self):
self._initialiseForm() self._initialiseForm()
def onAdvancedVersionComboBox(self): def onAdvancedVersionComboBox(self):
@ -230,7 +232,6 @@ class BiblePlugin(Plugin):
first = False first = False
self._initialiseBible(b) # use the fist bible as the trigger self._initialiseBible(b) # use the fist bible as the trigger
def _initialiseBible(self, bible): def _initialiseBible(self, bible):
log.debug("_initialiseBible %s ", bible) log.debug("_initialiseBible %s ", bible)
self._initialiseBibleQuick(bible) self._initialiseBibleQuick(bible)

View File

@ -17,3 +17,7 @@ You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from bibleimportform import BibleImportForm
__all__ = ['BibleImportForm']

View File

@ -17,3 +17,8 @@ You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from biblecommon import BibleCommon
from biblemanager import BibleManager
__all__ = ['BibleCommon', 'BibleManager']

View File

@ -16,7 +16,8 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
""" """
import os, os.path import os
import os.path
import sys import sys
import urllib2 import urllib2

View File

@ -19,24 +19,24 @@ Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from PyQt4 import QtCore, QtGui 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
class PresentationPlugin(Plugin): class PresentationPlugin(Plugin):
def __init__(self): def __init__(self):
# Call the parent constructor # Call the parent constructor
Plugin.__init__(self, 'Presentations', '1.9.0') Plugin.__init__(self, 'Presentations', '1.9.0')
self.Weight = -8 self.weight = -8
def getMediaManagerItem(self):
# 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'),
QtGui.QIcon.Normal, QtGui.QIcon.Off) QtGui.QIcon.Normal, QtGui.QIcon.Off)
def get_media_manager_item(self):
# Create the MediaManagerItem object # Create the MediaManagerItem object
self.MediaManagerItem = MediaManagerItem(self.Icon, 'Presentations') self.MediaManagerItem = MediaManagerItem(self.icon, 'Presentations')
# Add a toolbar # Add a toolbar
self.MediaManagerItem.addToolbar() self.MediaManagerItem.addToolbar()
# Create buttons for the toolbar # Create buttons for the toolbar
@ -70,7 +70,7 @@ class PresentationPlugin(Plugin):
return self.MediaManagerItem return self.MediaManagerItem
def initalise_ui(self): def initalise(self):
self.onPresentationNewClick() self.onPresentationNewClick()
def onPresentationNewClick(self): def onPresentationNewClick(self):

View File

@ -19,4 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from editsongform import EditSongForm from editsongform import EditSongForm
from openlpexportform import OpenLPExportForm
from openlpimportform import OpenLPImportForm
from opensongexportform import OpenSongExportForm
from opensongimportform import OpenSongImportForm

View File

@ -1,15 +1,26 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
# Form implementation generated from reading ui file 'C:\Project Folders\Personal Projects\openlp-2\trunk\openlp\resources\forms\openlpexportform.ui' This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Created: Wed Nov 05 20:55:51 2008 Foundation; version 2 of the License.
# by: PyQt4 UI code generator 4.4.4-snapshot-20080918
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARNING! All changes made in this file will be lost! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.resources import * from openlp.core.resources import *
class OpenLPExportForm(object): class OpenLPExportForm(object):

View File

@ -1,15 +1,26 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
# Form implementation generated from reading ui file 'C:\Project Folders\Personal Projects\openlp-2\trunk\openlp\resources\forms\openlpimportform.ui' This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Created: Wed Nov 05 20:56:08 2008 Foundation; version 2 of the License.
# by: PyQt4 UI code generator 4.4.4-snapshot-20080918
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARNING! All changes made in this file will be lost! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.resources import * from openlp.core.resources import *
class OpenLPImportForm(object): class OpenLPImportForm(object):

View File

@ -1,15 +1,26 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
# Form implementation generated from reading ui file 'C:\Project Folders\Personal Projects\openlp-2\trunk\openlp\resources\forms\opensongexportform.ui' This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Created: Wed Nov 05 20:56:41 2008 Foundation; version 2 of the License.
# by: PyQt4 UI code generator 4.4.4-snapshot-20080918
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARNING! All changes made in this file will be lost! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.resources import * from openlp.core.resources import *
class OpenSongExportForm(object): class OpenSongExportForm(object):

View File

@ -1,15 +1,26 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
# Form implementation generated from reading ui file 'C:\Project Folders\Personal Projects\openlp-2\trunk\openlp\resources\forms\opensongimportform.ui' This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Created: Wed Nov 05 20:56:54 2008 Foundation; version 2 of the License.
# by: PyQt4 UI code generator 4.4.4-snapshot-20080918
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARNING! All changes made in this file will be lost! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.resources import * from openlp.core.resources import *
class OpenSongImportForm(object): class OpenSongImportForm(object):

View File

@ -19,6 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from PyQt4 import QtCore, QtGui 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
@ -27,16 +28,16 @@ class SongsPlugin(Plugin):
def __init__(self): def __init__(self):
# Call the parent constructor # Call the parent constructor
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()
def getMediaManagerItem(self):
# 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'),
QtGui.QIcon.Normal, QtGui.QIcon.Off) QtGui.QIcon.Normal, QtGui.QIcon.Off)
def get_media_manager_item(self):
# Create the MediaManagerItem object # Create the MediaManagerItem object
self.MediaManagerItem = MediaManagerItem(self.Icon, 'Songs') self.MediaManagerItem = MediaManagerItem(self.icon, 'Songs')
# Add a toolbar # Add a toolbar
self.MediaManagerItem.addToolbar() self.MediaManagerItem.addToolbar()
# Create buttons for the toolbar # Create buttons for the toolbar
@ -64,41 +65,38 @@ class SongsPlugin(Plugin):
## Add the songlist widget ## ## Add the songlist widget ##
# Create the tab widget # Create the tab widget
self.SongGroupBox = QtGui.QGroupBox(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)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.SongGroupBox.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.SongWidget.sizePolicy().hasHeightForWidth())
self.SongGroupBox.setSizePolicy(sizePolicy) self.SongWidget.setSizePolicy(sizePolicy)
self.SongGroupBox.setObjectName('SearchTabWidget') self.SongWidget.setObjectName('SongWidget')
self.QuickLayout = QtGui.QGridLayout(self.SongGroupBox) self.SearchLayout = QtGui.QGridLayout(self.SongWidget)
self.QuickLayout.setObjectName('QuickLayout') self.SearchLayout.setObjectName('SearchLayout')
self.SearchTypeComboBox = QtGui.QComboBox(self.SongGroupBox) self.SearchTypeComboBox = QtGui.QComboBox(self.SongWidget)
self.SearchTypeComboBox.setObjectName('VersionComboBox') self.SearchTypeComboBox.setObjectName('SearchTypeComboBox')
self.QuickLayout.addWidget(self.SearchTypeComboBox, 0, 1, 1, 2) self.SearchLayout.addWidget(self.SearchTypeComboBox, 0, 1, 1, 2)
self.SearchTypeLabel = QtGui.QLabel(self.SongGroupBox) self.SearchTypeLabel = QtGui.QLabel(self.SongWidget)
self.SearchTypeLabel.setObjectName('SearchTypeLabel') self.SearchTypeLabel.setObjectName('SearchTypeLabel')
self.SearchTypeLabel.setText('Search Type:') self.SearchTypeLabel.setText('Search Type:')
self.QuickLayout.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.SongGroupBox)
self.SearchTextLabel.setObjectName('SearchTextLabel') self.SearchTextLabel.setObjectName('SearchTextLabel')
self.SearchTextLabel.setText('Search Text:') self.SearchTextLabel.setText('Search Text:')
self.QuickLayout.addWidget(self.SearchTextLabel, 2, 0, 1, 1) self.SearchLayout.addWidget(self.SearchTextLabel, 2, 0, 1, 1)
self.SearchTextEdit = QtGui.QLineEdit(self.SongGroupBox) self.SearchTextEdit = QtGui.QLineEdit(self.SongWidget)
self.SearchTextEdit.setObjectName('SearchTextEdit') self.SearchTextEdit.setObjectName('SearchTextEdit')
self.QuickLayout.addWidget(self.SearchTextEdit, 2, 1, 1, 2) self.SearchLayout.addWidget(self.SearchTextEdit, 2, 1, 1, 2)
self.SearchTextButton = QtGui.QPushButton(self.SongGroupBox) self.SearchTextButton = QtGui.QPushButton(self.SongWidget)
self.SearchTextButton.setObjectName('SearchTextButton') self.SearchTextButton.setObjectName('SearchTextButton')
self.SearchTextButton.setText('Search') self.SearchTextButton.setText('Search')
self.QuickLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1) self.SearchLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1)
QuickSpacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.QuickLayout.addItem(QuickSpacerItem, 4, 2, 1, 1)
# Add the search tab widget to the page layout # Add the song widget to the page layout
self.MediaManagerItem.PageLayout.addWidget(self.SongGroupBox) self.MediaManagerItem.PageLayout.addWidget(self.SongWidget)
self.listView = QtGui.QListWidget() self.listView = QtGui.QListWidget()
self.listView.setGeometry(QtCore.QRect(10, 100, 256, 591)) self.listView.setGeometry(QtCore.QRect(10, 100, 256, 591))
@ -107,7 +105,7 @@ class SongsPlugin(Plugin):
return self.MediaManagerItem return self.MediaManagerItem
def initalise_ui(self): def initalise(self):
self.SearchTypeComboBox.addItem("Lyrics") self.SearchTypeComboBox.addItem("Lyrics")
self.SearchTypeComboBox.addItem("Titles") self.SearchTypeComboBox.addItem("Titles")
self.SearchTypeComboBox.addItem("Authors") self.SearchTypeComboBox.addItem("Authors")

View File

@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
""" """
OpenLP - Open Source Lyrics Projection OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Carsten Tinggaard Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -15,6 +17,7 @@ You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
""" """
import py.test import py.test
import os import os
import sys import sys

View File

@ -3,7 +3,7 @@ suffix name = bible3
[main] [main]
themes path = themes themes path = themes
data path = /home/timali/.openlp/data data path = /home/raoul/.openlp/data
[songs] [songs]
file name = songs.sqlite file name = songs.sqlite