From 46f9153ea8e49612892d1f4db19c442670b759c7 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Sun, 29 May 2011 09:12:11 -0400 Subject: [PATCH 1/6] Remove some whitespace in editsongform.py --- openlp/plugins/songs/forms/editsongform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index f30c618b4..d30a1be10 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -757,7 +757,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.manager.save_object(self.song) if self.parent.new: self.parent.auto_select_id = self.song.id - + def _processLyrics(self): """ Process the lyric data entered by the user into the OpenLP XML format. From fe35a5775c3036d6bf41a474e1f2eae248fa428d Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Sun, 29 May 2011 19:52:36 -0400 Subject: [PATCH 2/6] bug-789102 - Removed code that auto-selects new items. --- openlp/plugins/custom/forms/editcustomform.py | 2 -- openlp/plugins/custom/lib/mediaitem.py | 3 --- openlp/plugins/songs/forms/editsongform.py | 2 -- openlp/plugins/songs/lib/mediaitem.py | 3 --- 4 files changed, 10 deletions(-) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index b74954fe6..eb4a13fda 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -137,8 +137,6 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.customSlide.credits = unicode(self.creditEdit.text()) self.customSlide.theme_name = unicode(self.themeComboBox.currentText()) success = self.manager.save_object(self.customSlide) - if self.parent.new: - self.parent.auto_select_id = self.customSlide.id return success def onUpButtonClicked(self): diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 718c78d75..d0a3de061 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -66,7 +66,6 @@ class CustomMediaItem(MediaManagerItem): # which Custom is required. self.remoteCustom = -1 self.manager = parent.manager - self.new = False def addEndHeaderBar(self): self.addToolbarSeparator() @@ -157,11 +156,9 @@ class CustomMediaItem(MediaManagerItem): self.auto_select_id = -1 def onNewClick(self): - self.new = True self.edit_custom_form.loadCustom(0) self.edit_custom_form.exec_() self.initialise() - self.new = False def onRemoteEditClear(self): self.remoteTriggered = None diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index d30a1be10..e6643568c 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -755,8 +755,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 self.parent.new: - 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 5454d5401..3d9a9ef76 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -74,7 +74,6 @@ class SongMediaItem(MediaManagerItem): self.editItem = None self.quickPreviewAllowed = True self.hasSearch = True - self.new = False def addEndHeaderBar(self): self.addToolbarSeparator() @@ -297,10 +296,8 @@ class SongMediaItem(MediaManagerItem): def onNewClick(self): log.debug(u'onNewClick') - self.new = True self.edit_song_form.newSong() self.edit_song_form.exec_() - self.new = False def onSongMaintenanceClick(self): self.song_maintenance_form.exec_() From 729fe2cfa3371c59e4a3584ee5391079b217c1a9 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Mon, 30 May 2011 23:52:17 -0400 Subject: [PATCH 3/6] bug-789102, moved mediaitem list updates out of editforms into mediaitems --- openlp/core/lib/mediamanageritem.py | 3 ++- openlp/plugins/custom/forms/editcustomform.py | 1 - openlp/plugins/custom/lib/mediaitem.py | 6 +++++- openlp/plugins/songs/forms/editsongform.py | 1 - openlp/plugins/songs/lib/mediaitem.py | 10 ++++++++++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 602b3c55b..223dd9385 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -453,7 +453,8 @@ class MediaManagerItem(QtGui.QWidget): """ if QtCore.QSettings().value(u'advanced/single click preview', QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed \ - and self.listView.selectedIndexes(): + and self.listView.selectedIndexes() \ + and self.auto_select_id == -1: self.onPreviewClick(True) def onPreviewClick(self, keepFocus=False): diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 5c9c035b7..4a7585f11 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -115,7 +115,6 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): def accept(self): log.debug(u'accept') if self.saveCustom(): - Receiver.send_message(u'custom_load_list') QtGui.QDialog.accept(self) def saveCustom(self): diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 0398d8fa2..9113352e7 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -131,7 +131,7 @@ class CustomMediaItem(MediaManagerItem): QtCore.QVariant(CustomSearch.Titles)).toInt()[0]) # Called to redisplay the custom list screen edith from a search # or from the exit of the Custom edit dialog. If remote editing is - # active trigger it and clean up so it will not update again. + # active trigger it and clean up so it will not update again. if self.remoteTriggered == u'L': self.onAddClick() if self.remoteTriggered == u'P': @@ -160,6 +160,7 @@ class CustomMediaItem(MediaManagerItem): self.edit_custom_form.loadCustom(0) self.edit_custom_form.exec_() self.initialise() + self.onSelectionChange() def onRemoteEditClear(self): self.remoteTriggered = None @@ -179,6 +180,8 @@ class CustomMediaItem(MediaManagerItem): self.remoteTriggered = remote_type self.edit_custom_form.loadCustom(custom_id, (remote_type == u'P')) self.edit_custom_form.exec_() + self.auto_select_id = -1 + self.initialise() def onEditClick(self): """ @@ -189,6 +192,7 @@ class CustomMediaItem(MediaManagerItem): item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] self.edit_custom_form.loadCustom(item_id, False) self.edit_custom_form.exec_() + self.auto_select_id = -1 self.initialise() def onDeleteClick(self): diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index c8c351509..a07ceb6c9 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_load_list') self.song = None QtGui.QDialog.accept(self) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 02108a846..ca93ed896 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -214,6 +214,7 @@ class SongMediaItem(MediaManagerItem): Handle the exit from the edit dialog and trigger remote updates of songs """ + print "reload list" log.debug(u'onSongListLoad - 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 @@ -248,6 +249,7 @@ class SongMediaItem(MediaManagerItem): self.listView.addItem(song_name) # Auto-select the item if name has been set if song.id == self.auto_select_id: + print "have match" , song.id self.listView.setCurrentItem(song_name) self.auto_select_id = -1 @@ -297,8 +299,12 @@ class SongMediaItem(MediaManagerItem): def onNewClick(self): log.debug(u'onNewClick') + print "New" self.edit_song_form.newSong() self.edit_song_form.exec_() + print "back from edit" + self.onSongListLoad() + self.onSelectionChange() def onSongMaintenanceClick(self): self.song_maintenance_form.exec_() @@ -323,6 +329,8 @@ class SongMediaItem(MediaManagerItem): self.remoteTriggered = remote_type self.edit_song_form.loadSong(song_id, (remote_type == u'P')) self.edit_song_form.exec_() + self.auto_select_id = -1 + self.onSongListLoad() def onEditClick(self): """ @@ -334,6 +342,8 @@ class SongMediaItem(MediaManagerItem): item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0] self.edit_song_form.loadSong(item_id, False) self.edit_song_form.exec_() + self.auto_select_id = -1 + self.onSongListLoad() self.editItem = None def onDeleteClick(self): From 227cd75b5cbc8b8787b459f99cf9a8a0d17b6b8c Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Tue, 31 May 2011 10:02:44 -0400 Subject: [PATCH 4/6] Cleanup whitespace, remove debug prints --- openlp/plugins/custom/lib/mediaitem.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 9113352e7..387221610 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -131,7 +131,7 @@ class CustomMediaItem(MediaManagerItem): QtCore.QVariant(CustomSearch.Titles)).toInt()[0]) # Called to redisplay the custom list screen edith from a search # or from the exit of the Custom edit dialog. If remote editing is - # active trigger it and clean up so it will not update again. + # active trigger it and clean up so it will not update again. if self.remoteTriggered == u'L': self.onAddClick() if self.remoteTriggered == u'P': diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index c7f37946e..df8fef820 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -215,7 +215,6 @@ class SongMediaItem(MediaManagerItem): Handle the exit from the edit dialog and trigger remote updates of songs """ - print "reload list" log.debug(u'onSongListLoad - 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 @@ -250,7 +249,6 @@ class SongMediaItem(MediaManagerItem): self.listView.addItem(song_name) # Auto-select the item if name has been set if song.id == self.auto_select_id: - print "have match" , song.id self.listView.setCurrentItem(song_name) self.auto_select_id = -1 @@ -300,10 +298,8 @@ class SongMediaItem(MediaManagerItem): def onNewClick(self): log.debug(u'onNewClick') - print "New" self.edit_song_form.newSong() self.edit_song_form.exec_() - print "back from edit" self.onSongListLoad() self.onSelectionChange() From 0969f4ffc3bde56e32b23c691bc987823a40e1d7 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Wed, 1 Jun 2011 17:06:45 -0400 Subject: [PATCH 5/6] Removed repeated calls to self.initalize() --- openlp/plugins/custom/lib/mediaitem.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 387221610..94ee6d94e 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -109,7 +109,7 @@ class CustomMediaItem(MediaManagerItem): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'custom_edit_clear'), self.onRemoteEditClear) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'custom_load_list'), self.initialise) + QtCore.SIGNAL(u'custom_load_list'), self.loadList) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'custom_preview'), self.onPreviewClick) @@ -129,14 +129,6 @@ class CustomMediaItem(MediaManagerItem): self.searchTextEdit.setCurrentSearchType(QtCore.QSettings().value( u'%s/last search type' % self.settingsSection, QtCore.QVariant(CustomSearch.Titles)).toInt()[0]) - # Called to redisplay the custom list screen edith from a search - # or from the exit of the Custom edit dialog. If remote editing is - # active trigger it and clean up so it will not update again. - if self.remoteTriggered == u'L': - self.onAddClick() - if self.remoteTriggered == u'P': - self.onPreviewClick() - self.onRemoteEditClear() def loadList(self, custom_slides): # Sort out what custom we want to select after loading the list. @@ -155,11 +147,19 @@ class CustomMediaItem(MediaManagerItem): if custom_slide.id == self.auto_select_id: self.listView.setCurrentItem(custom_name) self.auto_select_id = -1 + # Called to redisplay the custom list screen edith from a search + # or from the exit of the Custom edit dialog. If remote editing is + # active trigger it and clean up so it will not update again. + if self.remoteTriggered == u'L': + self.onAddClick() + if self.remoteTriggered == u'P': + self.onPreviewClick() + self.onRemoteEditClear() def onNewClick(self): self.edit_custom_form.loadCustom(0) self.edit_custom_form.exec_() - self.initialise() + self.onClearTextButtonClick() self.onSelectionChange() def onRemoteEditClear(self): @@ -181,7 +181,7 @@ class CustomMediaItem(MediaManagerItem): self.edit_custom_form.loadCustom(custom_id, (remote_type == u'P')) self.edit_custom_form.exec_() self.auto_select_id = -1 - self.initialise() + self.onSearchTextButtonClick() def onEditClick(self): """ @@ -193,7 +193,7 @@ class CustomMediaItem(MediaManagerItem): self.edit_custom_form.loadCustom(item_id, False) self.edit_custom_form.exec_() self.auto_select_id = -1 - self.initialise() + self.onSearchTextButtonClick() def onDeleteClick(self): """ From 4b20a3571f3da001487e26dfc716a31539c92684 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Thu, 2 Jun 2011 23:39:28 -0400 Subject: [PATCH 6/6] Song add clears search --- openlp/plugins/songs/lib/mediaitem.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index df8fef820..0dc40330f 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -300,8 +300,9 @@ class SongMediaItem(MediaManagerItem): log.debug(u'onNewClick') self.edit_song_form.newSong() self.edit_song_form.exec_() - self.onSongListLoad() + self.onClearTextButtonClick() self.onSelectionChange() + self.auto_select_id = -1 def onSongMaintenanceClick(self): self.song_maintenance_form.exec_()