forked from openlp/openlp
Head r1414
This commit is contained in:
commit
e0d12e08b6
@ -173,7 +173,9 @@ class OpenLP(QtGui.QApplication):
|
||||
has_run_wizard = QtCore.QSettings().value(
|
||||
u'general/has run wizard', QtCore.QVariant(False)).toBool()
|
||||
if not has_run_wizard:
|
||||
FirstTimeForm(screens).exec_()
|
||||
if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
|
||||
QtCore.QSettings().setValue(u'general/has run wizard',
|
||||
QtCore.QVariant(True))
|
||||
if os.name == u'nt':
|
||||
self.setStyleSheet(application_stylesheet)
|
||||
show_splash = QtCore.QSettings().value(
|
||||
|
@ -33,7 +33,8 @@ from ConfigParser import SafeConfigParser
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, PluginStatus, Receiver, build_icon
|
||||
from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, \
|
||||
check_directory_exists
|
||||
from openlp.core.utils import get_web_page, AppLocation
|
||||
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
|
||||
|
||||
@ -49,6 +50,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
def __init__(self, screens, parent=None):
|
||||
QtGui.QWizard.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.screens = screens
|
||||
# check to see if we have web access
|
||||
self.web = u'http://openlp.org/files/frw/'
|
||||
self.config = SafeConfigParser()
|
||||
@ -56,12 +58,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
if self.webAccess:
|
||||
files = self.webAccess.read()
|
||||
self.config.readfp(io.BytesIO(files))
|
||||
self.displayComboBox.addItems(screens.get_screen_list())
|
||||
self.updateScreenListCombo()
|
||||
self.downloading = unicode(translate('OpenLP.FirstTimeWizard',
|
||||
'Downloading %s...'))
|
||||
QtCore.QObject.connect(self,
|
||||
QtCore.SIGNAL(u'currentIdChanged(int)'),
|
||||
self.onCurrentIdChanged)
|
||||
QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'config_screen_changed'), self.updateScreenListCombo)
|
||||
|
||||
def exec_(self, edit=False):
|
||||
"""
|
||||
@ -75,6 +78,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
Set up display at start of theme edit.
|
||||
"""
|
||||
self.restart()
|
||||
check_directory_exists(os.path.join(gettempdir(), u'openlp'))
|
||||
# Sort out internet access for downloads
|
||||
if self.webAccess:
|
||||
songs = self.config.get(u'songs', u'languages')
|
||||
@ -111,8 +115,6 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
self.biblesTreeWidget.expandAll()
|
||||
themes = self.config.get(u'themes', u'files')
|
||||
themes = themes.split(u',')
|
||||
if not os.path.exists(os.path.join(gettempdir(), u'openlp')):
|
||||
os.makedirs(os.path.join(gettempdir(), u'openlp'))
|
||||
for theme in themes:
|
||||
title = self.config.get(u'theme_%s' % theme, u'title')
|
||||
filename = self.config.get(u'theme_%s' % theme, u'filename')
|
||||
@ -160,6 +162,15 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
self._performWizard()
|
||||
self._postWizard()
|
||||
|
||||
def updateScreenListCombo(self):
|
||||
"""
|
||||
The user changed screen resolution or enabled/disabled more screens, so
|
||||
we need to update the combo box.
|
||||
"""
|
||||
self.displayComboBox.clear()
|
||||
self.displayComboBox.addItems(self.screens.get_screen_list())
|
||||
self.displayComboBox.setCurrentIndex(self.displayComboBox.count() - 1)
|
||||
|
||||
def _getFileSize(self, url):
|
||||
site = urllib.urlopen(url)
|
||||
meta = site.info()
|
||||
@ -294,8 +305,6 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
if self.themeComboBox.currentIndex() != -1:
|
||||
QtCore.QSettings().setValue(u'themes/global theme',
|
||||
QtCore.QVariant(self.themeComboBox.currentText()))
|
||||
QtCore.QSettings().setValue(u'general/has run wizard',
|
||||
QtCore.QVariant(True))
|
||||
|
||||
def _setPluginStatus(self, field, tag):
|
||||
status = PluginStatus.Active if field.checkState() \
|
||||
|
@ -158,8 +158,6 @@ class Ui_FirstTimeWizard(object):
|
||||
self.displayComboBox = QtGui.QComboBox(self.defaultsPage)
|
||||
self.displayComboBox.setEditable(False)
|
||||
self.displayComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
|
||||
self.displayComboBox.setSizeAdjustPolicy(
|
||||
QtGui.QComboBox.AdjustToContents)
|
||||
self.displayComboBox.setObjectName(u'displayComboBox')
|
||||
self.defaultsLayout.addRow(self.displayLabel, self.displayComboBox)
|
||||
self.themeLabel = QtGui.QLabel(self.defaultsPage)
|
||||
|
@ -110,7 +110,7 @@ class MainDisplay(DisplayWidget):
|
||||
Phonon.createPath(self.mediaObject, self.audio)
|
||||
QtCore.QObject.connect(self.mediaObject,
|
||||
QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'),
|
||||
self.videoStart)
|
||||
self.videoState)
|
||||
QtCore.QObject.connect(self.mediaObject,
|
||||
QtCore.SIGNAL(u'finished()'),
|
||||
self.videoFinished)
|
||||
@ -378,11 +378,13 @@ class MainDisplay(DisplayWidget):
|
||||
Receiver.send_message(u'maindisplay_active')
|
||||
return self.preview()
|
||||
|
||||
def videoStart(self, newState, oldState):
|
||||
def videoState(self, newState, oldState):
|
||||
"""
|
||||
Start the video at a predetermined point.
|
||||
"""
|
||||
if newState == Phonon.PlayingState:
|
||||
if newState == Phonon.PlayingState \
|
||||
and oldState != Phonon.PausedState \
|
||||
and self.serviceItem.start_time > 0:
|
||||
# set start time in milliseconds
|
||||
self.mediaObject.seek(self.serviceItem.start_time * 1000)
|
||||
|
||||
|
@ -46,7 +46,6 @@ class SlideList(QtGui.QTableWidget):
|
||||
QtGui.QTableWidget.__init__(self, parent.controller)
|
||||
self.parent = parent
|
||||
|
||||
|
||||
class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
SlideController is the slide controller widget. This widget is what the
|
||||
@ -858,6 +857,7 @@ class SlideController(QtGui.QWidget):
|
||||
self.serviceItem.bg_image_bytes = None
|
||||
self.slidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||
self.selectedRow = row
|
||||
self.__checkUpdateSelectedSlide(row)
|
||||
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
|
||||
row)
|
||||
|
||||
|
@ -268,6 +268,7 @@ class SearchResults(object):
|
||||
return len(self.verselist) > 0
|
||||
|
||||
|
||||
from versereferencelist import VerseReferenceList
|
||||
from manager import BibleManager
|
||||
from biblestab import BiblesTab
|
||||
from mediaitem import BibleMediaItem
|
||||
|
@ -35,7 +35,7 @@ from openlp.core.lib.ui import UiStrings, add_widget_completer, \
|
||||
media_item_combo_box, critical_error_message_box
|
||||
from openlp.plugins.bibles.forms import BibleImportForm
|
||||
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
|
||||
get_reference_match
|
||||
VerseReferenceList, get_reference_match
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -637,6 +637,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
old_chapter = -1
|
||||
raw_slides = []
|
||||
raw_title = []
|
||||
verses = VerseReferenceList()
|
||||
for item in items:
|
||||
bitem = self.listView.item(item.row())
|
||||
book = self._decodeQtObject(bitem, 'book')
|
||||
@ -653,15 +654,9 @@ class BibleMediaItem(MediaManagerItem):
|
||||
second_permissions = \
|
||||
self._decodeQtObject(bitem, 'second_permissions')
|
||||
second_text = self._decodeQtObject(bitem, 'second_text')
|
||||
verses.add(book, chapter, verse, version, copyright, permissions)
|
||||
verse_text = self.formatVerse(old_chapter, chapter, verse)
|
||||
footer = u'%s (%s %s %s)' % (book, version, copyright, permissions)
|
||||
if footer not in service_item.raw_footer:
|
||||
service_item.raw_footer.append(footer)
|
||||
if second_bible:
|
||||
footer = u'%s (%s %s %s)' % (book, second_version,
|
||||
second_copyright, second_permissions)
|
||||
if footer not in service_item.raw_footer:
|
||||
service_item.raw_footer.append(footer)
|
||||
bible_text = u'%s %s\n\n%s %s' % (verse_text, text,
|
||||
verse_text, second_text)
|
||||
raw_slides.append(bible_text.rstrip())
|
||||
@ -684,6 +679,12 @@ class BibleMediaItem(MediaManagerItem):
|
||||
start_item = item
|
||||
old_item = item
|
||||
old_chapter = chapter
|
||||
# Add footer
|
||||
service_item.raw_footer.append(verses.format_verses())
|
||||
if second_bible:
|
||||
verses.add_version(second_version, second_copyright,
|
||||
second_permissions)
|
||||
service_item.raw_footer.append(verses.format_versions())
|
||||
raw_title.append(self.formatTitle(start_item, item))
|
||||
# If there are no more items we check whether we have to add bible_text.
|
||||
if bible_text:
|
||||
|
99
openlp/plugins/bibles/lib/versereferencelist.py
Normal file
99
openlp/plugins/bibles/lib/versereferencelist.py
Normal file
@ -0,0 +1,99 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2011 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat, #
|
||||
# Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon #
|
||||
# Tibble, Carsten Tinggaard, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
class VerseReferenceList(object):
|
||||
"""
|
||||
The VerseReferenceList class encapsulates a list of verse references, but
|
||||
maintains the order in which they were added.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.verse_list = []
|
||||
self.version_list = []
|
||||
self.current_index = -1
|
||||
|
||||
def add(self, book, chapter, verse, version, copyright, permission):
|
||||
self.add_version(version, copyright, permission)
|
||||
if not self.verse_list or \
|
||||
self.verse_list[self.current_index][u'book'] != book:
|
||||
self.verse_list.append({u'version': version, u'book': book,
|
||||
u'chapter': chapter, u'start': verse, u'end': verse})
|
||||
self.current_index += 1
|
||||
elif self.verse_list[self.current_index][u'chapter'] != chapter:
|
||||
self.verse_list.append({u'version': version, u'book': book,
|
||||
u'chapter': chapter, u'start': verse, u'end': verse})
|
||||
self.current_index += 1
|
||||
elif (self.verse_list[self.current_index][u'end'] + 1) == verse:
|
||||
self.verse_list[self.current_index][u'end'] = verse
|
||||
else:
|
||||
self.verse_list.append({u'version': version, u'book': book,
|
||||
u'chapter': chapter, u'start': verse, u'end': verse})
|
||||
self.current_index += 1
|
||||
|
||||
def add_version(self, version, copyright, permission):
|
||||
for bible_version in self.version_list:
|
||||
if bible_version[u'version'] == version:
|
||||
return
|
||||
self.version_list.append({u'version': version, u'copyright': copyright,
|
||||
u'permission': permission})
|
||||
|
||||
def format_verses(self):
|
||||
result = u''
|
||||
for index, verse in enumerate(self.verse_list):
|
||||
if index == 0:
|
||||
result = u'%s %s:%s' % (verse[u'book'], verse[u'chapter'],
|
||||
verse[u'start'])
|
||||
if verse[u'start'] != verse[u'end']:
|
||||
result = u'%s-%s' % (result, verse[u'end'])
|
||||
continue
|
||||
prev = index - 1
|
||||
if self.verse_list[prev][u'version'] != verse[u'version']:
|
||||
result = u'%s (%s)' % (result, verse[u'version'])
|
||||
result = result + u', '
|
||||
if self.verse_list[prev][u'book'] != verse[u'book']:
|
||||
result = u'%s%s %s:' % (result, verse[u'book'],
|
||||
verse[u'chapter'])
|
||||
elif self.verse_list[prev][u'chapter'] != verse[u'chapter']:
|
||||
result = u'%s%s:' % (result, verse[u'chapter'])
|
||||
result = result + str(verse[u'start'])
|
||||
if verse[u'start'] != verse[u'end']:
|
||||
result = u'%s-%s' % (result, verse[u'end'])
|
||||
if len(self.version_list) > 1:
|
||||
result = u'%s (%s)' % (result, verse[u'version'])
|
||||
return result
|
||||
|
||||
def format_versions(self):
|
||||
result = u''
|
||||
for index, version in enumerate(self.version_list):
|
||||
if index > 0:
|
||||
if result[-1] not in [u';', u',', u'.']:
|
||||
result = result + u';'
|
||||
result = result + u' '
|
||||
result = u'%s%s, %s' % (result, version[u'version'],
|
||||
version[u'copyright'])
|
||||
if version[u'permission'].strip():
|
||||
result = result + u', ' + version[u'permission']
|
||||
return result
|
@ -36,7 +36,7 @@ from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class MediaMediaItem(MediaManagerItem):
|
||||
"""
|
||||
This is the custom media manager item for Media Slides.
|
||||
@ -54,9 +54,6 @@ class MediaMediaItem(MediaManagerItem):
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'video_background_replaced'),
|
||||
self.videobackgroundReplaced)
|
||||
QtCore.QObject.connect(self.mediaObject,
|
||||
QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'),
|
||||
self.videoStart)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.onNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
|
||||
@ -124,41 +121,67 @@ class MediaMediaItem(MediaManagerItem):
|
||||
if item is None:
|
||||
return False
|
||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
if os.path.exists(filename):
|
||||
self.mediaState = None
|
||||
self.mediaObject.stop()
|
||||
self.mediaObject.clearQueue()
|
||||
self.mediaObject.setCurrentSource(Phonon.MediaSource(filename))
|
||||
self.mediaObject.play()
|
||||
service_item.title = unicode(self.plugin.nameStrings[u'singular'])
|
||||
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
||||
# force a nonexistent theme
|
||||
service_item.theme = -1
|
||||
frame = u':/media/image_clapperboard.png'
|
||||
(path, name) = os.path.split(filename)
|
||||
file_size = os.path.getsize(filename)
|
||||
# File too big for processing
|
||||
if file_size <= 52428800: # 50MiB
|
||||
start = datetime.now()
|
||||
while not self.mediaState:
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
tme = datetime.now() - start
|
||||
if tme.seconds > 5:
|
||||
break
|
||||
if self.mediaState:
|
||||
service_item.media_length = self.mediaLength
|
||||
service_item.add_capability(
|
||||
ItemCapabilities.AllowsVariableStartTime)
|
||||
service_item.add_from_command(path, name, frame)
|
||||
return True
|
||||
else:
|
||||
if not os.path.exists(filename):
|
||||
# File is no longer present
|
||||
critical_error_message_box(
|
||||
translate('MediaPlugin.MediaItem', 'Missing Media File'),
|
||||
unicode(translate('MediaPlugin.MediaItem',
|
||||
'The file %s no longer exists.')) % filename)
|
||||
return False
|
||||
self.mediaObject.stop()
|
||||
self.mediaObject.clearQueue()
|
||||
self.mediaObject.setCurrentSource(Phonon.MediaSource(filename))
|
||||
if not self.mediaStateWait(Phonon.StoppedState):
|
||||
# Due to string freeze, borrow a message from presentations
|
||||
# This will be corrected in 1.9.6
|
||||
critical_error_message_box(
|
||||
translate('PresentationPlugin.MediaItem', 'Unsupported File'),
|
||||
unicode(translate('PresentationPlugin.MediaItem',
|
||||
'Unsupported File')))
|
||||
return False
|
||||
# File too big for processing
|
||||
if os.path.getsize(filename) <= 52428800: # 50MiB
|
||||
self.mediaObject.play()
|
||||
if not self.mediaStateWait(Phonon.PlayingState) \
|
||||
or self.mediaObject.currentSource().type() \
|
||||
== Phonon.MediaSource.Invalid:
|
||||
# Due to string freeze, borrow a message from presentations
|
||||
# This will be corrected in 1.9.6
|
||||
self.mediaObject.stop()
|
||||
critical_error_message_box(
|
||||
translate('PresentationPlugin.MediaItem',
|
||||
'Unsupported File'),
|
||||
unicode(translate('PresentationPlugin.MediaItem',
|
||||
'Unsupported File')))
|
||||
return False
|
||||
self.mediaLength = self.mediaObject.totalTime() / 1000
|
||||
self.mediaObject.stop()
|
||||
service_item.media_length = self.mediaLength
|
||||
service_item.add_capability(
|
||||
ItemCapabilities.AllowsVariableStartTime)
|
||||
service_item.title = unicode(self.plugin.nameStrings[u'singular'])
|
||||
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
||||
# force a non-existent theme
|
||||
service_item.theme = -1
|
||||
frame = u':/media/image_clapperboard.png'
|
||||
(path, name) = os.path.split(filename)
|
||||
service_item.add_from_command(path, name, frame)
|
||||
return True
|
||||
|
||||
def mediaStateWait(self, mediaState):
|
||||
"""
|
||||
Wait for the video to change its state
|
||||
Wait no longer than 5 seconds.
|
||||
"""
|
||||
start = datetime.now()
|
||||
while self.mediaObject.state() != mediaState:
|
||||
if self.mediaObject.state() == Phonon.ErrorState:
|
||||
return False
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
if (datetime.now() - start).seconds > 5:
|
||||
return False
|
||||
return True
|
||||
|
||||
def initialise(self):
|
||||
self.listView.clear()
|
||||
self.listView.setIconSize(QtCore.QSize(88, 50))
|
||||
@ -186,12 +209,3 @@ class MediaMediaItem(MediaManagerItem):
|
||||
item_name.setIcon(build_icon(img))
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||
self.listView.addItem(item_name)
|
||||
|
||||
def videoStart(self, newState, oldState):
|
||||
"""
|
||||
Start the video at a predetermined point.
|
||||
"""
|
||||
if newState == Phonon.PlayingState:
|
||||
self.mediaState = newState
|
||||
self.mediaLength = self.mediaObject.totalTime()/1000
|
||||
self.mediaObject.stop()
|
||||
|
File diff suppressed because it is too large
Load Diff
1185
resources/i18n/de.ts
1185
resources/i18n/de.ts
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1001
resources/i18n/nl.ts
1001
resources/i18n/nl.ts
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user