WE HAVE OUR FIRST INTEGRATING PLUGIN!!

bzr-revno: 144
This commit is contained in:
Raoul Snyman 2008-11-30 18:36:13 +00:00
parent aa55cd9af3
commit dbec7d75b3
11 changed files with 78 additions and 68 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-11-29, 07:33:22 --> <!-- Saved: 2008-11-30, 20:32:44 -->
<!-- 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-11-29, 07:33:22 --> <!-- Saved: 2008-11-30, 20:32:44 -->
<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

@ -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-11-28, 23:40:29 --> <!-- Saved: 2008-11-30, 20:32:44 -->
<!-- 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>
@ -73,7 +73,9 @@
<Source>openlp/plugins/biblemanager/bibleCSVImpl.py</Source> <Source>openlp/plugins/biblemanager/bibleCSVImpl.py</Source>
<Source>openlp/plugins/biblemanager/bibleCommon.py</Source> <Source>openlp/plugins/biblemanager/bibleCommon.py</Source>
<Source>openlp/plugins/biblemanager/bibleManager.py</Source> <Source>openlp/plugins/biblemanager/bibleManager.py</Source>
<Source>resources/__init__.py</Source> <Source>openlp/plugins/biblemanager/forms/__init__.py</Source>
<Source>openlp/plugins/biblemanager/forms/bibleimportdialog.py</Source>
<Source>openlp/plugins/biblemanager/forms/bibleimportform.py</Source>
</Sources> </Sources>
<Forms> <Forms>
<Form>resources/forms/bibleimport.ui</Form> <Form>resources/forms/bibleimport.ui</Form>

View File

@ -66,15 +66,19 @@ class MediaManagerItem(QtGui.QWidget):
""" """
if self.Toolbar is None: if self.Toolbar is None:
self.addToolbar() self.addToolbar()
self.ToolbarLayout.addWidget(item) if item.__class__.__name__ == 'QSpacerItem':
self.ToolbarLayout.addSpacerItem(item)
else:
self.ToolbarLayout.addWidget(item)
def addToolbarButton(self, title, tooltip, icon, slot=None, objectname=None): def addToolbarButton(self, title, tooltip, icon, slot=None, objectname=None):
""" """
A method to help developers easily add a button to the toolbar. A method to help developers easily add a button to the toolbar.
""" """
ToolbarButton = QtGui.QToolButton(self.Toolbar) ToolbarButton = QtGui.QToolButton(self.Toolbar)
ToolbarButton.setText(QtCore.QObject.trUtf8(title)) ToolbarButton.setText(QtCore.QObject.trUtf8(ToolbarButton, title))
ToolbarButton.setToolTip(QtCore.QObject.trUtf8(tooltip)) ToolbarButton.setToolTip(QtCore.QObject.trUtf8(ToolbarButton, tooltip))
self.addToolbarItem(ToolbarButton)
if type(icon) is QtGui.QIcon: if type(icon) is QtGui.QIcon:
ButtonIcon = icon ButtonIcon = icon
elif type(icon) is types.StringType: elif type(icon) is types.StringType:
@ -88,11 +92,11 @@ class MediaManagerItem(QtGui.QWidget):
ToolbarButton.setIcon(ButtonIcon) ToolbarButton.setIcon(ButtonIcon)
ToolbarButton.setIconSize(QtCore.QSize(20, 20)) ToolbarButton.setIconSize(QtCore.QSize(20, 20))
ToolbarButton.setAutoRaise(True) ToolbarButton.setAutoRaise(True)
ToolbarButton.setMinimumSize(QtCore.QSize(20, 20))
if objectname is not None: if objectname is not None:
ToolbarButton.setObjectName(objectname) ToolbarButton.setObjectName(objectname)
if slot is not None: if slot is not None:
QtCore.QObject.connect(ToolbarButton, QtCore.SIGNAL("clicked()"), slot) QtCore.QObject.connect(ToolbarButton, QtCore.SIGNAL("clicked()"), slot)
self.addToolbarItem(ToolbarButton)
def addToolbarLine(self): def addToolbarLine(self):
ToolbarLine = QtGui.QFrame(self.Toolbar) ToolbarLine = QtGui.QFrame(self.Toolbar)

View File

@ -69,7 +69,7 @@ class Plugin(object):
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.MediaManagerItem = None self.MediaManagerItem = None
self.SettingsTab = None self.SettingsTab = None
self.ImportMenuItem = None self.ImportMenuItem = None
@ -113,3 +113,6 @@ class Plugin(object):
Handle the event contained in the event object. Handle the event contained in the event object.
""" """
pass pass
def getName(self):
return self.Name

View File

@ -72,14 +72,16 @@ class PluginManager(object):
self.plugins = Plugin.__subclasses__() self.plugins = Plugin.__subclasses__()
self.plugin_by_name = {} self.plugin_by_name = {}
for p in self.plugins: for p in self.plugins:
self.plugin_by_name[p.Name] = p; plugin = p()
self.plugin_by_name[plugin.Name] = plugin;
def hook_media_manager(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 pname in self.plugin_by_name:
plugin = self.plugin_by_name[pname]
if plugin.MediaManagerItem is not None: if plugin.MediaManagerItem 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(plugin.MediaManagerItem, plugin.Icon, plugin.Name) MediaToolBox.addItem(plugin.MediaManagerItem, plugin.Icon, plugin.Name)

View File

@ -18,7 +18,10 @@ 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 openlp.core.ui.mainwindow import MainWindow from splashscreen import SplashScreen
from openlp.core.ui.splashscreen import SplashScreen from about import AboutForm
from alertform import AlertForm
from settings import SettingsDialog
from mainwindow import MainWindow
__all__ = ['MainWindow', 'SplashScreen'] __all__ = ['SplashScreen', 'AboutForm', 'AlertForm', 'SettingsDialog', 'MainWindow']

View File

@ -22,25 +22,18 @@ from time import sleep
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.resources import * from openlp.core.resources import *
from openlp.core.ui.about import AboutForm from openlp.core.ui import AboutForm, AlertForm, SettingsDialog
from openlp.core.ui.alertform import AlertForm
from openlp.core.ui.settings import SettingsDialog
from openlp.core import Plugin, PluginManager, MediaManagerItem, SettingsTab from openlp.core import Plugin, PluginManager, MediaManagerItem, SettingsTab
class MainWindow(object): class MainWindow(object):
def __init__(self): def __init__(self):
self.main_window = QtGui.QMainWindow() self.main_window = QtGui.QMainWindow()
self.setupUi()
self.about_form = AboutForm() self.about_form = AboutForm()
self.alert_form = AlertForm() self.alert_form = AlertForm()
#self.edit_song_form = EditSongForm()
#self.openlpexportform = OpenLPExportForm()
#self.openlpimportform = OpenLPImportForm()
#self.opensongexportform = OpenSongExportForm()
#self.opensongimportform = OpenSongImportForm()
self.settings_form = SettingsDialog() self.settings_form = SettingsDialog()
self.plugin_manager = PluginManager('/home/raoul/Projects/openlp-2/openlp/plugins') self.plugin_manager = PluginManager('/home/raoul/Projects/openlp-2/openlp/plugins')
self.setupUi()
def setupUi(self): def setupUi(self):
self.main_window.setObjectName("main_window") self.main_window.setObjectName("main_window")
@ -149,6 +142,7 @@ class MainWindow(object):
self.MediaManagerDock.setWindowIcon(icon) self.MediaManagerDock.setWindowIcon(icon)
self.MediaManagerDock.setFloating(False) self.MediaManagerDock.setFloating(False)
self.MediaManagerDock.setObjectName("MediaManagerDock") self.MediaManagerDock.setObjectName("MediaManagerDock")
self.MediaManagerDock.setMinimumWidth(250)
self.MediaManagerContents = QtGui.QWidget() self.MediaManagerContents = QtGui.QWidget()
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
@ -164,6 +158,8 @@ 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.hook_media_manager(self.MediaToolBox)
# 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)
self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock) self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock)

View File

@ -1,3 +1,5 @@
# -*- 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
@ -35,7 +37,7 @@ logging.basicConfig(level=logging.DEBUG,
filemode='w') filemode='w')
class BibleManager(): class BibleManager():
global log global log
log=logging.getLogger("BibleMgr") log=logging.getLogger("BibleMgr")
log.info("Bible manager loaded") log.info("Bible manager loaded")
def __init__(self): def __init__(self):
@ -45,7 +47,7 @@ class BibleManager():
Throws Exception if no Bibles are found. Throws Exception if no Bibles are found.
Init confirms the bible exists and stores the database path. Init confirms the bible exists and stores the database path.
""" """
log.debug( "Bible Initialising") log.debug( "Bible Initialising")
self.bibleDBCache = {} # dict of bible database classes self.bibleDBCache = {} # dict of bible database classes
self.bibleHTTPCache = {} # dict of bible http readers self.bibleHTTPCache = {} # dict of bible http readers
@ -63,23 +65,23 @@ class BibleManager():
self.bibleHTTPCache[b] = nhttp self.bibleHTTPCache[b] = nhttp
proxy = self.bibleDBCache[b].getMeta("proxy") # look to see if lazy load bible exists and get create getter. proxy = self.bibleDBCache[b].getMeta("proxy") # look to see if lazy load bible exists and get create getter.
nhttp.setProxy(proxy) # tell The Server where to get the verses from. nhttp.setProxy(proxy) # tell The Server where to get the verses from.
# #
log.debug( "Bible Initialised") log.debug( "Bible Initialised")
def processDialog(self, dialogobject): def processDialog(self, dialogobject):
self.dialogobject = dialogobject self.dialogobject = dialogobject
def registerHTTPBible(self, biblename, biblesource, proxyurl=None, proxyid=None, proxypass=None): def registerHTTPBible(self, biblename, biblesource, proxyurl=None, proxyid=None, proxypass=None):
""" """
Return a list of bibles from a given URL. Return a list of bibles from a given URL.
The selected Bible can then be registered and LazyLoaded into a database The selected Bible can then be registered and LazyLoaded into a database
""" """
log.debug( "registerHTTPBible %s,%s,%s,%s,%s", biblename, biblesource, proxyurl, proxyid, proxypass) log.debug( "registerHTTPBible %s,%s,%s,%s,%s", biblename, biblesource, proxyurl, proxyid, proxypass)
if self._isNewBible(biblename): if self._isNewBible(biblename):
nbible = BibleDBImpl(biblename) # Create new Bible nbible = BibleDBImpl(biblename) # Create new Bible
nbible.createTables() # Create Database nbible.createTables() # Create Database
self.bibleDBCache[biblename] = nbible self.bibleDBCache[biblename] = nbible
nhttp = BibleHTTPImpl() nhttp = BibleHTTPImpl()
nhttp.setBibleSource(biblesource) nhttp.setBibleSource(biblesource)
@ -87,59 +89,59 @@ class BibleManager():
nbible.saveMeta("WEB", biblesource) # register a lazy loading interest nbible.saveMeta("WEB", biblesource) # register a lazy loading interest
if proxyurl != None: if proxyurl != None:
nbible.saveMeta("proxy", proxyurl) # store the proxy URL nbible.saveMeta("proxy", proxyurl) # store the proxy URL
nhttp.setProxy(proxyurl) nhttp.setProxy(proxyurl)
if proxyid != None: if proxyid != None:
nbible.saveMeta("proxyid", proxyid) # store the proxy userid nbible.saveMeta("proxyid", proxyid) # store the proxy userid
if proxypass != None: if proxypass != None:
nbible.saveMeta("proxypass", proxypass) # store the proxy password nbible.saveMeta("proxypass", proxypass) # store the proxy password
def registerCVSFileBible(self, biblename, booksfile, versefile): def registerCVSFileBible(self, biblename, booksfile, versefile):
""" """
Method to load a bible from a set of files into a database. Method to load a bible from a set of files into a database.
If the database exists it is deleted and the database is reloaded If the database exists it is deleted and the database is reloaded
from scratch. from scratch.
""" """
if self._isNewBible(biblename): if self._isNewBible(biblename):
nbible = BibleDBImpl(biblename) # Create new Bible nbible = BibleDBImpl(biblename) # Create new Bible
nbible.createTables() # Create Database nbible.createTables() # Create Database
self.bibleDBCache[biblename] = nbible # cache the database for use later self.bibleDBCache[biblename] = nbible # cache the database for use later
bcsv = BibleCSVImpl(nbible) # create the loader and pass in the database bcsv = BibleCSVImpl(nbible) # create the loader and pass in the database
bcsv.loadData(booksfile, versefile) bcsv.loadData(booksfile, versefile)
def registerOSISFileBible(self, biblename, osisfile): def registerOSISFileBible(self, biblename, osisfile):
""" """
Method to load a bible from a osis xml file extracted from Sword bible viewer. Method to load a bible from a osis xml file extracted from Sword bible viewer.
If the database exists it is deleted and the database is reloaded If the database exists it is deleted and the database is reloaded
from scratch. from scratch.
""" """
if self._isNewBible(biblename): if self._isNewBible(biblename):
nbible = BibleDBImpl(biblename) # Create new Bible nbible = BibleDBImpl(biblename) # Create new Bible
nbible.createTables() # Create Database nbible.createTables() # Create Database
self.bibleDBCache[biblename] = nbible # cache the database for use later self.bibleDBCache[biblename] = nbible # cache the database for use later
bcsv = BibleOSISImpl(nbible) # create the loader and pass in the database bcsv = BibleOSISImpl(nbible) # create the loader and pass in the database
bcsv.loadData(osisfile, self.dialogobject) bcsv.loadData(osisfile, self.dialogobject)
def loadBible(self,biblename): def loadBible(self,biblename):
""" """
Downloads all the books of the bible Downloads all the books of the bible
and loads it into the database and loads it into the database
""" """
log.debug( "loadBible %s", biblename) log.debug( "loadBible %s", biblename)
bookabbrev = "" bookabbrev = ""
for bookname in self.listOfBooks: for bookname in self.listOfBooks:
cptrs = self.booksChapters[ self.booksOfBible[bookname]] cptrs = self.booksChapters[ self.booksOfBible[bookname]]
log.debug( "book and chapter %s %s", bookname , self.booksChapters[ self.booksOfBible[bookname]] ) log.debug( "book and chapter %s %s", bookname , self.booksChapters[ self.booksOfBible[bookname]] )
for chptr in range(1 , int(cptrs)): # loop through all the chapters in book for chptr in range(1 , int(cptrs)): # loop through all the chapters in book
c = self.bibleDBCache[biblename].getBibleChapter(bookname, chptr) # check to see if book/chapter exists c = self.bibleDBCache[biblename].getBibleChapter(bookname, chptr) # check to see if book/chapter exists
log.debug( "got chapter %s", c) log.debug( "got chapter %s", c)
if not c: if not c:
bookid = self.booksOfBible[bookname] # convert to id ie Genesis --> 1 Revelation --> 73 bookid = self.booksOfBible[bookname] # convert to id ie Genesis --> 1 Revelation --> 73
log.debug( "missing %s,%s", bookname, chptr) log.debug( "missing %s,%s", bookname, chptr)
self._loadBook(biblename,bookid, bookname, bookabbrev) self._loadBook(biblename,bookid, bookname, bookabbrev)
self._loadChapter(biblename,bookid, bookname, chptr) self._loadChapter(biblename,bookid, bookname, chptr)
def getBibles(self): def getBibles(self):
""" """
Returns a list of Books of the bible Returns a list of Books of the bible
@ -152,9 +154,9 @@ class BibleManager():
def getBibleBooks(self,bible): def getBibleBooks(self,bible):
""" """
Returns a list of the books of the bible from the database Returns a list of the books of the bible from the database
""" """
return self.bibleDBCache[bible].getBibleBooks() return self.bibleDBCache[bible].getBibleBooks()
def getBookChapterCount(self,bible, book): def getBookChapterCount(self,bible, book):
""" """
Returns the number of Chapters for a given book Returns the number of Chapters for a given book
@ -189,8 +191,8 @@ class BibleManager():
#log.debug( self.bibleDBCache) #log.debug( self.bibleDBCache)
#log.debug( self.bibleHTTPCache) #log.debug( self.bibleHTTPCache)
log.debug( "getVerseText %s,%s,%s,%s,%s", bible,bookname, chapter, sverse, everse) log.debug( "getVerseText %s,%s,%s,%s,%s", bible,bookname, chapter, sverse, everse)
# bookid = self.booksOfBible[bookname] # convert to id ie Genesis --> 1 Revelation --> 73 # bookid = self.booksOfBible[bookname] # convert to id ie Genesis --> 1 Revelation --> 73
# # SORT OUT BOOKNAME BOOK ID. # # SORT OUT BOOKNAME BOOK ID.
# # NAME COMES IN TO ID AND BACK TO NAME ? # # NAME COMES IN TO ID AND BACK TO NAME ?
# c = self.bibleDBCache[bible].getBibleChapter(bookname, chapter) # check to see if book/chapter exists # c = self.bibleDBCache[bible].getBibleChapter(bookname, chapter) # check to see if book/chapter exists
# bookabbrev = "" # bookabbrev = ""
@ -204,28 +206,28 @@ class BibleManager():
#log.debug( text) #log.debug( text)
#self.bibleDBCache[bible].dumpBible() #self.bibleDBCache[bible].dumpBible()
return text return text
def _loadBook(self, bible, bookid, bookname, bookabbrev): def _loadBook(self, bible, bookid, bookname, bookabbrev):
log.debug( "loadbook %s,%s,%s,%s", bible, bookid, bookname, bookabbrev) log.debug( "loadbook %s,%s,%s,%s", bible, bookid, bookname, bookabbrev)
cl = self.bibleDBCache[bible].getBibleBook(bookname) cl = self.bibleDBCache[bible].getBibleBook(bookname)
log.debug( "get bible book %s" , cl) log.debug( "get bible book %s" , cl)
if not cl : if not cl :
self.bibleDBCache[bible].createBook(bookid, bookname, bookabbrev) self.bibleDBCache[bible].createBook(bookid, bookname, bookabbrev)
def _loadChapter(self, bible, bookid, bookname, chapter): def _loadChapter(self, bible, bookid, bookname, chapter):
log.debug( "loadChapter %s,%s,%s,%s", bible, bookid,bookname, chapter) log.debug( "loadChapter %s,%s,%s,%s", bible, bookid,bookname, chapter)
try : try :
chaptlist = self.bibleHTTPCache[bible].getBibleChapter(bible, bookid,bookname, chapter) chaptlist = self.bibleHTTPCache[bible].getBibleChapter(bible, bookid,bookname, chapter)
self.bibleDBCache[bible].createChapter(bookname, chapter, chaptlist) self.bibleDBCache[bible].createChapter(bookname, chapter, chaptlist)
except : except :
log.error("Errow thrown %s", sys.exc_info()[1]) log.error("Errow thrown %s", sys.exc_info()[1])
def _isNewBible(self, name): def _isNewBible(self, name):
""" """
Check cache to see if new bible Check cache to see if new bible
""" """
for b , o in self.bibleDBCache.iteritems(): for b , o in self.bibleDBCache.iteritems():
log.debug( b ) log.debug( b )
if b == name : if b == name :
return False return False
return True return True

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 # 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
@ -22,8 +22,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.resources import * from openlp.core.resources import *
from openlp.core import Plugin from openlp.core import Plugin
from openlp.plugins.biblemanager.biblemanager import BibleManager from biblemanager import BibleManager
from openlp.plugins.biblemanager.bibleimportform import BibleImportForm from bibleimportform import BibleImportForm
class BiblePlugin(Plugin): class BiblePlugin(Plugin):
def __init__(self): def __init__(self):
@ -78,5 +78,3 @@ class BiblePlugin(Plugin):
def onBibleAddClick(self): def onBibleAddClick(self):
pass pass
s

View File

@ -25,7 +25,7 @@ from openlp.core import Plugin, MediaManagerItem
class SongsPlugin(Plugin): class SongsPlugin(Plugin):
def __init__(self): def __init__(self):
# Call the parent constructor # Call the parent constructor
Plugin.__init__(self, 'Song', '1.9.0') Plugin.__init__(self, 'Songs', '1.9.0')
# 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'),
@ -61,11 +61,11 @@ class SongsPlugin(Plugin):
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.MediaManagerItem.addToolbarItem(self.SongSpacerItem) self.MediaManagerItem.addToolbarItem(self.SongSpacerItem)
# Add the songlist widget # Add the songlist widget
self.SongList = QtGui.QTableWidget(self.MediaManagerItem) #self.SongList = QtGui.QTableWidget(self.MediaManagerItem)
self.SongList.setObjectName("SongList") #self.SongList.setObjectName("SongList")
self.SongList.setColumnCount(0) #self.SongList.setColumnCount(0)
self.SongList.setRowCount(0) #self.SongList.setRowCount(0)
self.MediaManagerItem.PageLayout.addWidget(self.SongList) #self.MediaManagerItem.PageLayout.addWidget(self.SongList)
def onSongNewClick(self): def onSongNewClick(self):
pass pass