This commit is contained in:
Andreas Preikschat 2011-05-13 22:48:03 +02:00
commit a06c25c66c
19 changed files with 277 additions and 192 deletions

View File

@ -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)

View File

@ -244,7 +244,7 @@ class MediaManagerItem(QtGui.QWidget):
"""
# 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,54 +254,49 @@ 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)
if self.hasEditIcon:
self.listView.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))
context_menu_action(
self.listView, u':/general/general_edit.png',
self.plugin.getString(StringContent.Edit)[u'title'],
self.onEditClick)
context_menu_separator(self.listView)
if self.hasDeleteIcon:
self.listView.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(
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(
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.listView, u':/general/general_delete.png',
self.plugin.getString(StringContent.Delete)[u'title'],
self.onDeleteClick, [QtCore.Qt.Key_Delete])
context_menu_separator(self.listView)
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_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_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])
if self.addToServiceItem:
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(
context_menu_action(
self.listView, u':/general/general_add.png',
translate('OpenLP.MediaManagerItem',
'&Add to selected Service Item'),
self.onAddEditClick, context=QtCore.Qt.WidgetShortcut))
translate('OpenLP.MediaManagerItem',
'&Add to selected Service Item'), self.onAddEditClick)
# Create the context menu and add all actions from the listView.
self.menu = QtGui.QMenu()
self.menu.addActions(self.listView.actions())
QtCore.QObject.connect(self.listView,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onClickPressed)
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):
"""
@ -354,6 +349,15 @@ class MediaManagerItem(QtGui.QWidget):
self.settingsSection, self.getFileList())
Receiver.send_message(u'cursor_normal')
def contextMenu(self, point):
item = self.listView.itemAt(point)
# Decide if we have to show the context menu or not.
if item is None:
return
if not item.flags() & QtCore.Qt.ItemIsSelectable:
return
self.menu.exec_(self.listView.mapToGlobal(point))
def getFileList(self):
"""
Return the current list of files

View File

@ -186,10 +186,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)

View File

@ -62,6 +62,7 @@ class SearchEdit(QtGui.QLineEdit):
self._onSearchEditTextChanged
)
self._updateStyleSheet()
self.setAcceptDrops(False)
def _updateStyleSheet(self):
"""

View File

@ -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(

View File

@ -329,9 +329,9 @@ def shortcut_action(parent, name, shortcuts, function, icon=None, checked=None,
return action
def context_menu_action(base, icon, text, slot, shortcuts=None, category=None,
context=QtCore.Qt.WindowShortcut):
context=QtCore.Qt.WidgetShortcut):
"""
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.
@ -364,11 +364,12 @@ 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):
"""
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
@ -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):

View File

@ -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, \
@ -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)
@ -298,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)
@ -672,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]
@ -837,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):
"""
@ -1285,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()

View File

@ -608,7 +608,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:

View File

@ -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
@ -74,6 +76,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 +95,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)
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)
self.searchTabWidget.addTab(tab, name)
setattr(self, prefix + u'Tab', tab)
setattr(self, prefix + u'Layout', layout)
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'LockButton', lockButton)
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 +230,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')
@ -250,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:'))
@ -265,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)
@ -312,6 +311,20 @@ 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 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()
@ -517,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)
@ -558,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)

View File

@ -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 {

View File

@ -46,35 +46,79 @@ window.OpenLP = {
function (data, status) {
OpenLP.currentSlides = data.results.slides;
OpenLP.currentSlide = 0;
OpenLP.currentTags = Array();
var div = $("#verseorder");
div.html("");
for (idx in data.results.slides) {
idx = parseInt(idx, 10);
div.append("&nbsp;<span>");
var tag = data.results.slides[idx]["tag"];
if (tag == 'None')
tag = idx;
$("#verseorder span").last().attr("id", "tag" + idx).text(tag);
if (data.results.slides[idx]["selected"])
var tag = "";
var tags = 0;
var lastChange = 0;
$.each(data.results.slides, function(idx, slide) {
var prevtag = 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("&nbsp;<span>");
$("#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("&nbsp;<span>");
$("#verseorder span").last().attr("id", "tag" + tags).text(tag);
}
}
}
OpenLP.currentTags[idx] = tags;
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.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, '<br />');
$("#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++) {
if (OpenLP.currentTags[idx] != OpenLP.currentTags[idx - 1])
text = text + '<p class="nextslide">';
text = text + OpenLP.currentSlides[idx]["text"];
if (OpenLP.currentTags[idx] != OpenLP.currentTags[idx - 1])
text = text + '</p>';
else
text = text + '<br />';
}
text = text.replace(/\n/g, '<br />');
$("#nextslide").html(text);
}
else
$("#nextslide").html("Next: " + OpenLP.nextSong);
else {
text = '<p class="nextslide">Next: ' + OpenLP.nextSong + '</p>';
$("#nextslide").html(text);
}
},
updateClock: function() {
var div = $("#clock");

View File

@ -115,7 +115,6 @@ import os
import urlparse
import re
from pprint import pformat
from lxml import html
try:
import json
@ -402,12 +401,14 @@ 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('<br>', '\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 + 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)

View File

@ -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]

View File

@ -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:

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

View File

@ -24,6 +24,8 @@
<qresource prefix="bibles">
<file>bibles_search_text.png</file>
<file>bibles_search_reference.png</file>
<file>bibles_search_unlock.png</file>
<file>bibles_search_lock.png</file>
</qresource>
<qresource prefix="plugins">
<file>plugin_alerts.png</file>

View File

@ -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

View File

@ -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."