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
|
||||||
|
@ -48,23 +48,22 @@ class BibleManager():
|
|||||||
self.proxyname = self.config.get_config("proxy name") #get proxy name for screen
|
self.proxyname = self.config.get_config("proxy name") #get proxy name for screen
|
||||||
self.bibleSuffix = self.config.get_config("suffix name")
|
self.bibleSuffix = self.config.get_config("suffix name")
|
||||||
self.dialogobject = None
|
self.dialogobject = None
|
||||||
|
|
||||||
|
files = self.config.get_files()
|
||||||
|
log.debug("Bible Files %s", files )
|
||||||
|
|
||||||
log.debug("Bible Path %s", self.biblePath )
|
|
||||||
files = os.listdir(self.biblePath)
|
|
||||||
for f in files:
|
for f in files:
|
||||||
nme = f.split('.')
|
nme = f.split('.')
|
||||||
bname = nme[0]
|
bname = nme[0]
|
||||||
sfx = nme[1]
|
self.bibleDBCache[bname] = BibleDBImpl(self.biblePath, bname, self.bibleSuffix)
|
||||||
if sfx == self.bibleSuffix: # only load files with the correct suffix
|
biblesource = self.bibleDBCache[bname].getMeta("WEB") # look to see if lazy load bible exists and get create getter.
|
||||||
self.bibleDBCache[bname] = BibleDBImpl(self.biblePath, bname, self.bibleSuffix)
|
if biblesource:
|
||||||
biblesource = self.bibleDBCache[bname].getMeta("WEB") # look to see if lazy load bible exists and get create getter.
|
nhttp = BibleHTTPImpl()
|
||||||
if biblesource:
|
nhttp.setBibleSource(biblesource) # tell The Server where to get the verses from.
|
||||||
nhttp = BibleHTTPImpl()
|
self.bibleHTTPCache[bname] = nhttp
|
||||||
nhttp.setBibleSource(biblesource) # tell The Server where to get the verses from.
|
proxy = self.bibleDBCache[bname].getMeta("proxy") # look to see if lazy load bible exists and get create getter.
|
||||||
self.bibleHTTPCache[bname] = nhttp
|
nhttp.setProxy(proxy) # tell The Server where to get the verses from.
|
||||||
proxy = self.bibleDBCache[bname].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.
|
|
||||||
#
|
|
||||||
|
|
||||||
log.debug( "Bible Initialised")
|
log.debug( "Bible Initialised")
|
||||||
|
|
||||||
|
@ -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')
|
||||||
@ -67,11 +67,16 @@ class SongsPlugin(Plugin):
|
|||||||
self.listView.setGeometry(QtCore.QRect(10, 100, 256, 591))
|
self.listView.setGeometry(QtCore.QRect(10, 100, 256, 591))
|
||||||
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