forked from openlp/openlp
r1549
This commit is contained in:
commit
df86a729e6
@ -223,28 +223,6 @@ def resize_image(image, width, height, background=QtCore.Qt.black):
|
|||||||
painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
|
painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
|
||||||
return new_image
|
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):
|
def check_item_selected(list_widget, message):
|
||||||
"""
|
"""
|
||||||
Check if a list item is selected so an action may be performed on it
|
Check if a list item is selected so an action may be performed on it
|
||||||
|
@ -244,7 +244,6 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
# Add the List widget
|
# Add the List widget
|
||||||
self.listView = ListWidgetWithDnD(self, self.plugin.name)
|
self.listView = ListWidgetWithDnD(self, self.plugin.name)
|
||||||
self.listView.setUniformItemSizes(True)
|
|
||||||
self.listView.setSpacing(1)
|
self.listView.setSpacing(1)
|
||||||
self.listView.setSelectionMode(
|
self.listView.setSelectionMode(
|
||||||
QtGui.QAbstractItemView.ExtendedSelection)
|
QtGui.QAbstractItemView.ExtendedSelection)
|
||||||
@ -552,6 +551,20 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
pass
|
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):
|
def _getIdOfItemToGenerate(self, item, remoteItem):
|
||||||
"""
|
"""
|
||||||
Utility method to check items being submitted for slide generation.
|
Utility method to check items being submitted for slide generation.
|
||||||
|
@ -162,6 +162,8 @@ class Renderer(object):
|
|||||||
self.theme_data = self.theme_manager.getThemeData(theme)
|
self.theme_data = self.theme_manager.getThemeData(theme)
|
||||||
self._calculate_default(self.screens.current[u'size'])
|
self._calculate_default(self.screens.current[u'size'])
|
||||||
self._build_text_rectangle(self.theme_data)
|
self._build_text_rectangle(self.theme_data)
|
||||||
|
# if No file do not update cache
|
||||||
|
if self.theme_data.background_filename:
|
||||||
self.image_manager.add_image(self.theme_data.theme_name,
|
self.image_manager.add_image(self.theme_data.theme_name,
|
||||||
self.theme_data.background_filename)
|
self.theme_data.background_filename)
|
||||||
return self._rect, self._rect_footer
|
return self._rect, self._rect_footer
|
||||||
|
@ -50,7 +50,6 @@ class SettingsTab(QtGui.QWidget):
|
|||||||
self.setupUi()
|
self.setupUi()
|
||||||
self.retranslateUi()
|
self.retranslateUi()
|
||||||
self.initialise()
|
self.initialise()
|
||||||
self.preLoad()
|
|
||||||
self.load()
|
self.load()
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
@ -86,12 +85,6 @@ class SettingsTab(QtGui.QWidget):
|
|||||||
left_width = max(left_width, self.leftColumn.minimumSizeHint().width())
|
left_width = max(left_width, self.leftColumn.minimumSizeHint().width())
|
||||||
self.leftColumn.setFixedWidth(left_width)
|
self.leftColumn.setFixedWidth(left_width)
|
||||||
|
|
||||||
def preLoad(self):
|
|
||||||
"""
|
|
||||||
Setup the tab's interface.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
"""
|
"""
|
||||||
Setup the interface translation strings.
|
Setup the interface translation strings.
|
||||||
@ -118,9 +111,9 @@ class SettingsTab(QtGui.QWidget):
|
|||||||
|
|
||||||
def cancel(self):
|
def cancel(self):
|
||||||
"""
|
"""
|
||||||
Reset any settings
|
Reset any settings if cancel pressed
|
||||||
"""
|
"""
|
||||||
pass
|
self.load()
|
||||||
|
|
||||||
def postSetUp(self, postUpdate=False):
|
def postSetUp(self, postUpdate=False):
|
||||||
"""
|
"""
|
||||||
|
@ -47,7 +47,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog):
|
|||||||
"""
|
"""
|
||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.preLoad()
|
self._loadDisplayTags()
|
||||||
QtCore.QObject.connect(self.tagTableWidget,
|
QtCore.QObject.connect(self.tagTableWidget,
|
||||||
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onRowSelected)
|
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onRowSelected)
|
||||||
QtCore.QObject.connect(self.defaultPushButton,
|
QtCore.QObject.connect(self.defaultPushButton,
|
||||||
@ -66,12 +66,12 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog):
|
|||||||
Load Display and set field state.
|
Load Display and set field state.
|
||||||
"""
|
"""
|
||||||
# Create initial copy from master
|
# Create initial copy from master
|
||||||
self.preLoad()
|
self._loadDisplayTags()
|
||||||
self._resetTable()
|
self._resetTable()
|
||||||
self.selected = -1
|
self.selected = -1
|
||||||
return QtGui.QDialog.exec_(self)
|
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
|
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
|
update the display. If Cancel was selected this is needed to reset the
|
||||||
|
@ -401,7 +401,7 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'BibleDB.get_chapter_count("%s")', book)
|
log.debug(u'BibleDB.get_chapter_count("%s")', book)
|
||||||
count = self.session.query(Verse.chapter).join(Book)\
|
count = self.session.query(Verse.chapter).join(Book)\
|
||||||
.filter(Book.name==book)\
|
.filter(Book.name == book)\
|
||||||
.distinct().count()
|
.distinct().count()
|
||||||
if not count:
|
if not count:
|
||||||
return 0
|
return 0
|
||||||
@ -420,8 +420,8 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'BibleDB.get_verse_count("%s", %s)', book, chapter)
|
log.debug(u'BibleDB.get_verse_count("%s", %s)', book, chapter)
|
||||||
count = self.session.query(Verse).join(Book)\
|
count = self.session.query(Verse).join(Book)\
|
||||||
.filter(Book.name==book)\
|
.filter(Book.name == book)\
|
||||||
.filter(Verse.chapter==chapter)\
|
.filter(Verse.chapter == chapter)\
|
||||||
.count()
|
.count()
|
||||||
if not count:
|
if not count:
|
||||||
return 0
|
return 0
|
||||||
|
@ -285,7 +285,7 @@ class BibleManager(object):
|
|||||||
Does a verse search for the given bible and text.
|
Does a verse search for the given bible and text.
|
||||||
|
|
||||||
``bible``
|
``bible``
|
||||||
The bible to seach in (unicode).
|
The bible to search in (unicode).
|
||||||
|
|
||||||
``second_bible``
|
``second_bible``
|
||||||
The second bible (unicode). We do not search in this bible.
|
The second bible (unicode). We do not search in this bible.
|
||||||
@ -294,6 +294,15 @@ class BibleManager(object):
|
|||||||
The text to search for (unicode).
|
The text to search for (unicode).
|
||||||
"""
|
"""
|
||||||
log.debug(u'BibleManager.verse_search("%s", "%s")', bible, text)
|
log.debug(u'BibleManager.verse_search("%s", "%s")', bible, text)
|
||||||
|
if not bible:
|
||||||
|
Receiver.send_message(u'openlp_information_message', {
|
||||||
|
u'title': translate('BiblesPlugin.BibleManager',
|
||||||
|
'No Bibles Available'),
|
||||||
|
u'message': translate('BiblesPlugin.BibleManager',
|
||||||
|
'There are no Bibles currently installed. Please use the '
|
||||||
|
'Import Wizard to install one or more Bibles.')
|
||||||
|
})
|
||||||
|
return None
|
||||||
# Check if the bible or second_bible is a web bible.
|
# Check if the bible or second_bible is a web bible.
|
||||||
webbible = self.db_cache[bible].get_object(BibleMeta,
|
webbible = self.db_cache[bible].get_object(BibleMeta,
|
||||||
u'download source')
|
u'download source')
|
||||||
|
@ -29,7 +29,7 @@ import logging
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||||
translate, check_search_result
|
translate
|
||||||
from openlp.core.lib.searchedit import SearchEdit
|
from openlp.core.lib.searchedit import SearchEdit
|
||||||
from openlp.core.lib.ui import UiStrings, add_widget_completer, \
|
from openlp.core.lib.ui import UiStrings, add_widget_completer, \
|
||||||
media_item_combo_box, critical_error_message_box, find_and_set_in_combo_box
|
media_item_combo_box, critical_error_message_box, find_and_set_in_combo_box
|
||||||
@ -63,10 +63,43 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.quickPreviewAllowed = True
|
self.quickPreviewAllowed = True
|
||||||
self.search_results = {}
|
self.search_results = {}
|
||||||
self.second_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.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'bibles_load_list'), self.reloadBibles)
|
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):
|
def requiredIcons(self):
|
||||||
MediaManagerItem.requiredIcons(self)
|
MediaManagerItem.requiredIcons(self)
|
||||||
self.hasImportIcon = True
|
self.hasImportIcon = True
|
||||||
@ -114,6 +147,12 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
secondComboBox = media_item_combo_box(tab, prefix + u'SecondComboBox')
|
secondComboBox = media_item_combo_box(tab, prefix + u'SecondComboBox')
|
||||||
versionLabel.setBuddy(secondComboBox)
|
versionLabel.setBuddy(secondComboBox)
|
||||||
layout.addWidget(secondComboBox, idx + 1, 1, 1, 2)
|
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 = QtGui.QHBoxLayout()
|
||||||
searchButtonLayout.setObjectName(prefix + u'SearchButtonLayout')
|
searchButtonLayout.setObjectName(prefix + u'SearchButtonLayout')
|
||||||
searchButtonLayout.addStretch()
|
searchButtonLayout.addStretch()
|
||||||
@ -125,7 +164,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
searchButton = QtGui.QPushButton(tab)
|
searchButton = QtGui.QPushButton(tab)
|
||||||
searchButton.setObjectName(prefix + u'SearchButton')
|
searchButton.setObjectName(prefix + u'SearchButton')
|
||||||
searchButtonLayout.addWidget(searchButton)
|
searchButtonLayout.addWidget(searchButton)
|
||||||
layout.addLayout(searchButtonLayout, idx + 2, 1, 1, 2)
|
layout.addLayout(searchButtonLayout, idx + 3, 1, 1, 2)
|
||||||
self.pageLayout.addWidget(tab)
|
self.pageLayout.addWidget(tab)
|
||||||
tab.setVisible(False)
|
tab.setVisible(False)
|
||||||
QtCore.QObject.connect(lockButton, QtCore.SIGNAL(u'toggled(bool)'),
|
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'VersionComboBox', versionComboBox)
|
||||||
setattr(self, prefix + u'SecondLabel', secondLabel)
|
setattr(self, prefix + u'SecondLabel', secondLabel)
|
||||||
setattr(self, prefix + u'SecondComboBox', secondComboBox)
|
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'LockButton', lockButton)
|
||||||
setattr(self, prefix + u'SearchButtonLayout', searchButtonLayout)
|
setattr(self, prefix + u'SearchButtonLayout', searchButtonLayout)
|
||||||
setattr(self, prefix + u'SearchButton', searchButton)
|
setattr(self, prefix + u'SearchButton', searchButton)
|
||||||
@ -154,14 +195,6 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.quickSearchEdit.setObjectName(u'quickSearchEdit')
|
self.quickSearchEdit.setObjectName(u'quickSearchEdit')
|
||||||
self.quickSearchLabel.setBuddy(self.quickSearchEdit)
|
self.quickSearchLabel.setBuddy(self.quickSearchEdit)
|
||||||
self.quickLayout.addWidget(self.quickSearchEdit, 0, 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, 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(
|
self.addSearchFields(
|
||||||
u'quick', translate('BiblesPlugin.MediaItem', 'Quick'))
|
u'quick', translate('BiblesPlugin.MediaItem', 'Quick'))
|
||||||
self.quickTab.setVisible(True)
|
self.quickTab.setVisible(True)
|
||||||
@ -218,8 +251,11 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
QtCore.QObject.connect(self.quickVersionComboBox,
|
QtCore.QObject.connect(self.quickVersionComboBox,
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
|
QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(
|
||||||
self.quickLayoutComboBox, QtCore.SIGNAL(u'activated(int)'),
|
self.quickStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
|
||||||
self.onLayoutStyleComboBoxChanged)
|
self.onQuickStyleComboBoxChanged)
|
||||||
|
QtCore.QObject.connect(
|
||||||
|
self.advancedStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
|
||||||
|
self.onAdvancedStyleComboBoxChanged)
|
||||||
# Buttons
|
# Buttons
|
||||||
QtCore.QObject.connect(self.advancedSearchButton,
|
QtCore.QObject.connect(self.advancedSearchButton,
|
||||||
QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton)
|
QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton)
|
||||||
@ -247,21 +283,26 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.advancedSecondComboBox.setVisible(False)
|
self.advancedSecondComboBox.setVisible(False)
|
||||||
self.quickSecondLabel.setVisible(False)
|
self.quickSecondLabel.setVisible(False)
|
||||||
self.quickSecondComboBox.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):
|
def retranslateUi(self):
|
||||||
log.debug(u'retranslateUi')
|
log.debug(u'retranslateUi')
|
||||||
|
self.quickSearchLabel.setText(
|
||||||
|
translate('BiblesPlugin.MediaItem', 'Find:'))
|
||||||
self.quickVersionLabel.setText(u'%s:' % UiStrings().Version)
|
self.quickVersionLabel.setText(u'%s:' % UiStrings().Version)
|
||||||
self.quickSecondLabel.setText(
|
self.quickSecondLabel.setText(
|
||||||
translate('BiblesPlugin.MediaItem', 'Second:'))
|
translate('BiblesPlugin.MediaItem', 'Second:'))
|
||||||
self.quickSearchLabel.setText(
|
self.quickStyleLabel.setText(UiStrings().LayoutStyle)
|
||||||
translate('BiblesPlugin.MediaItem', 'Find:'))
|
self.quickStyleComboBox.setItemText(LayoutStyle.VersePerSlide,
|
||||||
self.quickSearchButton.setText(UiStrings().Search)
|
UiStrings().VersePerSlide)
|
||||||
|
self.quickStyleComboBox.setItemText(LayoutStyle.VersePerLine,
|
||||||
|
UiStrings().VersePerLine)
|
||||||
|
self.quickStyleComboBox.setItemText(LayoutStyle.Continuous,
|
||||||
|
UiStrings().Continuous)
|
||||||
self.quickLockButton.setToolTip(translate('BiblesPlugin.MediaItem',
|
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.quickSearchButton.setText(UiStrings().Search)
|
||||||
self.advancedSecondLabel.setText(
|
|
||||||
translate('BiblesPlugin.MediaItem', 'Second:'))
|
|
||||||
self.advancedBookLabel.setText(
|
self.advancedBookLabel.setText(
|
||||||
translate('BiblesPlugin.MediaItem', 'Book:'))
|
translate('BiblesPlugin.MediaItem', 'Book:'))
|
||||||
self.advancedChapterLabel.setText(
|
self.advancedChapterLabel.setText(
|
||||||
@ -272,16 +313,19 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
translate('BiblesPlugin.MediaItem', 'From:'))
|
translate('BiblesPlugin.MediaItem', 'From:'))
|
||||||
self.advancedToLabel.setText(
|
self.advancedToLabel.setText(
|
||||||
translate('BiblesPlugin.MediaItem', 'To:'))
|
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',
|
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.advancedSearchButton.setText(UiStrings().Search)
|
||||||
self.quickLayoutComboBox.setItemText(LayoutStyle.VersePerSlide,
|
|
||||||
UiStrings().VersePerSlide)
|
|
||||||
self.quickLayoutComboBox.setItemText(LayoutStyle.VersePerLine,
|
|
||||||
UiStrings().VersePerLine)
|
|
||||||
self.quickLayoutComboBox.setItemText(LayoutStyle.Continuous,
|
|
||||||
UiStrings().Continuous)
|
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
log.debug(u'bible manager initialise')
|
log.debug(u'bible manager initialise')
|
||||||
@ -303,28 +347,6 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.configUpdated()
|
self.configUpdated()
|
||||||
log.debug(u'bible manager initialise complete')
|
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):
|
def loadBibles(self):
|
||||||
log.debug(u'Loading Bibles')
|
log.debug(u'Loading Bibles')
|
||||||
self.quickVersionComboBox.clear()
|
self.quickVersionComboBox.clear()
|
||||||
@ -422,6 +444,47 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
books.sort()
|
books.sort()
|
||||||
add_widget_completer(books, self.quickSearchEdit)
|
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):
|
def onAdvancedVersionComboBox(self):
|
||||||
QtCore.QSettings().setValue(self.settingsSection + u'/advanced bible',
|
QtCore.QSettings().setValue(self.settingsSection + u'/advanced bible',
|
||||||
QtCore.QVariant(self.advancedVersionComboBox.currentText()))
|
QtCore.QVariant(self.advancedVersionComboBox.currentText()))
|
||||||
@ -537,7 +600,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
elif self.search_results:
|
elif self.search_results:
|
||||||
self.displayResults(bible, second_bible)
|
self.displayResults(bible, second_bible)
|
||||||
self.advancedSearchButton.setEnabled(True)
|
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'cursor_normal')
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
|
|
||||||
@ -578,34 +641,10 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
elif self.search_results:
|
elif self.search_results:
|
||||||
self.displayResults(bible, second_bible)
|
self.displayResults(bible, second_bible)
|
||||||
self.quickSearchButton.setEnabled(True)
|
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'cursor_normal')
|
||||||
Receiver.send_message(u'openlp_process_events')
|
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''):
|
def displayResults(self, bible, second_bible=u''):
|
||||||
"""
|
"""
|
||||||
Displays the search results in the media manager. All data needed for
|
Displays the search results in the media manager. All data needed for
|
||||||
@ -663,15 +702,6 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.search_results = {}
|
self.search_results = {}
|
||||||
self.second_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):
|
def generateSlideData(self, service_item, item=None, xmlVersion=False):
|
||||||
"""
|
"""
|
||||||
Generates and formats the slides for the service item as well as the
|
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:
|
if self.settings.display_style == DisplayStyle.Square:
|
||||||
return u'{su}[%s]{/su}' % verse_text
|
return u'{su}[%s]{/su}' % verse_text
|
||||||
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))
|
|
||||||
|
@ -32,7 +32,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
from sqlalchemy.sql import or_
|
from sqlalchemy.sql import or_
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
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.searchedit import SearchEdit
|
||||||
from openlp.core.lib.ui import UiStrings
|
from openlp.core.lib.ui import UiStrings
|
||||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
||||||
@ -199,7 +199,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
search_results = self.parent.manager.get_all_objects(Song,
|
search_results = self.parent.manager.get_all_objects(Song,
|
||||||
Song.theme_name == search_keywords)
|
Song.theme_name == search_keywords)
|
||||||
self.displayResultsSong(search_results)
|
self.displayResultsSong(search_results)
|
||||||
check_search_result(self.listView, search_results)
|
self.check_search_result()
|
||||||
|
|
||||||
def onSongListLoad(self):
|
def onSongListLoad(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user