HEAD r1547

This commit is contained in:
Armin Köhler 2011-05-15 16:22:04 +02:00
commit b10fbf98eb
21 changed files with 335 additions and 238 deletions

View File

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

View File

@ -49,6 +49,9 @@ class ListWidgetWithDnD(QtGui.QListWidget):
if event.buttons() != QtCore.Qt.LeftButton: if event.buttons() != QtCore.Qt.LeftButton:
event.ignore() event.ignore()
return return
if not self.selectedItems():
event.ignore()
return
drag = QtGui.QDrag(self) drag = QtGui.QDrag(self)
mimeData = QtCore.QMimeData() mimeData = QtCore.QMimeData()
drag.setMimeData(mimeData) drag.setMimeData(mimeData)

View File

@ -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.uniformItemSizes = True
self.listView.setSpacing(1) self.listView.setSpacing(1)
self.listView.setSelectionMode( self.listView.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection) QtGui.QAbstractItemView.ExtendedSelection)
@ -254,54 +253,49 @@ class MediaManagerItem(QtGui.QWidget):
# Add to pageLayout # Add to pageLayout
self.pageLayout.addWidget(self.listView) self.pageLayout.addWidget(self.listView)
# define and add the context menu # define and add the context menu
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
if self.hasEditIcon: if self.hasEditIcon:
self.listView.addAction( context_menu_action(
context_menu_action( self.listView, u':/general/general_edit.png',
self.listView, u':/general/general_edit.png', self.plugin.getString(StringContent.Edit)[u'title'],
self.plugin.getString(StringContent.Edit)[u'title'], self.onEditClick)
self.onEditClick, context=QtCore.Qt.WidgetShortcut)) context_menu_separator(self.listView)
self.listView.addAction(context_menu_separator(self.listView))
if self.hasDeleteIcon: 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( context_menu_action(
self.listView, u':/general/general_preview.png', self.listView, u':/general/general_delete.png',
self.plugin.getString(StringContent.Preview)[u'title'], self.plugin.getString(StringContent.Delete)[u'title'],
self.onPreviewClick, [QtCore.Qt.Key_Enter, self.onDeleteClick, [QtCore.Qt.Key_Delete])
QtCore.Qt.Key_Return], context=QtCore.Qt.WidgetShortcut)) context_menu_separator(self.listView)
self.listView.addAction( context_menu_action(
context_menu_action( self.listView, u':/general/general_preview.png',
self.listView, u':/general/general_live.png', self.plugin.getString(StringContent.Preview)[u'title'],
self.plugin.getString(StringContent.Live)[u'title'], self.onPreviewClick, [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return])
self.onLiveClick, [QtCore.Qt.ShiftModifier + \ context_menu_action(
QtCore.Qt.Key_Enter, QtCore.Qt.ShiftModifier + \ self.listView, u':/general/general_live.png',
QtCore.Qt.Key_Return], context=QtCore.Qt.WidgetShortcut)) self.plugin.getString(StringContent.Live)[u'title'],
self.listView.addAction( 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( context_menu_action(
self.listView, u':/general/general_add.png', self.listView, u':/general/general_add.png',
self.plugin.getString(StringContent.Service)[u'title'], translate('OpenLP.MediaManagerItem',
self.onAddClick, [QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal], '&Add to selected Service Item'), self.onAddEditClick)
context=QtCore.Qt.WidgetShortcut)) # Create the context menu and add all actions from the listView.
if self.addToServiceItem: self.menu = QtGui.QMenu()
self.listView.addAction( self.menu.addActions(self.listView.actions())
context_menu_action(
self.listView, u':/general/general_add.png',
translate('OpenLP.MediaManagerItem',
'&Add to selected Service Item'),
self.onAddEditClick, context=QtCore.Qt.WidgetShortcut))
QtCore.QObject.connect(self.listView, QtCore.QObject.connect(self.listView,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onClickPressed) self.onClickPressed)
QtCore.QObject.connect(self.listView, QtCore.QObject.connect(self.listView,
QtCore.SIGNAL(u'itemSelectionChanged()'), QtCore.SIGNAL(u'itemSelectionChanged()'),
self.onSelectionChange) self.onSelectionChange)
QtCore.QObject.connect(self.listView,
QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
self.contextMenu)
def initialise(self): def initialise(self):
""" """
@ -354,6 +348,15 @@ class MediaManagerItem(QtGui.QWidget):
self.settingsSection, self.getFileList()) self.settingsSection, self.getFileList())
Receiver.send_message(u'cursor_normal') 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): def getFileList(self):
""" """
Return the current list of files Return the current list of files
@ -548,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.

View File

@ -162,8 +162,10 @@ 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)
self.image_manager.add_image(self.theme_data.theme_name, # if No file do not update cache
self.theme_data.background_filename) if self.theme_data.background_filename:
self.image_manager.add_image(self.theme_data.theme_name,
self.theme_data.background_filename)
return self._rect, self._rect_footer return self._rect, self._rect_footer
def generate_preview(self, theme_data, force_page=False): def generate_preview(self, theme_data, force_page=False):
@ -186,10 +188,10 @@ class Renderer(object):
serviceItem.theme = theme_data serviceItem.theme = theme_data
if self.force_page: if self.force_page:
# make big page for theme edit dialog to get line count # 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: else:
self.image_manager.del_image(theme_data.theme_name) 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.renderer = self
serviceItem.raw_footer = FOOTER serviceItem.raw_footer = FOOTER
serviceItem.render(True) serviceItem.render(True)

View File

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

View File

@ -219,6 +219,8 @@ class ServiceItem(object):
``raw_slide`` ``raw_slide``
The raw text of the slide. The raw text of the slide.
""" """
if verse_tag:
verse_tag = verse_tag.upper()
self.service_item_type = ServiceItemType.Text self.service_item_type = ServiceItemType.Text
title = title.split(u'\n')[0] title = title.split(u'\n')[0]
self._raw_frames.append( self._raw_frames.append(

View File

@ -329,9 +329,9 @@ def shortcut_action(parent, name, shortcuts, function, icon=None, checked=None,
return action return action
def context_menu_action(base, icon, text, slot, shortcuts=None, category=None, 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`` ``base``
The parent menu to add this menu item to 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`` ``category``
The category the shortcut should be listed in the shortcut dialog. If 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`` ``context``
The context the shortcut is valid. 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.setShortcutContext(context)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_action(action) action_list.add_action(action)
base.addAction(action)
return action return action
def context_menu(base, icon, text): def context_menu(base, icon, text):
""" """
Utility method to help build context menus for plugins Utility method to help build context menus.
``base`` ``base``
The parent object to add this menu to The parent object to add this menu to
@ -392,6 +393,7 @@ def context_menu_separator(base):
""" """
action = QtGui.QAction(u'', base) action = QtGui.QAction(u'', base)
action.setSeparator(True) action.setSeparator(True)
base.addAction(action)
return action return action
def add_widget_completer(cache, widget): def add_widget_completer(cache, widget):

View File

@ -101,6 +101,7 @@ class GeneralTab(SettingsTab):
self.timeoutLabel.setObjectName(u'timeoutLabel') self.timeoutLabel.setObjectName(u'timeoutLabel')
self.timeoutSpinBox = QtGui.QSpinBox(self.settingsGroupBox) self.timeoutSpinBox = QtGui.QSpinBox(self.settingsGroupBox)
self.timeoutSpinBox.setObjectName(u'timeoutSpinBox') self.timeoutSpinBox.setObjectName(u'timeoutSpinBox')
self.timeoutSpinBox.setRange(1, 180)
self.settingsLayout.addRow(self.timeoutLabel, self.timeoutSpinBox) self.settingsLayout.addRow(self.timeoutLabel, self.timeoutSpinBox)
self.leftLayout.addWidget(self.settingsGroupBox) self.leftLayout.addWidget(self.settingsGroupBox)
self.leftLayout.addStretch() self.leftLayout.addStretch()

View File

@ -672,12 +672,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
'The Main Display has been blanked out')) 'The Main Display has been blanked out'))
def onErrorMessage(self, data): def onErrorMessage(self, data):
Receiver.send_message(u'close_splash')
QtGui.QMessageBox.critical(self, data[u'title'], data[u'message']) QtGui.QMessageBox.critical(self, data[u'title'], data[u'message'])
def onWarningMessage(self, data): def onWarningMessage(self, data):
Receiver.send_message(u'close_splash')
QtGui.QMessageBox.warning(self, data[u'title'], data[u'message']) QtGui.QMessageBox.warning(self, data[u'title'], data[u'message'])
def onInformationMessage(self, data): def onInformationMessage(self, data):
Receiver.send_message(u'close_splash')
QtGui.QMessageBox.information(self, data[u'title'], data[u'message']) QtGui.QMessageBox.information(self, data[u'title'], data[u'message'])
def onHelpWebSiteClicked(self): def onHelpWebSiteClicked(self):

View File

@ -36,7 +36,7 @@ from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, \
ItemCapabilities, SettingsManager, translate ItemCapabilities, SettingsManager, translate
from openlp.core.lib.theme import ThemeLevel from openlp.core.lib.theme import ThemeLevel
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ 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 import ServiceNoteForm, ServiceItemEditForm, StartTimeForm
from openlp.core.ui.printserviceform import PrintServiceForm from openlp.core.ui.printserviceform import PrintServiceForm
from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \ 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: if event.buttons() != QtCore.Qt.LeftButton:
event.ignore() event.ignore()
return return
if not self.selectedItems():
event.ignore()
return
drag = QtGui.QDrag(self) drag = QtGui.QDrag(self)
mimeData = QtCore.QMimeData() mimeData = QtCore.QMimeData()
drag.setMimeData(mimeData) drag.setMimeData(mimeData)
@ -298,31 +301,34 @@ class ServiceManager(QtGui.QWidget):
self.addToAction.setIcon(build_icon(u':/general/general_edit.png')) self.addToAction.setIcon(build_icon(u':/general/general_edit.png'))
# build the context menu # build the context menu
self.menu = QtGui.QMenu() self.menu = QtGui.QMenu()
self.editAction = self.menu.addAction( self.editAction = context_menu_action(
translate('OpenLP.ServiceManager', '&Edit Item')) self.menu, u':/general/general_edit.png',
self.editAction.setIcon(build_icon(u':/general/general_edit.png')) translate('OpenLP.ServiceManager', '&Edit Item'), self.remoteEdit)
self.maintainAction = self.menu.addAction( self.maintainAction = context_menu_action(
translate('OpenLP.ServiceManager', '&Reorder Item')) self.menu, u':/general/general_edit.png',
self.maintainAction.setIcon(build_icon(u':/general/general_edit.png')) translate('OpenLP.ServiceManager', '&Reorder Item'),
self.notesAction = self.menu.addAction( self.onServiceItemEditForm)
translate('OpenLP.ServiceManager', '&Notes')) self.notesAction = context_menu_action(
self.notesAction.setIcon(build_icon(u':/services/service_notes.png')) self.menu, u':/services/service_notes.png',
self.timeAction = self.menu.addAction( translate('OpenLP.ServiceManager', '&Notes'),
translate('OpenLP.ServiceManager', '&Start Time')) self.onServiceItemNoteForm)
self.timeAction.setIcon(build_icon(u':/media/media_time.png')) self.timeAction = context_menu_action(
self.deleteAction = self.menu.addAction( self.menu, u':/media/media_time.png',
translate('OpenLP.ServiceManager', '&Delete From Service')) translate('OpenLP.ServiceManager', '&Start Time'),
self.deleteAction.setIcon(build_icon(u':/general/general_delete.png')) self.onStartTimeForm)
self.sep1 = self.menu.addAction(u'') self.deleteAction = context_menu_action(
self.sep1.setSeparator(True) self.menu, u':/general/general_delete.png',
self.previewAction = self.menu.addAction( translate('OpenLP.ServiceManager', '&Delete From Service'),
translate('OpenLP.ServiceManager', 'Show &Preview')) self.onDeleteFromService)
self.previewAction.setIcon(build_icon(u':/general/general_preview.png')) context_menu_separator(self.menu)
self.liveAction = self.menu.addAction( self.previewAction = context_menu_action(
translate('OpenLP.ServiceManager', 'Show &Live')) self.menu, u':/general/general_preview.png',
self.liveAction.setIcon(build_icon(u':/general/general_live.png')) translate('OpenLP.ServiceManager', 'Show &Preview'),
self.sep2 = self.menu.addAction(u'') self.makePreview)
self.sep2.setSeparator(True) 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( self.themeMenu = QtGui.QMenu(
translate('OpenLP.ServiceManager', '&Change Item Theme')) translate('OpenLP.ServiceManager', '&Change Item Theme'))
self.menu.addMenu(self.themeMenu) self.menu.addMenu(self.themeMenu)
@ -672,20 +678,6 @@ class ServiceManager(QtGui.QWidget):
if serviceItem[u'service_item'].is_text(): if serviceItem[u'service_item'].is_text():
self.themeMenu.menuAction().setVisible(True) self.themeMenu.menuAction().setVisible(True)
action = self.menu.exec_(self.serviceManagerList.mapToGlobal(point)) 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): def onServiceItemNoteForm(self):
item = self.findServiceItem()[0] item = self.findServiceItem()[0]
@ -837,7 +829,7 @@ class ServiceManager(QtGui.QWidget):
correct state. correct state.
""" """
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0] 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): def onExpandAll(self):
""" """
@ -1285,9 +1277,8 @@ class ServiceManager(QtGui.QWidget):
self.themeComboBox.addItem(u'') self.themeComboBox.addItem(u'')
for theme in theme_list: for theme in theme_list:
self.themeComboBox.addItem(theme) self.themeComboBox.addItem(theme)
action = context_menu_action(self.serviceManagerList, None, theme, context_menu_action(self.themeMenu, None, theme,
self.onThemeChangeAction, context=QtCore.Qt.WidgetShortcut) self.onThemeChangeAction)
self.themeMenu.addAction(action)
find_and_set_in_combo_box(self.themeComboBox, self.service_theme) find_and_set_in_combo_box(self.themeComboBox, self.service_theme)
self.mainwindow.renderer.set_service_theme(self.service_theme) self.mainwindow.renderer.set_service_theme(self.service_theme)
self.regenerateServiceItems() self.regenerateServiceItems()

View File

@ -199,8 +199,7 @@ class SlideController(QtGui.QWidget):
'Start/Stop continuous loop')) 'Start/Stop continuous loop'))
self.addAction(self.toogleLoop) self.addAction(self.toogleLoop)
self.delaySpinBox = QtGui.QSpinBox() self.delaySpinBox = QtGui.QSpinBox()
self.delaySpinBox.setMinimum(1) self.delaySpinBox.setRange(1, 180)
self.delaySpinBox.setMaximum(180)
self.toolbar.addToolbarWidget(u'Image SpinBox', self.delaySpinBox) self.toolbar.addToolbarWidget(u'Image SpinBox', self.delaySpinBox)
self.delaySpinBox.setSuffix(UiStrings().Seconds) self.delaySpinBox.setSuffix(UiStrings().Seconds)
self.delaySpinBox.setToolTip(translate('OpenLP.SlideController', self.delaySpinBox.setToolTip(translate('OpenLP.SlideController',
@ -608,7 +607,7 @@ class SlideController(QtGui.QWidget):
if frame[u'verseTag']: if frame[u'verseTag']:
# These tags are already translated. # These tags are already translated.
verse_def = frame[u'verseTag'] 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:]) two_line_def = u'%s\n%s' % (verse_def[0], verse_def[1:])
row = two_line_def row = two_line_def
if self.isLive: if self.isLive:

View File

@ -23,6 +23,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from openlp.core.lib import Receiver
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
@ -30,6 +31,8 @@ class SplashScreen(QtGui.QSplashScreen):
def __init__(self): def __init__(self):
QtGui.QSplashScreen.__init__(self) QtGui.QSplashScreen.__init__(self)
self.setupUi() self.setupUi()
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'close_splash'), self.close)
def setupUi(self): def setupUi(self):
self.setObjectName(u'splash_screen') self.setObjectName(u'splash_screen')

View File

@ -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,28 +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)
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
@ -657,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
@ -860,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))

View File

@ -252,7 +252,7 @@ class ImpressDocument(PresentationDocument):
window.setVisible(False) window.setVisible(False)
self.presentation = self.document.getPresentation() self.presentation = self.document.getPresentation()
self.presentation.Display = \ self.presentation.Display = \
self.controller.plugin.renderer.screens.current_display + 1 self.controller.plugin.renderer.screens.current[u'number'] + 1
self.control = None self.control = None
self.create_thumbnails() self.create_thumbnails()
return True return True

View File

@ -30,12 +30,14 @@ body {
#currentslide { #currentslide {
font-size: 40pt; font-size: 40pt;
color: white; color: white;
padding-bottom: 0px;
} }
#nextslide { #nextslide {
font-size: 30pt; font-size: 40pt;
color: grey; color: grey;
padding-top: 25px; padding-top: 0px;
padding-bottom: 0px;
} }
#right { #right {

View File

@ -26,7 +26,7 @@
--> -->
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>OpenLP 2.0 Remote</title> <title>OpenLP 2.0 Stage View</title>
<link rel="stylesheet" href="/files/stage.css" /> <link rel="stylesheet" href="/files/stage.css" />
<script type="text/javascript" src="/files/jquery.js"></script> <script type="text/javascript" src="/files/jquery.js"></script>
<script type="text/javascript" src="/files/stage.js"></script> <script type="text/javascript" src="/files/stage.js"></script>

View File

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

View File

@ -115,7 +115,6 @@ import os
import urlparse import urlparse
import re import re
from pprint import pformat from pprint import pformat
from lxml import html
try: try:
import json import json
@ -402,12 +401,14 @@ class HttpConnection(object):
for index, frame in enumerate(current_item.get_frames()): for index, frame in enumerate(current_item.get_frames()):
item = {} item = {}
if current_item.is_text(): if current_item.is_text():
item[u'tag'] = unicode(frame[u'verseTag']) if frame[u'verseTag']:
text = unicode(frame[u'html'].replace('<br>', '\n')) item[u'tag'] = unicode(frame[u'verseTag'])
item[u'text'] = html.fromstring(text).text_content() else:
item[u'tag'] = unicode(index + 1)
item[u'text'] = unicode(frame[u'text'])
item[u'html'] = unicode(frame[u'html']) item[u'html'] = unicode(frame[u'html'])
else: else:
item[u'tag'] = unicode(index) item[u'tag'] = unicode(index + 1)
item[u'text'] = u'' item[u'text'] = u''
item[u'html'] = u'' item[u'html'] = u''
item[u'selected'] = (self.parent.current_slide == index) item[u'selected'] = (self.parent.current_slide == index)

View File

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

View File

@ -69,7 +69,7 @@ Source: ..\..\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion recursesubdirs
[Icons] [Icons]
Name: {group}\{#AppName}; Filename: {app}\{#AppExeName} Name: {group}\{#AppName}; Filename: {app}\{#AppExeName}
Name: {group}\{#AppName} (Debug); Filename: {app}\{#AppExeName}; Parameters: -l debug 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:ProgramOnTheWeb,{#AppName}}; Filename: {#AppURL}
Name: {group}\{cm:UninstallProgram,{#AppName}}; Filename: {uninstallexe} Name: {group}\{cm:UninstallProgram,{#AppName}}; Filename: {uninstallexe}
Name: {commondesktop}\{#AppName}; Filename: {app}\{#AppExeName}; Tasks: desktopicon Name: {commondesktop}\{#AppName}; Filename: {app}\{#AppExeName}; Tasks: desktopicon

View File

@ -53,7 +53,8 @@ UPX
add that directory to your PATH environment variable. add that directory to your PATH environment variable.
Sphinx 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 HTML Help Workshop
This is used to create the help file This is used to create the help file
@ -99,6 +100,7 @@ windows-builder.py
import os import os
import sys import sys
from shutil import copy from shutil import copy
from shutil import rmtree
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
python_exe = sys.executable 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') u'sphinx-build.exe')
hhc_exe = os.path.join(os.getenv(u'PROGRAMFILES'), 'HTML Help Workshop', hhc_exe = os.path.join(os.getenv(u'PROGRAMFILES'), 'HTML Help Workshop',
u'hhc.exe') 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') u'Microsoft Visual Studio 9.0', u'VC', u'vcpackages', u'vcbuild.exe')
# Base paths # Base paths
script_path = os.path.split(os.path.abspath(__file__))[0] script_path = os.path.split(os.path.abspath(__file__))[0]
branch_path = os.path.abspath(os.path.join(script_path, u'..')) 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', site_packages = os.path.join(os.path.split(python_exe)[0], u'Lib',
u'site-packages') u'site-packages')
@ -125,7 +129,9 @@ i18n_utils = os.path.join(script_path, u'translation_utils.py')
# Paths # Paths
source_path = os.path.join(branch_path, u'openlp') 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') i18n_path = os.path.join(branch_path, u'resources', u'i18n')
winres_path = os.path.join(branch_path, u'resources', u'windows') 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') 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')) os.path.join(dist_path, u'OpenLP.ico'))
copy(os.path.join(winres_path, u'LICENSE.txt'), copy(os.path.join(winres_path, u'LICENSE.txt'),
os.path.join(dist_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(): def update_translations():
print u'Updating translations...' print u'Updating translations...'
@ -253,6 +265,9 @@ def compile_translations():
os.path.join(dist_path, u'i18n', filename)) os.path.join(dist_path, u'i18n', filename))
def run_sphinx(): 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...' print u'Running Sphinx...'
os.chdir(manual_path) os.chdir(manual_path)
sphinx = Popen((sphinx_exe, u'-b', u'htmlhelp', u'-d', u'build/doctrees', sphinx = Popen((sphinx_exe, u'-b', u'htmlhelp', u'-d', u'build/doctrees',
@ -265,7 +280,7 @@ def run_sphinx():
def run_htmlhelp(): def run_htmlhelp():
print u'Running HTML Help Workshop...' 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) hhc = Popen((hhc_exe, u'OpenLP.chm'), stdout=PIPE)
output, error = hhc.communicate() output, error = hhc.communicate()
code = hhc.wait() code = hhc.wait()
@ -273,9 +288,6 @@ def run_htmlhelp():
print u'Exit code:', code print u'Exit code:', code
print output print output
raise Exception(u'Error running HTML Help Workshop') 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(): def run_innosetup():
print u'Running Inno Setup...' print u'Running Inno Setup...'
@ -306,6 +318,8 @@ def main():
print "Source path:", source_path print "Source path:", source_path
print "\"dist\" path:", dist_path print "\"dist\" path:", dist_path
print "PyInstaller:", pyi_build 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 "Inno Setup path:", innosetup_exe
print "Windows resources:", winres_path print "Windows resources:", winres_path
print "VCBuild path:", vcbuild_exe print "VCBuild path:", vcbuild_exe
@ -324,11 +338,17 @@ def main():
write_version_file() write_version_file()
copy_enchant() copy_enchant()
copy_plugins() 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() copy_windows_files()
update_translations() update_translations()
compile_translations() compile_translations()
run_sphinx()
run_htmlhelp()
run_innosetup() run_innosetup()
print "Done." print "Done."