Added an initial ServiceItem, plus a few minor changes.

bzr-revno: 296
This commit is contained in:
Raoul Snyman 2009-02-04 20:16:56 +00:00
parent ffeada555d
commit 3f0ba7a3ba
7 changed files with 115 additions and 68 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE UserProject SYSTEM "UserProject-4.0.dtd">
<!-- eric4 user project file for project openlp.org 2.0 -->
<!-- Saved: 2009-01-27, 23:44:25 -->
<!-- Saved: 2009-02-02, 23:04:02 -->
<!-- Copyright (C) 2009 Raoul Snyman, raoulsnyman@openlp.org -->
<UserProject version="4.0">
</UserProject>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Tasks SYSTEM "Tasks-4.2.dtd">
<!-- eric4 tasks file for project openlp.org 2.0 -->
<!-- Saved: 2009-01-27, 23:44:25 -->
<!-- Saved: 2009-02-02, 23:04:03 -->
<Tasks version="4.2">
<Task priority="1" completed="False" bugfix="False">
<Summary>TODO: what is the tags for bridge, pre-chorus?</Summary>

View File

@ -24,6 +24,7 @@ from settingstab import SettingsTab
from mediamanageritem import MediaManagerItem
from event import Event
from xmlrootclass import XmlRootClass
from serviceitem import ServiceItem
__all__ = ['PluginConfig', 'Plugin', 'PluginUtils', 'SettingsTab', 'MediaManagerItem', 'Event',
'XmlRootClass']
'XmlRootClass', 'ServiceItem']

View File

@ -75,7 +75,7 @@ class MediaManagerItem(QtGui.QWidget):
if tooltip is not None:
ToolbarButton.setToolTip(tooltip)
if slot is not None:
QtCore.QObject.connect(ToolbarButton, QtCore.SIGNAL("triggered()"), slot)
QtCore.QObject.connect(ToolbarButton, QtCore.SIGNAL('triggered()'), slot)
def addToolbarSeparator(self):
"""
@ -84,10 +84,12 @@ class MediaManagerItem(QtGui.QWidget):
self.Toolbar.addSeparator()
def getInputFile(self, dialogname, dialoglocation, dialogfilter):
return QtGui.QFileDialog.getOpenFileName(self, dialogname,dialoglocation, dialogfilter)
return QtGui.QFileDialog.getOpenFileName(self, dialogname,
dialoglocation, dialogfilter)
def getInputFiles(self, dialogname, dialoglocation, dialogfilter):
return QtGui.QFileDialog.getOpenFileNames(self, dialogname,dialoglocation, dialogfilter)
return QtGui.QFileDialog.getOpenFileNames(self, dialogname,
dialoglocation, dialogfilter)
def refresh(self):
self.update()

View File

@ -0,0 +1,39 @@
# -*- 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
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
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
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
"""
class ServiceItem():
"""
The service item is a base class for the plugins to use to interact with
the service manager, the slide controller, and the renderer.
"""
def render(self):
"""
The render method is what the plugin uses to render it's meda to the
screen.
"""
pass
def get_parent_node(self):
"""
This method returns a parent node to be inserted into the Service
Manager.
"""
pass

View File

@ -68,19 +68,25 @@ class MigrateSongs():
def _v1_9_0_authors(self, database):
self.display.sub_output("Authors Started for "+database);
conn = sqlite3.connect(self.data_path+os.sep+database)
conn.execute("""alter table authors rename to authors_temp;""")
conn.commit()
conn.execute("""create table authors add column display_name varchar(255);""")
conn.commit()
self.display.sub_output("first name created")
conn.execute("""alter table authors add column first_name varchar(128);""")
conn.commit()
self.display.sub_output("first name created")
conn.execute("""alter table authors add column last_name varchar(128);""")
conn.commit()
self.display.sub_output("last name created")
conn.execute("""create index if not exists author1 on authors (display_name ASC,id ASC);""")
conn.execute("""create index if not exists author_display_name on authors (display_name ASC,id ASC);""")
conn.commit()
self.display.sub_output("index author1 created")
conn.execute("""create index if not exists author2 on authors (last_name ASC,id ASC);""")
conn.execute("""create index if not exists author_last_name on authors (last_name ASC,id ASC);""")
conn.commit()
self.display.sub_output("index author2 created")
conn.execute("""create index if not exists author3 on authors (first_name ASC,id ASC);""")
conn.execute("""create index if not exists author_first_name on authors (first_name ASC,id ASC);""")
conn.commit()
self.display.sub_output("index author3 created")
self.display.sub_output("Author Data Migration started")
@ -94,9 +100,10 @@ class MigrateSongs():
afn = dispname[:pos]
aln = dispname[pos + 1:len(dispname)]
#txt = text[2]
s = "update authors set first_name = '" + afn + "' ,last_name = '" + aln + "' where id = " +str(author[0])
s = "update authors set display_name = '" + dispname + "', first_name = '" + afn + "', last_name = '" + aln + "' where id = " +str(author[0])
text1 = c.execute(s)
conn.commit()
conn.execute("""alter table authors drop column authorname;""")
conn.commit()
conn.close()
self.display.sub_output("Author Data Migration Completed")

View File

@ -34,8 +34,8 @@ class SongManager():
"""
global log
log=logging.getLogger("SongManager")
log.info("Song manager loaded")
log=logging.getLogger('SongManager')
log.info('Song manager loaded')
def __init__(self, config):
"""
@ -43,24 +43,22 @@ class SongManager():
don't exist.
"""
self.config = config
log.debug( "Song Initialising")
log.debug('Song Initialising')
self.db_url = u''
db_type = self.config.get_config(u'db type')
if db_type == u'sqlite':
self.db_url = u'sqlite:///' + self.config.get_data_path() + \
u'/songs.sqlite'
print self.db_url
else:
self.db_url = db_type + 'u://' + \
self.config.get_config(u'db username') + u':' + \
self.config.get_config(u'db password') + u'@' + \
self.config.get_config(u'db hostname') + u'/' + \
self.config.get_config(u'db database')
#print self.db_url
self.session = init_models(self.db_url)
if not songs_table.exists():
metadata.create_all()
log.debug( "Song Initialised")
log.debug('Song Initialised')
def process_dialog(self, dialogobject):
self.dialogobject = dialogobject
@ -75,13 +73,13 @@ class SongManager():
"""
Searches the song title for keywords.
"""
return self.session.query(Song).filter(search_title.like(u'%' + keywords + u'%'))
return self.session.query(Song).filter(Song.search_title.like(u'%' + keywords + u'%'))
def search_song_lyrics(self, keywords):
"""
Searches the song lyrics for keywords.
"""
return self.session.query(Song).filter(search_lyrics.like(u'%' + keywords + u'%'))
return self.session.query(Song).filter(Song.search_lyrics.like(u'%' + keywords + u'%'))
def get_song(self, id=None):
"""