openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #20501
[Merge] lp:~googol/openlp/short-lines into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/short-lines into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~googol/openlp/short-lines/+merge/159584
Hello,
- fixed short lines
- renamed attributes and methods
Passed functional tests
--
https://code.launchpad.net/~googol/openlp/short-lines/+merge/159584
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/short-lines into lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2013-03-23 06:46:41 +0000
+++ openlp/core/lib/mediamanageritem.py 2013-04-18 09:36:45 +0000
@@ -424,7 +424,7 @@
"""
raise NotImplementedError(u'MediaManagerItem.on_delete_click needs to be defined by the plugin')
- def onFocus(self):
+ def on_focus(self):
"""
Run when a tab in the media manager gains focus. This gives the media
item a chance to focus any elements it wants to.
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2013-03-28 20:05:46 +0000
+++ openlp/core/ui/mainwindow.py 2013-04-18 09:36:45 +0000
@@ -560,7 +560,7 @@
"""
widget = self.media_tool_box.widget(index)
if widget:
- widget.onFocus()
+ widget.on_focus()
def version_notice(self, version):
"""
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2013-04-05 09:04:38 +0000
+++ openlp/core/ui/servicemanager.py 2013-04-18 09:36:45 +0000
@@ -1393,7 +1393,7 @@
item = self.find_service_item()[0]
if self.service_items[item][u'service_item'].is_capable(ItemCapabilities.CanEdit):
new_item = Registry().get(self.service_items[item][u'service_item'].name). \
- onRemoteEdit(self.service_items[item][u'service_item'].edit_id)
+ on_remote_edit(self.service_items[item][u'service_item'].edit_id)
if new_item:
self.add_service_item(new_item, replace=True)
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2013-04-05 13:41:42 +0000
+++ openlp/core/ui/slidecontroller.py 2013-04-18 09:36:45 +0000
@@ -1229,7 +1229,7 @@
From the preview display requires the service Item to be editied
"""
self.song_edit = True
- new_item = Registry().get(self.service_item.name).onRemoteEdit(self.service_item.edit_id, True)
+ new_item = Registry().get(self.service_item.name).on_remote_edit(self.service_item.edit_id, True)
if new_item:
self.add_service_item(new_item)
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2013-04-05 17:41:01 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2013-04-18 09:36:45 +0000
@@ -250,7 +250,7 @@
self.quickSearchEdit.returnPressed.connect(self.onQuickSearchButton)
self.searchTabBar.currentChanged.connect(self.onSearchTabBarCurrentChanged)
- def onFocus(self):
+ def on_focus(self):
if self.quickTab.isVisible():
self.quickSearchEdit.setFocus()
else:
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2013-03-28 20:08:07 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2013-04-18 09:36:45 +0000
@@ -178,7 +178,7 @@
self.plugin.manager.delete_object(CustomSlide, id)
self.on_search_text_button_clicked()
- def onFocus(self):
+ def on_focus(self):
self.search_text_edit.setFocus()
def generate_slide_data(self, service_item, item=None, xmlVersion=False,
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2013-03-28 21:36:18 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2013-04-18 09:36:45 +0000
@@ -714,7 +714,7 @@
text = self.song_book_combo_box.currentText()
if item == 0 and text:
temp_song_book = text
- self.media_item.songMaintenanceForm.exec_(True)
+ self.media_item.song_maintenance_form.exec_(True)
self.load_authors()
self.load_books()
self.load_topics()
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2013-03-31 10:31:54 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2013-04-18 09:36:45 +0000
@@ -72,27 +72,24 @@
def __init__(self, parent, plugin):
self.icon_path = u'songs/song'
MediaManagerItem.__init__(self, parent, plugin)
- self.editSongForm = EditSongForm(self, self.main_window, self.plugin.manager)
+ self.edit_song_form = EditSongForm(self, self.main_window, self.plugin.manager)
self.openLyrics = OpenLyrics(self.plugin.manager)
self.single_service_item = False
- self.songMaintenanceForm = SongMaintenanceForm(self.plugin.manager, self)
- # Holds information about whether the edit is remotely triggered and
- # which Song is required.
- self.remoteSong = -1
- self.editItem = None
+ self.song_maintenance_form = SongMaintenanceForm(self.plugin.manager, self)
+ # Holds information about whether the edit is remotely triggered and which Song is required.
+ self.remote_song = -1
+ self.edit_item = None
self.quick_preview_allowed = True
self.has_search = True
- def _updateBackgroundAudio(self, song, item):
+ def _update_background_audio(self, song, item):
song.media_files = []
for i, bga in enumerate(item.background_audio):
dest_file = os.path.join(
AppLocation.get_section_data_path(self.plugin.name), u'audio', str(song.id), os.path.split(bga)[1])
check_directory_exists(os.path.split(dest_file)[0])
- shutil.copyfile(os.path.join(AppLocation.get_section_data_path(u'servicemanager'), bga),
- dest_file)
- song.media_files.append(MediaFile.populate(
- weight=i, file_name=dest_file))
+ shutil.copyfile(os.path.join(AppLocation.get_section_data_path(u'servicemanager'), bga), dest_file)
+ song.media_files.append(MediaFile.populate(weight=i, file_name=dest_file))
self.plugin.manager.save_object(song, True)
def add_end_header_bar(self):
@@ -100,7 +97,7 @@
## Song Maintenance Button ##
self.maintenanceAction = self.toolbar.add_toolbar_action('maintenanceAction',
icon=':/songs/song_maintenance.png',
- triggers=self.onSongMaintenanceClick)
+ triggers=self.on_song_maintenance_click)
self.add_search_to_toolbar()
# Signals and slots
Registry().register_function(u'songs_load_list', self.on_song_list_load)
@@ -113,17 +110,17 @@
create_widget_action(self.list_view, separator=True)
create_widget_action(self.list_view,
text=translate('OpenLP.MediaManagerItem', '&Clone'), icon=u':/general/general_clone.png',
- triggers=self.onCloneClick)
+ triggers=self.on_clone_click)
- def onFocus(self):
+ def on_focus(self):
self.search_text_edit.setFocus()
def config_update(self):
"""
- IS triggered when the songs config is updated
+ Is triggered when the songs config is updated
"""
log.debug(u'config_updated')
- self.searchAsYouType = Settings().value(self.settings_section + u'/search as type')
+ self.search_as_you_type = Settings().value(self.settings_section + u'/search as type')
self.updateServiceOnEdit = Settings().value(self.settings_section + u'/update service on edit')
self.addSongFromService = Settings().value(self.settings_section + u'/add song from service',)
@@ -164,23 +161,23 @@
search_type = self.search_text_edit.current_search_type()
if search_type == SongSearch.Entire:
log.debug(u'Entire Song Search')
- search_results = self.searchEntire(search_keywords)
- self.displayResultsSong(search_results)
+ search_results = self.search_entire(search_keywords)
+ self.display_results_song(search_results)
elif search_type == SongSearch.Titles:
log.debug(u'Titles Search')
search_results = self.plugin.manager.get_all_objects(Song,
Song.search_title.like(u'%' + clean_string(search_keywords) + u'%'))
- self.displayResultsSong(search_results)
+ self.display_results_song(search_results)
elif search_type == SongSearch.Lyrics:
log.debug(u'Lyrics Search')
search_results = self.plugin.manager.get_all_objects(Song,
Song.search_lyrics.like(u'%' + clean_string(search_keywords) + u'%'))
- self.displayResultsSong(search_results)
+ self.display_results_song(search_results)
elif search_type == SongSearch.Authors:
log.debug(u'Authors Search')
search_results = self.plugin.manager.get_all_objects(Author,
Author.display_name.like(u'%' + search_keywords + u'%'), Author.display_name.asc())
- self.displayResultsAuthor(search_results)
+ self.display_results_author(search_results)
elif search_type == SongSearch.Books:
log.debug(u'Books Search')
search_results = self.plugin.manager.get_all_objects(Book,
@@ -191,15 +188,15 @@
search_results = self.plugin.manager.get_all_objects(Book,
Book.name.like(u'%' + search_keywords[0] + u'%'), Book.name.asc())
song_number = re.sub(r'[^0-9]', u'', search_keywords[2])
- self.displayResultsBook(search_results, song_number)
+ self.display_results_book(search_results, song_number)
elif search_type == SongSearch.Themes:
log.debug(u'Theme Search')
search_results = self.plugin.manager.get_all_objects(Song,
Song.theme_name.like(u'%' + search_keywords + u'%'))
- self.displayResultsSong(search_results)
+ self.display_results_song(search_results)
self.check_search_result()
- def searchEntire(self, search_keywords):
+ def search_entire(self, search_keywords):
return self.plugin.manager.get_all_objects(Song,
or_(Song.search_title.like(u'%' + clean_string(search_keywords) + u'%'),
Song.search_lyrics.like(u'%' + clean_string(search_keywords) + u'%'),
@@ -211,17 +208,16 @@
of songs
"""
log.debug(u'on_song_list_load - start')
- # Called to redisplay the song list screen edit from a search
- # or from the exit of the Song edit dialog. If remote editing is active
- # Trigger it and clean up so it will not update again.
- # Push edits to the service manager to update items
- if self.editItem and self.updateServiceOnEdit and not self.remote_triggered:
- item = self.build_service_item(self.editItem)
+ # Called to redisplay the song list screen edit from a search or from the exit of the Song edit dialog. If
+ # remote editing is active Trigger it and clean up so it will not update again. Push edits to the service
+ # manager to update items
+ if self.edit_item and self.updateServiceOnEdit and not self.remote_triggered:
+ item = self.build_service_item(self.edit_item)
self.service_manager.replace_service_item(item)
self.on_search_text_button_clicked()
log.debug(u'on_song_list_load - finished')
- def displayResultsSong(self, searchresults):
+ def display_results_song(self, searchresults):
log.debug(u'display results Song')
self.save_auto_select_id()
self.list_view.clear()
@@ -241,7 +237,7 @@
self.list_view.setCurrentItem(song_name)
self.auto_select_id = -1
- def displayResultsAuthor(self, searchresults):
+ def display_results_author(self, searchresults):
log.debug(u'display results Author')
self.list_view.clear()
for author in searchresults:
@@ -254,7 +250,7 @@
song_name.setData(QtCore.Qt.UserRole, song.id)
self.list_view.addItem(song_name)
- def displayResultsBook(self, searchresults, song_number=False):
+ def display_results_book(self, searchresults, song_number=False):
log.debug(u'display results Book')
self.list_view.clear()
for book in searchresults:
@@ -280,11 +276,10 @@
def on_search_text_edit_changed(self, text):
"""
- If search as type enabled invoke the search on each key press.
- If the Lyrics are being searched do not start till 7 characters
- have been entered.
+ If search as type enabled invoke the search on each key press. If the Lyrics are being searched do not start
+ till 7 characters have been entered.
"""
- if self.searchAsYouType:
+ if self.search_as_you_type:
search_length = 1
if self.search_text_edit.current_search_type() == SongSearch.Entire:
search_length = 4
@@ -309,33 +304,32 @@
def on_new_click(self):
log.debug(u'on_new_click')
- self.editSongForm.new_song()
- self.editSongForm.exec_()
+ self.edit_song_form.new_song()
+ self.edit_song_form.exec_()
self.onClearTextButtonClick()
self.on_selection_change()
self.auto_select_id = -1
- def onSongMaintenanceClick(self):
- self.songMaintenanceForm.exec_()
+ def on_song_maintenance_click(self):
+ self.song_maintenance_form.exec_()
- def onRemoteEdit(self, song_id, preview=False):
- """
- Called by ServiceManager or SlideController by event passing
- the Song Id in the payload along with an indicator to say which
- type of display is required.
- """
- log.debug(u'onRemoteEdit for song %s' % song_id)
+ def on_remote_edit(self, song_id, preview=False):
+ """
+ Called by ServiceManager or SlideController by event passing the Song Id in the payload along with an indicator
+ to say which type of display is required.
+ """
+ log.debug(u'on_remote_edit for song %s' % song_id)
song_id = int(song_id)
valid = self.plugin.manager.get_object(Song, song_id)
if valid:
- self.editSongForm.load_song(song_id, preview)
- if self.editSongForm.exec_() == QtGui.QDialog.Accepted:
+ self.edit_song_form.load_song(song_id, preview)
+ if self.edit_song_form.exec_() == QtGui.QDialog.Accepted:
self.auto_select_id = -1
self.on_song_list_load()
- self.remoteSong = song_id
+ self.remote_song = song_id
self.remote_triggered = True
item = self.build_service_item(remote=True)
- self.remoteSong = -1
+ self.remote_song = -1
self.remote_triggered = None
if item:
return item
@@ -347,13 +341,13 @@
"""
log.debug(u'on_edit_click')
if check_item_selected(self.list_view, UiStrings().SelectEdit):
- self.editItem = self.list_view.currentItem()
- item_id = self.editItem.data(QtCore.Qt.UserRole)
- self.editSongForm.load_song(item_id, False)
- self.editSongForm.exec_()
+ self.edit_item = self.list_view.currentItem()
+ item_id = self.edit_item.data(QtCore.Qt.UserRole)
+ self.edit_song_form.load_song(item_id, False)
+ self.edit_song_form.exec_()
self.auto_select_id = -1
self.on_song_list_load()
- self.editItem = None
+ self.edit_item = None
def on_delete_click(self):
"""
@@ -362,11 +356,11 @@
if check_item_selected(self.list_view, UiStrings().SelectDelete):
items = self.list_view.selectedIndexes()
if QtGui.QMessageBox.question(self,
- UiStrings().ConfirmDelete,
- translate('SongsPlugin.MediaItem', 'Are you sure you want to delete the %n selected song(s)?', '',
- QtCore.QCoreApplication.CodecForTr, len(items)),
- QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
- QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
+ UiStrings().ConfirmDelete,
+ translate('SongsPlugin.MediaItem', 'Are you sure you want to delete the %n selected song(s)?', '',
+ QtCore.QCoreApplication.CodecForTr, len(items)),
+ QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
+ QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
return
self.application.set_busy_cursor()
self.main_window.display_progress_bar(len(items))
@@ -390,14 +384,14 @@
self.application.set_normal_cursor()
self.on_search_text_button_clicked()
- def onCloneClick(self):
+ def on_clone_click(self):
"""
Clone a Song
"""
- log.debug(u'onCloneClick')
+ log.debug(u'on_clone_click')
if check_item_selected(self.list_view, UiStrings().SelectEdit):
- self.editItem = self.list_view.currentItem()
- item_id = self.editItem.data(QtCore.Qt.UserRole)
+ self.edit_item = self.list_view.currentItem()
+ item_id = self.edit_item.data(QtCore.Qt.UserRole)
old_song = self.plugin.manager.get_object(Song, item_id)
song_xml = self.openLyrics.song_to_xml(old_song)
new_song = self.openLyrics.xml_to_song(song_xml)
@@ -411,8 +405,8 @@
"""
Generate the slide data. Needs to be implemented by the plugin.
"""
- log.debug(u'generate_slide_data: %s, %s, %s' % (service_item, item, self.remoteSong))
- item_id = self._get_id_of_item_to_generate(item, self.remoteSong)
+ log.debug(u'generate_slide_data: %s, %s, %s' % (service_item, item, self.remote_song))
+ item_id = self._get_id_of_item_to_generate(item, self.remote_song)
service_item.add_capability(ItemCapabilities.CanEdit)
service_item.add_capability(ItemCapabilities.CanPreview)
service_item.add_capability(ItemCapabilities.CanLoop)
@@ -430,8 +424,8 @@
verse_tags_translated = True
if not song.verse_order.strip():
for verse in verse_list:
- # We cannot use from_loose_input() here, because database
- # is supposed to contain English lowercase singlechar tags.
+ # We cannot use from_loose_input() here, because database is supposed to contain English lowercase
+ # singlechar tags.
verse_tag = verse[0][u'type']
verse_index = None
if len(verse_tag) > 1:
@@ -470,9 +464,7 @@
if Settings().value(u'general/ccli number'):
service_item.raw_footer.append(translate('SongsPlugin.MediaItem', 'CCLI License: ') +
Settings().value(u'general/ccli number'))
- service_item.audit = [
- song.title, author_list, song.copyright, unicode(song.ccli_number)
- ]
+ service_item.audit = [song.title, author_list, song.copyright, unicode(song.ccli_number)]
service_item.data_string = {u'title': song.search_title, u'authors': u', '.join(author_list)}
service_item.xml_version = self.openLyrics.song_to_xml(song)
# Add the audio file to the service item.
@@ -489,9 +481,8 @@
if self.plugin.status != PluginStatus.Active or not item.data_string:
return
if item.data_string[u'title'].find(u'@') == -1:
- # This file seems to be an old one (prior to 1.9.5), which means,
- # that the search title (data_string[u'title']) is probably wrong.
- # We add "@" to search title and hope that we do not add any
+ # FIXME: This file seems to be an old one (prior to 1.9.5), which means, that the search title
+ # (data_string[u'title']) is probably wrong. We add "@" to search title and hope that we do not add any
# duplicate. This should work for songs without alternate title.
search_results = self.plugin.manager.get_all_objects(Song,
Song.search_title == (re.compile(r'\W+', re.UNICODE).sub(u' ',
@@ -518,12 +509,12 @@
break
# If there's any backing tracks, copy them over.
if item.background_audio:
- self._updateBackgroundAudio(song, item)
+ self._update_background_audio(song, item)
if add_song and self.addSongFromService:
song = self.openLyrics.xml_to_song(item.xml_version)
# If there's any backing tracks, copy them over.
if item.background_audio:
- self._updateBackgroundAudio(song, item)
+ self._update_background_audio(song, item)
editId = song.id
self.on_search_text_button_clicked()
elif add_song and not self.addSongFromService:
@@ -531,7 +522,7 @@
song = self.openLyrics.xml_to_song(item.xml_version, True)
# If there's any backing tracks, copy them over.
if item.background_audio:
- self._updateBackgroundAudio(song, item)
+ self._update_background_audio(song, item)
editId = song.id
temporary = True
# Update service with correct song id.
@@ -542,5 +533,5 @@
"""
Search for some songs
"""
- search_results = self.searchEntire(string)
+ search_results = self.search_entire(string)
return [[song.id, song.title] for song in search_results]
Follow ups