forked from openlp/openlp
Update plugins to load from directory and filter by file suffix.
Updated Bibles and Presentations. Changed Add presentations to Reload from directory Updated base Config files to reflect changes bzr-revno: 214
This commit is contained in:
parent
eb1b1010c0
commit
f042e5e2d8
@ -52,3 +52,23 @@ class PluginConfig(object):
|
|||||||
|
|
||||||
def set_data_path(self, path):
|
def set_data_path(self, path):
|
||||||
return self.set_config('data path', os.path.basename(path))
|
return self.set_config('data path', os.path.basename(path))
|
||||||
|
|
||||||
|
def get_files(self):
|
||||||
|
returnfiles = []
|
||||||
|
suffix = self.get_config("suffix name")
|
||||||
|
try:
|
||||||
|
files = os.listdir(self.get_data_path())
|
||||||
|
except:
|
||||||
|
return returnfiles
|
||||||
|
if suffix != None:
|
||||||
|
for f in files:
|
||||||
|
if f.find('.') != -1:
|
||||||
|
nme = f.split('.')
|
||||||
|
bname = nme[0]
|
||||||
|
sfx = nme[1]
|
||||||
|
sfx.lower()
|
||||||
|
if suffix.find(sfx) > -1 : # only load files with the correct suffix
|
||||||
|
returnfiles.append(f)
|
||||||
|
return returnfiles
|
||||||
|
else:
|
||||||
|
return files # no filtering required
|
||||||
|
@ -49,13 +49,12 @@ class BibleManager():
|
|||||||
self.bibleSuffix = self.config.get_config("suffix name")
|
self.bibleSuffix = self.config.get_config("suffix name")
|
||||||
self.dialogobject = None
|
self.dialogobject = None
|
||||||
|
|
||||||
log.debug("Bible Path %s", self.biblePath )
|
files = self.config.get_files()
|
||||||
files = os.listdir(self.biblePath)
|
log.debug("Bible Files %s", files )
|
||||||
|
|
||||||
for f in files:
|
for f in files:
|
||||||
nme = f.split('.')
|
nme = f.split('.')
|
||||||
bname = nme[0]
|
bname = nme[0]
|
||||||
sfx = nme[1]
|
|
||||||
if sfx == self.bibleSuffix: # only load files with the correct suffix
|
|
||||||
self.bibleDBCache[bname] = BibleDBImpl(self.biblePath, bname, self.bibleSuffix)
|
self.bibleDBCache[bname] = BibleDBImpl(self.biblePath, bname, self.bibleSuffix)
|
||||||
biblesource = self.bibleDBCache[bname].getMeta("WEB") # look to see if lazy load bible exists and get create getter.
|
biblesource = self.bibleDBCache[bname].getMeta("WEB") # look to see if lazy load bible exists and get create getter.
|
||||||
if biblesource:
|
if biblesource:
|
||||||
|
@ -23,12 +23,12 @@ 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
|
||||||
|
|
||||||
class SongsPlugin(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
|
||||||
#self.edit_song_form = EditSongForm()
|
|
||||||
|
|
||||||
def getMediaManagerItem(self):
|
def getMediaManagerItem(self):
|
||||||
# Create the plugin icon
|
# Create the plugin icon
|
||||||
@ -41,11 +41,11 @@ class SongsPlugin(Plugin):
|
|||||||
self.MediaManagerItem.addToolbar()
|
self.MediaManagerItem.addToolbar()
|
||||||
# Create buttons for the toolbar
|
# Create buttons for the toolbar
|
||||||
## New Song Button ##
|
## New Song Button ##
|
||||||
self.MediaManagerItem.addToolbarButton('New Song', 'Add a new song',
|
self.MediaManagerItem.addToolbarButton('Update', 'Update Presentations',
|
||||||
':/songs/song_new.png', self.onSongNewClick, 'SongNewItem')
|
':/songs/song_new.png', self.onPresentationNewClick, 'PresentationNewItem')
|
||||||
## Edit Song Button ##
|
## Edit Song Button ##
|
||||||
self.MediaManagerItem.addToolbarButton('Edit Song', 'Edit the selected song',
|
self.MediaManagerItem.addToolbarButton('Edit Song', 'Edit the selected song',
|
||||||
':/songs/song_edit.png', self.onSongEditClick, 'SongEditItem')
|
':/songs/song_edit.png', self.onSongEditClick, 'PresentationEditItem')
|
||||||
## Delete Song Button ##
|
## Delete Song Button ##
|
||||||
self.MediaManagerItem.addToolbarButton('Delete Song', 'Delete the selected song',
|
self.MediaManagerItem.addToolbarButton('Delete Song', 'Delete the selected song',
|
||||||
':/songs/song_delete.png', self.onSongDeleteClick, 'SongDeleteItem')
|
':/songs/song_delete.png', self.onSongDeleteClick, 'SongDeleteItem')
|
||||||
@ -68,10 +68,15 @@ class SongsPlugin(Plugin):
|
|||||||
self.listView.setObjectName("listView")
|
self.listView.setObjectName("listView")
|
||||||
self.MediaManagerItem.PageLayout.addWidget(self.listView)
|
self.MediaManagerItem.PageLayout.addWidget(self.listView)
|
||||||
|
|
||||||
|
self.onPresentationNewClick()
|
||||||
|
|
||||||
return self.MediaManagerItem
|
return self.MediaManagerItem
|
||||||
|
|
||||||
def onSongNewClick(self):
|
def onPresentationNewClick(self):
|
||||||
pass
|
files = self.config.get_files()
|
||||||
|
self.listView.clear()
|
||||||
|
for f in files:
|
||||||
|
self.listView.addItem(f)
|
||||||
|
|
||||||
def onSongEditClick(self):
|
def onSongEditClick(self):
|
||||||
self.edit_song_form.show()
|
self.edit_song_form.show()
|
||||||
|
@ -8,3 +8,6 @@ data path = /home/timali/.openlp/data
|
|||||||
[songs]
|
[songs]
|
||||||
file name = songs.sqlite
|
file name = songs.sqlite
|
||||||
data path = songs
|
data path = songs
|
||||||
|
|
||||||
|
[presentations]
|
||||||
|
suffix name = ppt,pps,odi
|
@ -8,3 +8,6 @@ data path = /home/<username>/.openlp/data
|
|||||||
[songs]
|
[songs]
|
||||||
file name = songs.sqlite
|
file name = songs.sqlite
|
||||||
data path = songs
|
data path = songs
|
||||||
|
|
||||||
|
[presentations]
|
||||||
|
suffix name = ppt,pps,odi
|
@ -8,3 +8,6 @@ data path = c:\\Documents and Settings\\<username>\\Application Data\\.openlp\\d
|
|||||||
[songs]
|
[songs]
|
||||||
file name = songs.sqlite
|
file name = songs.sqlite
|
||||||
data path = songs
|
data path = songs
|
||||||
|
|
||||||
|
[presentations]
|
||||||
|
suffix name = ppt,pps,odi
|
||||||
|
Loading…
Reference in New Issue
Block a user