From 4f857f89216733c15bb74a0a127f145fe04975e7 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Wed, 25 May 2011 23:34:42 -0400 Subject: [PATCH 01/13] modified: openlp/plugins/custom/forms/editcustomform.py openlp/plugins/custom/lib/mediaitem.py openlp/plugins/songs/forms/editsongform.py openlp/plugins/songs/lib/mediaitem.py --- openlp/plugins/custom/forms/editcustomform.py | 2 +- openlp/plugins/custom/lib/mediaitem.py | 2 +- openlp/plugins/songs/forms/editsongform.py | 6 ++---- openlp/plugins/songs/lib/mediaitem.py | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 64147e874..e8b43d3ab 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -116,7 +116,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): log.debug(u'accept') if self.saveCustom(): Receiver.send_message(u'custom_set_autoselect_item', - self.customSlide.title) + self.customSlide.id) Receiver.send_message(u'custom_load_list') QtGui.QDialog.accept(self) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 64ddf2374..e3741ae84 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -147,7 +147,7 @@ class CustomMediaItem(MediaManagerItem): QtCore.Qt.UserRole, QtCore.QVariant(custom_slide.id)) self.listView.addItem(custom_name) # Auto-select the item if name has been set - if custom_slide.title == self.autoSelectItem: + if custom_slide.id == self.autoSelectItem: self.listView.setCurrentItem(custom_name) def onNewClick(self): diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 8411aa488..f66bc15ad 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -696,9 +696,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.clearCaches() if self._validate_song(): self.saveSong() - Receiver.send_message(u'songs_set_autoselect_item', - unicode(self.titleEdit.text())) + Receiver.send_message(u'songs_set_autoselect_item',self.song.id) Receiver.send_message(u'songs_load_list') + self.song = None QtGui.QDialog.accept(self) def saveSong(self, preview=False): @@ -756,8 +756,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.song.topics.append(self.manager.get_object(Topic, topicId)) clean_song(self.manager, self.song) self.manager.save_object(self.song) - if not preview: - self.song = None def _processLyrics(self): """ diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 7ea1658fc..4b88d81c3 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -242,7 +242,7 @@ class SongMediaItem(MediaManagerItem): song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id)) self.listView.addItem(song_name) # Auto-select the item if name has been set - if song.title == self.autoSelectItem : + if song.id == self.autoSelectItem : self.listView.setCurrentItem(song_name) def displayResultsAuthor(self, searchresults): From 98614f629c1c4c96eed68271d76a30161502eaf4 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 26 May 2011 10:15:56 +0200 Subject: [PATCH 03/13] make themes in menu checkable --- openlp/core/ui/servicemanager.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 6834c8df8..82a49cc54 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -37,7 +37,8 @@ from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, \ ItemCapabilities, SettingsManager, translate from openlp.core.lib.theme import ThemeLevel from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ - context_menu_action, context_menu_separator, find_and_set_in_combo_box + context_menu_action, context_menu_separator, find_and_set_in_combo_box, \ + checkable_action from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm from openlp.core.ui.printserviceform import PrintServiceForm from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \ @@ -676,8 +677,19 @@ class ServiceManager(QtGui.QWidget): .is_capable(ItemCapabilities.AllowsVariableStartTime): self.timeAction.setVisible(True) self.themeMenu.menuAction().setVisible(False) - if serviceItem[u'service_item'].is_text(): + if serviceItem[u'service_item'].is_text() and \ + len(self.themeMenu.actions()) > 1: self.themeMenu.menuAction().setVisible(True) + if serviceItem[u'service_item'].theme is None: + themeAction = self.themeMenu.findChild(QtGui.QAction, u'Sunrise') + else: + themeAction = self.themeMenu.findChild(QtGui.QAction, u'Sunrise') + if themeAction is not None: + themeAction.setChecked(True) + print self.mainwindow.renderer.global_theme + for themeAction in self.themeMenu.actions(): + themeAction.setChecked( + themeAction.text() == serviceItem[u'service_item'].theme) action = self.menu.exec_(self.serviceManagerList.mapToGlobal(point)) def onServiceItemNoteForm(self): @@ -1276,10 +1288,16 @@ class ServiceManager(QtGui.QWidget): self.themeComboBox.clear() self.themeMenu.clear() self.themeComboBox.addItem(u'') + themeGroup = QtGui.QActionGroup(self.themeMenu) + themeGroup.setExclusive(True) + themeGroup.setObjectName(u'themeGroup') for theme in theme_list: self.themeComboBox.addItem(theme) - context_menu_action(self.themeMenu, None, theme, + themeAction = context_menu_action(self.themeMenu, None, theme, self.onThemeChangeAction) + themeAction.setObjectName(theme) + themeAction.setCheckable(True) + themeGroup.addAction(themeAction) find_and_set_in_combo_box(self.themeComboBox, self.service_theme) self.mainwindow.renderer.set_service_theme(self.service_theme) self.regenerateServiceItems() From 40222b23c8f4991e95918f62ed11eaf7a1646fa5 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Thu, 26 May 2011 17:35:44 +0100 Subject: [PATCH 04/13] Remove index from search_lyrics for mysql - myisam --- openlp/plugins/songs/lib/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/db.py b/openlp/plugins/songs/lib/db.py index 404ad2c42..2c01f76fa 100644 --- a/openlp/plugins/songs/lib/db.py +++ b/openlp/plugins/songs/lib/db.py @@ -197,7 +197,7 @@ def init_schema(url): Column(u'song_number', types.Unicode(64)), Column(u'theme_name', types.Unicode(128)), Column(u'search_title', types.Unicode(255), index=True, nullable=False), - Column(u'search_lyrics', types.UnicodeText, index=True, nullable=False) + Column(u'search_lyrics', types.UnicodeText, nullable=False) ) # Definition of the "topics" table From 6aca4600b7b345f82de99bd210b14edbafa0c287 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 26 May 2011 20:52:05 +0200 Subject: [PATCH 06/13] fixed bug 788770 Fixes: https://launchpad.net/bugs/788770 --- openlp/core/lib/serviceitem.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 37723321c..cf682abc6 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -177,10 +177,11 @@ class ServiceItem(object): .format_slide(slide[u'raw_slide'], line_break, self) for page in formatted: page = page.replace(u'
', u'{br}') + html = expand_tags(cgi.escape(page.rstrip())) self._display_frames.append({ u'title': clean_tags(page), u'text': clean_tags(page.rstrip()), - u'html': expand_tags(cgi.escape(page.rstrip())), + u'html': html.replace(u' ', u' '), u'verseTag': slide[u'verseTag'] }) elif self.service_item_type == ServiceItemType.Image or \ From 39537f9ef711125d1b8ae6f5ed0d7c0d21612f0d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 26 May 2011 22:17:52 +0200 Subject: [PATCH 07/13] fixed bug 788770 Fixes: https://launchpad.net/bugs/788770 --- openlp/plugins/bibles/lib/mediaitem.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index b245f7241..41059f942 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -775,6 +775,7 @@ class BibleMediaItem(MediaManagerItem): # We have to be 'Continuous'. else: bible_text = u'%s %s %s\n' % (bible_text, verse_text, text) + bible_text = bible_text.strip(u' ') if not old_item: start_item = bitem elif self.checkTitle(bitem, old_item): From b890b52a8d5d88a35e33eb02de26e5e348888998 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 27 May 2011 08:29:14 +0200 Subject: [PATCH 08/13] finished the theme menu --- openlp/core/ui/servicemanager.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index ed0de1fa8..1cf76951c 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -677,19 +677,18 @@ class ServiceManager(QtGui.QWidget): .is_capable(ItemCapabilities.AllowsVariableStartTime): self.timeAction.setVisible(True) self.themeMenu.menuAction().setVisible(False) + # Set up the theme menu. if serviceItem[u'service_item'].is_text() and \ len(self.themeMenu.actions()) > 1: self.themeMenu.menuAction().setVisible(True) + # The service item does not have a theme, check the "Default". if serviceItem[u'service_item'].theme is None: - themeAction = self.themeMenu.findChild(QtGui.QAction, u'Sunrise') + themeAction = self.themeMenu.defaultAction() else: - themeAction = self.themeMenu.findChild(QtGui.QAction, u'Sunrise') + themeAction = self.themeMenu.findChild( + QtGui.QAction, serviceItem[u'service_item'].theme) if themeAction is not None: themeAction.setChecked(True) - print self.mainwindow.renderer.global_theme - for themeAction in self.themeMenu.actions(): - themeAction.setChecked( - themeAction.text() == serviceItem[u'service_item'].theme) action = self.menu.exec_(self.serviceManagerList.mapToGlobal(point)) def onServiceItemNoteForm(self): @@ -1295,6 +1294,14 @@ class ServiceManager(QtGui.QWidget): themeGroup = QtGui.QActionGroup(self.themeMenu) themeGroup.setExclusive(True) themeGroup.setObjectName(u'themeGroup') + # Create a "Default" theme, which allows the user to reset the item's + # theme to the service theme or global theme. + defaultTheme = context_menu_action(self.themeMenu, None, + UiStrings().Default, self.onThemeChangeAction) + defaultTheme.setCheckable(True) + self.themeMenu.setDefaultAction(defaultTheme) + themeGroup.addAction(defaultTheme) + context_menu_separator(self.themeMenu) for theme in theme_list: self.themeComboBox.addItem(theme) themeAction = context_menu_action(self.themeMenu, None, theme, @@ -1307,7 +1314,10 @@ class ServiceManager(QtGui.QWidget): self.regenerateServiceItems() def onThemeChangeAction(self): - theme = unicode(self.sender().text()) + theme = unicode(self.sender().objectName()) + # No object name means that the "Default" theme is supposed to be used. + if not theme: + theme = None item = self.findServiceItem()[0] self.serviceItems[item][u'service_item'].theme = theme self.regenerateServiceItems() From 8a38c0b76624427896cab097e254e534f78600b8 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 27 May 2011 08:45:42 +0200 Subject: [PATCH 09/13] do not hide the menu --- openlp/core/ui/servicemanager.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 1cf76951c..30bb66115 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -678,8 +678,7 @@ class ServiceManager(QtGui.QWidget): self.timeAction.setVisible(True) self.themeMenu.menuAction().setVisible(False) # Set up the theme menu. - if serviceItem[u'service_item'].is_text() and \ - len(self.themeMenu.actions()) > 1: + if serviceItem[u'service_item'].is_text(): self.themeMenu.menuAction().setVisible(True) # The service item does not have a theme, check the "Default". if serviceItem[u'service_item'].theme is None: From 18e3cb023264367520798455e53e69050bf40607 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 27 May 2011 09:02:02 +0200 Subject: [PATCH 10/13] removed not needed import --- openlp/core/ui/servicemanager.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 30bb66115..c32567075 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -37,8 +37,7 @@ from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, \ ItemCapabilities, SettingsManager, translate from openlp.core.lib.theme import ThemeLevel from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ - context_menu_action, context_menu_separator, find_and_set_in_combo_box, \ - checkable_action + context_menu_action, context_menu_separator, find_and_set_in_combo_box from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm from openlp.core.ui.printserviceform import PrintServiceForm from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \ From 59d374517e587de38169215fc6a68e2d50847a64 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 27 May 2011 11:34:14 +0200 Subject: [PATCH 11/13] - improved 'auto select' - fixed a traceback - improved parentage - clean ups --- openlp/core/lib/mediamanageritem.py | 18 +++++--- openlp/core/ui/slidecontroller.py | 3 +- openlp/plugins/custom/customplugin.py | 3 -- openlp/plugins/custom/forms/editcustomform.py | 10 ++-- openlp/plugins/custom/lib/mediaitem.py | 46 +++++++++---------- openlp/plugins/songs/forms/editsongform.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 9 ++-- 7 files changed, 46 insertions(+), 45 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 9b76447ff..33a59be08 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -112,13 +112,10 @@ class MediaManagerItem(QtGui.QWidget): self.requiredIcons() self.setupUi() self.retranslateUi() - self.autoSelectItem = None + self.auto_select_id = -1 QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_service_load' % self.parent.name.lower()), self.serviceLoad) - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'%s_set_autoselect_item' % self.parent.name.lower()), - self.setAutoSelectItem) def requiredIcons(self): """ @@ -479,9 +476,6 @@ class MediaManagerItem(QtGui.QWidget): if keepFocus: self.listView.setFocus() - def setAutoSelectItem(self, itemToSelect=None): - self.autoSelectItem = itemToSelect - def onLiveClick(self): """ Send an item live by building a service item then adding that service @@ -617,6 +611,16 @@ class MediaManagerItem(QtGui.QWidget): item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] return item_id + def save_auto_select_id(self): + """ + Sorts out, what item to select after loading a list. + """ + # The item to select has not been set. + if self.auto_select_id == -1: + item = self.listView.currentItem() + if item: + self.auto_select_id = item.data(QtCore.Qt.UserRole).toInt()[0] + def search(self, string): """ Performs a plugin specific search for items containing ``string`` diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index b1094bbe3..85598a767 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -1044,7 +1044,8 @@ class SlideController(QtGui.QWidget): """ From the preview display request the Item to be added to service """ - self.parent.serviceManagerContents.addServiceItem(self.serviceItem) + if self.serviceItem: + self.parent.serviceManagerContents.addServiceItem(self.serviceItem) def onGoLiveClick(self): """ diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index 887f813fa..e790a2449 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -27,8 +27,6 @@ import logging -from forms import EditCustomForm - from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib.db import Manager from openlp.plugins.custom.lib import CustomMediaItem, CustomTab @@ -52,7 +50,6 @@ class CustomPlugin(Plugin): CustomMediaItem, CustomTab) self.weight = -5 self.manager = Manager(u'custom', init_schema) - self.edit_custom_form = EditCustomForm(self) self.icon_path = u':/plugins/plugin_custom.png' self.icon = build_icon(self.icon_path) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 0e4376634..00165e6ff 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -43,13 +43,13 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): Class documentation goes here. """ log.info(u'Custom Editor loaded') - def __init__(self, parent): + def __init__(self, parent, manager): """ Constructor """ QtGui.QDialog.__init__(self) self.parent = parent - self.manager = self.parent.manager + self.manager = manager self.setupUi(self) # Create other objects and forms. self.editSlideForm = EditCustomSlideForm(self) @@ -115,8 +115,6 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): def accept(self): log.debug(u'accept') if self.saveCustom(): - Receiver.send_message(u'custom_set_autoselect_item', - self.customSlide.id) Receiver.send_message(u'custom_load_list') QtGui.QDialog.accept(self) @@ -138,7 +136,9 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.customSlide.text = unicode(sxml.extract_xml(), u'utf-8') self.customSlide.credits = unicode(self.creditEdit.text()) self.customSlide.theme_name = unicode(self.themeComboBox.currentText()) - return self.manager.save_object(self.customSlide) + success = self.manager.save_object(self.customSlide) + self.parent.auto_select_id = self.customSlide.id + return success def onUpButtonClicked(self): selectedRow = self.slideListView.currentRow() diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 43f4afd63..d0a3de061 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -35,6 +35,7 @@ from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \ check_item_selected, translate from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.ui import UiStrings +from openlp.plugins.custom.forms import EditCustomForm from openlp.plugins.custom.lib import CustomXMLParser from openlp.plugins.custom.lib.db import CustomSlide @@ -57,6 +58,7 @@ class CustomMediaItem(MediaManagerItem): def __init__(self, parent, plugin, icon): self.IconPath = u'custom/custom' MediaManagerItem.__init__(self, parent, self, icon) + self.edit_custom_form = EditCustomForm(self, self.parent.manager) self.singleServiceItem = False self.quickPreviewAllowed = True self.hasSearch = True @@ -136,6 +138,8 @@ class CustomMediaItem(MediaManagerItem): self.onRemoteEditClear() def loadList(self, custom_slides): + # Sort out what custom we want to select after loading the list. + self.save_auto_select_id() self.listView.clear() # Sort the customs by its title considering language specific # characters. lower() is needed for windows! @@ -146,33 +150,34 @@ class CustomMediaItem(MediaManagerItem): custom_name.setData( QtCore.Qt.UserRole, QtCore.QVariant(custom_slide.id)) self.listView.addItem(custom_name) - # Auto-select the item if name has been set - if custom_slide.id == self.autoSelectItem: + # Auto-select the custom. + if custom_slide.id == self.auto_select_id: self.listView.setCurrentItem(custom_name) + self.auto_select_id = -1 def onNewClick(self): - self.parent.edit_custom_form.loadCustom(0) - self.parent.edit_custom_form.exec_() + self.edit_custom_form.loadCustom(0) + self.edit_custom_form.exec_() self.initialise() def onRemoteEditClear(self): self.remoteTriggered = None self.remoteCustom = -1 - def onRemoteEdit(self, customid): + def onRemoteEdit(self, message): """ Called by ServiceManager or SlideController by event passing - the Song Id in the payload along with an indicator to say which + the custom Id in the payload along with an indicator to say which type of display is required. """ - fields = customid.split(u':') - valid = self.manager.get_object(CustomSlide, fields[1]) + remote_type, custom_id = message.split(u':') + custom_id = int(custom_id) + valid = self.manager.get_object(CustomSlide, custom_id) if valid: - self.remoteCustom = fields[1] - self.remoteTriggered = fields[0] - self.parent.edit_custom_form.loadCustom(fields[1], - (fields[0] == u'P')) - self.parent.edit_custom_form.exec_() + self.remoteCustom = custom_id + self.remoteTriggered = remote_type + self.edit_custom_form.loadCustom(custom_id, (remote_type == u'P')) + self.edit_custom_form.exec_() def onEditClick(self): """ @@ -181,8 +186,8 @@ class CustomMediaItem(MediaManagerItem): if check_item_selected(self.listView, UiStrings().SelectEdit): item = self.listView.currentItem() item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] - self.parent.edit_custom_form.loadCustom(item_id, False) - self.parent.edit_custom_form.exec_() + self.edit_custom_form.loadCustom(item_id, False) + self.edit_custom_form.exec_() self.initialise() def onDeleteClick(self): @@ -203,7 +208,6 @@ class CustomMediaItem(MediaManagerItem): self.searchTextEdit.setFocus() def generateSlideData(self, service_item, item=None, xmlVersion=False): - raw_slides = [] raw_footer = [] slide = None theme = None @@ -221,8 +225,7 @@ class CustomMediaItem(MediaManagerItem): service_item.theme = theme customXML = CustomXMLParser(customSlide.text) verseList = customXML.get_verses() - for verse in verseList: - raw_slides.append(verse[1]) + raw_slides = [verse[1] for verse in verseList] service_item.title = title for slide in raw_slides: service_item.add_from_text(slide[:30], slide) @@ -260,7 +263,7 @@ class CustomMediaItem(MediaManagerItem): def onSearchTextEditChanged(self, text): """ If search as type enabled invoke the search on each key press. - If the Title is being searched do not start till 2 characters + If the Title is being searched do not start until 2 characters have been entered. """ search_length = 2 @@ -283,8 +286,5 @@ class CustomMediaItem(MediaManagerItem): func.lower(CustomSlide.text).like(u'%' + string.lower() + u'%')), order_by_ref=CustomSlide.title) - results = [] - for custom in search_results: - results.append([custom.id, custom.title]) - return results + return [[custom.id, custom.title] for custom in search_results] diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 393009f82..45f1a123a 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -696,7 +696,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.clearCaches() if self._validate_song(): self.saveSong() - Receiver.send_message(u'songs_set_autoselect_item',self.song.id) Receiver.send_message(u'songs_load_list') self.song = None QtGui.QDialog.accept(self) @@ -756,6 +755,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.song.topics.append(self.manager.get_object(Topic, topicId)) clean_song(self.manager, self.song) self.manager.save_object(self.song) + self.parent.auto_select_id = self.song.id def _processLyrics(self): """ diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 7fe4d45c4..3d9a9ef76 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -232,6 +232,7 @@ class SongMediaItem(MediaManagerItem): def displayResultsSong(self, searchresults): log.debug(u'display results Song') + self.save_auto_select_id() self.listView.clear() # Sort the songs by its title considering language specific characters. # lower() is needed for windows! @@ -245,8 +246,9 @@ class SongMediaItem(MediaManagerItem): song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id)) self.listView.addItem(song_name) # Auto-select the item if name has been set - if song.id == self.autoSelectItem : + if song.id == self.auto_select_id: self.listView.setCurrentItem(song_name) + self.auto_select_id = -1 def displayResultsAuthor(self, searchresults): log.debug(u'display results Author') @@ -487,7 +489,4 @@ class SongMediaItem(MediaManagerItem): Search for some songs """ search_results = self.searchEntire(string) - results = [] - for song in search_results: - results.append([song.id, song.title]) - return results + return [[song.id, song.title] for song in search_results] From c63382e41c993a18e6d0b4a3770e38a6b25c3923 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 27 May 2011 12:17:59 +0200 Subject: [PATCH 12/13] - hide the theme menu when theme level is not 'Song' - clean ups --- openlp/core/ui/servicemanager.py | 3 ++- openlp/core/ui/thememanager.py | 2 -- openlp/core/ui/themestab.py | 9 +++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index c32567075..349b0a4a3 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -677,7 +677,8 @@ class ServiceManager(QtGui.QWidget): self.timeAction.setVisible(True) self.themeMenu.menuAction().setVisible(False) # Set up the theme menu. - if serviceItem[u'service_item'].is_text(): + if serviceItem[u'service_item'].is_text() and \ + self.mainwindow.renderer.theme_level == ThemeLevel.Song: self.themeMenu.menuAction().setVisible(True) # The service item does not have a theme, check the "Default". if serviceItem[u'service_item'].theme is None: diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 4dabcfdf7..72bdf4558 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -57,8 +57,6 @@ class ThemeManager(QtGui.QWidget): self.settingsSection = u'themes' self.themeForm = ThemeForm(self) self.fileRenameForm = FileRenameForm(self) - self.serviceComboBox = \ - self.mainwindow.serviceManagerContents.themeComboBox # start with the layout self.layout = QtGui.QVBoxLayout(self) self.layout.setSpacing(0) diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 709b3ad80..7e8188f42 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -145,10 +145,8 @@ class ThemesTab(SettingsTab): def save(self): settings = QtCore.QSettings() settings.beginGroup(self.settingsSection) - settings.setValue(u'theme level', - QtCore.QVariant(self.theme_level)) - settings.setValue(u'global theme', - QtCore.QVariant(self.global_theme)) + settings.setValue(u'theme level', QtCore.QVariant(self.theme_level)) + settings.setValue(u'global theme', QtCore.QVariant(self.global_theme)) settings.endGroup() self.mainwindow.renderer.set_global_theme( self.global_theme, self.theme_level) @@ -186,8 +184,7 @@ class ThemesTab(SettingsTab): self.settingsSection + u'/global theme', QtCore.QVariant(u'')).toString()) self.DefaultComboBox.clear() - for theme in theme_list: - self.DefaultComboBox.addItem(theme) + self.DefaultComboBox.addItems(theme_list) find_and_set_in_combo_box(self.DefaultComboBox, self.global_theme) self.mainwindow.renderer.set_global_theme( self.global_theme, self.theme_level) From f1b778fb240ab12582e435a98fbb68df32cdc028 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Fri, 27 May 2011 12:54:52 +0100 Subject: [PATCH 13/13] Change loop and timed slide settings labels --- openlp/core/ui/generaltab.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 2435b8dcc..2a9bd221e 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -223,9 +223,9 @@ class GeneralTab(SettingsTab): self.autoPreviewCheckBox.setText(translate('OpenLP.GeneralTab', 'Automatically preview next item in service')) self.enableLoopCheckBox.setText(translate('OpenLP.GeneralTab', - 'Enable slide loop')) + 'Enable slide wrap-around')) self.timeoutLabel.setText(translate('OpenLP.GeneralTab', - 'Slide loop delay:')) + 'Timed slide interval:')) self.timeoutSpinBox.setSuffix(translate('OpenLP.GeneralTab', ' sec')) self.ccliGroupBox.setTitle( translate('OpenLP.GeneralTab', 'CCLI Details'))