forked from openlp/openlp
Head r1218 and fixes
This commit is contained in:
commit
a064ad1b05
@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
||||||
<Theme>
|
|
||||||
<Name>openlp.org 2.0 Demo Theme</Name>
|
|
||||||
<BackgroundType>2</BackgroundType>
|
|
||||||
<BackgroundParameter1>./openlp/core/test/data_for_tests/treesbig.jpg</BackgroundParameter1>
|
|
||||||
<BackgroundParameter2>clBlack</BackgroundParameter2>
|
|
||||||
<BackgroundParameter3/>
|
|
||||||
<FontName>Tahoma</FontName>
|
|
||||||
<FontColor>clWhite</FontColor>
|
|
||||||
<FontProportion>16</FontProportion>
|
|
||||||
<Shadow>-1</Shadow>
|
|
||||||
<ShadowColor>$00000001</ShadowColor>
|
|
||||||
<Outline>-1</Outline>
|
|
||||||
<OutlineColor>clRed</OutlineColor>
|
|
||||||
<HorizontalAlign>2</HorizontalAlign>
|
|
||||||
<VerticalAlign>2</VerticalAlign>
|
|
||||||
</Theme>
|
|
@ -72,9 +72,6 @@ Song Importers
|
|||||||
.. automodule:: openlp.plugins.songs.lib.cclifileimport
|
.. automodule:: openlp.plugins.songs.lib.cclifileimport
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: openlp.plugins.songs.lib.cclifileimport.CCLIFileImportError
|
|
||||||
:members:
|
|
||||||
|
|
||||||
.. automodule:: openlp.plugins.songs.lib.ewimport
|
.. automodule:: openlp.plugins.songs.lib.ewimport
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
@ -293,6 +293,7 @@ def clean_tags(text):
|
|||||||
Remove Tags from text for display
|
Remove Tags from text for display
|
||||||
"""
|
"""
|
||||||
text = text.replace(u'<br>', u'\n')
|
text = text.replace(u'<br>', u'\n')
|
||||||
|
text = text.replace(u' ', u' ')
|
||||||
for tag in DisplayTags.get_html_tags():
|
for tag in DisplayTags.get_html_tags():
|
||||||
text = text.replace(tag[u'start tag'], u'')
|
text = text.replace(tag[u'start tag'], u'')
|
||||||
text = text.replace(tag[u'end tag'], u'')
|
text = text.replace(tag[u'end tag'], u'')
|
||||||
|
@ -34,7 +34,7 @@ from sqlalchemy import create_engine, MetaData
|
|||||||
from sqlalchemy.exceptions import InvalidRequestError
|
from sqlalchemy.exceptions import InvalidRequestError
|
||||||
from sqlalchemy.orm import scoped_session, sessionmaker
|
from sqlalchemy.orm import scoped_session, sessionmaker
|
||||||
|
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation, delete_file
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -75,11 +75,7 @@ def delete_database(plugin_name, db_file_name=None):
|
|||||||
else:
|
else:
|
||||||
db_file_path = os.path.join(
|
db_file_path = os.path.join(
|
||||||
AppLocation.get_section_data_path(plugin_name), plugin_name)
|
AppLocation.get_section_data_path(plugin_name), plugin_name)
|
||||||
try:
|
return delete_file(db_file_path)
|
||||||
os.remove(db_file_path)
|
|
||||||
return True
|
|
||||||
except OSError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
class BaseModel(object):
|
class BaseModel(object):
|
||||||
"""
|
"""
|
||||||
@ -295,4 +291,4 @@ class Manager(object):
|
|||||||
if self.is_dirty:
|
if self.is_dirty:
|
||||||
engine = create_engine(self.db_url)
|
engine = create_engine(self.db_url)
|
||||||
if self.db_url.startswith(u'sqlite'):
|
if self.db_url.startswith(u'sqlite'):
|
||||||
engine.execute("vacuum")
|
engine.execute("vacuum")
|
||||||
|
@ -641,4 +641,4 @@ def build_alert_css(alertTab, width):
|
|||||||
align = u'top'
|
align = u'top'
|
||||||
alert = style % (width, align, alertTab.font_face, alertTab.font_size,
|
alert = style % (width, align, alertTab.font_face, alertTab.font_size,
|
||||||
alertTab.font_color, alertTab.bg_color)
|
alertTab.font_color, alertTab.bg_color)
|
||||||
return alert
|
return alert
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
|
The :mod:`maindisplay` module provides the functionality to display screens
|
||||||
|
and play multimedia within OpenLP.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
@ -38,7 +38,8 @@ from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
|
|||||||
ThemeLevel
|
ThemeLevel
|
||||||
from openlp.core.ui import criticalErrorMessageBox, ServiceNoteForm, \
|
from openlp.core.ui import criticalErrorMessageBox, ServiceNoteForm, \
|
||||||
ServiceItemEditForm
|
ServiceItemEditForm
|
||||||
from openlp.core.utils import AppLocation, file_is_unicode, split_filename
|
from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \
|
||||||
|
split_filename
|
||||||
|
|
||||||
class ServiceManagerList(QtGui.QTreeWidget):
|
class ServiceManagerList(QtGui.QTreeWidget):
|
||||||
"""
|
"""
|
||||||
@ -446,11 +447,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
file.close()
|
file.close()
|
||||||
if zip:
|
if zip:
|
||||||
zip.close()
|
zip.close()
|
||||||
try:
|
delete_file(serviceFileName)
|
||||||
os.remove(serviceFileName)
|
|
||||||
except (IOError, OSError):
|
|
||||||
# if not present do not worry
|
|
||||||
pass
|
|
||||||
self.mainwindow.addRecentFile(fileName)
|
self.mainwindow.addRecentFile(fileName)
|
||||||
self.setModified(False)
|
self.setModified(False)
|
||||||
return True
|
return True
|
||||||
@ -515,11 +512,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate):
|
if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate):
|
||||||
Receiver.send_message(u'%s_service_load' %
|
Receiver.send_message(u'%s_service_load' %
|
||||||
serviceItem.name.lower(), serviceItem)
|
serviceItem.name.lower(), serviceItem)
|
||||||
try:
|
delete_file(p_file)
|
||||||
if os.path.isfile(p_file):
|
|
||||||
os.remove(p_file)
|
|
||||||
except (IOError, OSError):
|
|
||||||
log.exception(u'Failed to remove osd file')
|
|
||||||
else:
|
else:
|
||||||
criticalErrorMessageBox(
|
criticalErrorMessageBox(
|
||||||
message=translate('OpenLP.ServiceManager',
|
message=translate('OpenLP.ServiceManager',
|
||||||
@ -872,11 +865,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
for file in os.listdir(self.servicePath):
|
for file in os.listdir(self.servicePath):
|
||||||
file_path = os.path.join(self.servicePath, file)
|
file_path = os.path.join(self.servicePath, file)
|
||||||
try:
|
delete_file(file_path)
|
||||||
if os.path.isfile(file_path):
|
|
||||||
os.remove(file_path)
|
|
||||||
except OSError:
|
|
||||||
log.exception(u'Failed to clean up servicePath')
|
|
||||||
|
|
||||||
def onThemeComboBoxSelected(self, currentIndex):
|
def onThemeComboBoxSelected(self, currentIndex):
|
||||||
"""
|
"""
|
||||||
|
@ -687,8 +687,17 @@ class SlideController(QtGui.QWidget):
|
|||||||
Allow the main display to blank the main display at startup time
|
Allow the main display to blank the main display at startup time
|
||||||
"""
|
"""
|
||||||
log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
|
log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
|
||||||
|
display_type = QtCore.QSettings().value(
|
||||||
|
self.parent.generalSettingsSection + u'/screen blank',
|
||||||
|
QtCore.QVariant(u'')).toString()
|
||||||
if not self.display.primary:
|
if not self.display.primary:
|
||||||
self.onBlankDisplay(True)
|
# Order done to handle initial conversion
|
||||||
|
if display_type == u'themed':
|
||||||
|
self.onThemeDisplay(True)
|
||||||
|
elif display_type == u'hidden':
|
||||||
|
self.onHideDisplay(True)
|
||||||
|
else:
|
||||||
|
self.onBlankDisplay(True)
|
||||||
|
|
||||||
def onSlideBlank(self):
|
def onSlideBlank(self):
|
||||||
"""
|
"""
|
||||||
@ -712,13 +721,15 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.ThemeScreen.setChecked(False)
|
self.ThemeScreen.setChecked(False)
|
||||||
if self.screens.display_count > 1:
|
if self.screens.display_count > 1:
|
||||||
self.DesktopScreen.setChecked(False)
|
self.DesktopScreen.setChecked(False)
|
||||||
QtCore.QSettings().setValue(
|
|
||||||
self.parent.generalSettingsSection + u'/screen blank',
|
|
||||||
QtCore.QVariant(checked))
|
|
||||||
if checked:
|
if checked:
|
||||||
Receiver.send_message(u'maindisplay_hide', HideMode.Blank)
|
Receiver.send_message(u'maindisplay_hide', HideMode.Blank)
|
||||||
|
QtCore.QSettings().setValue(
|
||||||
|
self.parent.generalSettingsSection + u'/screen blank',
|
||||||
|
QtCore.QVariant(u'blanked'))
|
||||||
else:
|
else:
|
||||||
Receiver.send_message(u'maindisplay_show')
|
Receiver.send_message(u'maindisplay_show')
|
||||||
|
QtCore.QSettings().remove(
|
||||||
|
self.parent.generalSettingsSection + u'/screen blank')
|
||||||
self.blankPlugin(checked)
|
self.blankPlugin(checked)
|
||||||
|
|
||||||
def onThemeDisplay(self, checked):
|
def onThemeDisplay(self, checked):
|
||||||
@ -733,8 +744,13 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.DesktopScreen.setChecked(False)
|
self.DesktopScreen.setChecked(False)
|
||||||
if checked:
|
if checked:
|
||||||
Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
|
Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
|
||||||
|
QtCore.QSettings().setValue(
|
||||||
|
self.parent.generalSettingsSection + u'/screen blank',
|
||||||
|
QtCore.QVariant(u'themed'))
|
||||||
else:
|
else:
|
||||||
Receiver.send_message(u'maindisplay_show')
|
Receiver.send_message(u'maindisplay_show')
|
||||||
|
QtCore.QSettings().remove(
|
||||||
|
self.parent.generalSettingsSection + u'/screen blank')
|
||||||
self.blankPlugin(checked)
|
self.blankPlugin(checked)
|
||||||
|
|
||||||
def onHideDisplay(self, checked):
|
def onHideDisplay(self, checked):
|
||||||
@ -745,12 +761,19 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.HideMenu.setDefaultAction(self.DesktopScreen)
|
self.HideMenu.setDefaultAction(self.DesktopScreen)
|
||||||
self.BlankScreen.setChecked(False)
|
self.BlankScreen.setChecked(False)
|
||||||
self.ThemeScreen.setChecked(False)
|
self.ThemeScreen.setChecked(False)
|
||||||
if self.screens.display_count > 1:
|
# On valid if more than 1 display
|
||||||
self.DesktopScreen.setChecked(checked)
|
if self.screens.display_count <= 1:
|
||||||
|
return
|
||||||
|
self.DesktopScreen.setChecked(checked)
|
||||||
if checked:
|
if checked:
|
||||||
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
|
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
|
||||||
|
QtCore.QSettings().setValue(
|
||||||
|
self.parent.generalSettingsSection + u'/screen blank',
|
||||||
|
QtCore.QVariant(u'hidden'))
|
||||||
else:
|
else:
|
||||||
Receiver.send_message(u'maindisplay_show')
|
Receiver.send_message(u'maindisplay_show')
|
||||||
|
QtCore.QSettings().remove(
|
||||||
|
self.parent.generalSettingsSection + u'/screen blank')
|
||||||
self.hidePlugin(checked)
|
self.hidePlugin(checked)
|
||||||
|
|
||||||
def blankPlugin(self, blank):
|
def blankPlugin(self, blank):
|
||||||
@ -1040,9 +1063,8 @@ class SlideController(QtGui.QWidget):
|
|||||||
if self.BlankScreen.isChecked:
|
if self.BlankScreen.isChecked:
|
||||||
self.BlankScreen.setChecked(False)
|
self.BlankScreen.setChecked(False)
|
||||||
self.HideMenu.setDefaultAction(self.BlankScreen)
|
self.HideMenu.setDefaultAction(self.BlankScreen)
|
||||||
QtCore.QSettings().setValue(
|
QtCore.QSettings().remove(
|
||||||
self.parent.generalSettingsSection + u'/screen blank',
|
self.parent.generalSettingsSection + u'/screen blank')
|
||||||
QtCore.QVariant(False))
|
|
||||||
if self.ThemeScreen.isChecked:
|
if self.ThemeScreen.isChecked:
|
||||||
self.ThemeScreen.setChecked(False)
|
self.ThemeScreen.setChecked(False)
|
||||||
self.HideMenu.setDefaultAction(self.ThemeScreen)
|
self.HideMenu.setDefaultAction(self.ThemeScreen)
|
||||||
|
@ -37,7 +37,7 @@ from openlp.core.theme import Theme
|
|||||||
from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \
|
from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \
|
||||||
build_icon, Receiver, SettingsManager, translate, check_item_selected, \
|
build_icon, Receiver, SettingsManager, translate, check_item_selected, \
|
||||||
BackgroundType, BackgroundGradientType, check_directory_exists
|
BackgroundType, BackgroundGradientType, check_directory_exists
|
||||||
from openlp.core.utils import AppLocation, file_is_unicode, \
|
from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \
|
||||||
get_filesystem_encoding
|
get_filesystem_encoding
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -341,9 +341,9 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
self.themelist.remove(theme)
|
self.themelist.remove(theme)
|
||||||
thumb = theme + u'.png'
|
thumb = theme + u'.png'
|
||||||
|
delete_file(os.path.join(self.path, thumb))
|
||||||
|
delete_file(os.path.join(self.thumbPath, thumb))
|
||||||
try:
|
try:
|
||||||
os.remove(os.path.join(self.path, thumb))
|
|
||||||
os.remove(os.path.join(self.thumbPath, thumb))
|
|
||||||
encoding = get_filesystem_encoding()
|
encoding = get_filesystem_encoding()
|
||||||
shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
|
shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
|
||||||
except OSError:
|
except OSError:
|
||||||
@ -518,13 +518,10 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
check_directory_exists(theme_dir)
|
check_directory_exists(theme_dir)
|
||||||
if os.path.splitext(ucsfile)[1].lower() in [u'.xml']:
|
if os.path.splitext(ucsfile)[1].lower() in [u'.xml']:
|
||||||
xml_data = zip.read(file)
|
xml_data = zip.read(file)
|
||||||
try:
|
xml_data = file_is_unicode(xml_data)
|
||||||
xml_data = xml_data.decode(u'utf-8')
|
if not xml_data:
|
||||||
except UnicodeDecodeError:
|
|
||||||
log.exception(u'Theme XML is not UTF-8 '
|
|
||||||
u'encoded.')
|
|
||||||
break
|
break
|
||||||
filexml = self.checkVersionAndConvert(xml_data)
|
filexml = self._checkVersionAndConvert(xml_data)
|
||||||
outfile = open(fullpath, u'w')
|
outfile = open(fullpath, u'w')
|
||||||
outfile.write(filexml.encode(u'utf-8'))
|
outfile.write(filexml.encode(u'utf-8'))
|
||||||
else:
|
else:
|
||||||
@ -552,22 +549,6 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
if outfile:
|
if outfile:
|
||||||
outfile.close()
|
outfile.close()
|
||||||
|
|
||||||
def checkVersionAndConvert(self, xml_data):
|
|
||||||
"""
|
|
||||||
Check if a theme is from OpenLP version 1
|
|
||||||
|
|
||||||
``xml_data``
|
|
||||||
Theme XML to check the version of
|
|
||||||
"""
|
|
||||||
log.debug(u'checkVersion1 ')
|
|
||||||
theme = xml_data.encode(u'ascii', u'xmlcharrefreplace')
|
|
||||||
tree = ElementTree(element=XML(theme)).getroot()
|
|
||||||
# look for old version 1 tags
|
|
||||||
if tree.find(u'BackgroundType') is None:
|
|
||||||
return xml_data
|
|
||||||
else:
|
|
||||||
return self._migrateVersion122(xml_data)
|
|
||||||
|
|
||||||
def checkIfThemeExists(self, themeName):
|
def checkIfThemeExists(self, themeName):
|
||||||
"""
|
"""
|
||||||
Check if theme already exists and displays error message
|
Check if theme already exists and displays error message
|
||||||
@ -597,10 +578,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
theme_file = os.path.join(theme_dir, name + u'.xml')
|
theme_file = os.path.join(theme_dir, name + u'.xml')
|
||||||
if imageTo and self.oldBackgroundImage and \
|
if imageTo and self.oldBackgroundImage and \
|
||||||
imageTo != self.oldBackgroundImage:
|
imageTo != self.oldBackgroundImage:
|
||||||
try:
|
delete_file(self.oldBackgroundImage)
|
||||||
os.remove(self.oldBackgroundImage)
|
|
||||||
except OSError:
|
|
||||||
log.exception(u'Unable to remove old theme background')
|
|
||||||
outfile = None
|
outfile = None
|
||||||
try:
|
try:
|
||||||
outfile = open(theme_file, u'w')
|
outfile = open(theme_file, u'w')
|
||||||
@ -661,6 +639,22 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
image = os.path.join(self.path, theme + u'.png')
|
image = os.path.join(self.path, theme + u'.png')
|
||||||
return image
|
return image
|
||||||
|
|
||||||
|
def _checkVersionAndConvert(self, xml_data):
|
||||||
|
"""
|
||||||
|
Check if a theme is from OpenLP version 1
|
||||||
|
|
||||||
|
``xml_data``
|
||||||
|
Theme XML to check the version of
|
||||||
|
"""
|
||||||
|
log.debug(u'checkVersion1 ')
|
||||||
|
theme = xml_data.encode(u'ascii', u'xmlcharrefreplace')
|
||||||
|
tree = ElementTree(element=XML(theme)).getroot()
|
||||||
|
# look for old version 1 tags
|
||||||
|
if tree.find(u'BackgroundType') is None:
|
||||||
|
return xml_data
|
||||||
|
else:
|
||||||
|
return self._migrateVersion122(xml_data)
|
||||||
|
|
||||||
def _createThemeFromXml(self, themeXml, path):
|
def _createThemeFromXml(self, themeXml, path):
|
||||||
"""
|
"""
|
||||||
Return a theme object using information parsed from XML
|
Return a theme object using information parsed from XML
|
||||||
|
@ -282,6 +282,23 @@ def split_filename(path):
|
|||||||
else:
|
else:
|
||||||
return os.path.split(path)
|
return os.path.split(path)
|
||||||
|
|
||||||
|
def delete_file(file_path_name):
|
||||||
|
"""
|
||||||
|
Deletes a file from the system.
|
||||||
|
|
||||||
|
``file_path_name``
|
||||||
|
The file, including path, to delete.
|
||||||
|
"""
|
||||||
|
if not file_path_name:
|
||||||
|
return False
|
||||||
|
try:
|
||||||
|
if os.path.exists(file_path_name):
|
||||||
|
os.remove(file_path_name)
|
||||||
|
return True
|
||||||
|
except (IOError, OSError):
|
||||||
|
log.exception("Unable to delete file %s" % file_path_name)
|
||||||
|
return False
|
||||||
|
|
||||||
def get_web_page(url, header=None, update_openlp=False):
|
def get_web_page(url, header=None, update_openlp=False):
|
||||||
"""
|
"""
|
||||||
Attempts to download the webpage at url and returns that page or None.
|
Attempts to download the webpage at url and returns that page or None.
|
||||||
|
@ -536,7 +536,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
message=translate('BiblePlugin.MediaItem',
|
message=translate('BiblePlugin.MediaItem',
|
||||||
'You cannot combine single and second bible verses. Do you '
|
'You cannot combine single and second bible verses. Do you '
|
||||||
'want to delete your search results and start a new search?'),
|
'want to delete your search results and start a new search?'),
|
||||||
question=True) == QtGui.QMessageBox.Yes:
|
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
self.displayResults(bible, second_bible)
|
self.displayResults(bible, second_bible)
|
||||||
else:
|
else:
|
||||||
@ -584,7 +584,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
message=translate('BiblePlugin.MediaItem',
|
message=translate('BiblePlugin.MediaItem',
|
||||||
'You cannot combine single and second bible verses. Do you '
|
'You cannot combine single and second bible verses. Do you '
|
||||||
'want to delete your search results and start a new search?'),
|
'want to delete your search results and start a new search?'),
|
||||||
question=True) == QtGui.QMessageBox.Yes:
|
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
self.displayResults(bible, second_bible)
|
self.displayResults(bible, second_bible)
|
||||||
elif self.search_results:
|
elif self.search_results:
|
||||||
@ -710,21 +710,21 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
second_copyright, second_permissions)
|
second_copyright, second_permissions)
|
||||||
if footer not in raw_footer:
|
if footer not in raw_footer:
|
||||||
raw_footer.append(footer)
|
raw_footer.append(footer)
|
||||||
bible_text = u'%s\u00a0%s\n\n%s\u00a0%s' % (verse_text, text,
|
bible_text = u'%s %s\n\n%s %s' % (verse_text, text,
|
||||||
verse_text, second_text)
|
verse_text, second_text)
|
||||||
raw_slides.append(bible_text)
|
raw_slides.append(bible_text.rstrip())
|
||||||
bible_text = u''
|
bible_text = u''
|
||||||
# If we are 'Verse Per Slide' then create a new slide.
|
# If we are 'Verse Per Slide' then create a new slide.
|
||||||
elif self.parent.settings_tab.layout_style == 0:
|
elif self.parent.settings_tab.layout_style == 0:
|
||||||
bible_text = u'%s\u00a0%s' % (verse_text, text)
|
bible_text = u'%s %s' % (verse_text, text)
|
||||||
raw_slides.append(bible_text)
|
raw_slides.append(bible_text.rstrip())
|
||||||
bible_text = u''
|
bible_text = u''
|
||||||
# If we are 'Verse Per Line' then force a new line.
|
# If we are 'Verse Per Line' then force a new line.
|
||||||
elif self.parent.settings_tab.layout_style == 1:
|
elif self.parent.settings_tab.layout_style == 1:
|
||||||
bible_text = u'%s %s\u00a0%s\n' % (bible_text, verse_text, text)
|
bible_text = u'%s %s %s\n' % (bible_text, verse_text, text)
|
||||||
# We have to be 'Continuous'.
|
# We have to be 'Continuous'.
|
||||||
else:
|
else:
|
||||||
bible_text = u'%s %s\u00a0%s\n' % (bible_text, verse_text, text)
|
bible_text = u'%s %s %s\n' % (bible_text, verse_text, text)
|
||||||
if not old_item:
|
if not old_item:
|
||||||
start_item = item
|
start_item = item
|
||||||
elif self.checkTitle(item, old_item):
|
elif self.checkTitle(item, old_item):
|
||||||
@ -735,7 +735,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
raw_title.append(self.formatTitle(start_item, item))
|
raw_title.append(self.formatTitle(start_item, item))
|
||||||
# If there are no more items we check whether we have to add bible_text.
|
# If there are no more items we check whether we have to add bible_text.
|
||||||
if bible_text:
|
if bible_text:
|
||||||
raw_slides.append(bible_text)
|
raw_slides.append(bible_text.lstrip())
|
||||||
bible_text = u''
|
bible_text = u''
|
||||||
# Service Item: Capabilities
|
# Service Item: Capabilities
|
||||||
if self.parent.settings_tab.layout_style == 2 and not second_bible:
|
if self.parent.settings_tab.layout_style == 2 and not second_bible:
|
||||||
|
@ -33,7 +33,7 @@ from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
|||||||
ItemCapabilities, SettingsManager, translate, check_item_selected, \
|
ItemCapabilities, SettingsManager, translate, check_item_selected, \
|
||||||
check_directory_exists
|
check_directory_exists
|
||||||
from openlp.core.ui import criticalErrorMessageBox
|
from openlp.core.ui import criticalErrorMessageBox
|
||||||
from openlp.core.utils import AppLocation, get_images_filter
|
from openlp.core.utils import AppLocation, delete_file, get_images_filter
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -116,12 +116,8 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
for row in row_list:
|
for row in row_list:
|
||||||
text = self.listView.item(row)
|
text = self.listView.item(row)
|
||||||
if text:
|
if text:
|
||||||
try:
|
delete_file(os.path.join(self.servicePath,
|
||||||
os.remove(os.path.join(self.servicePath,
|
unicode(text.text())))
|
||||||
unicode(text.text())))
|
|
||||||
except OSError:
|
|
||||||
# if not present do not worry
|
|
||||||
pass
|
|
||||||
self.listView.takeItem(row)
|
self.listView.takeItem(row)
|
||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
self.settingsSection, self.getFileList())
|
self.settingsSection, self.getFileList())
|
||||||
|
@ -51,6 +51,7 @@ else:
|
|||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
|
from openlp.core.utils import delete_file
|
||||||
from presentationcontroller import PresentationController, PresentationDocument
|
from presentationcontroller import PresentationController, PresentationDocument
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -292,8 +293,7 @@ class ImpressDocument(PresentationDocument):
|
|||||||
try:
|
try:
|
||||||
doc.storeToURL(urlpath, props)
|
doc.storeToURL(urlpath, props)
|
||||||
self.convert_thumbnail(path, idx + 1)
|
self.convert_thumbnail(path, idx + 1)
|
||||||
if os.path.exists(path):
|
delete_file(path)
|
||||||
os.remove(path)
|
|
||||||
except:
|
except:
|
||||||
log.exception(u'%s - Unable to store openoffice preview' % path)
|
log.exception(u'%s - Unable to store openoffice preview' % path)
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
|||||||
message=translate('SongsPlugin.AuthorsForm',
|
message=translate('SongsPlugin.AuthorsForm',
|
||||||
'You have not set a display name for the '
|
'You have not set a display name for the '
|
||||||
'author, combine the first and last names?'),
|
'author, combine the first and last names?'),
|
||||||
question=True) == QtGui.QMessageBox.Yes:
|
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.displayEdit.setText(self.firstNameEdit.text() + \
|
self.displayEdit.setText(self.firstNameEdit.text() + \
|
||||||
u' ' + self.lastNameEdit.text())
|
u' ' + self.lastNameEdit.text())
|
||||||
return QtGui.QDialog.accept(self)
|
return QtGui.QDialog.accept(self)
|
||||||
|
@ -332,7 +332,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
else:
|
else:
|
||||||
author = Author.populate(first_name=text.rsplit(u' ', 1)[0],
|
author = Author.populate(first_name=text.rsplit(u' ', 1)[0],
|
||||||
last_name=text.rsplit(u' ', 1)[1], display_name=text)
|
last_name=text.rsplit(u' ', 1)[1], display_name=text)
|
||||||
self.manager.save_object(author)
|
self.manager.save_object(author, False)
|
||||||
author_item = QtGui.QListWidgetItem(
|
author_item = QtGui.QListWidgetItem(
|
||||||
unicode(author.display_name))
|
unicode(author.display_name))
|
||||||
author_item.setData(QtCore.Qt.UserRole,
|
author_item.setData(QtCore.Qt.UserRole,
|
||||||
@ -386,7 +386,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
|
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
|
||||||
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
|
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
|
||||||
topic = Topic.populate(name=text)
|
topic = Topic.populate(name=text)
|
||||||
self.manager.save_object(topic)
|
self.manager.save_object(topic, False)
|
||||||
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
|
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
|
||||||
topic_item.setData(QtCore.Qt.UserRole,
|
topic_item.setData(QtCore.Qt.UserRole,
|
||||||
QtCore.QVariant(topic.id))
|
QtCore.QVariant(topic.id))
|
||||||
@ -649,7 +649,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
"""
|
"""
|
||||||
Exit Dialog and save soong if valid
|
Exit Dialog and save song if valid
|
||||||
"""
|
"""
|
||||||
log.debug(u'accept')
|
log.debug(u'accept')
|
||||||
self.clearCaches()
|
self.clearCaches()
|
||||||
@ -665,7 +665,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
|
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
|
||||||
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
|
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
|
||||||
book = Book.populate(name=text, publisher=u'')
|
book = Book.populate(name=text, publisher=u'')
|
||||||
self.manager.save_object(book)
|
self.manager.save_object(book, False)
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
if self.saveSong():
|
if self.saveSong():
|
||||||
|
@ -92,7 +92,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
item = self.manager.get_object(item_class, item_id)
|
item = self.manager.get_object(item_class, item_id)
|
||||||
if item and len(item.songs) == 0:
|
if item and len(item.songs) == 0:
|
||||||
if criticalErrorMessageBox(title=dlg_title, message=del_text,
|
if criticalErrorMessageBox(title=dlg_title, message=del_text,
|
||||||
question=True) == QtGui.QMessageBox.Yes:
|
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.manager.delete_object(item_class, item.id)
|
self.manager.delete_object(item_class, item.id)
|
||||||
reset_func()
|
reset_func()
|
||||||
else:
|
else:
|
||||||
@ -303,7 +303,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
'exists. Would you like to make songs with author %s use '
|
'exists. Would you like to make songs with author %s use '
|
||||||
'the existing author %s?')) % (author.display_name,
|
'the existing author %s?')) % (author.display_name,
|
||||||
temp_display_name, author.display_name),
|
temp_display_name, author.display_name),
|
||||||
question=True) == QtGui.QMessageBox.Yes:
|
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.mergeAuthors(author)
|
self.mergeAuthors(author)
|
||||||
self.resetAuthors()
|
self.resetAuthors()
|
||||||
Receiver.send_message(u'songs_load_list')
|
Receiver.send_message(u'songs_load_list')
|
||||||
@ -339,7 +339,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
'The topic %s already exists. Would you like to make songs '
|
'The topic %s already exists. Would you like to make songs '
|
||||||
'with topic %s use the existing topic %s?')) % (topic.name,
|
'with topic %s use the existing topic %s?')) % (topic.name,
|
||||||
temp_name, topic.name),
|
temp_name, topic.name),
|
||||||
question=True) == QtGui.QMessageBox.Yes:
|
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.mergeTopics(topic)
|
self.mergeTopics(topic)
|
||||||
self.resetTopics()
|
self.resetTopics()
|
||||||
else:
|
else:
|
||||||
@ -377,7 +377,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
'The book %s already exists. Would you like to make songs '
|
'The book %s already exists. Would you like to make songs '
|
||||||
'with book %s use the existing book %s?')) % (book.name,
|
'with book %s use the existing book %s?')) % (book.name,
|
||||||
temp_name, book.name),
|
temp_name, book.name),
|
||||||
question=True) == QtGui.QMessageBox.Yes:
|
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.mergeBooks(book)
|
self.mergeBooks(book)
|
||||||
self.resetBooks()
|
self.resetBooks()
|
||||||
else:
|
else:
|
||||||
|
@ -34,9 +34,6 @@ from songimport import SongImport
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class CCLIFileImportError(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class CCLIFileImport(SongImport):
|
class CCLIFileImport(SongImport):
|
||||||
"""
|
"""
|
||||||
The :class:`CCLIFileImport` class provides OpenLP with the ability to
|
The :class:`CCLIFileImport` class provides OpenLP with the ability to
|
||||||
@ -152,7 +149,6 @@ class CCLIFileImport(SongImport):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
log.debug(u'USR file text: %s', textList)
|
log.debug(u'USR file text: %s', textList)
|
||||||
lyrics = []
|
|
||||||
self.set_defaults()
|
self.set_defaults()
|
||||||
for line in textList:
|
for line in textList:
|
||||||
if line.startswith(u'Title='):
|
if line.startswith(u'Title='):
|
||||||
|
@ -72,7 +72,7 @@ def init_schema(url):
|
|||||||
``url``
|
``url``
|
||||||
The database to setup
|
The database to setup
|
||||||
"""
|
"""
|
||||||
session, metadata = init_db(url)
|
session, metadata = init_db(url, False)
|
||||||
|
|
||||||
# Definition of the "authors" table
|
# Definition of the "authors" table
|
||||||
authors_table = Table(u'authors', metadata,
|
authors_table = Table(u'authors', metadata,
|
||||||
@ -181,4 +181,4 @@ def init_schema(url):
|
|||||||
mapper(Topic, topics_table)
|
mapper(Topic, topics_table)
|
||||||
|
|
||||||
metadata.create_all(checkfirst=True)
|
metadata.create_all(checkfirst=True)
|
||||||
return session
|
return session
|
||||||
|
Loading…
Reference in New Issue
Block a user