Song Edit Preview button only active from Preview, Reset Theme Editor image text Edit

This commit is contained in:
Tim Bentley 2009-10-30 06:43:28 +00:00
parent 81de929460
commit 0d959fbfb1
4 changed files with 48 additions and 32 deletions

View File

@ -408,6 +408,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.theme.background_endColor = u'#ff0000'
else:
self.theme.background_type = u'image'
a=c
self.stateChanging(self.theme)
self.previewTheme(self.theme)
@ -431,7 +432,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtGui.QColor(self.theme.background_endColor), self).name()
self.Color2PushButton.setStyleSheet(
u'background-color: %s' % unicode(self.theme.background_endColor))
self.previewTheme(self.theme)
#
#Other Tab
@ -486,12 +486,14 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
else:
self.BackgroundComboBox.setCurrentIndex(1)
self.ImageLineEdit.setText(u'')
if theme.background_type == u'solid':
self.BackgroundTypeComboBox.setCurrentIndex(0)
elif theme.background_type == u'gradient':
self.BackgroundTypeComboBox.setCurrentIndex(1)
else:
self.BackgroundTypeComboBox.setCurrentIndex(2)
self.ImageLineEdit.setText(self.theme.background_filename)
if self.theme.background_direction == u'horizontal':
self.GradientComboBox.setCurrentIndex(0)

View File

@ -129,6 +129,8 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems = []
self.serviceName = u''
self.isNew = True
#Indicates if remoteTriggering is active. If it is the next addServiceItem call
#will replace the currently selected one.
self.remoteEditTriggered = False
self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0)

View File

@ -95,9 +95,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
QtCore.SIGNAL(u'lostFocus()'), self.onCommentsEditLostFocus)
QtCore.QObject.connect(self.VerseOrderEdit,
QtCore.SIGNAL(u'lostFocus()'), self.onVerseOrderEditLostFocus)
previewButton = QtGui.QPushButton()
previewButton.setText(self.trUtf8(u'Save && Preview'))
self.ButtonBox.addButton(previewButton, QtGui.QDialogButtonBox.ActionRole)
self.previewButton = QtGui.QPushButton()
self.previewButton.setText(self.trUtf8(u'Save && Preview'))
self.ButtonBox.addButton(
self.previewButton, QtGui.QDialogButtonBox.ActionRole)
QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
# Create other objects and forms
@ -167,7 +168,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.loadTopics()
self.loadBooks()
def loadSong(self, id):
def loadSong(self, id, preview):
log.debug(u'Load Song')
self.SongTabWidget.setCurrentIndex(0)
self.loadAuthors()
@ -236,6 +237,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self._validate_song()
self.title_change = False
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason)
#if not preview hide the preview button
self.previewButton.setVisible(False)
if preview:
self.previewButton.setVisible(True)
def onAuthorAddButtonClicked(self):
item = int(self.AuthorsSelectionComboItem.currentIndex())
@ -434,6 +439,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def processLyrics(self):
log.debug(u'processLyrics')
try:
sxml = SongXMLBuilder()
sxml.new_document()
sxml.add_lyrics_to_song()
@ -459,6 +465,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
text = text.replace(u'?', u'')
self.song.search_lyrics = unicode(text)
self.song.lyrics = unicode(sxml.extract_xml())
except:
log.exception(u'Problem processing song Lyrics')
def processTitle(self):
log.debug(u'processTitle')

View File

@ -55,7 +55,11 @@ class SongMediaItem(MediaManagerItem):
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
self.song_maintenance_form = SongMaintenanceForm(
self.parent.songmanager, self)
#fromPreview holds the id of the item if the song editor needs to trigger a preview
#without closing. It is set to -1 if this function is inactive
self.fromPreview = -1
#fromServiceManager holds the id of the item if the song editor needs to trigger posting
#to the servicemanager without closing. It is set to -1 if this function is inactive
self.fromServiceManager = -1
def initPluginNameVisible(self):
@ -244,7 +248,7 @@ class SongMediaItem(MediaManagerItem):
valid = self.parent.songmanager.get_song(songid)
if valid is not None:
self.fromServiceManager = songid
self.edit_song_form.loadSong(songid)
self.edit_song_form.loadSong(songid, False)
self.edit_song_form.exec_()
def onEditClick(self, preview=False):
@ -254,7 +258,7 @@ class SongMediaItem(MediaManagerItem):
self.fromPreview = -1
if preview:
self.fromPreview = item_id
self.edit_song_form.loadSong(item_id)
self.edit_song_form.loadSong(item_id, preview)
self.edit_song_form.exec_()
def onEventEditSong (self):