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: 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,7 @@ 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.setUniformItemSizes(True)
self.listView.setSpacing(1) self.listView.setSpacing(1)
self.listView.setSelectionMode( self.listView.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection) QtGui.QAbstractItemView.ExtendedSelection)
@ -254,54 +254,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, context=QtCore.Qt.WidgetShortcut)) self.onEditClick)
self.listView.addAction(context_menu_separator(self.listView)) context_menu_separator(self.listView)
if self.hasDeleteIcon: if self.hasDeleteIcon:
self.listView.addAction(
context_menu_action( context_menu_action(
self.listView, u':/general/general_delete.png', self.listView, u':/general/general_delete.png',
self.plugin.getString(StringContent.Delete)[u'title'], self.plugin.getString(StringContent.Delete)[u'title'],
self.onDeleteClick, [QtCore.Qt.Key_Delete], self.onDeleteClick, [QtCore.Qt.Key_Delete])
context=QtCore.Qt.WidgetShortcut)) context_menu_separator(self.listView)
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_preview.png',
self.plugin.getString(StringContent.Preview)[u'title'], self.plugin.getString(StringContent.Preview)[u'title'],
self.onPreviewClick, [QtCore.Qt.Key_Enter, self.onPreviewClick, [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return])
QtCore.Qt.Key_Return], context=QtCore.Qt.WidgetShortcut))
self.listView.addAction(
context_menu_action( context_menu_action(
self.listView, u':/general/general_live.png', self.listView, u':/general/general_live.png',
self.plugin.getString(StringContent.Live)[u'title'], self.plugin.getString(StringContent.Live)[u'title'],
self.onLiveClick, [QtCore.Qt.ShiftModifier + \ self.onLiveClick, [QtCore.Qt.ShiftModifier + QtCore.Qt.Key_Enter,
QtCore.Qt.Key_Enter, QtCore.Qt.ShiftModifier + \ QtCore.Qt.ShiftModifier + QtCore.Qt.Key_Return])
QtCore.Qt.Key_Return], context=QtCore.Qt.WidgetShortcut))
self.listView.addAction(
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'], self.plugin.getString(StringContent.Service)[u'title'],
self.onAddClick, [QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal], self.onAddClick, [QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal])
context=QtCore.Qt.WidgetShortcut))
if self.addToServiceItem: if self.addToServiceItem:
self.listView.addAction(
context_menu_action( context_menu_action(
self.listView, u':/general/general_add.png', self.listView, u':/general/general_add.png',
translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'&Add to selected Service Item'), '&Add to selected Service Item'), self.onAddEditClick)
self.onAddEditClick, context=QtCore.Qt.WidgetShortcut)) # 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.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 +349,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

View File

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

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

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

@ -55,6 +55,8 @@ class BibleMediaItem(MediaManagerItem):
def __init__(self, parent, plugin, icon): def __init__(self, parent, plugin, icon):
self.IconPath = u'songs/song' 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) MediaManagerItem.__init__(self, parent, plugin, icon)
# Place to store the search results for both bibles. # Place to store the search results for both bibles.
self.settings = self.parent.settings_tab self.settings = self.parent.settings_tab
@ -74,6 +76,16 @@ class BibleMediaItem(MediaManagerItem):
self.addToServiceItem = False self.addToServiceItem = False
def addSearchTab(self, prefix, name): 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. Creates and adds generic search tab.
@ -83,121 +95,113 @@ class BibleMediaItem(MediaManagerItem):
``name`` ``name``
The translated string to display. The translated string to display.
""" """
tab = QtGui.QWidget() if prefix == u'quick':
tab.setObjectName(prefix + u'Tab') idx = 2
layout = QtGui.QGridLayout(tab) else:
layout.setObjectName(prefix + u'Layout') idx = 5
tab = getattr(self, prefix + u'Tab')
layout = getattr(self, prefix + u'Layout')
versionLabel = QtGui.QLabel(tab) versionLabel = QtGui.QLabel(tab)
versionLabel.setObjectName(prefix + u'VersionLabel') versionLabel.setObjectName(prefix + u'VersionLabel')
layout.addWidget(versionLabel, 0, 0, QtCore.Qt.AlignRight) layout.addWidget(versionLabel, idx, 0, QtCore.Qt.AlignRight)
versionComboBox = media_item_combo_box(tab, prefix + u'VersionComboBox') versionComboBox = media_item_combo_box(tab,
prefix + u'VersionComboBox')
versionLabel.setBuddy(versionComboBox) versionLabel.setBuddy(versionComboBox)
layout.addWidget(versionComboBox, 0, 1, 1, 2) layout.addWidget(versionComboBox, idx, 1, 1, 2)
secondLabel = QtGui.QLabel(tab) secondLabel = QtGui.QLabel(tab)
secondLabel.setObjectName(prefix + u'SecondLabel') 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') secondComboBox = media_item_combo_box(tab, prefix + u'SecondComboBox')
versionLabel.setBuddy(secondComboBox) versionLabel.setBuddy(secondComboBox)
layout.addWidget(secondComboBox, 1, 1, 1, 2) layout.addWidget(secondComboBox, idx + 1, 1, 1, 2)
searchButtonLayout = QtGui.QHBoxLayout() searchButtonLayout = QtGui.QHBoxLayout()
searchButtonLayout.setObjectName(prefix + u'SearchButtonLayout') searchButtonLayout.setObjectName(prefix + u'SearchButtonLayout')
searchButtonLayout.addStretch() 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 = QtGui.QPushButton(tab)
searchButton.setObjectName(prefix + u'SearchButton') searchButton.setObjectName(prefix + u'SearchButton')
searchButtonLayout.addWidget(searchButton) searchButtonLayout.addWidget(searchButton)
self.searchTabWidget.addTab(tab, name) layout.addLayout(searchButtonLayout, idx + 2, 1, 1, 2)
setattr(self, prefix + u'Tab', tab) self.pageLayout.addWidget(tab)
setattr(self, prefix + u'Layout', layout) tab.setVisible(False)
QtCore.QObject.connect(lockButton, QtCore.SIGNAL(u'toggled(bool)'),
self.onLockButtonToggled)
setattr(self, prefix + u'VersionLabel', versionLabel) setattr(self, prefix + u'VersionLabel', versionLabel)
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'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)
def addEndHeaderBar(self): def addEndHeaderBar(self):
self.searchTabWidget = QtGui.QTabWidget(self) self.searchTabBar = QtGui.QTabBar(self)
self.searchTabWidget.setSizePolicy( self.searchTabBar.setExpanding(False)
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) self.searchTabBar.setObjectName(u'searchTabBar')
self.searchTabWidget.setObjectName(u'searchTabWidget') self.pageLayout.addWidget(self.searchTabBar)
# Add the Quick Search tab. # Add the Quick Search tab.
self.addSearchTab( self.addSearchTab(
u'quick', translate('BiblesPlugin.MediaItem', 'Quick')) u'quick', translate('BiblesPlugin.MediaItem', 'Quick'))
self.quickSearchLabel = QtGui.QLabel(self.quickTab) self.quickSearchLabel = QtGui.QLabel(self.quickTab)
self.quickSearchLabel.setObjectName(u'quickSearchLabel') self.quickSearchLabel.setObjectName(u'quickSearchLabel')
self.quickLayout.addWidget( self.quickLayout.addWidget(
self.quickSearchLabel, 2, 0, QtCore.Qt.AlignRight) self.quickSearchLabel, 0, 0, QtCore.Qt.AlignRight)
self.quickSearchEdit = SearchEdit(self.quickTab) self.quickSearchEdit = SearchEdit(self.quickTab)
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, 2, 1, 1, 2) self.quickLayout.addWidget(self.quickSearchEdit, 0, 1, 1, 2)
self.quickLayoutLabel = QtGui.QLabel(self.quickTab) self.quickLayoutLabel = QtGui.QLabel(self.quickTab)
self.quickLayoutLabel.setObjectName(u'quickClearLabel') self.quickLayoutLabel.setObjectName(u'quickClearLabel')
self.quickLayout.addWidget( 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, self.quickLayoutComboBox = media_item_combo_box(self.quickTab,
u'quickLayoutComboBox') u'quickLayoutComboBox')
self.quickLayoutComboBox.addItems([u'', u'', u'']) self.quickLayoutComboBox.addItems([u'', u'', u''])
self.quickLayout.addWidget(self.quickLayoutComboBox, 3, 1, 1, 2) self.quickLayout.addWidget(self.quickLayoutComboBox, 1, 1, 1, 2)
self.quickClearLabel = QtGui.QLabel(self.quickTab) self.addSearchFields(
self.quickClearLabel.setObjectName(u'quickClearLabel') u'quick', translate('BiblesPlugin.MediaItem', 'Quick'))
self.quickLayout.addWidget( self.quickTab.setVisible(True)
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)
# Add the Advanced Search tab. # Add the Advanced Search tab.
self.addSearchTab(u'advanced', UiStrings().Advanced) self.addSearchTab(u'advanced', UiStrings().Advanced)
self.advancedBookLabel = QtGui.QLabel(self.advancedTab) self.advancedBookLabel = QtGui.QLabel(self.advancedTab)
self.advancedBookLabel.setObjectName(u'advancedBookLabel') self.advancedBookLabel.setObjectName(u'advancedBookLabel')
self.advancedLayout.addWidget(self.advancedBookLabel, 2, 0, self.advancedLayout.addWidget(self.advancedBookLabel, 0, 0,
QtCore.Qt.AlignRight) QtCore.Qt.AlignRight)
self.advancedBookComboBox = media_item_combo_box(self.advancedTab, self.advancedBookComboBox = media_item_combo_box(self.advancedTab,
u'advancedBookComboBox') u'advancedBookComboBox')
self.advancedBookLabel.setBuddy(self.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 = QtGui.QLabel(self.advancedTab)
self.advancedChapterLabel.setObjectName(u'advancedChapterLabel') 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 = QtGui.QLabel(self.advancedTab)
self.advancedVerseLabel.setObjectName(u'advancedVerseLabel') 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 = QtGui.QLabel(self.advancedTab)
self.advancedFromLabel.setObjectName(u'advancedFromLabel') self.advancedFromLabel.setObjectName(u'advancedFromLabel')
self.advancedLayout.addWidget(self.advancedFromLabel, 4, 0, self.advancedLayout.addWidget(self.advancedFromLabel, 3, 0,
QtCore.Qt.AlignRight) QtCore.Qt.AlignRight)
self.advancedFromChapter = QtGui.QComboBox(self.advancedTab) self.advancedFromChapter = QtGui.QComboBox(self.advancedTab)
self.advancedFromChapter.setObjectName(u'advancedFromChapter') 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 = QtGui.QComboBox(self.advancedTab)
self.advancedFromVerse.setObjectName(u'advancedFromVerse') 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 = QtGui.QLabel(self.advancedTab)
self.advancedToLabel.setObjectName(u'advancedToLabel') self.advancedToLabel.setObjectName(u'advancedToLabel')
self.advancedLayout.addWidget(self.advancedToLabel, 5, 0, self.advancedLayout.addWidget(self.advancedToLabel, 4, 0,
QtCore.Qt.AlignRight) QtCore.Qt.AlignRight)
self.advancedToChapter = QtGui.QComboBox(self.advancedTab) self.advancedToChapter = QtGui.QComboBox(self.advancedTab)
self.advancedToChapter.setObjectName(u'advancedToChapter') 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 = QtGui.QComboBox(self.advancedTab)
self.advancedToVerse.setObjectName(u'advancedToVerse') self.advancedToVerse.setObjectName(u'advancedToVerse')
self.advancedLayout.addWidget(self.advancedToVerse, 5, 2) self.advancedLayout.addWidget(self.advancedToVerse, 4, 2)
self.advancedClearLabel = QtGui.QLabel(self.quickTab) self.addSearchFields(u'advanced', UiStrings().Advanced)
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)
# Combo Boxes # Combo Boxes
QtCore.QObject.connect(self.advancedVersionComboBox, QtCore.QObject.connect(self.advancedVersionComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox) QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox)
@ -226,6 +230,9 @@ class BibleMediaItem(MediaManagerItem):
# Other stuff # Other stuff
QtCore.QObject.connect(self.quickSearchEdit, QtCore.QObject.connect(self.quickSearchEdit,
QtCore.SIGNAL(u'returnPressed()'), self.onQuickSearchButton) QtCore.SIGNAL(u'returnPressed()'), self.onQuickSearchButton)
QtCore.QObject.connect(self.searchTabBar,
QtCore.SIGNAL(u'currentChanged(int)'),
self.onSearchTabBarCurrentChanged)
def configUpdated(self): def configUpdated(self):
log.debug(u'configUpdated') log.debug(u'configUpdated')
@ -250,8 +257,8 @@ class BibleMediaItem(MediaManagerItem):
self.quickSearchLabel.setText( self.quickSearchLabel.setText(
translate('BiblesPlugin.MediaItem', 'Find:')) translate('BiblesPlugin.MediaItem', 'Find:'))
self.quickSearchButton.setText(UiStrings().Search) self.quickSearchButton.setText(UiStrings().Search)
self.quickClearLabel.setText( self.quickLockButton.setToolTip(translate('BiblesPlugin.MediaItem',
translate('BiblesPlugin.MediaItem', 'Results:')) 'Toggle to keep or clear the previous results.'))
self.advancedVersionLabel.setText(u'%s:' % UiStrings().Version) self.advancedVersionLabel.setText(u'%s:' % UiStrings().Version)
self.advancedSecondLabel.setText( self.advancedSecondLabel.setText(
translate('BiblesPlugin.MediaItem', 'Second:')) translate('BiblesPlugin.MediaItem', 'Second:'))
@ -265,17 +272,9 @@ 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.advancedClearLabel.setText(
translate('BiblesPlugin.MediaItem', 'Results:'))
self.advancedSearchButton.setText(UiStrings().Search) self.advancedSearchButton.setText(UiStrings().Search)
self.quickClearComboBox.addItem( self.advancedLockButton.setToolTip(translate('BiblesPlugin.MediaItem',
translate('BiblesPlugin.MediaItem', 'Clear')) 'Toggle to keep or clear the previous results.'))
self.quickClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Keep'))
self.advancedClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Clear'))
self.advancedClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Keep'))
self.quickLayoutLabel.setText(UiStrings().LayoutStyle) self.quickLayoutLabel.setText(UiStrings().LayoutStyle)
self.quickLayoutComboBox.setItemText(LayoutStyle.VersePerSlide, self.quickLayoutComboBox.setItemText(LayoutStyle.VersePerSlide,
UiStrings().VersePerSlide) UiStrings().VersePerSlide)
@ -312,6 +311,20 @@ class BibleMediaItem(MediaManagerItem):
if self.import_wizard.exec_(): if self.import_wizard.exec_():
self.reloadBibles() 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()
@ -517,7 +530,7 @@ class BibleMediaItem(MediaManagerItem):
if second_bible: if second_bible:
self.second_search_results = self.parent.manager.get_verses( self.second_search_results = self.parent.manager.get_verses(
second_bible, versetext) second_bible, versetext)
if self.advancedClearComboBox.currentIndex() == 0: if not self.advancedLockButton.isChecked():
self.listView.clear() self.listView.clear()
if self.listView.count() != 0: if self.listView.count() != 0:
self.__checkSecondBible(bible, second_bible) self.__checkSecondBible(bible, second_bible)
@ -558,7 +571,7 @@ class BibleMediaItem(MediaManagerItem):
verse.verse)) verse.verse))
self.second_search_results = \ self.second_search_results = \
bibles[second_bible].get_verses(text) bibles[second_bible].get_verses(text)
if self.quickClearComboBox.currentIndex() == 0: if not self.quickLockButton.isChecked():
self.listView.clear() self.listView.clear()
if self.listView.count() != 0 and self.search_results: if self.listView.count() != 0 and self.search_results:
self.__checkSecondBible(bible, second_bible) self.__checkSecondBible(bible, second_bible)

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

@ -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;
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>"); div.append("&nbsp;<span>");
var tag = data.results.slides[idx]["tag"]; $("#verseorder span").last().attr("id", "tag" + tags).text(tag);
if (tag == 'None')
tag = idx;
$("#verseorder span").last().attr("id", "tag" + idx).text(tag);
if (data.results.slides[idx]["selected"])
OpenLP.currentSlide = idx;
} }
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(); 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():
if frame[u'verseTag']:
item[u'tag'] = unicode(frame[u'verseTag']) item[u'tag'] = unicode(frame[u'verseTag'])
text = unicode(frame[u'html'].replace('<br>', '\n')) else:
item[u'text'] = html.fromstring(text).text_content() 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

@ -431,7 +431,7 @@ class FoilPresenter(object):
verse_sortnr = self._child(strophe.sortnr) verse_sortnr = self._child(strophe.sortnr)
sortnr = True sortnr = True
# In older Version there is no sortnr, but we need one # In older Version there is no sortnr, but we need one
if sortnr == False: if not sortnr:
verse_sortnr = unicode(temp_sortnr_backup) verse_sortnr = unicode(temp_sortnr_backup)
temp_sortnr_backup += 1 temp_sortnr_backup += 1
# Foilpresenter allows e. g. "Ref" or "1", but we need "C1" or "V1". # 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 # test if foilpresenter have the same versenumber two times with
# different parts raise the verse number # different parts raise the verse number
for value in temp_verse_order_backup: 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_number = unicode(int(verse_number) + 1)
verse_type_index = VerseType.from_tag(verse_type[0]) verse_type_index = VerseType.from_tag(verse_type[0])
verse_type = VerseType.Names[verse_type_index] verse_type = VerseType.Names[verse_type_index]

View File

@ -150,13 +150,13 @@ class SongShowPlusImport(SongImport):
self.ccli_number = int(data) self.ccli_number = int(data)
elif blockKey == VERSE: elif blockKey == VERSE:
self.add_verse(unicode(data, u'cp1252'), self.add_verse(unicode(data, u'cp1252'),
"V%s" % verseNo) "%s%s" % (VerseType.Tags[VerseType.Verse], verseNo))
elif blockKey == CHORUS: elif blockKey == CHORUS:
self.add_verse(unicode(data, u'cp1252'), self.add_verse(unicode(data, u'cp1252'),
"C%s" % verseNo) "%s%s" % (VerseType.Tags[VerseType.Chorus], verseNo))
elif blockKey == BRIDGE: elif blockKey == BRIDGE:
self.add_verse(unicode(data, u'cp1252'), self.add_verse(unicode(data, u'cp1252'),
"B%s" % verseNo) "%s%s" % (VerseType.Tags[VerseType.Bridge], verseNo))
elif blockKey == TOPIC: elif blockKey == TOPIC:
self.topics.append(unicode(data, u'cp1252')) self.topics.append(unicode(data, u'cp1252'))
elif blockKey == COMMENTS: 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"> <qresource prefix="bibles">
<file>bibles_search_text.png</file> <file>bibles_search_text.png</file>
<file>bibles_search_reference.png</file> <file>bibles_search_reference.png</file>
<file>bibles_search_unlock.png</file>
<file>bibles_search_lock.png</file>
</qresource> </qresource>
<qresource prefix="plugins"> <qresource prefix="plugins">
<file>plugin_alerts.png</file> <file>plugin_alerts.png</file>

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
@ -114,6 +116,8 @@ vcbuild_exe = os.path.join(os.getenv(u'PROGRAMFILES'),
# 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."