- Fixed re-playing of previous audio file.

- Fixed left-over files from previous song.
- Renamed a few more enumerations.
- Fixed some exception handling.
This commit is contained in:
Raoul Snyman 2011-08-31 09:49:57 +02:00
parent 0d16b05779
commit 4d66954d62
11 changed files with 25 additions and 30 deletions

View File

@ -25,7 +25,12 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
__all__ = ('OpenLP', 'main') """
The :mod:`core` module provides all core application functions
All the core functions of the OpenLP application including the GUI, settings,
logging and a plugin framework are contained within the openlp.core module.
"""
import os import os
import sys import sys
@ -46,16 +51,11 @@ from openlp.core.ui import SplashScreen, ScreenList
from openlp.core.utils import AppLocation, LanguageManager, VersionThread, \ from openlp.core.utils import AppLocation, LanguageManager, VersionThread, \
get_application_version, DelayStartThread get_application_version, DelayStartThread
__all__ = [u'OpenLP', u'main']
log = logging.getLogger() log = logging.getLogger()
"""
The :mod:`core` module provides all core application functions
All the core functions of the OpenLP application including the GUI, settings,
logging and a plugin framework are contained within the openlp.core module.
"""
application_stylesheet = u""" application_stylesheet = u"""
QMainWindow::separator QMainWindow::separator
{ {

View File

@ -82,7 +82,7 @@ def upgrade_db(url, upgrade):
load_changes = True load_changes = True
try: try:
tables = upgrade.upgrade_setup(metadata) tables = upgrade.upgrade_setup(metadata)
except SQLAlchemyError, DBAPIError: except (SQLAlchemyError, DBAPIError):
load_changes = False load_changes = False
metadata_table = Table(u'metadata', metadata, metadata_table = Table(u'metadata', metadata,
Column(u'key', types.Unicode(64), primary_key=True), Column(u'key', types.Unicode(64), primary_key=True),
@ -106,7 +106,7 @@ def upgrade_db(url, upgrade):
getattr(upgrade, u'upgrade_%d' % version) \ getattr(upgrade, u'upgrade_%d' % version) \
(session, metadata, tables) (session, metadata, tables)
version_meta.value = unicode(version) version_meta.value = unicode(version)
except SQLAlchemyError, DBAPIError: except (SQLAlchemyError, DBAPIError):
log.exception(u'Could not run database upgrade script ' log.exception(u'Could not run database upgrade script '
'"upgrade_%s", upgrade process has been halted.', version) '"upgrade_%s", upgrade process has been halted.', version)
break break
@ -213,7 +213,7 @@ class Manager(object):
return return
try: try:
self.session = init_schema(self.db_url) self.session = init_schema(self.db_url)
except SQLAlchemyError, DBAPIError: except (SQLAlchemyError, DBAPIError):
log.exception(u'Error loading database: %s', self.db_url) log.exception(u'Error loading database: %s', self.db_url)
critical_error_message_box( critical_error_message_box(
translate('OpenLP.Manager', 'Database Error'), translate('OpenLP.Manager', 'Database Error'),

View File

@ -222,14 +222,14 @@ class Renderer(object):
if item.is_capable(ItemCapabilities.NoLineBreaks): if item.is_capable(ItemCapabilities.NoLineBreaks):
line_end = u' ' line_end = u' '
# Bibles # Bibles
if item.is_capable(ItemCapabilities.HasWordSplit): if item.is_capable(ItemCapabilities.CanWordSplit):
pages = self._paginate_slide_words(text.split(u'\n'), line_end) pages = self._paginate_slide_words(text.split(u'\n'), line_end)
else: else:
# Clean up line endings. # Clean up line endings.
lines = self._lines_split(text) lines = self._lines_split(text)
pages = self._paginate_slide(lines, line_end) pages = self._paginate_slide(lines, line_end)
# Songs and Custom # Songs and Custom
if item.is_capable(ItemCapabilities.HasVirtualSplit) and \ if item.is_capable(ItemCapabilities.CanSoftBreak) and \
len(pages) > 1 and u'[---]' in text: len(pages) > 1 and u'[---]' in text:
pages = [] pages = []
while True: while True:

View File

@ -57,15 +57,15 @@ class ItemCapabilities(object):
CanMaintain = 3 CanMaintain = 3
RequiresMedia = 4 RequiresMedia = 4
CanLoop = 5 CanLoop = 5
HasAdditions = 6 CanAppend = 6
NoLineBreaks = 7 NoLineBreaks = 7
OnLoadUpdate = 8 OnLoadUpdate = 8
AddIfNewItem = 9 AddIfNewItem = 9
ProvidesOwnDisplay = 10 ProvidesOwnDisplay = 10
HasDetailedTitleDisplay = 11 HasDetailedTitleDisplay = 11
HasVariableStartTime = 12 HasVariableStartTime = 12
HasVirtualSplit = 13 CanSoftBreak = 13
HasWordSplit = 14 CanWordSplit = 14
HasBackgroundAudio = 15 HasBackgroundAudio = 15

View File

@ -627,7 +627,7 @@ class AudioPlayer(QtCore.QObject):
self.currentIndex = -1 self.currentIndex = -1
self.playlist = [] self.playlist = []
self.stop() self.stop()
self.clearQueue() self.mediaObject.clear()
def play(self): def play(self):
""" """
@ -664,9 +664,3 @@ class AudioPlayer(QtCore.QObject):
for filename in filenames: for filename in filenames:
self.playlist.append(Phonon.MediaSource(filename)) self.playlist.append(Phonon.MediaSource(filename))
def clearQueue(self):
"""
Clean up the Object queue
"""
log.debug(u'AudioPlayer.clearQueue() called')
self.mediaObject.clearQueue()

View File

@ -1314,7 +1314,7 @@ class ServiceManager(QtGui.QWidget):
serviceItem = self.serviceItems[pos] serviceItem = self.serviceItems[pos]
if (plugin == serviceItem[u'service_item'].name and if (plugin == serviceItem[u'service_item'].name and
serviceItem[u'service_item'].is_capable( serviceItem[u'service_item'].is_capable(
ItemCapabilities.HasAdditions)): ItemCapabilities.CanAppend)):
action = self.dndMenu.exec_(QtGui.QCursor.pos()) action = self.dndMenu.exec_(QtGui.QCursor.pos())
# New action required # New action required
if action == self.newAction: if action == self.newAction:

View File

@ -865,7 +865,7 @@ class BibleMediaItem(MediaManagerItem):
service_item.add_capability(ItemCapabilities.NoLineBreaks) service_item.add_capability(ItemCapabilities.NoLineBreaks)
service_item.add_capability(ItemCapabilities.CanPreview) service_item.add_capability(ItemCapabilities.CanPreview)
service_item.add_capability(ItemCapabilities.CanLoop) service_item.add_capability(ItemCapabilities.CanLoop)
service_item.add_capability(ItemCapabilities.HasWordSplit) service_item.add_capability(ItemCapabilities.CanWordSplit)
# Service Item: Title # Service Item: Title
service_item.title = u', '.join(raw_title) service_item.title = u', '.join(raw_title)
# Service Item: Theme # Service Item: Theme

View File

@ -230,7 +230,7 @@ class CustomMediaItem(MediaManagerItem):
service_item.add_capability(ItemCapabilities.CanEdit) service_item.add_capability(ItemCapabilities.CanEdit)
service_item.add_capability(ItemCapabilities.CanPreview) service_item.add_capability(ItemCapabilities.CanPreview)
service_item.add_capability(ItemCapabilities.CanLoop) service_item.add_capability(ItemCapabilities.CanLoop)
service_item.add_capability(ItemCapabilities.HasVirtualSplit) service_item.add_capability(ItemCapabilities.CanSoftBreak)
customSlide = self.plugin.manager.get_object(CustomSlide, item_id) customSlide = self.plugin.manager.get_object(CustomSlide, item_id)
title = customSlide.title title = customSlide.title
credit = customSlide.credits credit = customSlide.credits

View File

@ -152,7 +152,7 @@ class ImageMediaItem(MediaManagerItem):
service_item.add_capability(ItemCapabilities.CanMaintain) service_item.add_capability(ItemCapabilities.CanMaintain)
service_item.add_capability(ItemCapabilities.CanPreview) service_item.add_capability(ItemCapabilities.CanPreview)
service_item.add_capability(ItemCapabilities.CanLoop) service_item.add_capability(ItemCapabilities.CanLoop)
service_item.add_capability(ItemCapabilities.HasAdditions) service_item.add_capability(ItemCapabilities.CanAppend)
# force a nonexistent theme # force a nonexistent theme
service_item.theme = -1 service_item.theme = -1
missing_items = [] missing_items = []

View File

@ -198,6 +198,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.verseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)
self.authorsListView.clear() self.authorsListView.clear()
self.topicsListView.clear() self.topicsListView.clear()
self.audioListWidget.clear()
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason) self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
self.songBookNumberEdit.setText(u'') self.songBookNumberEdit.setText(u'')
self.loadAuthors() self.loadAuthors()

View File

@ -419,7 +419,7 @@ class SongMediaItem(MediaManagerItem):
service_item.add_capability(ItemCapabilities.CanLoop) service_item.add_capability(ItemCapabilities.CanLoop)
service_item.add_capability(ItemCapabilities.OnLoadUpdate) service_item.add_capability(ItemCapabilities.OnLoadUpdate)
service_item.add_capability(ItemCapabilities.AddIfNewItem) service_item.add_capability(ItemCapabilities.AddIfNewItem)
service_item.add_capability(ItemCapabilities.HasVirtualSplit) service_item.add_capability(ItemCapabilities.CanSoftBreak)
song = self.plugin.manager.get_object(Song, item_id) song = self.plugin.manager.get_object(Song, item_id)
service_item.theme = song.theme_name service_item.theme = song.theme_name
service_item.edit_id = item_id service_item.edit_id = item_id