Song editing from Preview, bible fixes

bzr-revno: 623
This commit is contained in:
Tim Bentley 2009-10-24 17:10:30 +01:00
commit a1ae98b18f
9 changed files with 61 additions and 25 deletions

View File

@ -118,7 +118,6 @@ class MediaManagerItem(QtGui.QWidget):
self.requiredIcons()
self.setupUi()
self.retranslateUi()
#self.initialise()
def requiredIcons(self):
"""

View File

@ -201,7 +201,7 @@ class Renderer(object):
#if we have more text add up to 10 spaces on the front.
if len(line) > 0 and self._theme.font_main_indentation > 0:
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
for count, line in enumerate(split_lines):
page.append(line)

View File

@ -65,6 +65,7 @@ class RenderManager(object):
self.service_theme = u''
self.global_style = u''
self.override_background = None
self.themedata = None
self.save_bg_frame = None
self.override_background_changed = False
@ -130,7 +131,7 @@ class RenderManager(object):
self.theme = self.service_theme
else:
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)
self.themedata = self.theme_manager.getThemeData(self.theme)
self.calculate_default(

View File

@ -678,6 +678,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
log.debug(u'Page Length area height %s , metrics %s , lines %s' %
(int(self.FontMainHeightSpinBox.value()), metrics.height(), page_length ))
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)
self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame))

View File

@ -87,10 +87,13 @@ class SlideController(QtGui.QWidget):
self.isLive = isLive
self.parent = parent
self.image_list = [
self.trUtf8(u'Start Loop'),
self.trUtf8(u'Stop Loop'),
#self.trUtf8(u'Loop Separator'),
self.trUtf8(u'Image SpinBox')
u'Start Loop',
u'Stop Loop',
u'Loop Separator',
u'Image SpinBox'
]
self.song_list = [
u'Edit Song',
]
self.timer_id = 0
self.commandItem = None
@ -140,17 +143,17 @@ class SlideController(QtGui.QWidget):
self.Toolbar.setSizePolicy(sizeToolbarPolicy)
if self.isLive:
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.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.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)
if self.isLive:
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)
if self.isLive:
self.Toolbar.addToolbarSeparator(u'Close Separator')
@ -159,19 +162,23 @@ class SlideController(QtGui.QWidget):
if not self.isLive:
self.Toolbar.addToolbarSeparator(u'Close Separator')
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.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:
self.Toolbar.addToolbarSeparator(u'Loop Separator')
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.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.DelaySpinBox = QtGui.QSpinBox()
self.Toolbar.addToolbarWidget(
self.trUtf8(u'Image SpinBox'), self.DelaySpinBox)
u'Image SpinBox', self.DelaySpinBox)
self.DelaySpinBox.setSuffix(self.trUtf8(u's'))
self.ControllerLayout.addWidget(self.Toolbar)
@ -216,6 +223,8 @@ class SlideController(QtGui.QWidget):
Receiver().send_message(u'request_spin_delay')
if isLive:
self.Toolbar.makeWidgetsInvisible(self.image_list)
else:
self.Toolbar.makeWidgetsInvisible(self.song_list)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_first'), self.onSlideSelectedFirst)
QtCore.QObject.connect(Receiver.get_receiver(),
@ -255,7 +264,10 @@ class SlideController(QtGui.QWidget):
"""
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):
"""
@ -461,6 +473,9 @@ class SlideController(QtGui.QWidget):
if event.timerId() == self.timer_id:
self.onSlideSelectedNext()
def onEditSong(self):
Receiver().send_message(u'edit_song')
def onGoLive(self):
"""
If preview copy slide item to live

View File

@ -371,7 +371,7 @@ class ThemeManager(QtGui.QWidget):
newtheme.add_font(unicode(theme.FontName),
unicode(theme.FontColor.name()),
unicode(theme.FontProportion * 2), u'False')
unicode(theme.FontProportion * 3), u'False')
newtheme.add_font(unicode(theme.FontName),
unicode(theme.FontColor.name()),
unicode(12), u'False', u'footer')

View File

@ -158,6 +158,11 @@ class BibleDBImpl(BibleCommon):
def get_bible_text(self, bookname, chapter, sverse, everse):
log.debug(u'get_bible_text %s, %s, %s, %s', bookname, chapter, sverse,
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(
Book.name == bookname).filter(Verse.chapter == chapter).filter(
Verse.verse>=sverse).filter(Verse.verse<=everse).order_by(

View File

@ -410,6 +410,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.songmanager.save_song(self.song)
if self.title_change:
Receiver().send_message(u'load_song_list')
Receiver().send_message(u'preview_song')
self.close()
def processLyrics(self):

View File

@ -55,6 +55,7 @@ class SongMediaItem(MediaManagerItem):
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
self.song_maintenance_form = SongMaintenanceForm(
self.parent.songmanager, self)
self.fromPreview = None
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@ -121,6 +122,10 @@ class SongMediaItem(MediaManagerItem):
QtCore.SIGNAL(u'load_song_list'), self.onSearchTextButtonClick)
QtCore.QObject.connect(Receiver.get_receiver(),
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):
self.searchAsYouType = str_to_bool(
@ -168,19 +173,23 @@ class SongMediaItem(MediaManagerItem):
if author_list != u'':
author_list = author_list + u', '
author_list = author_list + author.display_name
song_detail = unicode(u'%s (%s)' % \
(unicode(song.title), unicode(author_list)))
song_detail = unicode(self.trUtf8(u'%s (%s)' % \
(unicode(song.title), unicode(author_list))))
song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
self.ListView.addItem(song_name)
if song.id == self.fromPreview:
self.fromPreview = 0
self.ListView.setCurrentItem(song_name)
self.onPreviewClick()
def displayResultsAuthor(self, searchresults):
log.debug(u'display results Author')
self.ListView.clear()
for author in searchresults:
for song in author.songs:
song_detail = unicode(u'%s (%s)' % \
(unicode(author.display_name), unicode(song.title)))
song_detail = unicode(self.trUtf8(u'%s (%s)' % \
(unicode(author.display_name), unicode(song.title))))
song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
self.ListView.addItem(song_name)
@ -218,13 +227,19 @@ class SongMediaItem(MediaManagerItem):
def onSongMaintenanceClick(self):
self.song_maintenance_form.exec_()
def onEditClick(self):
def onEditClick(self, preview=False):
item = self.ListView.currentItem()
if item is not None:
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.exec_()
def onEventEditSong (self):
self.onEditClick(True)
def onDeleteClick(self):
item = self.ListView.currentItem()
if item is not None: