forked from openlp/openlp
identify button from object name
revert some only cosmetic changes
This commit is contained in:
parent
5a238e663b
commit
604a6d0c77
@ -101,6 +101,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
QtCore.QObject.connect(self.VerseOrderEdit,
|
QtCore.QObject.connect(self.VerseOrderEdit,
|
||||||
QtCore.SIGNAL(u'lostFocus()'), self.onVerseOrderEditLostFocus)
|
QtCore.SIGNAL(u'lostFocus()'), self.onVerseOrderEditLostFocus)
|
||||||
self.previewButton = QtGui.QPushButton()
|
self.previewButton = QtGui.QPushButton()
|
||||||
|
self.previewButton.setObjectName(u'previewButton')
|
||||||
self.previewButton.setText(self.trUtf8('Save && Preview'))
|
self.previewButton.setText(self.trUtf8('Save && Preview'))
|
||||||
self.ButtonBox.addButton(
|
self.ButtonBox.addButton(
|
||||||
self.previewButton, QtGui.QDialogButtonBox.ActionRole)
|
self.previewButton, QtGui.QDialogButtonBox.ActionRole)
|
||||||
@ -334,7 +335,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
def onTopicRemoveButtonClicked(self):
|
def onTopicRemoveButtonClicked(self):
|
||||||
self.TopicRemoveButton.setEnabled(False)
|
self.TopicRemoveButton.setEnabled(False)
|
||||||
item = self.TopicsListView.currentItem()
|
item = self.TopicsListView.currentItem()
|
||||||
topic_id = item.data(QtCore.Qt.UserRole).toInt()[0]
|
topic_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
topic = self.songmanager.get_topic(topic_id)
|
topic = self.songmanager.get_topic(topic_id)
|
||||||
self.song.topics.remove(topic)
|
self.song.topics.remove(topic)
|
||||||
row = self.TopicsListView.row(item)
|
row = self.TopicsListView.row(item)
|
||||||
@ -379,8 +380,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
def onVerseEditButtonClicked(self):
|
def onVerseEditButtonClicked(self):
|
||||||
item = self.VerseListWidget.currentItem()
|
item = self.VerseListWidget.currentItem()
|
||||||
if item:
|
if item:
|
||||||
tempText = unicode(item.text())
|
tempText = item.text()
|
||||||
verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
|
verseId = unicode((item.data(QtCore.Qt.UserRole)).toString())
|
||||||
self.verse_form.setVerse(tempText, True, verseId)
|
self.verse_form.setVerse(tempText, True, verseId)
|
||||||
if self.verse_form.exec_():
|
if self.verse_form.exec_():
|
||||||
afterText, verse, subVerse = self.verse_form.getVerse()
|
afterText, verse, subVerse = self.verse_form.getVerse()
|
||||||
@ -411,16 +412,16 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
if self.VerseListWidget.rowCount() > 0:
|
if self.VerseListWidget.rowCount() > 0:
|
||||||
for row in range(0, self.VerseListWidget.rowCount()):
|
for row in range(0, self.VerseListWidget.rowCount()):
|
||||||
item = self.VerseListWidget.item(row, 0)
|
item = self.VerseListWidget.item(row, 0)
|
||||||
field = unicode(item.data(QtCore.Qt.UserRole).toString())
|
field = unicode((item.data(QtCore.Qt.UserRole)).toString())
|
||||||
verse_list += u'---[%s]---\n' % field
|
verse_list += u'---[%s]---\n' % field
|
||||||
verse_list += unicode(item.text())
|
verse_list += item.text()
|
||||||
verse_list += u'\n'
|
verse_list += u'\n'
|
||||||
self.verse_form.setVerse(verse_list)
|
self.verse_form.setVerse(verse_list)
|
||||||
else:
|
else:
|
||||||
self.verse_form.setVerse(u'')
|
self.verse_form.setVerse(u'')
|
||||||
if self.verse_form.exec_():
|
if self.verse_form.exec_():
|
||||||
verse_list = unicode(self.verse_form.getVerseAll())
|
verse_list = self.verse_form.getVerseAll()
|
||||||
verse_list = verse_list.replace(u'\r\n', u'\n')
|
verse_list = unicode(verse_list.replace(u'\r\n', u'\n'))
|
||||||
self.VerseListWidget.clear()
|
self.VerseListWidget.clear()
|
||||||
self.VerseListWidget.setRowCount(0)
|
self.VerseListWidget.setRowCount(0)
|
||||||
for row in self.findVerseSplit.split(verse_list):
|
for row in self.findVerseSplit.split(verse_list):
|
||||||
@ -458,7 +459,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'Validate Song')
|
log.debug(u'Validate Song')
|
||||||
# Lets be nice and assume the data is correct.
|
# Lets be nice and assume the data is correct.
|
||||||
if self.TitleEditItem.text().isEmpty():
|
if len(self.TitleEditItem.displayText()) == 0:
|
||||||
self.SongTabWidget.setCurrentIndex(0)
|
self.SongTabWidget.setCurrentIndex(0)
|
||||||
self.TitleEditItem.setFocus()
|
self.TitleEditItem.setFocus()
|
||||||
return False, self.trUtf8('You need to enter a song title.')
|
return False, self.trUtf8('You need to enter a song title.')
|
||||||
@ -473,8 +474,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
taglist = unicode(self.trUtf8(' bitpeo'))
|
taglist = unicode(self.trUtf8(' bitpeo'))
|
||||||
for verse in unicode(self.VerseOrderEdit.text()).lower().split(u' '):
|
for verse in unicode(self.VerseOrderEdit.text()).lower().split(u' '):
|
||||||
if len(verse) > 1:
|
if len(verse) > 1:
|
||||||
if (verse[0:1] == unicode(self.trUtf8('v')) or
|
if (verse[0:1] == u'%s' % self.trUtf8('v') or
|
||||||
verse[0:1] == unicode(self.trUtf8('c')) \
|
verse[0:1] == u'%s' % self.trUtf8('c')) \
|
||||||
and verse[1:].isdigit():
|
and verse[1:].isdigit():
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@ -503,7 +504,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.song.comments = unicode(self.CommentsEdit.text())
|
self.song.comments = unicode(self.CommentsEdit.text())
|
||||||
|
|
||||||
def onCCLNumberEditLostFocus(self):
|
def onCCLNumberEditLostFocus(self):
|
||||||
self.song.ccli_number = unicode(self.CCLNumberEdit.text())
|
self.song.ccli_number = self.CCLNumberEdit.text()
|
||||||
|
|
||||||
def onCopyrightInsertButtonTriggered(self):
|
def onCopyrightInsertButtonTriggered(self):
|
||||||
text = self.CopyrightEditItem.text()
|
text = self.CopyrightEditItem.text()
|
||||||
@ -525,7 +526,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
The Song is valid so as the plugin to add it to preview to see.
|
The Song is valid so as the plugin to add it to preview to see.
|
||||||
"""
|
"""
|
||||||
log.debug(u'onPreview')
|
log.debug(u'onPreview')
|
||||||
if button.text() == self.trUtf8('Save && Preview') and self.saveSong():
|
if unicode(button.objectName()) == u'previewButton' and self.saveSong():
|
||||||
Receiver.send_message(u'songs_preview')
|
Receiver.send_message(u'songs_preview')
|
||||||
|
|
||||||
def closePressed(self):
|
def closePressed(self):
|
||||||
@ -566,7 +567,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
text = u' '
|
text = u' '
|
||||||
for i in range (0, self.VerseListWidget.rowCount()):
|
for i in range (0, self.VerseListWidget.rowCount()):
|
||||||
item = self.VerseListWidget.item(i, 0)
|
item = self.VerseListWidget.item(i, 0)
|
||||||
verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
|
verseId = unicode((item.data(QtCore.Qt.UserRole)).toString())
|
||||||
bits = verseId.split(u':')
|
bits = verseId.split(u':')
|
||||||
sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text()))
|
sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text()))
|
||||||
text = text + unicode(self.VerseListWidget.item(i, 0).text()) \
|
text = text + unicode(self.VerseListWidget.item(i, 0).text()) \
|
||||||
@ -580,7 +581,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
text = text.replace(u'{', u'')
|
text = text.replace(u'{', u'')
|
||||||
text = text.replace(u'}', u'')
|
text = text.replace(u'}', u'')
|
||||||
text = text.replace(u'?', u'')
|
text = text.replace(u'?', u'')
|
||||||
self.song.search_lyrics = text
|
self.song.search_lyrics = unicode(text)
|
||||||
self.song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
|
self.song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
|
||||||
except:
|
except:
|
||||||
log.exception(u'Problem processing song Lyrics \n%s',
|
log.exception(u'Problem processing song Lyrics \n%s',
|
||||||
@ -601,3 +602,4 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.song.search_title = self.song.search_title.replace(u'}', u'')
|
self.song.search_title = self.song.search_title.replace(u'}', u'')
|
||||||
self.song.search_title = self.song.search_title.replace(u'?', u'')
|
self.song.search_title = self.song.search_title.replace(u'?', u'')
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.configUpdated()
|
self.configUpdated()
|
||||||
|
|
||||||
def onSearchTextButtonClick(self):
|
def onSearchTextButtonClick(self):
|
||||||
search_keywords = unicode(self.SearchTextEdit.text())
|
search_keywords = unicode(self.SearchTextEdit.displayText())
|
||||||
search_results = []
|
search_results = []
|
||||||
search_type = self.SearchTypeComboBox.currentIndex()
|
search_type = self.SearchTypeComboBox.currentIndex()
|
||||||
if search_type == 0:
|
if search_type == 0:
|
||||||
@ -198,8 +198,8 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
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(self.trUtf8('%s (%s)')) % \
|
song_detail = unicode(self.trUtf8('%s (%s)') % \
|
||||||
(unicode(author.display_name), unicode(song.title))
|
(author.display_name, 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)
|
||||||
@ -220,7 +220,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
search_length = 1
|
search_length = 1
|
||||||
if self.SearchTypeComboBox.currentIndex() == 1:
|
if self.SearchTypeComboBox.currentIndex() == 1:
|
||||||
search_length = 7
|
search_length = 7
|
||||||
if text.size() > search_length:
|
if len(text) > search_length:
|
||||||
self.onSearchTextButtonClick()
|
self.onSearchTextButtonClick()
|
||||||
|
|
||||||
def onImportClick(self):
|
def onImportClick(self):
|
||||||
@ -268,7 +268,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
def onEditClick(self):
|
def onEditClick(self):
|
||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item:
|
if item:
|
||||||
item_id = item.data(QtCore.Qt.UserRole).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
self.edit_song_form.loadSong(item_id, False)
|
self.edit_song_form.loadSong(item_id, False)
|
||||||
self.edit_song_form.exec_()
|
self.edit_song_form.exec_()
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
if ans == QtGui.QMessageBox.Cancel:
|
if ans == QtGui.QMessageBox.Cancel:
|
||||||
return
|
return
|
||||||
for item in items:
|
for item in items:
|
||||||
item_id = item.data(QtCore.Qt.UserRole).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
self.parent.manager.delete_song(item_id)
|
self.parent.manager.delete_song(item_id)
|
||||||
self.onSearchTextButtonClick()
|
self.onSearchTextButtonClick()
|
||||||
|
|
||||||
@ -302,11 +302,11 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item is None:
|
if item is None:
|
||||||
return False
|
return False
|
||||||
item_id = item.data(QtCore.Qt.UserRole).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
else:
|
else:
|
||||||
item_id = self.remoteSong
|
item_id = self.remoteSong
|
||||||
else:
|
else:
|
||||||
item_id = item.data(QtCore.Qt.UserRole).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
service_item.add_capability(ItemCapabilities.AllowsEdit)
|
service_item.add_capability(ItemCapabilities.AllowsEdit)
|
||||||
service_item.add_capability(ItemCapabilities.AllowsPreview)
|
service_item.add_capability(ItemCapabilities.AllowsPreview)
|
||||||
service_item.add_capability(ItemCapabilities.AllowsLoop)
|
service_item.add_capability(ItemCapabilities.AllowsLoop)
|
||||||
@ -330,10 +330,10 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
break
|
break
|
||||||
for verse in verseList:
|
for verse in verseList:
|
||||||
if verse[1]:
|
if verse[1]:
|
||||||
if verse[0][u'type'] == u'Verse' or \
|
if verse[0][u'type'] == "Verse" \
|
||||||
verse[0][u'type'] == u'Chorus':
|
or verse[0][u'type'] == "Chorus":
|
||||||
if verse[0][u'type'][0] == order[0] and \
|
if verse[0][u'label'] == order[1:] and \
|
||||||
verse[0][u'label'] == order[1:]:
|
verse[0][u'type'][0] == order[0]:
|
||||||
verseTag = u'%s:%s' % \
|
verseTag = u'%s:%s' % \
|
||||||
(verse[0][u'type'], verse[0][u'label'])
|
(verse[0][u'type'], verse[0][u'label'])
|
||||||
service_item.add_from_text\
|
service_item.add_from_text\
|
||||||
|
Loading…
Reference in New Issue
Block a user