forked from openlp/openlp
Song editing from Preview, bible fixes
bzr-revno: 623
This commit is contained in:
commit
a1ae98b18f
@ -118,7 +118,6 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
self.requiredIcons()
|
self.requiredIcons()
|
||||||
self.setupUi()
|
self.setupUi()
|
||||||
self.retranslateUi()
|
self.retranslateUi()
|
||||||
#self.initialise()
|
|
||||||
|
|
||||||
def requiredIcons(self):
|
def requiredIcons(self):
|
||||||
"""
|
"""
|
||||||
|
@ -201,7 +201,7 @@ class Renderer(object):
|
|||||||
#if we have more text add up to 10 spaces on the front.
|
#if we have more text add up to 10 spaces on the front.
|
||||||
if len(line) > 0 and self._theme.font_main_indentation > 0:
|
if len(line) > 0 and self._theme.font_main_indentation > 0:
|
||||||
line = u'%s%s' % \
|
line = u'%s%s' % \
|
||||||
(u' '[:self._theme.font_main_indentation], line)
|
(u' '[:int(self._theme.font_main_indentation)], line)
|
||||||
#Text fits in a line now
|
#Text fits in a line now
|
||||||
for count, line in enumerate(split_lines):
|
for count, line in enumerate(split_lines):
|
||||||
page.append(line)
|
page.append(line)
|
||||||
|
@ -65,6 +65,7 @@ class RenderManager(object):
|
|||||||
self.service_theme = u''
|
self.service_theme = u''
|
||||||
self.global_style = u''
|
self.global_style = u''
|
||||||
self.override_background = None
|
self.override_background = None
|
||||||
|
self.themedata = None
|
||||||
self.save_bg_frame = None
|
self.save_bg_frame = None
|
||||||
self.override_background_changed = False
|
self.override_background_changed = False
|
||||||
|
|
||||||
@ -130,7 +131,7 @@ class RenderManager(object):
|
|||||||
self.theme = self.service_theme
|
self.theme = self.service_theme
|
||||||
else:
|
else:
|
||||||
self.theme = self.global_theme
|
self.theme = self.global_theme
|
||||||
if self.theme != self.renderer.theme_name:
|
if self.theme != self.renderer.theme_name or self.themedata is None:
|
||||||
log.debug(u'theme is now %s', self.theme)
|
log.debug(u'theme is now %s', self.theme)
|
||||||
self.themedata = self.theme_manager.getThemeData(self.theme)
|
self.themedata = self.theme_manager.getThemeData(self.theme)
|
||||||
self.calculate_default(
|
self.calculate_default(
|
||||||
|
@ -678,6 +678,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||||||
log.debug(u'Page Length area height %s , metrics %s , lines %s' %
|
log.debug(u'Page Length area height %s , metrics %s , lines %s' %
|
||||||
(int(self.FontMainHeightSpinBox.value()), metrics.height(), page_length ))
|
(int(self.FontMainHeightSpinBox.value()), metrics.height(), page_length ))
|
||||||
self.FontMainLinesPageLabel.setText(
|
self.FontMainLinesPageLabel.setText(
|
||||||
self.trUtf8(u'Slide Height is %s rows') % page_length)
|
self.trUtf8((u'Slide Height is %s rows') % page_length))
|
||||||
frame = self.thememanager.generateImage(theme)
|
frame = self.thememanager.generateImage(theme)
|
||||||
self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
|
self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||||
|
@ -87,10 +87,13 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.isLive = isLive
|
self.isLive = isLive
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.image_list = [
|
self.image_list = [
|
||||||
self.trUtf8(u'Start Loop'),
|
u'Start Loop',
|
||||||
self.trUtf8(u'Stop Loop'),
|
u'Stop Loop',
|
||||||
#self.trUtf8(u'Loop Separator'),
|
u'Loop Separator',
|
||||||
self.trUtf8(u'Image SpinBox')
|
u'Image SpinBox'
|
||||||
|
]
|
||||||
|
self.song_list = [
|
||||||
|
u'Edit Song',
|
||||||
]
|
]
|
||||||
self.timer_id = 0
|
self.timer_id = 0
|
||||||
self.commandItem = None
|
self.commandItem = None
|
||||||
@ -140,17 +143,17 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.Toolbar.setSizePolicy(sizeToolbarPolicy)
|
self.Toolbar.setSizePolicy(sizeToolbarPolicy)
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
self.Toolbar.addToolbarButton(
|
self.Toolbar.addToolbarButton(
|
||||||
self.trUtf8(u'First Slide'), u':/slides/slide_first.png',
|
u'First Slide', u':/slides/slide_first.png',
|
||||||
self.trUtf8(u'Move to first'), self.onSlideSelectedFirst)
|
self.trUtf8(u'Move to first'), self.onSlideSelectedFirst)
|
||||||
self.Toolbar.addToolbarButton(
|
self.Toolbar.addToolbarButton(
|
||||||
self.trUtf8(u'Previous Slide'), u':/slides/slide_previous.png',
|
u'Previous Slide', u':/slides/slide_previous.png',
|
||||||
self.trUtf8(u'Move to previous'), self.onSlideSelectedPrevious)
|
self.trUtf8(u'Move to previous'), self.onSlideSelectedPrevious)
|
||||||
self.Toolbar.addToolbarButton(
|
self.Toolbar.addToolbarButton(
|
||||||
self.trUtf8(u'Next Slide'), u':/slides/slide_next.png',
|
u'Next Slide', u':/slides/slide_next.png',
|
||||||
self.trUtf8(u'Move to next'), self.onSlideSelectedNext)
|
self.trUtf8(u'Move to next'), self.onSlideSelectedNext)
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
self.Toolbar.addToolbarButton(
|
self.Toolbar.addToolbarButton(
|
||||||
self.trUtf8(u'Last Slide'), u':/slides/slide_last.png',
|
u'Last Slide', u':/slides/slide_last.png',
|
||||||
self.trUtf8(u'Move to last'), self.onSlideSelectedLast)
|
self.trUtf8(u'Move to last'), self.onSlideSelectedLast)
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
self.Toolbar.addToolbarSeparator(u'Close Separator')
|
self.Toolbar.addToolbarSeparator(u'Close Separator')
|
||||||
@ -159,19 +162,23 @@ class SlideController(QtGui.QWidget):
|
|||||||
if not self.isLive:
|
if not self.isLive:
|
||||||
self.Toolbar.addToolbarSeparator(u'Close Separator')
|
self.Toolbar.addToolbarSeparator(u'Close Separator')
|
||||||
self.Toolbar.addToolbarButton(
|
self.Toolbar.addToolbarButton(
|
||||||
self.trUtf8(u'Go Live'), u':/system/system_live.png',
|
u'Go Live', u':/system/system_live.png',
|
||||||
self.trUtf8(u'Move to live'), self.onGoLive)
|
self.trUtf8(u'Move to live'), self.onGoLive)
|
||||||
|
self.Toolbar.addToolbarSeparator(u'Close Separator')
|
||||||
|
self.Toolbar.addToolbarButton(
|
||||||
|
u'Edit Song', u':songs/song_edit.png',
|
||||||
|
self.trUtf8(u'Edit and re-preview Song'), self.onEditSong)
|
||||||
if isLive:
|
if isLive:
|
||||||
self.Toolbar.addToolbarSeparator(u'Loop Separator')
|
self.Toolbar.addToolbarSeparator(u'Loop Separator')
|
||||||
self.Toolbar.addToolbarButton(
|
self.Toolbar.addToolbarButton(
|
||||||
self.trUtf8(u'Start Loop'), u':/media/media_time.png',
|
u'Start Loop', u':/media/media_time.png',
|
||||||
self.trUtf8(u'Start continuous loop'), self.onStartLoop)
|
self.trUtf8(u'Start continuous loop'), self.onStartLoop)
|
||||||
self.Toolbar.addToolbarButton(
|
self.Toolbar.addToolbarButton(
|
||||||
self.trUtf8(u'Stop Loop'), u':/media/media_stop.png',
|
u'Stop Loop', u':/media/media_stop.png',
|
||||||
self.trUtf8(u'Stop continuous loop'), self.onStopLoop)
|
self.trUtf8(u'Stop continuous loop'), self.onStopLoop)
|
||||||
self.DelaySpinBox = QtGui.QSpinBox()
|
self.DelaySpinBox = QtGui.QSpinBox()
|
||||||
self.Toolbar.addToolbarWidget(
|
self.Toolbar.addToolbarWidget(
|
||||||
self.trUtf8(u'Image SpinBox'), self.DelaySpinBox)
|
u'Image SpinBox', self.DelaySpinBox)
|
||||||
self.DelaySpinBox.setSuffix(self.trUtf8(u's'))
|
self.DelaySpinBox.setSuffix(self.trUtf8(u's'))
|
||||||
|
|
||||||
self.ControllerLayout.addWidget(self.Toolbar)
|
self.ControllerLayout.addWidget(self.Toolbar)
|
||||||
@ -216,6 +223,8 @@ class SlideController(QtGui.QWidget):
|
|||||||
Receiver().send_message(u'request_spin_delay')
|
Receiver().send_message(u'request_spin_delay')
|
||||||
if isLive:
|
if isLive:
|
||||||
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
||||||
|
else:
|
||||||
|
self.Toolbar.makeWidgetsInvisible(self.song_list)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'slidecontroller_first'), self.onSlideSelectedFirst)
|
QtCore.SIGNAL(u'slidecontroller_first'), self.onSlideSelectedFirst)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
@ -255,7 +264,10 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Allows the Preview toolbar to be customised
|
Allows the Preview toolbar to be customised
|
||||||
"""
|
"""
|
||||||
pass
|
if item.name == u'Songs':
|
||||||
|
self.Toolbar.makeWidgetsVisible(self.song_list)
|
||||||
|
else:
|
||||||
|
self.Toolbar.makeWidgetsInvisible(self.song_list)
|
||||||
|
|
||||||
def addServiceItem(self, item):
|
def addServiceItem(self, item):
|
||||||
"""
|
"""
|
||||||
@ -389,13 +401,13 @@ class SlideController(QtGui.QWidget):
|
|||||||
log.info(u'Slide Rendering took %4s' % (time.time() - before))
|
log.info(u'Slide Rendering took %4s' % (time.time() - before))
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
self.parent.mainDisplay.frameView(frame)
|
self.parent.mainDisplay.frameView(frame)
|
||||||
|
|
||||||
def grabMainDisplay(self):
|
def grabMainDisplay(self):
|
||||||
winid = QtGui.QApplication.desktop().winId()
|
winid = QtGui.QApplication.desktop().winId()
|
||||||
rm = self.parent.RenderManager
|
rm = self.parent.RenderManager
|
||||||
rect = rm.screen_list[rm.current_display][u'size']
|
rect = rm.screen_list[rm.current_display][u'size']
|
||||||
winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height())
|
winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height())
|
||||||
self.SlidePreview.setPixmap(winimg)
|
self.SlidePreview.setPixmap(winimg)
|
||||||
|
|
||||||
def onSlideSelectedNext(self):
|
def onSlideSelectedNext(self):
|
||||||
"""
|
"""
|
||||||
@ -461,6 +473,9 @@ class SlideController(QtGui.QWidget):
|
|||||||
if event.timerId() == self.timer_id:
|
if event.timerId() == self.timer_id:
|
||||||
self.onSlideSelectedNext()
|
self.onSlideSelectedNext()
|
||||||
|
|
||||||
|
def onEditSong(self):
|
||||||
|
Receiver().send_message(u'edit_song')
|
||||||
|
|
||||||
def onGoLive(self):
|
def onGoLive(self):
|
||||||
"""
|
"""
|
||||||
If preview copy slide item to live
|
If preview copy slide item to live
|
||||||
|
@ -371,7 +371,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
|
|
||||||
newtheme.add_font(unicode(theme.FontName),
|
newtheme.add_font(unicode(theme.FontName),
|
||||||
unicode(theme.FontColor.name()),
|
unicode(theme.FontColor.name()),
|
||||||
unicode(theme.FontProportion * 2), u'False')
|
unicode(theme.FontProportion * 3), u'False')
|
||||||
newtheme.add_font(unicode(theme.FontName),
|
newtheme.add_font(unicode(theme.FontName),
|
||||||
unicode(theme.FontColor.name()),
|
unicode(theme.FontColor.name()),
|
||||||
unicode(12), u'False', u'footer')
|
unicode(12), u'False', u'footer')
|
||||||
|
@ -158,6 +158,11 @@ class BibleDBImpl(BibleCommon):
|
|||||||
def get_bible_text(self, bookname, chapter, sverse, everse):
|
def get_bible_text(self, bookname, chapter, sverse, everse):
|
||||||
log.debug(u'get_bible_text %s, %s, %s, %s', bookname, chapter, sverse,
|
log.debug(u'get_bible_text %s, %s, %s, %s', bookname, chapter, sverse,
|
||||||
everse)
|
everse)
|
||||||
|
#Look up book name or abbreviation
|
||||||
|
book = self.get_bible_book(bookname)
|
||||||
|
if book is not None:
|
||||||
|
bookname = book.name
|
||||||
|
log.debug(u'bookname corrected to %s' % bookname)
|
||||||
verses = self.session.query(Verse).join(Book).filter(
|
verses = self.session.query(Verse).join(Book).filter(
|
||||||
Book.name == bookname).filter(Verse.chapter == chapter).filter(
|
Book.name == bookname).filter(Verse.chapter == chapter).filter(
|
||||||
Verse.verse>=sverse).filter(Verse.verse<=everse).order_by(
|
Verse.verse>=sverse).filter(Verse.verse<=everse).order_by(
|
||||||
|
@ -410,6 +410,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.songmanager.save_song(self.song)
|
self.songmanager.save_song(self.song)
|
||||||
if self.title_change:
|
if self.title_change:
|
||||||
Receiver().send_message(u'load_song_list')
|
Receiver().send_message(u'load_song_list')
|
||||||
|
Receiver().send_message(u'preview_song')
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def processLyrics(self):
|
def processLyrics(self):
|
||||||
|
@ -55,6 +55,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
|
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
|
||||||
self.song_maintenance_form = SongMaintenanceForm(
|
self.song_maintenance_form = SongMaintenanceForm(
|
||||||
self.parent.songmanager, self)
|
self.parent.songmanager, self)
|
||||||
|
self.fromPreview = None
|
||||||
|
|
||||||
def requiredIcons(self):
|
def requiredIcons(self):
|
||||||
MediaManagerItem.requiredIcons(self)
|
MediaManagerItem.requiredIcons(self)
|
||||||
@ -121,6 +122,10 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
QtCore.SIGNAL(u'load_song_list'), self.onSearchTextButtonClick)
|
QtCore.SIGNAL(u'load_song_list'), self.onSearchTextButtonClick)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'config_updated'), self.configUpdated)
|
QtCore.SIGNAL(u'config_updated'), self.configUpdated)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'edit_song'), self.onEventEditSong)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'proview_song'), self.onPreviewClick)
|
||||||
|
|
||||||
def configUpdated(self):
|
def configUpdated(self):
|
||||||
self.searchAsYouType = str_to_bool(
|
self.searchAsYouType = str_to_bool(
|
||||||
@ -168,19 +173,23 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
if author_list != u'':
|
if author_list != u'':
|
||||||
author_list = author_list + u', '
|
author_list = author_list + u', '
|
||||||
author_list = author_list + author.display_name
|
author_list = author_list + author.display_name
|
||||||
song_detail = unicode(u'%s (%s)' % \
|
song_detail = unicode(self.trUtf8(u'%s (%s)' % \
|
||||||
(unicode(song.title), unicode(author_list)))
|
(unicode(song.title), unicode(author_list))))
|
||||||
song_name = QtGui.QListWidgetItem(song_detail)
|
song_name = QtGui.QListWidgetItem(song_detail)
|
||||||
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
||||||
self.ListView.addItem(song_name)
|
self.ListView.addItem(song_name)
|
||||||
|
if song.id == self.fromPreview:
|
||||||
|
self.fromPreview = 0
|
||||||
|
self.ListView.setCurrentItem(song_name)
|
||||||
|
self.onPreviewClick()
|
||||||
|
|
||||||
def displayResultsAuthor(self, searchresults):
|
def displayResultsAuthor(self, searchresults):
|
||||||
log.debug(u'display results Author')
|
log.debug(u'display results Author')
|
||||||
self.ListView.clear()
|
self.ListView.clear()
|
||||||
for author in searchresults:
|
for author in searchresults:
|
||||||
for song in author.songs:
|
for song in author.songs:
|
||||||
song_detail = unicode(u'%s (%s)' % \
|
song_detail = unicode(self.trUtf8(u'%s (%s)' % \
|
||||||
(unicode(author.display_name), unicode(song.title)))
|
(unicode(author.display_name), unicode(song.title))))
|
||||||
song_name = QtGui.QListWidgetItem(song_detail)
|
song_name = QtGui.QListWidgetItem(song_detail)
|
||||||
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
||||||
self.ListView.addItem(song_name)
|
self.ListView.addItem(song_name)
|
||||||
@ -218,13 +227,19 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
def onSongMaintenanceClick(self):
|
def onSongMaintenanceClick(self):
|
||||||
self.song_maintenance_form.exec_()
|
self.song_maintenance_form.exec_()
|
||||||
|
|
||||||
def onEditClick(self):
|
def onEditClick(self, preview=False):
|
||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item is not None:
|
if item is not None:
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
|
self.fromPreview = 0
|
||||||
|
if preview:
|
||||||
|
self.fromPreview = item_id
|
||||||
self.edit_song_form.loadSong(item_id)
|
self.edit_song_form.loadSong(item_id)
|
||||||
self.edit_song_form.exec_()
|
self.edit_song_form.exec_()
|
||||||
|
|
||||||
|
def onEventEditSong (self):
|
||||||
|
self.onEditClick(True)
|
||||||
|
|
||||||
def onDeleteClick(self):
|
def onDeleteClick(self):
|
||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item is not None:
|
if item is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user