From 78c3c3ef393b69e1158db48b2adffd48581a9cb1 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 10 May 2011 16:08:11 +0200 Subject: [PATCH 01/16] clean up --- openlp/plugins/songs/lib/foilpresenterimport.py | 4 ++-- openlp/plugins/songs/lib/songshowplusimport.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/plugins/songs/lib/foilpresenterimport.py b/openlp/plugins/songs/lib/foilpresenterimport.py index 0c7152bfd..c5dfd5d96 100644 --- a/openlp/plugins/songs/lib/foilpresenterimport.py +++ b/openlp/plugins/songs/lib/foilpresenterimport.py @@ -431,7 +431,7 @@ class FoilPresenter(object): verse_sortnr = self._child(strophe.sortnr) sortnr = True # In older Version there is no sortnr, but we need one - if sortnr == False: + if not sortnr: verse_sortnr = unicode(temp_sortnr_backup) temp_sortnr_backup += 1 # Foilpresenter allows e. g. "Ref" or "1", but we need "C1" or "V1". @@ -467,7 +467,7 @@ class FoilPresenter(object): # test if foilpresenter have the same versenumber two times with # different parts raise the verse number for value in temp_verse_order_backup: - if value == (u''.join((verse_type, verse_number))): + if value == u''.join((verse_type, verse_number)): verse_number = unicode(int(verse_number) + 1) verse_type_index = VerseType.from_tag(verse_type[0]) verse_type = VerseType.Names[verse_type_index] diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songshowplusimport.py index 6d2e1f5b6..ac06d7840 100644 --- a/openlp/plugins/songs/lib/songshowplusimport.py +++ b/openlp/plugins/songs/lib/songshowplusimport.py @@ -150,13 +150,13 @@ class SongShowPlusImport(SongImport): self.ccli_number = int(data) elif blockKey == VERSE: self.add_verse(unicode(data, u'cp1252'), - "V%s" % verseNo) + "%s%s" % (VerseType.Tags[VerseType.Verse], verseNo)) elif blockKey == CHORUS: self.add_verse(unicode(data, u'cp1252'), - "C%s" % verseNo) + "%s%s" % (VerseType.Tags[VerseType.Chorus], verseNo)) elif blockKey == BRIDGE: self.add_verse(unicode(data, u'cp1252'), - "B%s" % verseNo) + "%s%s" % (VerseType.Tags[VerseType.Bridge], verseNo)) elif blockKey == TOPIC: self.topics.append(unicode(data, u'cp1252')) elif blockKey == COMMENTS: From 3e1bdc7475f98e72207e2056a85e7a3f95800919 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Wed, 11 May 2011 23:32:25 +0100 Subject: [PATCH 02/16] More stageview changes --- openlp/core/lib/renderer.py | 4 +-- openlp/core/lib/serviceitem.py | 2 ++ openlp/plugins/remotes/html/stage.css | 6 ++-- openlp/plugins/remotes/html/stage.js | 37 ++++++++++++++++++------ openlp/plugins/remotes/lib/httpserver.py | 9 +++--- 5 files changed, 41 insertions(+), 17 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index bba85d176..98ae877b2 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -189,10 +189,10 @@ class Renderer(object): serviceItem.theme = theme_data if self.force_page: # make big page for theme edit dialog to get line count - serviceItem.add_from_text(u'', VERSE + VERSE + VERSE, FOOTER) + serviceItem.add_from_text(u'', VERSE + VERSE + VERSE) else: self.image_manager.del_image(theme_data.theme_name) - serviceItem.add_from_text(u'', VERSE, FOOTER) + serviceItem.add_from_text(u'', VERSE) serviceItem.renderer = self serviceItem.raw_footer = FOOTER serviceItem.render(True) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index c1ae95b8b..95702f229 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -219,6 +219,8 @@ class ServiceItem(object): ``raw_slide`` The raw text of the slide. """ + if verse_tag: + verse_tag = verse_tag.upper() self.service_item_type = ServiceItemType.Text title = title.split(u'\n')[0] self._raw_frames.append( diff --git a/openlp/plugins/remotes/html/stage.css b/openlp/plugins/remotes/html/stage.css index a773c2393..73551b92e 100644 --- a/openlp/plugins/remotes/html/stage.css +++ b/openlp/plugins/remotes/html/stage.css @@ -30,12 +30,14 @@ body { #currentslide { font-size: 40pt; color: white; + padding-bottom: 0px; } #nextslide { - font-size: 30pt; + font-size: 40pt; color: grey; - padding-top: 25px; + padding-top: 0px; + padding-bottom: 0px; } #right { diff --git a/openlp/plugins/remotes/html/stage.js b/openlp/plugins/remotes/html/stage.js index 96e4c5a14..0c1c0ce63 100644 --- a/openlp/plugins/remotes/html/stage.js +++ b/openlp/plugins/remotes/html/stage.js @@ -46,15 +46,21 @@ window.OpenLP = { function (data, status) { OpenLP.currentSlides = data.results.slides; OpenLP.currentSlide = 0; + OpenLP.currentTags = Array(); var div = $("#verseorder"); div.html(""); + var tag = ""; + var tags = 0; for (idx in data.results.slides) { idx = parseInt(idx, 10); - div.append(" "); - var tag = data.results.slides[idx]["tag"]; - if (tag == 'None') - tag = idx; - $("#verseorder span").last().attr("id", "tag" + idx).text(tag); + var prevtag = tag; + tag = data.results.slides[idx]["tag"]; + if (tag != prevtag) { + tags = tags + 1; + div.append(" "); + $("#verseorder span").last().attr("id", "tag" + tags).text(tag); + } + OpenLP.currentTags[idx] = tags; if (data.results.slides[idx]["selected"]) OpenLP.currentSlide = idx; } @@ -64,17 +70,30 @@ window.OpenLP = { }, updateSlide: function() { $("#verseorder span").removeClass("currenttag"); - $("#tag" + OpenLP.currentSlide).addClass("currenttag"); - var text = OpenLP.currentSlides[OpenLP.currentSlide]["text"]; + $("#tag" + OpenLP.currentTags[OpenLP.currentSlide]).addClass("currenttag"); + var slide = OpenLP.currentSlides[OpenLP.currentSlide]; + var text = slide["text"]; text = text.replace(/\n/g, '
'); $("#currentslide").html(text); + text = ""; if (OpenLP.currentSlide < OpenLP.currentSlides.length - 1) { - text = OpenLP.currentSlides[OpenLP.currentSlide + 1]["text"]; + for (var idx = OpenLP.currentSlide + 1; idx < OpenLP.currentSlides.length; idx++) { + var prevslide = slide; + slide = OpenLP.currentSlides[idx]; + if (slide["tag"] != prevslide["tag"]) + text = text + '

'; + text = text + slide["text"]; + if (slide["tag"] != prevslide["tag"]) + text = text + '

'; + else + text = text + '
'; + } text = text.replace(/\n/g, '
'); $("#nextslide").html(text); } else - $("#nextslide").html("Next: " + OpenLP.nextSong); + text = '

Next: ' + OpenLP.nextSong + '

'; + $("#nextslide").html(text); }, updateClock: function() { var div = $("#clock"); diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 790175965..6e5c2c0b6 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -115,7 +115,6 @@ import os import urlparse import re from pprint import pformat -from lxml import html try: import json @@ -402,9 +401,11 @@ class HttpConnection(object): for index, frame in enumerate(current_item.get_frames()): item = {} if current_item.is_text(): - item[u'tag'] = unicode(frame[u'verseTag']) - text = unicode(frame[u'html'].replace('
', '\n')) - item[u'text'] = html.fromstring(text).text_content() + if frame[u'verseTag']: + item[u'tag'] = unicode(frame[u'verseTag']) + else: + item[u'tag'] = unicode(index) + item[u'text'] = unicode(frame[u'text']) item[u'html'] = unicode(frame[u'html']) else: item[u'tag'] = unicode(index) From e940279b34c792480d15658370eb495a8ab52eb2 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Thu, 12 May 2011 00:16:53 +0100 Subject: [PATCH 03/16] More stageview changes --- openlp/core/ui/slidecontroller.py | 2 +- openlp/plugins/remotes/lib/httpserver.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index fdbf184b5..7623faa9b 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -616,7 +616,7 @@ class SlideController(QtGui.QWidget): if frame[u'verseTag']: # These tags are already translated. verse_def = frame[u'verseTag'] - verse_def = u'%s%s' % (verse_def[0].upper(), verse_def[1:]) + verse_def = u'%s%s' % (verse_def[0], verse_def[1:]) two_line_def = u'%s\n%s' % (verse_def[0], verse_def[1:]) row = two_line_def if self.isLive: diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 6e5c2c0b6..20005840c 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -404,11 +404,11 @@ class HttpConnection(object): if frame[u'verseTag']: item[u'tag'] = unicode(frame[u'verseTag']) else: - item[u'tag'] = unicode(index) + item[u'tag'] = unicode(index + 1) item[u'text'] = unicode(frame[u'text']) item[u'html'] = unicode(frame[u'html']) else: - item[u'tag'] = unicode(index) + item[u'tag'] = unicode(index + 1) item[u'text'] = u'' item[u'html'] = u'' item[u'selected'] = (self.parent.current_slide == index) From 5e954d86b69cf4c694f471fec0f105190187ce53 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 12 May 2011 01:25:11 +0200 Subject: [PATCH 04/16] Changed from a QTabWidget to QTabBar, giving us resizeable tabs. --- openlp/plugins/bibles/lib/mediaitem.py | 119 ++++++++++++++----------- 1 file changed, 66 insertions(+), 53 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 461828d9e..d729399cf 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -74,6 +74,16 @@ class BibleMediaItem(MediaManagerItem): self.addToServiceItem = False def addSearchTab(self, prefix, name): + self.searchTabBar.addTab(name) + tab = QtGui.QWidget() + tab.setObjectName(prefix + u'Tab') + tab.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) + layout = QtGui.QGridLayout(tab) + layout.setObjectName(prefix + u'Layout') + setattr(self, prefix + u'Tab', tab) + setattr(self, prefix + u'Layout', layout) + + def addSearchFields(self, prefix, name): """ Creates and adds generic search tab. @@ -83,121 +93,113 @@ class BibleMediaItem(MediaManagerItem): ``name`` The translated string to display. """ - tab = QtGui.QWidget() - tab.setObjectName(prefix + u'Tab') - layout = QtGui.QGridLayout(tab) - layout.setObjectName(prefix + u'Layout') + if prefix == u'quick': + idx = 2 + else: + idx = 5 + tab = getattr(self, prefix + u'Tab') + layout = getattr(self, prefix + u'Layout') versionLabel = QtGui.QLabel(tab) versionLabel.setObjectName(prefix + u'VersionLabel') - layout.addWidget(versionLabel, 0, 0, QtCore.Qt.AlignRight) - versionComboBox = media_item_combo_box(tab, prefix + u'VersionComboBox') + layout.addWidget(versionLabel, idx, 0, QtCore.Qt.AlignRight) + versionComboBox = media_item_combo_box(tab, + prefix + u'VersionComboBox') versionLabel.setBuddy(versionComboBox) - layout.addWidget(versionComboBox, 0, 1, 1, 2) + layout.addWidget(versionComboBox, idx, 1, 1, 2) secondLabel = QtGui.QLabel(tab) secondLabel.setObjectName(prefix + u'SecondLabel') - layout.addWidget(secondLabel, 1, 0, QtCore.Qt.AlignRight) + layout.addWidget(secondLabel, idx + 1, 0, QtCore.Qt.AlignRight) secondComboBox = media_item_combo_box(tab, prefix + u'SecondComboBox') versionLabel.setBuddy(secondComboBox) - layout.addWidget(secondComboBox, 1, 1, 1, 2) + layout.addWidget(secondComboBox, idx + 1, 1, 1, 2) + clearLabel = QtGui.QLabel(tab) + clearLabel.setObjectName(prefix + u'ClearLabel') + layout.addWidget(clearLabel, idx + 2, 0, QtCore.Qt.AlignRight) + clearComboBox = media_item_combo_box(tab, prefix + u'ClearComboBox') + clearLabel.setBuddy(clearComboBox) + layout.addWidget(clearComboBox, idx + 2, 1, 1, 2) searchButtonLayout = QtGui.QHBoxLayout() searchButtonLayout.setObjectName(prefix + u'SearchButtonLayout') searchButtonLayout.addStretch() searchButton = QtGui.QPushButton(tab) searchButton.setObjectName(prefix + u'SearchButton') searchButtonLayout.addWidget(searchButton) - self.searchTabWidget.addTab(tab, name) - setattr(self, prefix + u'Tab', tab) - setattr(self, prefix + u'Layout', layout) + layout.addLayout(searchButtonLayout, idx + 3, 1, 1, 2) + self.pageLayout.addWidget(tab) + tab.setVisible(False) setattr(self, prefix + u'VersionLabel', versionLabel) setattr(self, prefix + u'VersionComboBox', versionComboBox) setattr(self, prefix + u'SecondLabel', secondLabel) setattr(self, prefix + u'SecondComboBox', secondComboBox) + setattr(self, prefix + u'ClearLabel', clearLabel) + setattr(self, prefix + u'ClearComboBox', clearComboBox) setattr(self, prefix + u'SearchButtonLayout', searchButtonLayout) setattr(self, prefix + u'SearchButton', searchButton) def addEndHeaderBar(self): - self.searchTabWidget = QtGui.QTabWidget(self) - self.searchTabWidget.setSizePolicy( - QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) - self.searchTabWidget.setObjectName(u'searchTabWidget') + self.searchTabBar = QtGui.QTabBar(self) + self.searchTabBar.setExpanding(False) + self.searchTabBar.setObjectName(u'searchTabBar') + self.pageLayout.addWidget(self.searchTabBar) # Add the Quick Search tab. self.addSearchTab( u'quick', translate('BiblesPlugin.MediaItem', 'Quick')) self.quickSearchLabel = QtGui.QLabel(self.quickTab) self.quickSearchLabel.setObjectName(u'quickSearchLabel') self.quickLayout.addWidget( - self.quickSearchLabel, 2, 0, QtCore.Qt.AlignRight) + self.quickSearchLabel, 0, 0, QtCore.Qt.AlignRight) self.quickSearchEdit = SearchEdit(self.quickTab) self.quickSearchEdit.setObjectName(u'quickSearchEdit') self.quickSearchLabel.setBuddy(self.quickSearchEdit) - self.quickLayout.addWidget(self.quickSearchEdit, 2, 1, 1, 2) + 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, 3, 0, QtCore.Qt.AlignRight) + 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, 3, 1, 1, 2) - self.quickClearLabel = QtGui.QLabel(self.quickTab) - self.quickClearLabel.setObjectName(u'quickClearLabel') - self.quickLayout.addWidget( - self.quickClearLabel, 4, 0, QtCore.Qt.AlignRight) - self.quickClearComboBox = media_item_combo_box(self.quickTab, - u'quickClearComboBox') - self.quickLayout.addWidget(self.quickClearComboBox, 4, 1, 1, 2) - self.quickLayout.addLayout(self.quickSearchButtonLayout, 6, 1, 1, 2) - # Add a QWidget, so that the quick tab has as many rows as the advanced - # tab. - self.quickLayout.addWidget(QtGui.QWidget(), 7, 0) + self.quickLayout.addWidget(self.quickLayoutComboBox, 1, 1, 1, 2) + self.addSearchFields( + u'quick', translate('BiblesPlugin.MediaItem', 'Quick')) + self.quickTab.setVisible(True) # Add the Advanced Search tab. self.addSearchTab(u'advanced', UiStrings().Advanced) self.advancedBookLabel = QtGui.QLabel(self.advancedTab) self.advancedBookLabel.setObjectName(u'advancedBookLabel') - self.advancedLayout.addWidget(self.advancedBookLabel, 2, 0, + self.advancedLayout.addWidget(self.advancedBookLabel, 0, 0, QtCore.Qt.AlignRight) self.advancedBookComboBox = media_item_combo_box(self.advancedTab, u'advancedBookComboBox') self.advancedBookLabel.setBuddy(self.advancedBookComboBox) - self.advancedLayout.addWidget(self.advancedBookComboBox, 2, 1, 1, 2) + self.advancedLayout.addWidget(self.advancedBookComboBox, 0, 1, 1, 2) self.advancedChapterLabel = QtGui.QLabel(self.advancedTab) self.advancedChapterLabel.setObjectName(u'advancedChapterLabel') - self.advancedLayout.addWidget(self.advancedChapterLabel, 3, 1, 1, 2) + self.advancedLayout.addWidget(self.advancedChapterLabel, 1, 1, 1, 2) self.advancedVerseLabel = QtGui.QLabel(self.advancedTab) self.advancedVerseLabel.setObjectName(u'advancedVerseLabel') - self.advancedLayout.addWidget(self.advancedVerseLabel, 3, 2) + self.advancedLayout.addWidget(self.advancedVerseLabel, 1, 2) self.advancedFromLabel = QtGui.QLabel(self.advancedTab) self.advancedFromLabel.setObjectName(u'advancedFromLabel') - self.advancedLayout.addWidget(self.advancedFromLabel, 4, 0, + self.advancedLayout.addWidget(self.advancedFromLabel, 3, 0, QtCore.Qt.AlignRight) self.advancedFromChapter = QtGui.QComboBox(self.advancedTab) self.advancedFromChapter.setObjectName(u'advancedFromChapter') - self.advancedLayout.addWidget(self.advancedFromChapter, 4, 1) + self.advancedLayout.addWidget(self.advancedFromChapter, 3, 1) self.advancedFromVerse = QtGui.QComboBox(self.advancedTab) self.advancedFromVerse.setObjectName(u'advancedFromVerse') - self.advancedLayout.addWidget(self.advancedFromVerse, 4, 2) + self.advancedLayout.addWidget(self.advancedFromVerse, 3, 2) self.advancedToLabel = QtGui.QLabel(self.advancedTab) self.advancedToLabel.setObjectName(u'advancedToLabel') - self.advancedLayout.addWidget(self.advancedToLabel, 5, 0, + self.advancedLayout.addWidget(self.advancedToLabel, 4, 0, QtCore.Qt.AlignRight) self.advancedToChapter = QtGui.QComboBox(self.advancedTab) self.advancedToChapter.setObjectName(u'advancedToChapter') - self.advancedLayout.addWidget(self.advancedToChapter, 5, 1) + self.advancedLayout.addWidget(self.advancedToChapter, 4, 1) self.advancedToVerse = QtGui.QComboBox(self.advancedTab) self.advancedToVerse.setObjectName(u'advancedToVerse') - self.advancedLayout.addWidget(self.advancedToVerse, 5, 2) - self.advancedClearLabel = QtGui.QLabel(self.quickTab) - self.advancedClearLabel.setObjectName(u'advancedClearLabel') - self.advancedLayout.addWidget(self.advancedClearLabel, 6, 0, - QtCore.Qt.AlignRight) - self.advancedClearComboBox = media_item_combo_box(self.quickTab, - u'advancedClearComboBox') - self.advancedClearLabel.setBuddy(self.advancedClearComboBox) - self.advancedLayout.addWidget(self.advancedClearComboBox, 6, 1, 1, 2) - self.advancedLayout.addLayout( - self.advancedSearchButtonLayout, 7, 0, 1, 3) - # Add the search tab widget to the page layout. - self.pageLayout.addWidget(self.searchTabWidget) + self.advancedLayout.addWidget(self.advancedToVerse, 4, 2) + self.addSearchFields(u'advanced', UiStrings().Advanced) # Combo Boxes QtCore.QObject.connect(self.advancedVersionComboBox, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox) @@ -226,6 +228,9 @@ class BibleMediaItem(MediaManagerItem): # Other stuff QtCore.QObject.connect(self.quickSearchEdit, QtCore.SIGNAL(u'returnPressed()'), self.onQuickSearchButton) + QtCore.QObject.connect(self.searchTabBar, + QtCore.SIGNAL(u'currentChanged(int)'), + self.onSearchTabBarCurrentChanged) def configUpdated(self): log.debug(u'configUpdated') @@ -312,6 +317,14 @@ class BibleMediaItem(MediaManagerItem): 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 loadBibles(self): log.debug(u'Loading Bibles') self.quickVersionComboBox.clear() From e55e9f284a5bf78e68bf16d00855b89bcff932ec Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 12 May 2011 01:59:04 +0200 Subject: [PATCH 05/16] Dropped the results dropdowns in favour of a toggle button. --- openlp/plugins/bibles/lib/mediaitem.py | 46 +++++++++++++------------- resources/images/openlp-2.qrc | 2 ++ 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index d729399cf..9f3a97a0b 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -55,6 +55,8 @@ class BibleMediaItem(MediaManagerItem): def __init__(self, parent, plugin, icon): self.IconPath = u'songs/song' + self.lockIcon = QtGui.QIcon(u':/bibles/bibles_search_lock.png') + self.unlockIcon = QtGui.QIcon(u':/bibles/bibles_search_unlock.png') MediaManagerItem.__init__(self, parent, plugin, icon) # Place to store the search results for both bibles. self.settings = self.parent.settings_tab @@ -112,27 +114,27 @@ class BibleMediaItem(MediaManagerItem): secondComboBox = media_item_combo_box(tab, prefix + u'SecondComboBox') versionLabel.setBuddy(secondComboBox) layout.addWidget(secondComboBox, idx + 1, 1, 1, 2) - clearLabel = QtGui.QLabel(tab) - clearLabel.setObjectName(prefix + u'ClearLabel') - layout.addWidget(clearLabel, idx + 2, 0, QtCore.Qt.AlignRight) - clearComboBox = media_item_combo_box(tab, prefix + u'ClearComboBox') - clearLabel.setBuddy(clearComboBox) - layout.addWidget(clearComboBox, idx + 2, 1, 1, 2) searchButtonLayout = QtGui.QHBoxLayout() searchButtonLayout.setObjectName(prefix + u'SearchButtonLayout') searchButtonLayout.addStretch() + lockButton = QtGui.QToolButton(tab) + lockButton.setIcon(self.unlockIcon) + lockButton.setCheckable(True) + lockButton.setObjectName(prefix + u'LockButton') + searchButtonLayout.addWidget(lockButton) searchButton = QtGui.QPushButton(tab) searchButton.setObjectName(prefix + u'SearchButton') searchButtonLayout.addWidget(searchButton) - layout.addLayout(searchButtonLayout, idx + 3, 1, 1, 2) + layout.addLayout(searchButtonLayout, idx + 2, 1, 1, 2) self.pageLayout.addWidget(tab) tab.setVisible(False) + QtCore.QObject.connect(lockButton, QtCore.SIGNAL(u'toggled(bool)'), + self.onLockButtonToggled) setattr(self, prefix + u'VersionLabel', versionLabel) setattr(self, prefix + u'VersionComboBox', versionComboBox) setattr(self, prefix + u'SecondLabel', secondLabel) setattr(self, prefix + u'SecondComboBox', secondComboBox) - setattr(self, prefix + u'ClearLabel', clearLabel) - setattr(self, prefix + u'ClearComboBox', clearComboBox) + setattr(self, prefix + u'LockButton', lockButton) setattr(self, prefix + u'SearchButtonLayout', searchButtonLayout) setattr(self, prefix + u'SearchButton', searchButton) @@ -255,8 +257,8 @@ class BibleMediaItem(MediaManagerItem): self.quickSearchLabel.setText( translate('BiblesPlugin.MediaItem', 'Find:')) self.quickSearchButton.setText(UiStrings().Search) - self.quickClearLabel.setText( - translate('BiblesPlugin.MediaItem', 'Results:')) + 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:')) @@ -270,17 +272,9 @@ class BibleMediaItem(MediaManagerItem): translate('BiblesPlugin.MediaItem', 'From:')) self.advancedToLabel.setText( translate('BiblesPlugin.MediaItem', 'To:')) - self.advancedClearLabel.setText( - translate('BiblesPlugin.MediaItem', 'Results:')) self.advancedSearchButton.setText(UiStrings().Search) - self.quickClearComboBox.addItem( - translate('BiblesPlugin.MediaItem', 'Clear')) - self.quickClearComboBox.addItem( - translate('BiblesPlugin.MediaItem', 'Keep')) - self.advancedClearComboBox.addItem( - translate('BiblesPlugin.MediaItem', 'Clear')) - self.advancedClearComboBox.addItem( - translate('BiblesPlugin.MediaItem', 'Keep')) + 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) @@ -325,6 +319,12 @@ class BibleMediaItem(MediaManagerItem): 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() @@ -530,7 +530,7 @@ class BibleMediaItem(MediaManagerItem): if second_bible: self.second_search_results = self.parent.manager.get_verses( second_bible, versetext) - if self.advancedClearComboBox.currentIndex() == 0: + if not self.advancedLockButton.isChecked(): self.listView.clear() if self.listView.count() != 0: self.__checkSecondBible(bible, second_bible) @@ -571,7 +571,7 @@ class BibleMediaItem(MediaManagerItem): verse.verse)) self.second_search_results = \ bibles[second_bible].get_verses(text) - if self.quickClearComboBox.currentIndex() == 0: + if not self.quickLockButton.isChecked(): self.listView.clear() if self.listView.count() != 0 and self.search_results: self.__checkSecondBible(bible, second_bible) diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc index 364a75810..a32d15940 100644 --- a/resources/images/openlp-2.qrc +++ b/resources/images/openlp-2.qrc @@ -24,6 +24,8 @@ bibles_search_text.png bibles_search_reference.png + bibles_search_unlock.png + bibles_search_lock.png plugin_alerts.png From cfb7e0be1aceda9963d601034abd5b42f5b7d7ed Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 12 May 2011 01:59:37 +0200 Subject: [PATCH 06/16] Added the missing images. --- resources/images/bibles_search_lock.png | Bin 0 -> 452 bytes resources/images/bibles_search_unlock.png | Bin 0 -> 440 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 resources/images/bibles_search_lock.png create mode 100644 resources/images/bibles_search_unlock.png diff --git a/resources/images/bibles_search_lock.png b/resources/images/bibles_search_lock.png new file mode 100644 index 0000000000000000000000000000000000000000..ac2fd6f90f473f0e497f9ec65e01b26e8fcbc1e4 GIT binary patch literal 452 zcmV;#0XzPQP){*xqu6zo97u8y1ZJ6plT?@BQ4ok{ z+TdZhC=vE=s3yPtE(pTv`m^2X6qh6^;cz(S^xkLL z&o;NmD#TR4R~VS);WMLje^R3O!hz^@Kh)i9`%foV1%w+4~N55nzQfvtjFUy&15ol zJ!2#oB>{Mz*BamI^ZDd-It@MZtw0pTVxvG11UZ#T84D7^G_I5}oJWRnxZ00xZx^Co z8#WQ`#K^LN3SNTc+x1dZRgv)F~$k_|^fFLKc#)GiFZk*b-n u5N$*!(L?kT14JLuO<0LmqJ?PE_q_mVmxN%}APaE-0000#GNQ#XgniT2Vo?-i9TY0a1g_U iov;yRqKoKkeyR`IorwpbwM(D?0000 Date: Thu, 12 May 2011 13:55:53 +0200 Subject: [PATCH 07/16] Fixed a missing full stop in a tool tip. --- openlp/plugins/bibles/lib/mediaitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 9f3a97a0b..b6085ea1e 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -274,7 +274,7 @@ class BibleMediaItem(MediaManagerItem): translate('BiblesPlugin.MediaItem', 'To:')) self.advancedSearchButton.setText(UiStrings().Search) self.advancedLockButton.setToolTip(translate('BiblesPlugin.MediaItem', - 'Toggle to keep or clear the previous results')) + 'Toggle to keep or clear the previous results.')) self.quickLayoutLabel.setText(UiStrings().LayoutStyle) self.quickLayoutComboBox.setItemText(LayoutStyle.VersePerSlide, UiStrings().VersePerSlide) From d1c1f38407cf41449913e9bb36e2d7c24d08ba0c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 12 May 2011 17:36:06 +0200 Subject: [PATCH 08/16] r1534 From 4778bfd781e9765cf18555244e288f715574bf78 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 12 May 2011 17:44:20 +0200 Subject: [PATCH 09/16] disable drops for search edit --- openlp/core/lib/searchedit.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/core/lib/searchedit.py b/openlp/core/lib/searchedit.py index b524855ba..fc007227e 100644 --- a/openlp/core/lib/searchedit.py +++ b/openlp/core/lib/searchedit.py @@ -62,6 +62,7 @@ class SearchEdit(QtGui.QLineEdit): self._onSearchEditTextChanged ) self._updateStyleSheet() + self.setAcceptDrops(False) def _updateStyleSheet(self): """ From 4e870ed705987481e11bfe62c511a1744b98a8e5 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 12 May 2011 17:50:20 +0200 Subject: [PATCH 10/16] only allow drag if an item is selected --- openlp/core/lib/listwidgetwithdnd.py | 3 +++ openlp/core/ui/servicemanager.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/openlp/core/lib/listwidgetwithdnd.py b/openlp/core/lib/listwidgetwithdnd.py index c45b4cc9d..2419d1a35 100644 --- a/openlp/core/lib/listwidgetwithdnd.py +++ b/openlp/core/lib/listwidgetwithdnd.py @@ -49,6 +49,9 @@ class ListWidgetWithDnD(QtGui.QListWidget): if event.buttons() != QtCore.Qt.LeftButton: event.ignore() return + if not self.selectedItems(): + event.ignore() + return drag = QtGui.QDrag(self) mimeData = QtCore.QMimeData() drag.setMimeData(mimeData) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index b5e8bbc54..9031a0b1a 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -73,6 +73,9 @@ class ServiceManagerList(QtGui.QTreeWidget): if event.buttons() != QtCore.Qt.LeftButton: event.ignore() return + if not self.selectedItems(): + event.ignore() + return drag = QtGui.QDrag(self) mimeData = QtCore.QMimeData() drag.setMimeData(mimeData) From ef5c4bc7d413369cc771b9325a4be285f86cd89a Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Thu, 12 May 2011 22:55:45 +0100 Subject: [PATCH 11/16] Detect repeat verses --- openlp/plugins/remotes/html/stage.js | 47 +++++++++++++++++++++------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/openlp/plugins/remotes/html/stage.js b/openlp/plugins/remotes/html/stage.js index 0c1c0ce63..8ca041366 100644 --- a/openlp/plugins/remotes/html/stage.js +++ b/openlp/plugins/remotes/html/stage.js @@ -51,24 +51,50 @@ window.OpenLP = { div.html(""); var tag = ""; var tags = 0; - for (idx in data.results.slides) { - idx = parseInt(idx, 10); + var lastChange = 0; + $.each(data.results.slides, function(idx, slide) { var prevtag = tag; - tag = data.results.slides[idx]["tag"]; + tag = slide["tag"]; if (tag != prevtag) { + // If the tag has changed, add new one to the list + lastChange = idx; tags = tags + 1; div.append(" "); $("#verseorder span").last().attr("id", "tag" + tags).text(tag); } + else { + if ((slide["text"] == data.results.slides[lastChange]["text"]) && + (data.results.slides.length > idx + (idx - lastChange))) { + // If the tag hasn't changed, check to see if the same verse + // has been repeated consecutively. Note the verse may have been + // split over several slides, so search through. If so, repeat the tag. + var match = true; + for (var idx2 = 0; idx2 < idx - lastChange; idx2++) { + if(data.results.slides[lastChange + idx2]["text"] != data.results.slides[idx + idx2]["text"]) { + match = false; + break; + } + } + if (match) { + lastChange = idx; + tags = tags + 1; + div.append(" "); + $("#verseorder span").last().attr("id", "tag" + tags).text(tag); + } + } + } OpenLP.currentTags[idx] = tags; - if (data.results.slides[idx]["selected"]) + if (slide["selected"]) OpenLP.currentSlide = idx; - } + }) OpenLP.loadService(); } ); }, updateSlide: function() { + // Show the current slide on top. Any trailing slides for the same verse + // are shown too underneath in grey. + // Then leave a blank line between following verses $("#verseorder span").removeClass("currenttag"); $("#tag" + OpenLP.currentTags[OpenLP.currentSlide]).addClass("currenttag"); var slide = OpenLP.currentSlides[OpenLP.currentSlide]; @@ -78,12 +104,10 @@ window.OpenLP = { text = ""; if (OpenLP.currentSlide < OpenLP.currentSlides.length - 1) { for (var idx = OpenLP.currentSlide + 1; idx < OpenLP.currentSlides.length; idx++) { - var prevslide = slide; - slide = OpenLP.currentSlides[idx]; - if (slide["tag"] != prevslide["tag"]) + if (OpenLP.currentTags[idx] != OpenLP.currentTags[idx - 1]) text = text + '

'; - text = text + slide["text"]; - if (slide["tag"] != prevslide["tag"]) + text = text + OpenLP.currentSlides[idx]["text"]; + if (OpenLP.currentTags[idx] != OpenLP.currentTags[idx - 1]) text = text + '

'; else text = text + '
'; @@ -91,9 +115,10 @@ window.OpenLP = { text = text.replace(/\n/g, '
'); $("#nextslide").html(text); } - else + else { text = '

Next: ' + OpenLP.nextSong + '

'; $("#nextslide").html(text); + } }, updateClock: function() { var div = $("#clock"); From be413a688c507863e2d9f20eb6d068480949e81a Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Thu, 12 May 2011 21:23:01 -0400 Subject: [PATCH 12/16] modified: resources/windows/OpenLP-2.0.iss scripts/windows-builder.py --- resources/windows/OpenLP-2.0.iss | 2 +- scripts/windows-builder.py | 38 ++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/resources/windows/OpenLP-2.0.iss b/resources/windows/OpenLP-2.0.iss index 8cc8a4aa7..9f193b0e8 100644 --- a/resources/windows/OpenLP-2.0.iss +++ b/resources/windows/OpenLP-2.0.iss @@ -69,7 +69,7 @@ Source: ..\..\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion recursesubdirs [Icons] Name: {group}\{#AppName}; Filename: {app}\{#AppExeName} Name: {group}\{#AppName} (Debug); Filename: {app}\{#AppExeName}; Parameters: -l debug -Name: {group}\{#AppName} Help; Filename: {app}\{#AppName}.chm +Name: {group}\{#AppName} Help; Filename: {app}\{#AppName}.chm; Check: FileExists(ExpandConstant('{app}\{#AppName}.chm')) Name: {group}\{cm:ProgramOnTheWeb,{#AppName}}; Filename: {#AppURL} Name: {group}\{cm:UninstallProgram,{#AppName}}; Filename: {uninstallexe} Name: {commondesktop}\{#AppName}; Filename: {app}\{#AppExeName}; Tasks: desktopicon diff --git a/scripts/windows-builder.py b/scripts/windows-builder.py index 0271f80b8..27798a850 100644 --- a/scripts/windows-builder.py +++ b/scripts/windows-builder.py @@ -53,7 +53,8 @@ UPX add that directory to your PATH environment variable. Sphinx - This is used to build the documentation + This is used to build the documentation. The documentation trunk must be at + the same directory level as Openlp trunk and named "documentation" HTML Help Workshop This is used to create the help file @@ -99,6 +100,7 @@ windows-builder.py import os import sys from shutil import copy +from shutil import rmtree from subprocess import Popen, PIPE python_exe = sys.executable @@ -108,12 +110,14 @@ sphinx_exe = os.path.join(os.path.split(python_exe)[0], u'Scripts', u'sphinx-build.exe') hhc_exe = os.path.join(os.getenv(u'PROGRAMFILES'), 'HTML Help Workshop', u'hhc.exe') -vcbuild_exe = os.path.join(os.getenv(u'PROGRAMFILES'), +vcbuild_exe = os.path.join(os.getenv(u'PROGRAMFILES'), u'Microsoft Visual Studio 9.0', u'VC', u'vcpackages', u'vcbuild.exe') # Base paths script_path = os.path.split(os.path.abspath(__file__))[0] branch_path = os.path.abspath(os.path.join(script_path, u'..')) +doc_branch_path = os.path.abspath(os.path.join(script_path, u'..', + u'..',u'documentation')) site_packages = os.path.join(os.path.split(python_exe)[0], u'Lib', u'site-packages') @@ -125,7 +129,9 @@ i18n_utils = os.path.join(script_path, u'translation_utils.py') # Paths source_path = os.path.join(branch_path, u'openlp') -manual_path = os.path.join(branch_path, u'documentation', u'manual') +manual_path = os.path.join(doc_branch_path, u'manual') +manual_build_path = os.path.join(manual_path, u'build') +helpfile_path = os.path.join(manual_build_path, u'htmlhelp') i18n_path = os.path.join(branch_path, u'resources', u'i18n') winres_path = os.path.join(branch_path, u'resources', u'windows') build_path = os.path.join(branch_path, u'build', u'pyi.win32', u'OpenLP') @@ -219,6 +225,12 @@ def copy_windows_files(): os.path.join(dist_path, u'OpenLP.ico')) copy(os.path.join(winres_path, u'LICENSE.txt'), os.path.join(dist_path, u'LICENSE.txt')) + if os.path.isfile(os.path.join(helpfile_path, u'Openlp.chm')): + print u' Windows help file found' + copy(os.path.join(helpfile_path,u'Openlp.chm'), + os.path.join(dist_path, u'Openlp.chm')) + else: + print u' WARNING ---- Windows help file not found ---- WARNING' def update_translations(): print u'Updating translations...' @@ -253,6 +265,9 @@ def compile_translations(): os.path.join(dist_path, u'i18n', filename)) def run_sphinx(): + print u'Deleting previous manual build...',manual_build_path + if os.path.exists(manual_build_path): + rmtree(manual_build_path) print u'Running Sphinx...' os.chdir(manual_path) sphinx = Popen((sphinx_exe, u'-b', u'htmlhelp', u'-d', u'build/doctrees', @@ -265,7 +280,7 @@ def run_sphinx(): def run_htmlhelp(): print u'Running HTML Help Workshop...' - os.chdir(os.path.join(manual_path, u'build', u'htmlhelp')) + os.chdir(os.path.join(manual_build_path, u'htmlhelp')) hhc = Popen((hhc_exe, u'OpenLP.chm'), stdout=PIPE) output, error = hhc.communicate() code = hhc.wait() @@ -273,9 +288,6 @@ def run_htmlhelp(): print u'Exit code:', code print output raise Exception(u'Error running HTML Help Workshop') - else: - copy(os.path.join(manual_path, u'build', 'htmlhelp', u'OpenLP.chm'), - os.path.join(dist_path, u'OpenLP.chm')) def run_innosetup(): print u'Running Inno Setup...' @@ -306,6 +318,8 @@ def main(): print "Source path:", source_path print "\"dist\" path:", dist_path print "PyInstaller:", pyi_build + print "Documentation branch path:", doc_branch_path + print "Help file build path;", helpfile_path print "Inno Setup path:", innosetup_exe print "Windows resources:", winres_path print "VCBuild path:", vcbuild_exe @@ -324,11 +338,17 @@ def main(): write_version_file() copy_enchant() copy_plugins() + if os.path.exists(manual_path): + run_sphinx() + run_htmlhelp() + else: + print u' ' + print u' WARNING ---- Documentation Trunk not found ---- WARNING' + print u' --- Windows Help file will not be included in build ---' + print u' ' copy_windows_files() update_translations() compile_translations() - run_sphinx() - run_htmlhelp() run_innosetup() print "Done." From a4fa470817ab76421433f6e7249aad5f9aad9d8d Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Fri, 13 May 2011 07:45:41 -0400 Subject: [PATCH 13/16] modified: scripts/windows-builder.py --- scripts/windows-builder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/windows-builder.py b/scripts/windows-builder.py index 27798a850..8f2dc0171 100644 --- a/scripts/windows-builder.py +++ b/scripts/windows-builder.py @@ -117,7 +117,7 @@ vcbuild_exe = os.path.join(os.getenv(u'PROGRAMFILES'), script_path = os.path.split(os.path.abspath(__file__))[0] branch_path = os.path.abspath(os.path.join(script_path, u'..')) doc_branch_path = os.path.abspath(os.path.join(script_path, u'..', - u'..',u'documentation')) + u'..', u'documentation')) site_packages = os.path.join(os.path.split(python_exe)[0], u'Lib', u'site-packages') @@ -227,7 +227,7 @@ def copy_windows_files(): os.path.join(dist_path, u'LICENSE.txt')) if os.path.isfile(os.path.join(helpfile_path, u'Openlp.chm')): print u' Windows help file found' - copy(os.path.join(helpfile_path,u'Openlp.chm'), + copy(os.path.join(helpfile_path, u'Openlp.chm'), os.path.join(dist_path, u'Openlp.chm')) else: print u' WARNING ---- Windows help file not found ---- WARNING' @@ -265,7 +265,7 @@ def compile_translations(): os.path.join(dist_path, u'i18n', filename)) def run_sphinx(): - print u'Deleting previous manual build...',manual_build_path + print u'Deleting previous manual build...', manual_build_path if os.path.exists(manual_build_path): rmtree(manual_build_path) print u'Running Sphinx...' From d4f7bf1e0a5b015913b03803e7843e10cdeddda8 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 13 May 2011 14:55:04 +0200 Subject: [PATCH 14/16] --- openlp/core/lib/mediamanageritem.py | 34 ++++++++++++++++++++--------- openlp/core/lib/ui.py | 2 ++ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index e5e8ed3b1..225d4023e 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -238,13 +238,21 @@ class MediaManagerItem(QtGui.QWidget): self.plugin.getString(action[0])[u'tooltip'], action[1], action[2]) + def contextMenu(self, point): + item = self.listView.itemAt(point) + if item is None: + return + if not item.flags() & QtCore.Qt.ItemIsSelectable: + return + self.menu.exec_(self.listView.mapToGlobal(point)) + def addListViewToToolBar(self): """ Creates the main widget for listing items the media item is tracking """ # Add the List widget self.listView = ListWidgetWithDnD(self, self.plugin.name) - self.listView.uniformItemSizes = True + self.listView.setUniformItemSizes(True) self.listView.setSpacing(1) self.listView.setSelectionMode( QtGui.QAbstractItemView.ExtendedSelection) @@ -254,43 +262,46 @@ class MediaManagerItem(QtGui.QWidget): # Add to pageLayout self.pageLayout.addWidget(self.listView) # define and add the context menu - self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) + self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) + self.menu = QtGui.QMenu() + # Create the actions. All actions are automatically added to the + # listView. if self.hasEditIcon: - self.listView.addAction( + self.menu.addAction( context_menu_action( self.listView, u':/general/general_edit.png', self.plugin.getString(StringContent.Edit)[u'title'], self.onEditClick, context=QtCore.Qt.WidgetShortcut)) - self.listView.addAction(context_menu_separator(self.listView)) + self.menu.addAction(context_menu_separator(self.listView)) if self.hasDeleteIcon: - self.listView.addAction( + self.menu.addAction( context_menu_action( self.listView, u':/general/general_delete.png', self.plugin.getString(StringContent.Delete)[u'title'], self.onDeleteClick, [QtCore.Qt.Key_Delete], context=QtCore.Qt.WidgetShortcut)) - self.listView.addAction(context_menu_separator(self.listView)) - self.listView.addAction( + self.menu.addAction(context_menu_separator(self.listView)) + self.menu.addAction( context_menu_action( self.listView, u':/general/general_preview.png', self.plugin.getString(StringContent.Preview)[u'title'], self.onPreviewClick, [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return], context=QtCore.Qt.WidgetShortcut)) - self.listView.addAction( + self.menu.addAction( context_menu_action( self.listView, u':/general/general_live.png', self.plugin.getString(StringContent.Live)[u'title'], self.onLiveClick, [QtCore.Qt.ShiftModifier + \ QtCore.Qt.Key_Enter, QtCore.Qt.ShiftModifier + \ QtCore.Qt.Key_Return], context=QtCore.Qt.WidgetShortcut)) - self.listView.addAction( + self.menu.addAction( context_menu_action( self.listView, u':/general/general_add.png', self.plugin.getString(StringContent.Service)[u'title'], self.onAddClick, [QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal], context=QtCore.Qt.WidgetShortcut)) if self.addToServiceItem: - self.listView.addAction( + self.menu.addAction( context_menu_action( self.listView, u':/general/general_add.png', translate('OpenLP.MediaManagerItem', @@ -302,6 +313,9 @@ class MediaManagerItem(QtGui.QWidget): QtCore.QObject.connect(self.listView, QtCore.SIGNAL(u'itemSelectionChanged()'), self.onSelectionChange) + QtCore.QObject.connect(self.listView, + QtCore.SIGNAL('customContextMenuRequested(QPoint)'), + self.contextMenu) def initialise(self): """ diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index e8be32a92..3fdf9642d 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -364,6 +364,7 @@ def context_menu_action(base, icon, text, slot, shortcuts=None, category=None, action.setShortcutContext(context) action_list = ActionList.get_instance() action_list.add_action(action) + base.addAction(action) return action def context_menu(base, icon, text): @@ -392,6 +393,7 @@ def context_menu_separator(base): """ action = QtGui.QAction(u'', base) action.setSeparator(True) + base.addAction(action) return action def add_widget_completer(cache, widget): From 07b704677abd00283f7c3941e57a2edede9eccd4 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 13 May 2011 15:58:17 +0200 Subject: [PATCH 15/16] --- openlp/core/lib/ui.py | 6 +-- openlp/core/ui/servicemanager.py | 76 ++++++++++++++------------------ 2 files changed, 35 insertions(+), 47 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 3fdf9642d..7350d8b74 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -331,7 +331,7 @@ def shortcut_action(parent, name, shortcuts, function, icon=None, checked=None, def context_menu_action(base, icon, text, slot, shortcuts=None, category=None, context=QtCore.Qt.WindowShortcut): """ - Utility method to help build context menus for plugins + Utility method to help build context menus. ``base`` The parent menu to add this menu item to @@ -350,7 +350,7 @@ def context_menu_action(base, icon, text, slot, shortcuts=None, category=None, ``category`` The category the shortcut should be listed in the shortcut dialog. If - left to None, then the action will be hidden in the shortcut dialog. + left to ``None``, then the action will be hidden in the shortcut dialog. ``context`` The context the shortcut is valid. @@ -369,7 +369,7 @@ def context_menu_action(base, icon, text, slot, shortcuts=None, category=None, def context_menu(base, icon, text): """ - Utility method to help build context menus for plugins + Utility method to help build context menus. ``base`` The parent object to add this menu to diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 9031a0b1a..358877cc7 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -36,7 +36,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, find_and_set_in_combo_box + 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, \ @@ -301,31 +301,34 @@ class ServiceManager(QtGui.QWidget): self.addToAction.setIcon(build_icon(u':/general/general_edit.png')) # build the context menu self.menu = QtGui.QMenu() - self.editAction = self.menu.addAction( - translate('OpenLP.ServiceManager', '&Edit Item')) - self.editAction.setIcon(build_icon(u':/general/general_edit.png')) - self.maintainAction = self.menu.addAction( - translate('OpenLP.ServiceManager', '&Reorder Item')) - self.maintainAction.setIcon(build_icon(u':/general/general_edit.png')) - self.notesAction = self.menu.addAction( - translate('OpenLP.ServiceManager', '&Notes')) - self.notesAction.setIcon(build_icon(u':/services/service_notes.png')) - self.timeAction = self.menu.addAction( - translate('OpenLP.ServiceManager', '&Start Time')) - self.timeAction.setIcon(build_icon(u':/media/media_time.png')) - self.deleteAction = self.menu.addAction( - translate('OpenLP.ServiceManager', '&Delete From Service')) - self.deleteAction.setIcon(build_icon(u':/general/general_delete.png')) - self.sep1 = self.menu.addAction(u'') - self.sep1.setSeparator(True) - self.previewAction = self.menu.addAction( - translate('OpenLP.ServiceManager', 'Show &Preview')) - self.previewAction.setIcon(build_icon(u':/general/general_preview.png')) - self.liveAction = self.menu.addAction( - translate('OpenLP.ServiceManager', 'Show &Live')) - self.liveAction.setIcon(build_icon(u':/general/general_live.png')) - self.sep2 = self.menu.addAction(u'') - self.sep2.setSeparator(True) + self.editAction = context_menu_action( + self.menu, u':/general/general_edit.png', + translate('OpenLP.ServiceManager', '&Edit Item'), self.remoteEdit) + self.maintainAction = context_menu_action( + self.menu, u':/general/general_edit.png', + translate('OpenLP.ServiceManager', '&Reorder Item'), + self.onServiceItemEditForm) + self.notesAction = context_menu_action( + self.menu, u':/services/service_notes.png', + translate('OpenLP.ServiceManager', '&Notes'), + self.onServiceItemNoteForm) + self.timeAction = context_menu_action( + self.menu, u':/media/media_time.png', + translate('OpenLP.ServiceManager', '&Start Time'), + self.onStartTimeForm) + self.deleteAction = context_menu_action( + self.menu, u':/general/general_delete.png', + translate('OpenLP.ServiceManager', '&Delete From Service'), + self.onDeleteFromService) + context_menu_separator(self.menu) + self.previewAction = context_menu_action( + self.menu, u':/general/general_preview.png', + translate('OpenLP.ServiceManager', 'Show &Preview'), + self.makePreview) + self.liveAction = context_menu_action( + self.menu, u':/general/general_live.png', + translate('OpenLP.ServiceManager', 'Show &Live'), self.makeLive) + context_menu_separator(self.menu) self.themeMenu = QtGui.QMenu( translate('OpenLP.ServiceManager', '&Change Item Theme')) self.menu.addMenu(self.themeMenu) @@ -675,20 +678,6 @@ class ServiceManager(QtGui.QWidget): if serviceItem[u'service_item'].is_text(): self.themeMenu.menuAction().setVisible(True) action = self.menu.exec_(self.serviceManagerList.mapToGlobal(point)) - if action == self.editAction: - self.remoteEdit() - elif action == self.maintainAction: - self.onServiceItemEditForm() - elif action == self.deleteAction: - self.onDeleteFromService() - elif action == self.notesAction: - self.onServiceItemNoteForm() - elif action == self.timeAction: - self.onStartTimeForm() - elif action == self.previewAction: - self.makePreview() - elif action == self.liveAction: - self.makeLive() def onServiceItemNoteForm(self): item = self.findServiceItem()[0] @@ -840,7 +829,7 @@ class ServiceManager(QtGui.QWidget): correct state. """ pos = item.data(0, QtCore.Qt.UserRole).toInt()[0] - self.serviceItems[pos -1 ][u'expanded'] = False + self.serviceItems[pos - 1][u'expanded'] = False def onExpandAll(self): """ @@ -1288,9 +1277,8 @@ class ServiceManager(QtGui.QWidget): self.themeComboBox.addItem(u'') for theme in theme_list: self.themeComboBox.addItem(theme) - action = context_menu_action(self.serviceManagerList, None, theme, - self.onThemeChangeAction, context=QtCore.Qt.WidgetShortcut) - self.themeMenu.addAction(action) + context_menu_action(self.themeMenu, None, theme, + self.onThemeChangeAction) find_and_set_in_combo_box(self.themeComboBox, self.service_theme) self.mainwindow.renderer.set_service_theme(self.service_theme) self.regenerateServiceItems() From 31cebdf4f7dcc6105fc110918a8f03dba74ed2e6 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 13 May 2011 17:34:56 +0200 Subject: [PATCH 16/16] added missing period --- openlp/plugins/bibles/lib/mediaitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index b6085ea1e..4f349c998 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -258,7 +258,7 @@ class BibleMediaItem(MediaManagerItem): translate('BiblesPlugin.MediaItem', 'Find:')) self.quickSearchButton.setText(UiStrings().Search) self.quickLockButton.setToolTip(translate('BiblesPlugin.MediaItem', - 'Toggle to keep or clear the previous results')) + 'Toggle to keep or clear the previous results.')) self.advancedVersionLabel.setText(u'%s:' % UiStrings().Version) self.advancedSecondLabel.setText( translate('BiblesPlugin.MediaItem', 'Second:'))