forked from openlp/openlp
Bible refactor & search, getter & setter removal, cleanups
bzr-revno: 969 Fixes: https://launchpad.net/bugs/608409
This commit is contained in:
commit
bc7d643ab2
@ -58,34 +58,6 @@ class SettingsManager(object):
|
|||||||
self.mainwindow_left + self.mainwindow_right) - 100 ) / 2
|
self.mainwindow_left + self.mainwindow_right) - 100 ) / 2
|
||||||
self.slidecontroller_image = self.slidecontroller - 50
|
self.slidecontroller_image = self.slidecontroller - 50
|
||||||
|
|
||||||
def get_preview_visibility(self):
|
|
||||||
"""
|
|
||||||
Return the preview panel's visibility.
|
|
||||||
"""
|
|
||||||
return QtCore.QSettings().value(u'user interface/preview panel',
|
|
||||||
QtCore.QVariant(True)).toBool()
|
|
||||||
|
|
||||||
def set_preview_visibility(self, visible):
|
|
||||||
"""
|
|
||||||
Set the preview panel's visibility.
|
|
||||||
"""
|
|
||||||
QtCore.QSettings().setValue(u'user interface/preview panel',
|
|
||||||
QtCore.QVariant(visible))
|
|
||||||
|
|
||||||
def get_live_visibility(self):
|
|
||||||
"""
|
|
||||||
Return the live panel's visibility.
|
|
||||||
"""
|
|
||||||
return QtCore.QSettings().value(u'user interface/live panel',
|
|
||||||
QtCore.QVariant(True)).toBool()
|
|
||||||
|
|
||||||
def set_live_visibility(self, visible):
|
|
||||||
"""
|
|
||||||
Set the live panel's visibility.
|
|
||||||
"""
|
|
||||||
QtCore.QSettings().setValue(u'user interface/live panel',
|
|
||||||
QtCore.QVariant(visible))
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_last_dir(section, num=None):
|
def get_last_dir(section, num=None):
|
||||||
"""
|
"""
|
||||||
@ -206,4 +178,4 @@ class SettingsManager(object):
|
|||||||
if extension == os.path.splitext(filename)[1]]
|
if extension == os.path.splitext(filename)[1]]
|
||||||
else:
|
else:
|
||||||
# no filtering required
|
# no filtering required
|
||||||
return files
|
return files
|
||||||
|
@ -308,18 +308,18 @@ class Ui_MainWindow(object):
|
|||||||
self.ToolsAddToolItem.setObjectName(u'ToolsAddToolItem')
|
self.ToolsAddToolItem.setObjectName(u'ToolsAddToolItem')
|
||||||
self.ViewPreviewPanel = QtGui.QAction(MainWindow)
|
self.ViewPreviewPanel = QtGui.QAction(MainWindow)
|
||||||
self.ViewPreviewPanel.setCheckable(True)
|
self.ViewPreviewPanel.setCheckable(True)
|
||||||
self.ViewPreviewPanel.setChecked(
|
previewVisible = QtCore.QSettings().value(
|
||||||
self.settingsmanager.get_preview_visibility())
|
u'user interface/preview panel', QtCore.QVariant(True)).toBool()
|
||||||
|
self.ViewPreviewPanel.setChecked(previewVisible)
|
||||||
self.ViewPreviewPanel.setObjectName(u'ViewPreviewPanel')
|
self.ViewPreviewPanel.setObjectName(u'ViewPreviewPanel')
|
||||||
self.PreviewController.Panel.setVisible(
|
self.PreviewController.Panel.setVisible(previewVisible)
|
||||||
self.settingsmanager.get_preview_visibility())
|
|
||||||
self.ViewLivePanel = QtGui.QAction(MainWindow)
|
self.ViewLivePanel = QtGui.QAction(MainWindow)
|
||||||
self.ViewLivePanel.setCheckable(True)
|
self.ViewLivePanel.setCheckable(True)
|
||||||
self.ViewLivePanel.setChecked(
|
liveVisible = QtCore.QSettings().value(u'user interface/live panel',
|
||||||
self.settingsmanager.get_live_visibility())
|
QtCore.QVariant(True)).toBool()
|
||||||
|
self.ViewLivePanel.setChecked(liveVisible)
|
||||||
self.ViewLivePanel.setObjectName(u'ViewLivePanel')
|
self.ViewLivePanel.setObjectName(u'ViewLivePanel')
|
||||||
self.LiveController.Panel.setVisible(
|
self.LiveController.Panel.setVisible(liveVisible)
|
||||||
self.settingsmanager.get_live_visibility())
|
|
||||||
self.ModeDefaultItem = QtGui.QAction(MainWindow)
|
self.ModeDefaultItem = QtGui.QAction(MainWindow)
|
||||||
self.ModeDefaultItem.setCheckable(True)
|
self.ModeDefaultItem.setCheckable(True)
|
||||||
self.ModeDefaultItem.setObjectName(u'ModeDefaultItem')
|
self.ModeDefaultItem.setObjectName(u'ModeDefaultItem')
|
||||||
@ -918,7 +918,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
False - Hidden
|
False - Hidden
|
||||||
"""
|
"""
|
||||||
self.PreviewController.Panel.setVisible(visible)
|
self.PreviewController.Panel.setVisible(visible)
|
||||||
self.settingsmanager.set_preview_visibility(visible)
|
QtCore.QSettings().setValue(u'user interface/preview panel',
|
||||||
|
QtCore.QVariant(visible))
|
||||||
self.ViewPreviewPanel.setChecked(visible)
|
self.ViewPreviewPanel.setChecked(visible)
|
||||||
|
|
||||||
def setLivePanelVisibility(self, visible):
|
def setLivePanelVisibility(self, visible):
|
||||||
@ -932,7 +933,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
False - Hidden
|
False - Hidden
|
||||||
"""
|
"""
|
||||||
self.LiveController.Panel.setVisible(visible)
|
self.LiveController.Panel.setVisible(visible)
|
||||||
self.settingsmanager.set_live_visibility(visible)
|
QtCore.QSettings().setValue(u'user interface/live panel',
|
||||||
|
QtCore.QVariant(visible))
|
||||||
self.ViewLivePanel.setChecked(visible)
|
self.ViewLivePanel.setChecked(visible)
|
||||||
|
|
||||||
def loadSettings(self):
|
def loadSettings(self):
|
||||||
|
@ -757,4 +757,4 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
theme.font_main_y = int(theme.font_main_y.strip())
|
theme.font_main_y = int(theme.font_main_y.strip())
|
||||||
#theme.theme_mode
|
#theme.theme_mode
|
||||||
theme.theme_name = theme.theme_name.strip()
|
theme.theme_name = theme.theme_name.strip()
|
||||||
#theme.theme_version
|
#theme.theme_version
|
||||||
|
@ -143,4 +143,4 @@ class LanguageManager(object):
|
|||||||
"""
|
"""
|
||||||
if LanguageManager.__qmList__ is None:
|
if LanguageManager.__qmList__ is None:
|
||||||
LanguageManager.init_qm_list()
|
LanguageManager.init_qm_list()
|
||||||
return LanguageManager.__qmList__
|
return LanguageManager.__qmList__
|
||||||
|
@ -139,24 +139,6 @@ class SearchResults(object):
|
|||||||
self.chapter = chapter
|
self.chapter = chapter
|
||||||
self.verselist = verselist
|
self.verselist = verselist
|
||||||
|
|
||||||
def get_verselist(self):
|
|
||||||
"""
|
|
||||||
Returns the list of verses.
|
|
||||||
"""
|
|
||||||
return self.verselist
|
|
||||||
|
|
||||||
def get_book(self):
|
|
||||||
"""
|
|
||||||
Returns the book of the Bible.
|
|
||||||
"""
|
|
||||||
return self.book
|
|
||||||
|
|
||||||
def get_chapter(self):
|
|
||||||
"""
|
|
||||||
Returns the chapter of the book.
|
|
||||||
"""
|
|
||||||
return self.chapter
|
|
||||||
|
|
||||||
def has_verselist(self):
|
def has_verselist(self):
|
||||||
"""
|
"""
|
||||||
Returns whether or not the verse list contains verses.
|
Returns whether or not the verse list contains verses.
|
||||||
@ -277,4 +259,4 @@ def unescape(text):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
return text # leave as is
|
return text # leave as is
|
||||||
return re.sub(u'&#?\w+;', fixup, text)
|
return re.sub(u'&#?\w+;', fixup, text)
|
||||||
|
@ -306,6 +306,13 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
Book.abbreviation.like(book + u'%'))
|
Book.abbreviation.like(book + u'%'))
|
||||||
return db_book
|
return db_book
|
||||||
|
|
||||||
|
def get_books(self):
|
||||||
|
"""
|
||||||
|
A wrapper so both local and web bibles have a get_books() method that
|
||||||
|
manager can call. Used in the media manager advanced search tab.
|
||||||
|
"""
|
||||||
|
return self.get_all_objects(Book, order_by_ref=Book.id)
|
||||||
|
|
||||||
def get_verses(self, reference_list):
|
def get_verses(self, reference_list):
|
||||||
"""
|
"""
|
||||||
This is probably the most used function. It retrieves the list of
|
This is probably the most used function. It retrieves the list of
|
||||||
|
@ -31,12 +31,11 @@ import sqlite3
|
|||||||
import urllib
|
import urllib
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
from BeautifulSoup import BeautifulSoup, Tag, NavigableString
|
from BeautifulSoup import BeautifulSoup, NavigableString
|
||||||
|
|
||||||
from openlp.core.lib import Receiver
|
from openlp.core.lib import Receiver
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
from openlp.plugins.bibles.lib.common import BibleCommon, SearchResults, \
|
from openlp.plugins.bibles.lib.common import BibleCommon, SearchResults
|
||||||
unescape
|
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB, Book
|
from openlp.plugins.bibles.lib.db import BibleDB, Book
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -106,6 +105,7 @@ class HTTPBooks(object):
|
|||||||
"""
|
"""
|
||||||
if not isinstance(name, unicode):
|
if not isinstance(name, unicode):
|
||||||
name = unicode(name)
|
name = unicode(name)
|
||||||
|
name = name.title()
|
||||||
books = HTTPBooks.run_sql(u'SELECT id, testament_id, name, '
|
books = HTTPBooks.run_sql(u'SELECT id, testament_id, name, '
|
||||||
u'abbreviation, chapters FROM books WHERE name = ? OR '
|
u'abbreviation, chapters FROM books WHERE name = ? OR '
|
||||||
u'abbreviation = ?', (name, name))
|
u'abbreviation = ?', (name, name))
|
||||||
@ -138,10 +138,10 @@ class HTTPBooks(object):
|
|||||||
u'verses FROM chapters WHERE book_id = ?', (book[u'id'],))
|
u'verses FROM chapters WHERE book_id = ?', (book[u'id'],))
|
||||||
if chapters:
|
if chapters:
|
||||||
return {
|
return {
|
||||||
u'id': chapters[chapter][0],
|
u'id': chapters[chapter-1][0],
|
||||||
u'book_id': chapters[chapter][1],
|
u'book_id': chapters[chapter-1][1],
|
||||||
u'chapter': chapters[chapter][2],
|
u'chapter': chapters[chapter-1][2],
|
||||||
u'verses': chapters[chapter][3]
|
u'verses': chapters[chapter-1][3]
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
@ -180,7 +180,6 @@ class BGExtract(BibleCommon):
|
|||||||
"""
|
"""
|
||||||
Extract verses from BibleGateway
|
Extract verses from BibleGateway
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, proxyurl=None):
|
def __init__(self, proxyurl=None):
|
||||||
log.debug(u'init %s', proxyurl)
|
log.debug(u'init %s', proxyurl)
|
||||||
self.proxyurl = proxyurl
|
self.proxyurl = proxyurl
|
||||||
@ -202,78 +201,33 @@ class BGExtract(BibleCommon):
|
|||||||
url_params = urllib.urlencode(
|
url_params = urllib.urlencode(
|
||||||
{u'search': u'%s %s' % (bookname, chapter),
|
{u'search': u'%s %s' % (bookname, chapter),
|
||||||
u'version': u'%s' % version})
|
u'version': u'%s' % version})
|
||||||
# Let's get the page, and then open it in BeautifulSoup, so as to
|
|
||||||
# attempt to make "easy" work of bad HTML.
|
|
||||||
page = urllib2.urlopen(
|
page = urllib2.urlopen(
|
||||||
u'http://www.biblegateway.com/passage/?%s' % url_params)
|
u'http://www.biblegateway.com/passage/?%s' % url_params)
|
||||||
log.debug(u'BibleGateway url = %s' % page.geturl())
|
log.debug(u'BibleGateway url = %s' % page.geturl())
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
soup = BeautifulSoup(page)
|
cleaner = [(re.compile(' |<br />'), lambda match: '')]
|
||||||
|
soup = BeautifulSoup(page, markupMassage=cleaner)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
verses = soup.find(u'div', u'result-text-style-normal')
|
footnotes = soup.findAll(u'sup', u'footnote')
|
||||||
verse_number = 0
|
[footnote.extract() for footnote in footnotes]
|
||||||
verse_list = {0: u''}
|
cleanup = [(re.compile('\s+'), lambda match: ' ')]
|
||||||
# http://www.codinghorror.com/blog/2009/11/parsing-html-the-cthulhu-way.html
|
verses = BeautifulSoup(str(soup), markupMassage=cleanup)
|
||||||
# This is a PERFECT example of opening the Cthulu tag!
|
content = verses.find(u'div', u'result-text-style-normal')
|
||||||
# O Bible Gateway, why doth ye such horrific HTML produce?
|
verse_count = len(verses.findAll(u'sup', u'versenum'))
|
||||||
for verse in verses:
|
found_count = 0
|
||||||
Receiver.send_message(u'openlp_process_events')
|
verse_list = {}
|
||||||
if isinstance(verse, Tag) and verse.name == u'div' and filter(lambda a: a[0] == u'class', verse.attrs)[0][1] == u'footnotes':
|
while found_count < verse_count:
|
||||||
break
|
content = content.findNext(u'sup', u'versenum')
|
||||||
if isinstance(verse, Tag) and verse.name == u'sup' and filter(lambda a: a[0] == u'class', verse.attrs)[0][1] != u'versenum':
|
raw_verse_num = content.next
|
||||||
continue
|
raw_verse_text = raw_verse_num.next
|
||||||
if isinstance(verse, Tag) and verse.name == u'p' and not verse.contents:
|
verse_list[int(str(raw_verse_num))] = unicode(raw_verse_text)
|
||||||
continue
|
found_count += 1
|
||||||
if isinstance(verse, Tag) and (verse.name == u'p' or verse.name == u'font') and verse.contents:
|
|
||||||
for item in verse.contents:
|
|
||||||
Receiver.send_message(u'openlp_process_events')
|
|
||||||
if isinstance(item, Tag) and (item.name == u'h4' or item.name == u'h5'):
|
|
||||||
continue
|
|
||||||
if isinstance(item, Tag) and item.name == u'sup' and filter(lambda a: a[0] == u'class', item.attrs)[0][1] != u'versenum':
|
|
||||||
continue
|
|
||||||
if isinstance(item, Tag) and item.name == u'p' and not item.contents:
|
|
||||||
continue
|
|
||||||
if isinstance(item, Tag) and item.name == u'sup':
|
|
||||||
verse_number = int(str(item.contents[0]))
|
|
||||||
verse_list[verse_number] = u''
|
|
||||||
continue
|
|
||||||
if isinstance(item, Tag) and item.name == u'font':
|
|
||||||
for subitem in item.contents:
|
|
||||||
Receiver.send_message(u'openlp_process_events')
|
|
||||||
if isinstance(subitem, Tag) and subitem.name == u'sup' and filter(lambda a: a[0] == u'class', subitem.attrs)[0][1] != u'versenum':
|
|
||||||
continue
|
|
||||||
if isinstance(subitem, Tag) and subitem.name == u'p' and not subitem.contents:
|
|
||||||
continue
|
|
||||||
if isinstance(subitem, Tag) and subitem.name == u'sup':
|
|
||||||
verse_number = int(str(subitem.contents[0]))
|
|
||||||
verse_list[verse_number] = u''
|
|
||||||
continue
|
|
||||||
if isinstance(subitem, NavigableString):
|
|
||||||
verse_list[verse_number] = verse_list[verse_number] + subitem.replace(u' ', u' ')
|
|
||||||
continue
|
|
||||||
if isinstance(item, NavigableString):
|
|
||||||
verse_list[verse_number] = verse_list[verse_number] + item.replace(u' ', u' ')
|
|
||||||
continue
|
|
||||||
if isinstance(verse, Tag) and verse.name == u'sup':
|
|
||||||
verse_number = int(str(verse.contents[0]))
|
|
||||||
verse_list[verse_number] = u''
|
|
||||||
continue
|
|
||||||
if isinstance(verse, NavigableString):
|
|
||||||
if not isinstance(verse, unicode):
|
|
||||||
verse = unicode(verse, u'utf8')
|
|
||||||
verse_list[verse_number] = verse_list[verse_number] + \
|
|
||||||
unescape(verse.replace(u' ', u' '))
|
|
||||||
# Delete the "0" element, since we don't need it, it's just there for
|
|
||||||
# some stupid initial whitespace, courtesy of Bible Gateway.
|
|
||||||
del verse_list[0]
|
|
||||||
# Finally, return the list of verses in a "SearchResults" object.
|
|
||||||
return SearchResults(bookname, chapter, verse_list)
|
return SearchResults(bookname, chapter, verse_list)
|
||||||
|
|
||||||
class CWExtract(BibleCommon):
|
class CWExtract(BibleCommon):
|
||||||
"""
|
"""
|
||||||
Extract verses from CrossWalk/BibleStudyTools
|
Extract verses from CrossWalk/BibleStudyTools
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, proxyurl=None):
|
def __init__(self, proxyurl=None):
|
||||||
log.debug(u'init %s', proxyurl)
|
log.debug(u'init %s', proxyurl)
|
||||||
self.proxyurl = proxyurl
|
self.proxyurl = proxyurl
|
||||||
@ -433,13 +387,12 @@ class HTTPBible(BibleDB):
|
|||||||
## if it was there. By reusing the returned book name
|
## if it was there. By reusing the returned book name
|
||||||
## we get a correct book. For example it is possible
|
## we get a correct book. For example it is possible
|
||||||
## to request ac and get Acts back.
|
## to request ac and get Acts back.
|
||||||
bookname = search_results.get_book()
|
bookname = search_results.book
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
# check to see if book/chapter exists
|
# check to see if book/chapter exists
|
||||||
db_book = self.get_book(bookname)
|
db_book = self.get_book(bookname)
|
||||||
self.create_chapter(db_book.id,
|
self.create_chapter(db_book.id, search_results.chapter,
|
||||||
search_results.get_chapter(),
|
search_results.verselist)
|
||||||
search_results.get_verselist())
|
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
Receiver.send_message(u'bibles_hideprogress')
|
Receiver.send_message(u'bibles_hideprogress')
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
@ -491,14 +444,3 @@ class HTTPBible(BibleDB):
|
|||||||
The chapter whose verses are being counted.
|
The chapter whose verses are being counted.
|
||||||
"""
|
"""
|
||||||
return HTTPBooks.get_verse_count(book, chapter)
|
return HTTPBooks.get_verse_count(book, chapter)
|
||||||
|
|
||||||
def set_proxy_server(self, server):
|
|
||||||
"""
|
|
||||||
Sets the proxy server.
|
|
||||||
|
|
||||||
**Note: This is not actually used.**
|
|
||||||
|
|
||||||
``server``
|
|
||||||
The hostname or IP address of the proxy server.
|
|
||||||
"""
|
|
||||||
self.proxy_server = server
|
|
@ -30,7 +30,7 @@ from PyQt4 import QtCore
|
|||||||
|
|
||||||
from openlp.core.lib import SettingsManager
|
from openlp.core.lib import SettingsManager
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB, Book, BibleMeta
|
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
|
||||||
|
|
||||||
from common import parse_reference
|
from common import parse_reference
|
||||||
from opensong import OpenSongBible
|
from opensong import OpenSongBible
|
||||||
@ -149,7 +149,7 @@ class BibleManager(object):
|
|||||||
file=filename, download_source=source.value,
|
file=filename, download_source=source.value,
|
||||||
download_name=download_name)
|
download_name=download_name)
|
||||||
if meta_proxy:
|
if meta_proxy:
|
||||||
web_bible.set_proxy_server(meta_proxy.value)
|
web_bible.proxy_server = meta_proxy.value
|
||||||
self.db_cache[name] = web_bible
|
self.db_cache[name] = web_bible
|
||||||
log.debug(u'Bibles reloaded')
|
log.debug(u'Bibles reloaded')
|
||||||
|
|
||||||
@ -199,8 +199,7 @@ class BibleManager(object):
|
|||||||
u'name': book.name,
|
u'name': book.name,
|
||||||
u'chapters': self.db_cache[bible].get_chapter_count(book.name)
|
u'chapters': self.db_cache[bible].get_chapter_count(book.name)
|
||||||
}
|
}
|
||||||
for book in self.db_cache[bible].get_all_objects(Book,
|
for book in self.db_cache[bible].get_books()
|
||||||
order_by_ref=Book.id)
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_chapter_count(self, bible, book):
|
def get_chapter_count(self, bible, book):
|
||||||
|
Binary file not shown.
@ -32,7 +32,8 @@ import logging
|
|||||||
|
|
||||||
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate
|
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
from openlp.plugins.presentations.lib import *
|
from openlp.plugins.presentations.lib import PresentationController, \
|
||||||
|
PresentationMediaItem, PresentationTab
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -25,15 +25,9 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
#import sys
|
|
||||||
#import os
|
|
||||||
|
|
||||||
from types import ListType
|
from types import ListType
|
||||||
|
|
||||||
# Do we need these two lines?
|
|
||||||
#sys.path.append(os.path.abspath(u'./../../../..'))
|
|
||||||
#sys.path.append(os.path.abspath(os.path.join(u'.', u'..', u'..')))
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class SongException(Exception):
|
class SongException(Exception):
|
||||||
@ -71,14 +65,7 @@ class Song(object):
|
|||||||
from_ccli_text_buffer
|
from_ccli_text_buffer
|
||||||
to_ccli_text_buffer
|
to_ccli_text_buffer
|
||||||
|
|
||||||
OpenSong:
|
|
||||||
from_opensong_file
|
|
||||||
to_opensong_file
|
|
||||||
from_opensong_buffer
|
|
||||||
to_opensong_buffer
|
|
||||||
|
|
||||||
presentation (screen):
|
presentation (screen):
|
||||||
get_number_of_slides
|
|
||||||
get_preview_slide
|
get_preview_slide
|
||||||
get_render_slide
|
get_render_slide
|
||||||
|
|
||||||
@ -216,8 +203,8 @@ class Song(object):
|
|||||||
author_list = u', '.join(lst)
|
author_list = u', '.join(lst)
|
||||||
self.set_title(sName)
|
self.set_title(sName)
|
||||||
self.set_author_list(author_list)
|
self.set_author_list(author_list)
|
||||||
self.set_copyright(sCopyright)
|
self.copyright = sCopyright
|
||||||
self.set_ccli_number(sCcli)
|
self.ccli_number = sCcli
|
||||||
self.set_lyrics(lyrics)
|
self.set_lyrics(lyrics)
|
||||||
|
|
||||||
def from_ccli_text_file(self, textFileName):
|
def from_ccli_text_file(self, textFileName):
|
||||||
@ -268,58 +255,30 @@ class Song(object):
|
|||||||
"""Return copyright info string"""
|
"""Return copyright info string"""
|
||||||
return self._assure_string(self.copyright)
|
return self._assure_string(self.copyright)
|
||||||
|
|
||||||
def set_copyright(self, copyright):
|
|
||||||
"""Set the copyright string"""
|
|
||||||
self.copyright = copyright
|
|
||||||
|
|
||||||
def get_ccli_number(self):
|
def get_ccli_number(self):
|
||||||
"""Return the songCclino"""
|
"""Return the songCclino"""
|
||||||
return self._assure_string(self.ccli_number)
|
return self._assure_string(self.ccli_number)
|
||||||
|
|
||||||
def set_ccli_number(self, ccli_number):
|
|
||||||
"""Set the ccli_number"""
|
|
||||||
self.ccli_number = ccli_number
|
|
||||||
|
|
||||||
def get_theme_name(self):
|
def get_theme_name(self):
|
||||||
"""Return the theme name for the song"""
|
"""Return the theme name for the song"""
|
||||||
return self._assure_string(self.theme_name)
|
return self._assure_string(self.theme_name)
|
||||||
|
|
||||||
def set_theme_name(self, theme_name):
|
|
||||||
"""Set the theme name (string)"""
|
|
||||||
self.theme_name = theme_name
|
|
||||||
|
|
||||||
def get_song_book(self):
|
def get_song_book(self):
|
||||||
"""Return the song_book (string)"""
|
"""Return the song_book (string)"""
|
||||||
return self._assure_string(self.song_book)
|
return self._assure_string(self.song_book)
|
||||||
|
|
||||||
def set_song_book(self, song_book):
|
|
||||||
"""Set the song_book (string)"""
|
|
||||||
self.song_book = song_book
|
|
||||||
|
|
||||||
def get_song_number(self):
|
def get_song_number(self):
|
||||||
"""Return the song_number (string)"""
|
"""Return the song_number (string)"""
|
||||||
return self._assure_string(self.song_number)
|
return self._assure_string(self.song_number)
|
||||||
|
|
||||||
def set_song_number(self, song_number):
|
|
||||||
"""Set the song_number (string)"""
|
|
||||||
self.song_number = song_number
|
|
||||||
|
|
||||||
def get_comments(self):
|
def get_comments(self):
|
||||||
"""Return the comments (string)"""
|
"""Return the comments (string)"""
|
||||||
return self._assure_string(self.comments)
|
return self._assure_string(self.comments)
|
||||||
|
|
||||||
def set_comments(self, comments):
|
|
||||||
"""Set the comments (string)"""
|
|
||||||
self.comments = comments
|
|
||||||
|
|
||||||
def get_verse_order(self):
|
def get_verse_order(self):
|
||||||
"""Get the verseOrder (string) - preferably space delimited"""
|
"""Get the verseOrder (string) - preferably space delimited"""
|
||||||
return self._assure_string(self.verse_order)
|
return self._assure_string(self.verse_order)
|
||||||
|
|
||||||
def set_verse_order(self, verse_order):
|
|
||||||
"""Set the verse order (string) - space delimited"""
|
|
||||||
self.verse_order = verse_order
|
|
||||||
|
|
||||||
def get_author_list(self, asOneString = True):
|
def get_author_list(self, asOneString = True):
|
||||||
"""Return the list of authors as a string
|
"""Return the list of authors as a string
|
||||||
|
|
||||||
@ -370,45 +329,6 @@ class Song(object):
|
|||||||
else:
|
else:
|
||||||
self.category_array = self._list_to_string(category_array)
|
self.category_array = self._list_to_string(category_array)
|
||||||
|
|
||||||
def get_show_title(self):
|
|
||||||
"""Return the show_title flag (bool)"""
|
|
||||||
return self.show_title
|
|
||||||
|
|
||||||
def set_show_title(self, show_title):
|
|
||||||
"""Set the show_title flag (bool)"""
|
|
||||||
self.show_title = show_title
|
|
||||||
|
|
||||||
def get_show_author_list(self):
|
|
||||||
"""Return the show_author_list flag"""
|
|
||||||
return self.show_author_list
|
|
||||||
|
|
||||||
def set_show_author_list(self, show_author_list):
|
|
||||||
"""Set the show_author_list flag (bool)"""
|
|
||||||
self.show_author_list = show_author_list
|
|
||||||
|
|
||||||
def get_show_copyright(self):
|
|
||||||
"""Return the show_copyright flag"""
|
|
||||||
return self.show_copyright
|
|
||||||
|
|
||||||
def set_show_copyright(self, show_copyright):
|
|
||||||
"""Set the show_copyright flag (bool)"""
|
|
||||||
self.show_copyright = show_copyright
|
|
||||||
|
|
||||||
def get_show_ccli_number(self):
|
|
||||||
"""Return the showSongCclino (string)"""
|
|
||||||
return self.show_ccli_number
|
|
||||||
|
|
||||||
def set_show_ccli_number(self, show_ccli_number):
|
|
||||||
"""Set the show_ccli_number flag (bool)"""
|
|
||||||
self.show_ccli_number = show_ccli_number
|
|
||||||
|
|
||||||
def get_lyrics(self):
|
|
||||||
"""Return the lyrics as a list of strings
|
|
||||||
|
|
||||||
this will return all the strings in the song
|
|
||||||
"""
|
|
||||||
return self.lyrics
|
|
||||||
|
|
||||||
def set_lyrics(self, lyrics):
|
def set_lyrics(self, lyrics):
|
||||||
"""Set the lyrics as a list of strings"""
|
"""Set the lyrics as a list of strings"""
|
||||||
self.lyrics = lyrics
|
self.lyrics = lyrics
|
||||||
@ -432,11 +352,6 @@ class Song(object):
|
|||||||
if tmpSlide:
|
if tmpSlide:
|
||||||
self.slideList.append(tmpSlide)
|
self.slideList.append(tmpSlide)
|
||||||
|
|
||||||
def get_number_of_slides(self):
|
|
||||||
"""Return the number of slides in the song (int)"""
|
|
||||||
numOfSlides = len(self.slideList)
|
|
||||||
return numOfSlides
|
|
||||||
|
|
||||||
def get_preview_slide(self, slideNumber):
|
def get_preview_slide(self, slideNumber):
|
||||||
"""Return the preview text for specified slide number
|
"""Return the preview text for specified slide number
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user