From 1f4bc114a9e3d6368c92bdf1cd8c1e3894ffde61 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 13 May 2011 21:44:34 +0200 Subject: [PATCH 1/9] Fixed traceback, when 'locked' and no dual bible selected. --- openlp/plugins/bibles/lib/mediaitem.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 4f349c998..f8b23d3ec 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -587,7 +587,12 @@ class BibleMediaItem(MediaManagerItem): Check if the first item is a second bible item or not. """ bitem = self.listView.item(0) - item_second_bible = self._decodeQtObject(bitem, 'second_bible') + if not bitem.flags() & QtCore.Qt.ItemIsSelectable: + # The item is the "No Search Results" item. + self.listView.clear() + item_second_bible = None + else: + item_second_bible = self._decodeQtObject(bitem, 'second_bible') if item_second_bible and second_bible or not item_second_bible and \ not second_bible: self.displayResults(bible, second_bible) From b1979857e40878d77a25f14cf208f8550a3a77b0 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 13 May 2011 21:58:05 +0200 Subject: [PATCH 2/9] complete fix --- openlp/plugins/bibles/lib/mediaitem.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index f8b23d3ec..281f9bcc5 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -590,7 +590,8 @@ class BibleMediaItem(MediaManagerItem): if not bitem.flags() & QtCore.Qt.ItemIsSelectable: # The item is the "No Search Results" item. self.listView.clear() - item_second_bible = None + self.displayResults(bible, second_bible) + return else: item_second_bible = self._decodeQtObject(bitem, 'second_bible') if item_second_bible and second_bible or not item_second_bible and \ From b04e688647f44c4163e3bb6c93ce87d8312095ff Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 13 May 2011 22:59:14 +0200 Subject: [PATCH 3/9] fixed attribute error --- openlp/plugins/presentations/lib/impresscontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index a67d8f818..b691c47ce 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -252,7 +252,7 @@ class ImpressDocument(PresentationDocument): window.setVisible(False) self.presentation = self.document.getPresentation() self.presentation.Display = \ - self.controller.plugin.renderer.screens.current_display + 1 + self.controller.plugin.renderer.screens.current[u'number'] + 1 self.control = None self.create_thumbnails() return True From 144ff29e9080cda45407c6828a250e76f2b0dd26 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 14 May 2011 13:48:15 +0200 Subject: [PATCH 4/9] fixed bug #744463 Fixes: https://launchpad.net/bugs/744463 --- openlp/core/ui/mainwindow.py | 3 +++ openlp/core/ui/splashscreen.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 11727f4ae..09e2ec9e7 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -672,12 +672,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): 'The Main Display has been blanked out')) def onErrorMessage(self, data): + Receiver.send_message(u'close_splash') QtGui.QMessageBox.critical(self, data[u'title'], data[u'message']) def onWarningMessage(self, data): + Receiver.send_message(u'close_splash') QtGui.QMessageBox.warning(self, data[u'title'], data[u'message']) def onInformationMessage(self, data): + Receiver.send_message(u'close_splash') QtGui.QMessageBox.information(self, data[u'title'], data[u'message']) def onHelpWebSiteClicked(self): diff --git a/openlp/core/ui/splashscreen.py b/openlp/core/ui/splashscreen.py index 84aa1d7df..2bb516d00 100644 --- a/openlp/core/ui/splashscreen.py +++ b/openlp/core/ui/splashscreen.py @@ -23,6 +23,7 @@ # with this program; if not, write to the Free Software Foundation, Inc., 59 # # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### +from openlp.core.lib import Receiver from PyQt4 import QtCore, QtGui @@ -30,6 +31,8 @@ class SplashScreen(QtGui.QSplashScreen): def __init__(self): QtGui.QSplashScreen.__init__(self) self.setupUi() + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'close_splash'), self.close) def setupUi(self): self.setObjectName(u'splash_screen') From 3774bf2312a573683c38a8d7c8342582ae568315 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 14 May 2011 22:12:01 +0200 Subject: [PATCH 5/9] Added layout style to advanced tab. Made search edit focused on switch to quick tab. Reordered methods to: private, inherited, slots, additional. --- openlp/plugins/bibles/lib/mediaitem.py | 200 ++++++++++++++----------- 1 file changed, 111 insertions(+), 89 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 281f9bcc5..614beb32e 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -67,6 +67,39 @@ class BibleMediaItem(MediaManagerItem): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'bibles_load_list'), self.reloadBibles) + def __checkSecondBible(self, bible, second_bible): + """ + Check if the first item is a second bible item or not. + """ + bitem = self.listView.item(0) + if not bitem.flags() & QtCore.Qt.ItemIsSelectable: + # The item is the "No Search Results" item. + self.listView.clear() + self.displayResults(bible, second_bible) + return + else: + item_second_bible = self._decodeQtObject(bitem, 'second_bible') + if item_second_bible and second_bible or not item_second_bible and \ + not second_bible: + self.displayResults(bible, second_bible) + elif critical_error_message_box( + message=translate('BiblePlugin.MediaItem', + 'You cannot combine single and dual Bible verse search results. ' + 'Do you want to delete your search results and start a new ' + 'search?'), + parent=self, question=True) == QtGui.QMessageBox.Yes: + self.listView.clear() + self.displayResults(bible, second_bible) + + def _decodeQtObject(self, bitem, key): + reference = bitem.data(QtCore.Qt.UserRole) + if isinstance(reference, QtCore.QVariant): + reference = reference.toPyObject() + obj = reference[QtCore.QString(key)] + if isinstance(obj, QtCore.QVariant): + obj = obj.toPyObject() + return unicode(obj).strip() + def requiredIcons(self): MediaManagerItem.requiredIcons(self) self.hasImportIcon = True @@ -114,6 +147,12 @@ class BibleMediaItem(MediaManagerItem): secondComboBox = media_item_combo_box(tab, prefix + u'SecondComboBox') versionLabel.setBuddy(secondComboBox) layout.addWidget(secondComboBox, idx + 1, 1, 1, 2) + styleLabel = QtGui.QLabel(tab) + styleLabel.setObjectName(prefix + u'StyleLabel') + layout.addWidget(styleLabel, idx + 2, 0, QtCore.Qt.AlignRight) + styleComboBox = media_item_combo_box(tab, prefix + u'StyleComboBox') + styleComboBox.addItems([u'', u'', u'']) + layout.addWidget(styleComboBox, idx + 2, 1, 1, 2) searchButtonLayout = QtGui.QHBoxLayout() searchButtonLayout.setObjectName(prefix + u'SearchButtonLayout') searchButtonLayout.addStretch() @@ -125,7 +164,7 @@ class BibleMediaItem(MediaManagerItem): searchButton = QtGui.QPushButton(tab) searchButton.setObjectName(prefix + u'SearchButton') searchButtonLayout.addWidget(searchButton) - layout.addLayout(searchButtonLayout, idx + 2, 1, 1, 2) + layout.addLayout(searchButtonLayout, idx + 3, 1, 1, 2) self.pageLayout.addWidget(tab) tab.setVisible(False) QtCore.QObject.connect(lockButton, QtCore.SIGNAL(u'toggled(bool)'), @@ -134,6 +173,8 @@ class BibleMediaItem(MediaManagerItem): setattr(self, prefix + u'VersionComboBox', versionComboBox) setattr(self, prefix + u'SecondLabel', secondLabel) setattr(self, prefix + u'SecondComboBox', secondComboBox) + setattr(self, prefix + u'StyleLabel', styleLabel) + setattr(self, prefix + u'StyleComboBox', styleComboBox) setattr(self, prefix + u'LockButton', lockButton) setattr(self, prefix + u'SearchButtonLayout', searchButtonLayout) setattr(self, prefix + u'SearchButton', searchButton) @@ -154,14 +195,6 @@ class BibleMediaItem(MediaManagerItem): self.quickSearchEdit.setObjectName(u'quickSearchEdit') self.quickSearchLabel.setBuddy(self.quickSearchEdit) self.quickLayout.addWidget(self.quickSearchEdit, 0, 1, 1, 2) - self.quickLayoutLabel = QtGui.QLabel(self.quickTab) - self.quickLayoutLabel.setObjectName(u'quickClearLabel') - self.quickLayout.addWidget( - self.quickLayoutLabel, 1, 0, QtCore.Qt.AlignRight) - self.quickLayoutComboBox = media_item_combo_box(self.quickTab, - u'quickLayoutComboBox') - self.quickLayoutComboBox.addItems([u'', u'', u'']) - self.quickLayout.addWidget(self.quickLayoutComboBox, 1, 1, 1, 2) self.addSearchFields( u'quick', translate('BiblesPlugin.MediaItem', 'Quick')) self.quickTab.setVisible(True) @@ -218,8 +251,11 @@ class BibleMediaItem(MediaManagerItem): QtCore.QObject.connect(self.quickVersionComboBox, QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter) QtCore.QObject.connect( - self.quickLayoutComboBox, QtCore.SIGNAL(u'activated(int)'), - self.onLayoutStyleComboBoxChanged) + self.quickStyleComboBox, QtCore.SIGNAL(u'activated(int)'), + self.onQuickStyleComboBoxChanged) + QtCore.QObject.connect( + self.advancedStyleComboBox, QtCore.SIGNAL(u'activated(int)'), + self.onAdvancedStyleComboBoxChanged) # Buttons QtCore.QObject.connect(self.advancedSearchButton, QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton) @@ -247,21 +283,26 @@ class BibleMediaItem(MediaManagerItem): self.advancedSecondComboBox.setVisible(False) self.quickSecondLabel.setVisible(False) self.quickSecondComboBox.setVisible(False) - self.quickLayoutComboBox.setCurrentIndex(self.settings.layout_style) + self.quickStyleComboBox.setCurrentIndex(self.settings.layout_style) + self.advancedStyleComboBox.setCurrentIndex(self.settings.layout_style) def retranslateUi(self): log.debug(u'retranslateUi') + self.quickSearchLabel.setText( + translate('BiblesPlugin.MediaItem', 'Find:')) self.quickVersionLabel.setText(u'%s:' % UiStrings().Version) self.quickSecondLabel.setText( translate('BiblesPlugin.MediaItem', 'Second:')) - self.quickSearchLabel.setText( - translate('BiblesPlugin.MediaItem', 'Find:')) - self.quickSearchButton.setText(UiStrings().Search) + self.quickStyleLabel.setText(UiStrings().LayoutStyle) + self.quickStyleComboBox.setItemText(LayoutStyle.VersePerSlide, + UiStrings().VersePerSlide) + self.quickStyleComboBox.setItemText(LayoutStyle.VersePerLine, + UiStrings().VersePerLine) + self.quickStyleComboBox.setItemText(LayoutStyle.Continuous, + UiStrings().Continuous) self.quickLockButton.setToolTip(translate('BiblesPlugin.MediaItem', 'Toggle to keep or clear the previous results.')) - self.advancedVersionLabel.setText(u'%s:' % UiStrings().Version) - self.advancedSecondLabel.setText( - translate('BiblesPlugin.MediaItem', 'Second:')) + self.quickSearchButton.setText(UiStrings().Search) self.advancedBookLabel.setText( translate('BiblesPlugin.MediaItem', 'Book:')) self.advancedChapterLabel.setText( @@ -272,16 +313,19 @@ class BibleMediaItem(MediaManagerItem): translate('BiblesPlugin.MediaItem', 'From:')) self.advancedToLabel.setText( translate('BiblesPlugin.MediaItem', 'To:')) - self.advancedSearchButton.setText(UiStrings().Search) + self.advancedVersionLabel.setText(u'%s:' % UiStrings().Version) + self.advancedSecondLabel.setText( + translate('BiblesPlugin.MediaItem', 'Second:')) + self.advancedStyleLabel.setText(UiStrings().LayoutStyle) + self.advancedStyleComboBox.setItemText(LayoutStyle.VersePerSlide, + UiStrings().VersePerSlide) + self.advancedStyleComboBox.setItemText(LayoutStyle.VersePerLine, + UiStrings().VersePerLine) + self.advancedStyleComboBox.setItemText(LayoutStyle.Continuous, + UiStrings().Continuous) self.advancedLockButton.setToolTip(translate('BiblesPlugin.MediaItem', 'Toggle to keep or clear the previous results.')) - self.quickLayoutLabel.setText(UiStrings().LayoutStyle) - self.quickLayoutComboBox.setItemText(LayoutStyle.VersePerSlide, - UiStrings().VersePerSlide) - self.quickLayoutComboBox.setItemText(LayoutStyle.VersePerLine, - UiStrings().VersePerLine) - self.quickLayoutComboBox.setItemText(LayoutStyle.Continuous, - UiStrings().Continuous) + self.advancedSearchButton.setText(UiStrings().Search) def initialise(self): log.debug(u'bible manager initialise') @@ -303,28 +347,6 @@ class BibleMediaItem(MediaManagerItem): self.configUpdated() log.debug(u'bible manager initialise complete') - def onImportClick(self): - if not hasattr(self, u'import_wizard'): - self.import_wizard = BibleImportForm(self, self.parent.manager, - self.parent) - # If the import was not cancelled then reload. - if self.import_wizard.exec_(): - self.reloadBibles() - - def onSearchTabBarCurrentChanged(self, index): - if index == 0: - self.advancedTab.setVisible(False) - self.quickTab.setVisible(True) - else: - self.quickTab.setVisible(False) - self.advancedTab.setVisible(True) - - def onLockButtonToggled(self, checked): - if checked: - self.sender().setIcon(self.lockIcon) - else: - self.sender().setIcon(self.unlockIcon) - def loadBibles(self): log.debug(u'Loading Bibles') self.quickVersionComboBox.clear() @@ -422,6 +444,47 @@ class BibleMediaItem(MediaManagerItem): books.sort() add_widget_completer(books, self.quickSearchEdit) + def onImportClick(self): + if not hasattr(self, u'import_wizard'): + self.import_wizard = BibleImportForm(self, self.parent.manager, + self.parent) + # If the import was not cancelled then reload. + if self.import_wizard.exec_(): + self.reloadBibles() + + def onSearchTabBarCurrentChanged(self, index): + if index == 0: + self.advancedTab.setVisible(False) + self.quickTab.setVisible(True) + self.quickSearchEdit.setFocus() + else: + self.quickTab.setVisible(False) + self.advancedTab.setVisible(True) + + def onLockButtonToggled(self, checked): + if checked: + self.sender().setIcon(self.lockIcon) + else: + self.sender().setIcon(self.unlockIcon) + + def onQuickStyleComboBoxChanged(self): + self.settings.layout_style = self.quickStyleComboBox.currentIndex() + self.advancedStyleComboBox.setCurrentIndex(self.settings.layout_style) + self.settings.layoutStyleComboBox.setCurrentIndex( + self.settings.layout_style) + QtCore.QSettings().setValue( + self.settingsSection + u'/verse layout style', + QtCore.QVariant(self.settings.layout_style)) + + def onAdvancedStyleComboBoxChanged(self): + self.settings.layout_style = self.advancedStyleComboBox.currentIndex() + self.quickStyleComboBox.setCurrentIndex(self.settings.layout_style) + self.settings.layoutStyleComboBox.setCurrentIndex( + self.settings.layout_style) + QtCore.QSettings().setValue( + self.settingsSection + u'/verse layout style', + QtCore.QVariant(self.settings.layout_style)) + def onAdvancedVersionComboBox(self): QtCore.QSettings().setValue(self.settingsSection + u'/advanced bible', QtCore.QVariant(self.advancedVersionComboBox.currentText())) @@ -582,30 +645,6 @@ class BibleMediaItem(MediaManagerItem): Receiver.send_message(u'cursor_normal') Receiver.send_message(u'openlp_process_events') - def __checkSecondBible(self, bible, second_bible): - """ - Check if the first item is a second bible item or not. - """ - bitem = self.listView.item(0) - if not bitem.flags() & QtCore.Qt.ItemIsSelectable: - # The item is the "No Search Results" item. - self.listView.clear() - self.displayResults(bible, second_bible) - return - else: - item_second_bible = self._decodeQtObject(bitem, 'second_bible') - if item_second_bible and second_bible or not item_second_bible and \ - not second_bible: - self.displayResults(bible, second_bible) - elif critical_error_message_box( - message=translate('BiblePlugin.MediaItem', - 'You cannot combine single and dual Bible verse search results. ' - 'Do you want to delete your search results and start a new ' - 'search?'), - parent=self, question=True) == QtGui.QMessageBox.Yes: - self.listView.clear() - self.displayResults(bible, second_bible) - def displayResults(self, bible, second_bible=u''): """ Displays the search results in the media manager. All data needed for @@ -663,15 +702,6 @@ class BibleMediaItem(MediaManagerItem): self.search_results = {} self.second_search_results = {} - def _decodeQtObject(self, bitem, key): - reference = bitem.data(QtCore.Qt.UserRole) - if isinstance(reference, QtCore.QVariant): - reference = reference.toPyObject() - obj = reference[QtCore.QString(key)] - if isinstance(obj, QtCore.QVariant): - obj = obj.toPyObject() - return unicode(obj).strip() - def generateSlideData(self, service_item, item=None, xmlVersion=False): """ Generates and formats the slides for the service item as well as the @@ -866,11 +896,3 @@ class BibleMediaItem(MediaManagerItem): if self.settings.display_style == DisplayStyle.Square: return u'{su}[%s]{/su}' % verse_text return u'{su}%s{/su}' % verse_text - - def onLayoutStyleComboBoxChanged(self): - self.settings.layout_style = self.quickLayoutComboBox.currentIndex() - self.settings.layoutStyleComboBox.setCurrentIndex( - self.settings.layout_style) - QtCore.QSettings().setValue( - self.settingsSection + u'/verse layout style', - QtCore.QVariant(self.settings.layout_style)) From 6d1ec4ae108f50f83364c736153941e27e801536 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 15 May 2011 12:38:11 +0200 Subject: [PATCH 6/9] - prevent setting the loop delay spin box to 0 - Changed title for the stage view html --- openlp/core/ui/generaltab.py | 1 + openlp/core/ui/slidecontroller.py | 3 +-- openlp/plugins/remotes/html/stage.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index bd6a8e373..75cb8fa98 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -101,6 +101,7 @@ class GeneralTab(SettingsTab): self.timeoutLabel.setObjectName(u'timeoutLabel') self.timeoutSpinBox = QtGui.QSpinBox(self.settingsGroupBox) self.timeoutSpinBox.setObjectName(u'timeoutSpinBox') + self.timeoutSpinBox.setRange(1, 180) self.settingsLayout.addRow(self.timeoutLabel, self.timeoutSpinBox) self.leftLayout.addWidget(self.settingsGroupBox) self.leftLayout.addStretch() diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 048b434ba..c298f897f 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -199,8 +199,7 @@ class SlideController(QtGui.QWidget): 'Start/Stop continuous loop')) self.addAction(self.toogleLoop) self.delaySpinBox = QtGui.QSpinBox() - self.delaySpinBox.setMinimum(1) - self.delaySpinBox.setMaximum(180) + self.delaySpinBox.setRange(1, 180) self.toolbar.addToolbarWidget(u'Image SpinBox', self.delaySpinBox) self.delaySpinBox.setSuffix(UiStrings().Seconds) self.delaySpinBox.setToolTip(translate('OpenLP.SlideController', diff --git a/openlp/plugins/remotes/html/stage.html b/openlp/plugins/remotes/html/stage.html index 99090b6f9..9c74cc371 100644 --- a/openlp/plugins/remotes/html/stage.html +++ b/openlp/plugins/remotes/html/stage.html @@ -26,7 +26,7 @@ --> - OpenLP 2.0 Remote + OpenLP 2.0 Stage View From c728559862ae526c5c4ef44eb5c08629aa8cd420 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 15 May 2011 14:11:08 +0200 Subject: [PATCH 7/9] moved 'No Search Results' code --- openlp/core/lib/__init__.py | 22 ---------------------- openlp/core/lib/mediamanageritem.py | 15 ++++++++++++++- openlp/plugins/bibles/lib/mediaitem.py | 8 ++++---- openlp/plugins/songs/lib/mediaitem.py | 4 ++-- 4 files changed, 20 insertions(+), 29 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 1b001dfa7..27a34d54d 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -223,28 +223,6 @@ def resize_image(image, width, height, background=QtCore.Qt.black): painter.drawImage((width - realw) / 2, (height - realh) / 2, preview) return new_image -def check_search_result(treeWidget, search_results): - """ - Checks if the given ``search_results`` is empty and adds a - "No Search Results" item to the given ``treeWidget``. - - ``treeWidget`` - The ``QTreeWidget`` where the "No Search Results" item should be added - to, if the ``search_results`` is empty. - - ``search_results`` - This can either be a list or a dict. - """ - if search_results or treeWidget.count(): - return - message = translate('OpenLP.MediaManagerItem', 'No Search Results') - item = QtGui.QListWidgetItem(message) - item.setFlags(QtCore.Qt.NoItemFlags) - font = QtGui.QFont() - font.setItalic(True) - item.setFont(font) - treeWidget.addItem(item) - def check_item_selected(list_widget, message): """ Check if a list item is selected so an action may be performed on it diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 99a42e3cf..9c1a84c99 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -244,7 +244,6 @@ class MediaManagerItem(QtGui.QWidget): """ # Add the List widget self.listView = ListWidgetWithDnD(self, self.plugin.name) - self.listView.setUniformItemSizes(True) self.listView.setSpacing(1) self.listView.setSelectionMode( QtGui.QAbstractItemView.ExtendedSelection) @@ -552,6 +551,20 @@ class MediaManagerItem(QtGui.QWidget): """ pass + def check_search_result(self): + """ + Checks if the listView is empty and adds a "No Search Results" item. + """ + if self.listView.count(): + return + message = translate('OpenLP.MediaManagerItem', 'No Search Results') + item = QtGui.QListWidgetItem(message) + item.setFlags(QtCore.Qt.NoItemFlags) + font = QtGui.QFont() + font.setItalic(True) + item.setFont(font) + self.listView.addItem(item) + def _getIdOfItemToGenerate(self, item, remoteItem): """ Utility method to check items being submitted for slide generation. diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 281f9bcc5..56821303a 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -29,7 +29,7 @@ import logging from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \ - translate, check_search_result + translate from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.ui import UiStrings, add_widget_completer, \ media_item_combo_box, critical_error_message_box, find_and_set_in_combo_box @@ -63,7 +63,7 @@ class BibleMediaItem(MediaManagerItem): self.quickPreviewAllowed = True self.search_results = {} self.second_search_results = {} - check_search_result(self.listView, self.search_results) + self.check_search_result() QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'bibles_load_list'), self.reloadBibles) @@ -537,7 +537,7 @@ class BibleMediaItem(MediaManagerItem): elif self.search_results: self.displayResults(bible, second_bible) self.advancedSearchButton.setEnabled(True) - check_search_result(self.listView, self.search_results) + self.check_search_result() Receiver.send_message(u'cursor_normal') Receiver.send_message(u'openlp_process_events') @@ -578,7 +578,7 @@ class BibleMediaItem(MediaManagerItem): elif self.search_results: self.displayResults(bible, second_bible) self.quickSearchButton.setEnabled(True) - check_search_result(self.listView, self.search_results) + self.check_search_result() Receiver.send_message(u'cursor_normal') Receiver.send_message(u'openlp_process_events') diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 3b014d4b0..8ac69392e 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -32,7 +32,7 @@ from PyQt4 import QtCore, QtGui from sqlalchemy.sql import or_ from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \ - translate, check_item_selected, PluginStatus, check_search_result + translate, check_item_selected, PluginStatus from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.ui import UiStrings from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \ @@ -199,7 +199,7 @@ class SongMediaItem(MediaManagerItem): search_results = self.parent.manager.get_all_objects(Song, Song.theme_name == search_keywords) self.displayResultsSong(search_results) - check_search_result(self.listView, search_results) + self.check_search_result() def onSongListLoad(self): """ From 0786f2059ea783a03087e90e5e9c286569e5a9ab Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 15 May 2011 16:52:20 +0100 Subject: [PATCH 8/9] Add dialog reset on cancelled exit of Settings. Remove PreLoad() is no longer needed. Rename preLoad is displayTags to say what it means. Fixes: https://launchpad.net/bugs/778537 --- openlp/core/lib/settingstab.py | 11 ++--------- openlp/core/ui/displaytagform.py | 6 +++--- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index e1396d984..42823a701 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -50,7 +50,6 @@ class SettingsTab(QtGui.QWidget): self.setupUi() self.retranslateUi() self.initialise() - self.preLoad() self.load() def setupUi(self): @@ -86,12 +85,6 @@ class SettingsTab(QtGui.QWidget): left_width = max(left_width, self.leftColumn.minimumSizeHint().width()) self.leftColumn.setFixedWidth(left_width) - def preLoad(self): - """ - Setup the tab's interface. - """ - pass - def retranslateUi(self): """ Setup the interface translation strings. @@ -118,9 +111,9 @@ class SettingsTab(QtGui.QWidget): def cancel(self): """ - Reset any settings + Reset any settings if cance pressed """ - pass + self.load() def postSetUp(self, postUpdate=False): """ diff --git a/openlp/core/ui/displaytagform.py b/openlp/core/ui/displaytagform.py index b8169b9be..c439fc116 100644 --- a/openlp/core/ui/displaytagform.py +++ b/openlp/core/ui/displaytagform.py @@ -47,7 +47,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): """ QtGui.QDialog.__init__(self, parent) self.setupUi(self) - self.preLoad() + self._loadDisplayTags() QtCore.QObject.connect(self.tagTableWidget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onRowSelected) QtCore.QObject.connect(self.defaultPushButton, @@ -66,12 +66,12 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): Load Display and set field state. """ # Create initial copy from master - self.preLoad() + self._loadDisplayTags() self._resetTable() self.selected = -1 return QtGui.QDialog.exec_(self) - def preLoad(self): + def _loadDisplayTags(self): """ Load the Tags from store so can be used in the system or used to update the display. If Cancel was selected this is needed to reset the From 9fc67eba68be99ee447e876961819713dee58ff8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 15 May 2011 17:36:34 +0100 Subject: [PATCH 9/9] Spelling --- openlp/core/lib/settingstab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index 42823a701..53fd37ed9 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -111,7 +111,7 @@ class SettingsTab(QtGui.QWidget): def cancel(self): """ - Reset any settings if cance pressed + Reset any settings if cancel pressed """ self.load()