This commit is contained in:
Tim Bentley 2011-07-01 05:41:31 +01:00
commit 98775fb7f4
57 changed files with 32445 additions and 24478 deletions

View File

@ -486,11 +486,11 @@ def build_lyrics_css(item, webkitvers):
# Before 533.3 the webkit-text-fill colour wasn't displayed, only the
# stroke (outline) color. So put stroke layer underneath the main text.
#
# Before 534.4 the webkit-text-stroke was sometimes out of alignment
# Up to 534.3 the webkit-text-stroke was sometimes out of alignment
# with the fill, or normal text. letter-spacing=1 is workaround
# https://bugs.webkit.org/show_bug.cgi?id=44403
#
# Before 534.4 the text-shadow didn't get displayed when
# Up to 534.3 the text-shadow didn't get displayed when
# webkit-text-stroke was used. So use an offset text layer underneath.
# https://bugs.webkit.org/show_bug.cgi?id=19728
if webkitvers >= 533.3:
@ -498,7 +498,7 @@ def build_lyrics_css(item, webkitvers):
else:
outline = build_lyrics_outline_css(theme)
if theme.font_main_shadow:
if theme.font_main_outline and webkitvers < 534.3:
if theme.font_main_outline and webkitvers <= 534.3:
shadow = u'padding-left: %spx; padding-top: %spx;' % \
(int(theme.font_main_shadow_size) +
(int(theme.font_main_outline_size) * 2),
@ -564,7 +564,7 @@ def build_lyrics_format_css(theme, width, height):
theme.font_main_color, 100 + int(theme.font_main_line_adjustment),
left_margin, width, height)
if theme.font_main_outline:
if webkit_version() < 534.3:
if webkit_version() <= 534.3:
lyrics += u' letter-spacing: 1px;'
if theme.font_main_italics:
lyrics += u' font-style:italic; '
@ -588,7 +588,7 @@ def build_lyrics_html(item, webkitvers):
# display:table/display:table-cell are required for each lyric block.
lyrics = u''
theme = item.themedata
if webkitvers < 534.4 and theme and theme.font_main_outline:
if webkitvers <= 534.3 and theme and theme.font_main_outline:
lyrics += u'<div class="lyricstable">' \
u'<div id="lyricsshadow" style="opacity:1" ' \
u'class="lyricscell lyricsshadow"></div></div>'

View File

@ -32,6 +32,7 @@ to wait for the conversion to happen.
"""
import logging
import time
import Queue
from PyQt4 import QtCore
@ -42,8 +43,8 @@ log = logging.getLogger(__name__)
class ImageThread(QtCore.QThread):
"""
A special Qt thread class to speed up the display of text based frames.
This is threaded so it loads the frames in background
A special Qt thread class to speed up the display of images. This is
threaded so it loads the frames and generates byte stream in background.
"""
def __init__(self, manager):
QtCore.QThread.__init__(self, None)
@ -53,15 +54,75 @@ class ImageThread(QtCore.QThread):
"""
Run the thread.
"""
self.imageManager.process()
self.imageManager._process()
class Priority(object):
"""
Enumeration class for different priorities.
``Lowest``
Only the image's byte stream has to be generated. But neither the
``QImage`` nor the byte stream has been requested yet.
``Low``
Only the image's byte stream has to be generated. Because the image's
``QImage`` has been requested previously it is reasonable to assume that
the byte stream will be needed before the byte stream of other images
whose ``QImage`` were not generated due to a request.
``Normal``
The image's byte stream as well as the image has to be generated.
Neither the ``QImage`` nor the byte stream has been requested yet.
``High``
The image's byte stream as well as the image has to be generated. The
``QImage`` for this image has been requested.
**Note**, this priority is only set when the ``QImage`` has not been
generated yet.
``Urgent``
The image's byte stream as well as the image has to be generated. The
byte stream for this image has been requested.
**Note**, this priority is only set when the byte stream has not been
generated yet.
"""
Lowest = 4
Low = 3
Normal = 2
High = 1
Urgent = 0
class Image(object):
name = ''
path = ''
dirty = True
image = None
image_bytes = None
"""
This class represents an image. To mark an image as *dirty* set the instance
variables ``image`` and ``image_bytes`` to ``None`` and add the image object
to the queue of images to process.
"""
def __init__(self, name='', path=''):
self.name = name
self.path = path
self.image = None
self.image_bytes = None
self.priority = Priority.Normal
class PriorityQueue(Queue.PriorityQueue):
"""
Customised ``Queue.PriorityQueue``.
"""
def remove(self, item):
"""
Removes the given ``item`` from the queue.
``item``
The item to remove. This should be a tuple::
``(Priority, Image)``
"""
if item in self.queue:
self.queue.remove(item)
class ImageManager(QtCore.QObject):
@ -76,96 +137,120 @@ class ImageManager(QtCore.QObject):
self.width = current_screen[u'size'].width()
self.height = current_screen[u'size'].height()
self._cache = {}
self._thread_running = False
self._cache_dirty = False
self.image_thread = ImageThread(self)
self._imageThread = ImageThread(self)
self._conversion_queue = PriorityQueue()
def update_display(self):
"""
Screen has changed size so rebuild the cache to new size
Screen has changed size so rebuild the cache to new size.
"""
log.debug(u'update_display')
current_screen = ScreenList.get_instance().current
self.width = current_screen[u'size'].width()
self.height = current_screen[u'size'].height()
# mark the images as dirty for a rebuild
for key in self._cache.keys():
image = self._cache[key]
image.dirty = True
image.image = resize_image(image.path, self.width, self.height)
self._cache_dirty = True
# only one thread please
if not self._thread_running:
self.image_thread.start()
# Mark the images as dirty for a rebuild by setting the image and byte
# stream to None.
self._conversion_queue = PriorityQueue()
for key, image in self._cache.iteritems():
image.priority = Priority.Normal
image.image = None
image.image_bytes = None
self._conversion_queue.put((image.priority, image))
# We want only one thread.
if not self._imageThread.isRunning():
self._imageThread.start()
def get_image(self, name):
"""
Return the Qimage from the cache
Return the ``QImage`` from the cache. If not present wait for the
background thread to process it.
"""
log.debug(u'get_image %s' % name)
return self._cache[name].image
image = self._cache[name]
if image.image is None:
self._conversion_queue.remove((image.priority, image))
image.priority = Priority.High
self._conversion_queue.put((image.priority, image))
while image.image is None:
log.debug(u'get_image - waiting')
time.sleep(0.1)
return image.image
def get_image_bytes(self, name):
"""
Returns the byte string for an image
If not present wait for the background thread to process it.
Returns the byte string for an image. If not present wait for the
background thread to process it.
"""
log.debug(u'get_image_bytes %s' % name)
if not self._cache[name].image_bytes:
while self._cache[name].dirty:
image = self._cache[name]
if image.image_bytes is None:
self._conversion_queue.remove((image.priority, image))
image.priority = Priority.Urgent
self._conversion_queue.put((image.priority, image))
while image.image_bytes is None:
log.debug(u'get_image_bytes - waiting')
time.sleep(0.1)
return self._cache[name].image_bytes
return image.image_bytes
def del_image(self, name):
"""
Delete the Image from the Cache
Delete the Image from the cache.
"""
log.debug(u'del_image %s' % name)
if name in self._cache:
self._conversion_queue.remove(
(self._cache[name].priority, self._cache[name]))
del self._cache[name]
def add_image(self, name, path):
"""
Add image to cache if it is not already there
Add image to cache if it is not already there.
"""
log.debug(u'add_image %s:%s' % (name, path))
if not name in self._cache:
image = Image()
image.name = name
image.path = path
image.image = resize_image(path, self.width, self.height)
image = Image(name, path)
self._cache[name] = image
self._conversion_queue.put((image.priority, image))
else:
log.debug(u'Image in cache %s:%s' % (name, path))
self._cache_dirty = True
# only one thread please
if not self._thread_running:
self.image_thread.start()
# We want only one thread.
if not self._imageThread.isRunning():
self._imageThread.start()
def process(self):
def _process(self):
"""
Controls the processing called from a QThread
Controls the processing called from a ``QtCore.QThread``.
"""
log.debug(u'process - started')
self._thread_running = True
self.clean_cache()
# data loaded since we started ?
while self._cache_dirty:
log.debug(u'process - recycle')
self.clean_cache()
self._thread_running = False
log.debug(u'process - ended')
log.debug(u'_process - started')
while not self._conversion_queue.empty():
self._process_cache()
log.debug(u'_process - ended')
def clean_cache(self):
def _process_cache(self):
"""
Actually does the work.
"""
log.debug(u'clean_cache')
# we will clean the cache now
self._cache_dirty = False
for key in self._cache.keys():
image = self._cache[key]
if image.dirty:
image.image_bytes = image_to_byte(image.image)
image.dirty = False
log.debug(u'_process_cache')
image = self._conversion_queue.get()[1]
# Generate the QImage for the image.
if image.image is None:
image.image = resize_image(image.path, self.width, self.height)
# Set the priority to Lowest and stop here as we need to process
# more important images first.
if image.priority == Priority.Normal:
self._conversion_queue.remove((image.priority, image))
image.priority = Priority.Lowest
self._conversion_queue.put((image.priority, image))
return
# For image with high priority we set the priority to Low, as the
# byte stream might be needed earlier the byte stream of image with
# Normal priority. We stop here as we need to process more important
# images first.
elif image.priority == Priority.High:
self._conversion_queue.remove((image.priority, image))
image.priority = Priority.Low
self._conversion_queue.put((image.priority, image))
return
# Generate the byte stream for the image.
if image.image_bytes is None:
image.image_bytes = image_to_byte(image.image)

View File

@ -354,6 +354,7 @@ class ServiceItem(object):
replace an original version.
"""
self._uuid = other._uuid
self.notes = other.notes
def __eq__(self, other):
"""

View File

@ -29,6 +29,7 @@ import re
try:
import enchant
from enchant import DictNotFoundError
from enchant.errors import Error
ENCHANT_AVAILABLE = True
except ImportError:
ENCHANT_AVAILABLE = False
@ -56,7 +57,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
self.dictionary = enchant.Dict()
self.highlighter = Highlighter(self.document())
self.highlighter.spellingDictionary = self.dictionary
except DictNotFoundError:
except Error, DictNotFoundError:
ENCHANT_AVAILABLE = False
log.debug(u'Could not load default dictionary')

View File

@ -178,10 +178,6 @@ class HorizontalType(object):
Center = 2
Names = [u'left', u'right', u'center']
TranslatedNames = [
translate('OpenLP.ThemeWizard', 'Left'),
translate('OpenLP.ThemeWizard', 'Right'),
translate('OpenLP.ThemeWizard', 'Center')]
class VerticalType(object):
@ -193,7 +189,6 @@ class VerticalType(object):
Bottom = 2
Names = [u'top', u'middle', u'bottom']
TranslatedNames = [UiStrings().Top, UiStrings().Middle, UiStrings().Bottom]
BOOLEAN_LIST = [u'bold', u'italics', u'override', u'outline', u'shadow',

View File

@ -64,6 +64,7 @@ class UiStrings(object):
self.Cancel = translate('OpenLP.Ui', 'Cancel')
self.CCLINumberLabel = translate('OpenLP.Ui', 'CCLI number:')
self.CreateService = translate('OpenLP.Ui', 'Create a new service.')
self.ConfirmDelete = translate('OpenLP.Ui', 'Confirm Delete')
self.Continuous = translate('OpenLP.Ui', 'Continuous')
self.Default = unicode(translate('OpenLP.Ui', 'Default'))
self.Delete = translate('OpenLP.Ui', '&Delete')
@ -323,8 +324,9 @@ def shortcut_action(parent, name, shortcuts, function, icon=None, checked=None,
if checked is not None:
action.setCheckable(True)
action.setChecked(checked)
action.setShortcuts(shortcuts)
action.setShortcutContext(context)
if shortcuts:
action.setShortcuts(shortcuts)
action.setShortcutContext(context)
action_list = ActionList.get_instance()
action_list.add_action(action, category)
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), function)

View File

@ -35,13 +35,10 @@ class Ui_DisplayTagDialog(object):
def setupUi(self, displayTagDialog):
displayTagDialog.setObjectName(u'displayTagDialog')
displayTagDialog.resize(725, 548)
self.widget = QtGui.QWidget(displayTagDialog)
self.widget.setGeometry(QtCore.QRect(10, 10, 701, 521))
self.widget.setObjectName(u'widget')
self.listdataGridLayout = QtGui.QGridLayout(self.widget)
self.listdataGridLayout.setMargin(0)
self.listdataGridLayout = QtGui.QGridLayout(displayTagDialog)
self.listdataGridLayout.setMargin(8)
self.listdataGridLayout.setObjectName(u'listdataGridLayout')
self.tagTableWidget = QtGui.QTableWidget(self.widget)
self.tagTableWidget = QtGui.QTableWidget(displayTagDialog)
self.tagTableWidget.setHorizontalScrollBarPolicy(
QtCore.Qt.ScrollBarAlwaysOff)
self.tagTableWidget.setEditTriggers(
@ -55,6 +52,7 @@ class Ui_DisplayTagDialog(object):
self.tagTableWidget.setObjectName(u'tagTableWidget')
self.tagTableWidget.setColumnCount(4)
self.tagTableWidget.setRowCount(0)
self.tagTableWidget.horizontalHeader().setStretchLastSection(True)
item = QtGui.QTableWidgetItem()
self.tagTableWidget.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
@ -69,11 +67,11 @@ class Ui_DisplayTagDialog(object):
spacerItem = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.deletePushButton = QtGui.QPushButton(self.widget)
self.deletePushButton = QtGui.QPushButton(displayTagDialog)
self.deletePushButton.setObjectName(u'deletePushButton')
self.horizontalLayout.addWidget(self.deletePushButton)
self.listdataGridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1)
self.editGroupBox = QtGui.QGroupBox(self.widget)
self.editGroupBox = QtGui.QGroupBox(displayTagDialog)
self.editGroupBox.setObjectName(u'editGroupBox')
self.dataGridLayout = QtGui.QGridLayout(self.editGroupBox)
self.dataGridLayout.setObjectName(u'dataGridLayout')
@ -115,9 +113,8 @@ class Ui_DisplayTagDialog(object):
self.dataGridLayout.addWidget(self.savePushButton, 4, 2, 1, 1)
self.listdataGridLayout.addWidget(self.editGroupBox, 2, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(displayTagDialog)
closeButton = QtGui.QDialogButtonBox.Close
self.buttonBox.setObjectName('displayTagDialogButtonBox')
self.buttonBox.setStandardButtons(closeButton)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
self.listdataGridLayout.addWidget(self.buttonBox, 3, 0, 1, 1)
self.retranslateUi(displayTagDialog)
@ -148,6 +145,5 @@ class Ui_DisplayTagDialog(object):
self.tagTableWidget.horizontalHeaderItem(3).setText(
translate('OpenLP.DisplayTagDialog', 'End HTML'))
self.tagTableWidget.setColumnWidth(0, 120)
self.tagTableWidget.setColumnWidth(1, 40)
self.tagTableWidget.setColumnWidth(2, 240)
self.tagTableWidget.setColumnWidth(3, 240)
self.tagTableWidget.setColumnWidth(1, 80)
self.tagTableWidget.setColumnWidth(2, 330)

View File

@ -138,6 +138,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog):
# Highlight new row
self.tagTableWidget.selectRow(self.tagTableWidget.rowCount() - 1)
self.onRowSelected()
self.tagTableWidget.scrollToBottom()
def onDeletePushed(self):
"""

View File

@ -49,7 +49,10 @@ class MainDisplay(QtGui.QGraphicsView):
This is the display screen.
"""
def __init__(self, parent, image_manager, live):
QtGui.QGraphicsView.__init__(self, parent)
if live:
QtGui.QGraphicsView.__init__(self)
else:
QtGui.QGraphicsView.__init__(self, parent)
self.isLive = live
self.image_manager = image_manager
self.screens = ScreenList.get_instance()
@ -62,7 +65,8 @@ class MainDisplay(QtGui.QGraphicsView):
self.firstTime = True
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool |
QtCore.Qt.WindowStaysOnTopHint)
QtCore.Qt.WindowStaysOnTopHint |
QtCore.Qt.X11BypassWindowManagerHint)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
if self.isLive:
QtCore.QObject.connect(Receiver.get_receiver(),

View File

@ -27,6 +27,7 @@
import logging
import os
import sys
from tempfile import gettempdir
from PyQt4 import QtCore, QtGui
@ -64,6 +65,12 @@ MEDIA_MANAGER_STYLE = """
}
"""
PROGRESSBAR_STYLE = """
QProgressBar{
height: 10px;
}
"""
class Ui_MainWindow(object):
def setupUi(self, mainWindow):
"""
@ -92,6 +99,8 @@ class Ui_MainWindow(object):
self.previewController.panel.setVisible(previewVisible)
liveVisible = QtCore.QSettings().value(u'user interface/live panel',
QtCore.QVariant(True)).toBool()
panelLocked = QtCore.QSettings().value(u'user interface/lock panel',
QtCore.QVariant(False)).toBool()
self.liveController.panel.setVisible(liveVisible)
# Create menu
self.menuBar = QtGui.QMenuBar(mainWindow)
@ -127,6 +136,7 @@ class Ui_MainWindow(object):
self.statusBar.addPermanentWidget(self.loadProgressBar)
self.loadProgressBar.hide()
self.loadProgressBar.setValue(0)
self.loadProgressBar.setStyleSheet(PROGRESSBAR_STYLE)
self.defaultThemeLabel = QtGui.QLabel(self.statusBar)
self.defaultThemeLabel.setObjectName(u'defaultThemeLabel')
self.statusBar.addPermanentWidget(self.defaultThemeLabel)
@ -212,11 +222,15 @@ class Ui_MainWindow(object):
self.viewLivePanel = shortcut_action(mainWindow, u'viewLivePanel',
[QtGui.QKeySequence(u'F12')], self.setLivePanelVisibility,
checked=liveVisible, category=UiStrings().View)
action_list.add_category(UiStrings().ViewMode, CategoryOrder.standardMenu)
self.lockPanel = shortcut_action(mainWindow, u'lockPanel',
None, self.setLockPanel,
checked=panelLocked, category=None)
action_list.add_category(UiStrings().ViewMode,
CategoryOrder.standardMenu)
self.modeDefaultItem = checkable_action(
mainWindow, u'modeDefaultItem', category=UiStrings().ViewMode)
self.modeSetupItem = checkable_action(
mainWindow, u'modeLiveItem', category=UiStrings().ViewMode)
mainWindow, u'modeSetupItem', category=UiStrings().ViewMode)
self.modeLiveItem = checkable_action(
mainWindow, u'modeLiveItem', True, UiStrings().ViewMode)
self.modeGroup = QtGui.QActionGroup(mainWindow)
@ -232,7 +246,8 @@ class Ui_MainWindow(object):
category=UiStrings().Tools)
self.updateThemeImages = base_action(mainWindow,
u'updateThemeImages', category=UiStrings().Tools)
action_list.add_category(UiStrings().Settings, CategoryOrder.standardMenu)
action_list.add_category(UiStrings().Settings,
CategoryOrder.standardMenu)
self.settingsPluginListItem = shortcut_action(mainWindow,
u'settingsPluginListItem', [QtGui.QKeySequence(u'Alt+F7')],
self.onPluginItemClicked, u':/system/settings_plugin_list.png',
@ -268,7 +283,19 @@ class Ui_MainWindow(object):
self.helpAboutItem = shortcut_action(mainWindow, u'helpAboutItem',
[QtGui.QKeySequence(u'Ctrl+F1')], self.onHelpAboutItemClicked,
u':/system/system_about.png', category=UiStrings().Help)
self.helpOnlineHelpItem = shortcut_action(
if os.name == u'nt':
self.localHelpFile = os.path.join(
AppLocation.get_directory(AppLocation.AppDir), 'OpenLP.chm')
self.helpLocalHelpItem = shortcut_action(
mainWindow, u'helpLocalHelpItem', [QtGui.QKeySequence(u'F1')],
self.onHelpLocalHelpClicked, u':/system/system_about.png',
category=UiStrings().Help)
self.helpOnlineHelpItem = shortcut_action(
mainWindow, u'helpOnlineHelpItem', [QtGui.QKeySequence(u'Alt+F1')],
self.onHelpOnlineHelpClicked, u':/system/system_online_help.png',
category=UiStrings().Help)
else:
self.helpOnlineHelpItem = shortcut_action(
mainWindow, u'helpOnlineHelpItem', [QtGui.QKeySequence(u'F1')],
self.onHelpOnlineHelpClicked, u':/system/system_online_help.png',
category=UiStrings().Help)
@ -287,20 +314,33 @@ class Ui_MainWindow(object):
add_actions(self.viewMenu, (self.viewModeMenu.menuAction(),
None, self.viewMediaManagerItem, self.viewServiceManagerItem,
self.viewThemeManagerItem, None, self.viewPreviewPanel,
self.viewLivePanel))
self.viewLivePanel, None, self.lockPanel))
# i18n add Language Actions
add_actions(self.settingsLanguageMenu, (self.autoLanguageItem, None))
add_actions(self.settingsLanguageMenu, self.languageGroup.actions())
add_actions(self.settingsMenu, (self.settingsPluginListItem,
self.settingsLanguageMenu.menuAction(), None,
self.displayTagItem, self.settingsShortcutsItem,
self.settingsConfigureItem))
# Order things differently in OS X so that Preferences menu item in the
# app menu is correct (this gets picked up automatically by Qt).
if sys.platform == u'darwin':
add_actions(self.settingsMenu, (self.settingsPluginListItem,
self.settingsLanguageMenu.menuAction(), None,
self.settingsConfigureItem, self.settingsShortcutsItem,
self.displayTagItem))
else:
add_actions(self.settingsMenu, (self.settingsPluginListItem,
self.settingsLanguageMenu.menuAction(), None,
self.displayTagItem, self.settingsShortcutsItem,
self.settingsConfigureItem))
add_actions(self.toolsMenu, (self.toolsAddToolItem, None))
add_actions(self.toolsMenu, (self.toolsOpenDataFolder, None))
add_actions(self.toolsMenu, [self.updateThemeImages])
add_actions(self.helpMenu, (self.helpDocumentationItem,
add_actions(self.helpMenu, (self.helpDocumentationItem, None))
if os.name == u'nt':
add_actions(self.helpMenu, (self.helpLocalHelpItem,
self.helpOnlineHelpItem, None, self.helpWebSiteItem,
self.helpAboutItem))
else:
add_actions(self.helpMenu, (self.helpOnlineHelpItem, None,
self.helpWebSiteItem, self.helpAboutItem))
add_actions(self.menuBar, (self.fileMenu.menuAction(),
self.viewMenu.menuAction(), self.toolsMenu.menuAction(),
self.settingsMenu.menuAction(), self.helpMenu.menuAction()))
@ -316,6 +356,7 @@ class Ui_MainWindow(object):
self.importLanguageItem.setVisible(False)
self.exportLanguageItem.setVisible(False)
self.helpDocumentationItem.setVisible(False)
self.setLockPanel(panelLocked)
def retranslateUi(self, mainWindow):
"""
@ -405,6 +446,10 @@ class Ui_MainWindow(object):
translate('OpenLP.MainWindow', '&Live Panel'))
self.viewLivePanel.setToolTip(
translate('OpenLP.MainWindow', 'Toggle Live Panel'))
self.lockPanel.setText(
translate('OpenLP.MainWindow', 'L&ock Panels'))
self.lockPanel.setStatusTip(
translate('OpenLP.MainWindow', 'Prevent the panels being moved.'))
self.viewLivePanel.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibility of the live panel.'))
self.settingsPluginListItem.setText(translate('OpenLP.MainWindow',
@ -416,6 +461,9 @@ class Ui_MainWindow(object):
self.helpAboutItem.setText(translate('OpenLP.MainWindow', '&About'))
self.helpAboutItem.setStatusTip(
translate('OpenLP.MainWindow', 'More information about OpenLP'))
if os.name == u'nt':
self.helpLocalHelpItem.setText(
translate('OpenLP.MainWindow', '&Help'))
self.helpOnlineHelpItem.setText(
translate('OpenLP.MainWindow', '&Online Help'))
self.helpWebSiteItem.setText(
@ -644,7 +692,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.QVariant(False)).toBool():
self.serviceManagerContents.loadLastFile()
view_mode = QtCore.QSettings().value(u'%s/view mode' % \
self.generalSettingsSection, u'default')
self.generalSettingsSection, u'default').toString()
if view_mode == u'default':
self.modeDefaultItem.setChecked(True)
elif view_mode == u'setup':
@ -714,6 +762,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
import webbrowser
webbrowser.open_new(u'http://openlp.org/')
def onHelpLocalHelpClicked(self):
"""
Load the local OpenLP help file
"""
os.startfile(self.localHelpFile)
def onHelpOnlineHelpClicked(self):
"""
Load the online OpenLP manual
@ -927,7 +981,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.mediaManagerDock.setVisible(not self.mediaManagerDock.isVisible())
def toggleServiceManager(self):
self.serviceManagerDock.setVisible(not self.serviceManagerDock.isVisible())
self.serviceManagerDock.setVisible(
not self.serviceManagerDock.isVisible())
def toggleThemeManager(self):
self.themeManagerDock.setVisible(not self.themeManagerDock.isVisible())
@ -947,6 +1002,37 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.QVariant(visible))
self.viewPreviewPanel.setChecked(visible)
def setLockPanel(self, lock):
"""
Sets the ability to stop the toolbars being changed.
"""
if lock:
self.themeManagerDock.setFeatures(
QtGui.QDockWidget.NoDockWidgetFeatures)
self.serviceManagerDock.setFeatures(
QtGui.QDockWidget.NoDockWidgetFeatures)
self.mediaManagerDock.setFeatures(
QtGui.QDockWidget.NoDockWidgetFeatures)
self.viewMediaManagerItem.setEnabled(False)
self.viewServiceManagerItem.setEnabled(False)
self.viewThemeManagerItem.setEnabled(False)
self.viewPreviewPanel.setEnabled(False)
self.viewLivePanel.setEnabled(False)
else:
self.themeManagerDock.setFeatures(
QtGui.QDockWidget.AllDockWidgetFeatures)
self.serviceManagerDock.setFeatures(
QtGui.QDockWidget.AllDockWidgetFeatures)
self.mediaManagerDock.setFeatures(
QtGui.QDockWidget.AllDockWidgetFeatures)
self.viewMediaManagerItem.setEnabled(True)
self.viewServiceManagerItem.setEnabled(True)
self.viewThemeManagerItem.setEnabled(True)
self.viewPreviewPanel.setEnabled(True)
self.viewLivePanel.setEnabled(True)
QtCore.QSettings().setValue(u'user interface/lock panel',
QtCore.QVariant(lock))
def setLivePanelVisibility(self, visible):
"""
Sets the visibility of the live panel including saving the setting and
@ -977,6 +1063,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.restoreGeometry(
settings.value(u'main window geometry').toByteArray())
self.restoreState(settings.value(u'main window state').toByteArray())
self.liveController.splitter.restoreState(
settings.value(u'live splitter geometry').toByteArray())
self.previewController.splitter.restoreState(
settings.value(u'preview splitter geometry').toByteArray())
self.controlSplitter.restoreState(
settings.value(u'mainwindow splitter geometry').toByteArray())
settings.endGroup()
def saveSettings(self):
@ -997,6 +1090,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.QVariant(self.saveState()))
settings.setValue(u'main window geometry',
QtCore.QVariant(self.saveGeometry()))
settings.setValue(u'live splitter geometry',
QtCore.QVariant(self.liveController.splitter.saveState()))
settings.setValue(u'preview splitter geometry',
QtCore.QVariant(self.previewController.splitter.saveState()))
settings.setValue(u'mainwindow splitter geometry',
QtCore.QVariant(self.controlSplitter.saveState()))
settings.endGroup()
def updateFileMenu(self):

View File

@ -41,11 +41,6 @@ class ZoomSize(object):
Fifty = 4
TwentyFive = 5
Sizes = [
translate('OpenLP.PrintServiceDialog', 'Fit Page'),
translate('OpenLP.PrintServiceDialog', 'Fit Width'),
u'100%', u'75%', u'50%', u'25%']
class Ui_PrintServiceDialog(object):
def setupUi(self, printServiceDialog):
@ -59,18 +54,14 @@ class Ui_PrintServiceDialog(object):
self.toolbar.setIconSize(QtCore.QSize(22, 22))
self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
self.printButton = self.toolbar.addAction(
build_icon(u':/general/general_print.png'), 'Print')
build_icon(u':/general/general_print.png'),
translate('OpenLP.PrintServiceForm', 'Print'))
self.optionsButton = QtGui.QToolButton(self.toolbar)
self.optionsButton.setText(translate('OpenLP.PrintServiceForm',
'Options'))
self.optionsButton.setToolButtonStyle(
QtCore.Qt.ToolButtonTextBesideIcon)
self.optionsButton.setIcon(build_icon(u':/system/system_configure.png'))
self.optionsButton.setCheckable(True)
self.toolbar.addWidget(self.optionsButton)
self.closeButton = self.toolbar.addAction(
build_icon(u':/system/system_close.png'),
translate('OpenLP.PrintServiceForm', 'Close'))
self.toolbar.addSeparator()
self.plainCopy = self.toolbar.addAction(
build_icon(u':/system/system_edit_copy.png'),
@ -81,24 +72,18 @@ class Ui_PrintServiceDialog(object):
self.toolbar.addSeparator()
self.zoomInButton = QtGui.QToolButton(self.toolbar)
self.zoomInButton.setIcon(build_icon(u':/general/general_zoom_in.png'))
self.zoomInButton.setToolTip(translate('OpenLP.PrintServiceForm',
'Zoom In'))
self.zoomInButton.setObjectName(u'zoomInButton')
self.zoomInButton.setIconSize(QtCore.QSize(22, 22))
self.toolbar.addWidget(self.zoomInButton)
self.zoomOutButton = QtGui.QToolButton(self.toolbar)
self.zoomOutButton.setIcon(
build_icon(u':/general/general_zoom_out.png'))
self.zoomOutButton.setToolTip(translate('OpenLP.PrintServiceForm',
'Zoom Out'))
self.zoomOutButton.setObjectName(u'zoomOutButton')
self.zoomOutButton.setIconSize(QtCore.QSize(22, 22))
self.toolbar.addWidget(self.zoomOutButton)
self.zoomOriginalButton = QtGui.QToolButton(self.toolbar)
self.zoomOriginalButton.setIcon(
build_icon(u':/general/general_zoom_original.png'))
self.zoomOriginalButton.setToolTip(translate('OpenLP.PrintServiceForm',
'Zoom Original'))
self.zoomOriginalButton.setObjectName(u'zoomOriginalButton')
self.zoomOriginalButton.setIconSize(QtCore.QSize(22, 22))
self.toolbar.addWidget(self.zoomOriginalButton)
@ -116,20 +101,17 @@ class Ui_PrintServiceDialog(object):
self.optionsLayout.setContentsMargins(8, 8, 8, 8)
self.titleLabel = QtGui.QLabel(self.optionsWidget)
self.titleLabel.setObjectName(u'titleLabel')
self.titleLabel.setText(u'Title:')
self.optionsLayout.addWidget(self.titleLabel)
self.titleLineEdit = QtGui.QLineEdit(self.optionsWidget)
self.titleLineEdit.setObjectName(u'titleLineEdit')
self.optionsLayout.addWidget(self.titleLineEdit)
self.footerLabel = QtGui.QLabel(self.optionsWidget)
self.footerLabel.setObjectName(u'footerLabel')
self.footerLabel.setText(u'Custom Footer Text:')
self.optionsLayout.addWidget(self.footerLabel)
self.footerTextEdit = SpellTextEdit(self.optionsWidget)
self.footerTextEdit.setObjectName(u'footerTextEdit')
self.optionsLayout.addWidget(self.footerTextEdit)
self.optionsGroupBox = QtGui.QGroupBox(
translate('OpenLP.PrintServiceForm','Other Options'))
self.optionsGroupBox = QtGui.QGroupBox()
self.groupLayout = QtGui.QVBoxLayout()
self.slideTextCheckBox = QtGui.QCheckBox()
self.groupLayout.addWidget(self.slideTextCheckBox)
@ -150,6 +132,19 @@ class Ui_PrintServiceDialog(object):
def retranslateUi(self, printServiceDialog):
printServiceDialog.setWindowTitle(UiStrings().PrintService)
self.zoomOutButton.setToolTip(translate('OpenLP.PrintServiceForm',
'Zoom Out'))
self.zoomOriginalButton.setToolTip(translate('OpenLP.PrintServiceForm',
'Zoom Original'))
self.zoomInButton.setToolTip(translate('OpenLP.PrintServiceForm',
'Zoom In'))
self.optionsButton.setText(translate('OpenLP.PrintServiceForm',
'Options'))
self.titleLabel.setText(translate('OpenLP.PrintServiceForm', 'Title:'))
self.footerLabel.setText(translate('OpenLP.PrintServiceForm',
'Custom Footer Text:'))
self.optionsGroupBox.setTitle(
translate('OpenLP.PrintServiceForm','Other Options'))
self.slideTextCheckBox.setText(translate('OpenLP.PrintServiceForm',
'Include slide text if available'))
self.pageBreakAfterText.setText(translate('OpenLP.PrintServiceForm',
@ -160,10 +155,13 @@ class Ui_PrintServiceDialog(object):
'Include play length of media items'))
self.titleLineEdit.setText(translate('OpenLP.PrintServiceForm',
'Service Sheet'))
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Page])
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Width])
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.OneHundred])
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.SeventyFive])
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Fifty])
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.TwentyFive])
# Do not change the order.
self.zoomComboBox.addItems([
translate('OpenLP.PrintServiceDialog', 'Fit Page'),
translate('OpenLP.PrintServiceDialog', 'Fit Width'),
u'100%',
u'75%',
u'50%',
u'25%']
)

View File

@ -137,8 +137,6 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
# Signals
QtCore.QObject.connect(self.printButton,
QtCore.SIGNAL(u'triggered()'), self.printServiceOrder)
QtCore.QObject.connect(self.closeButton,
QtCore.SIGNAL(u'triggered()'), self.accept)
QtCore.QObject.connect(self.zoomOutButton,
QtCore.SIGNAL(u'clicked()'), self.zoomOut)
QtCore.QObject.connect(self.zoomInButton,
@ -326,8 +324,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
"""
Copies the display text to the clipboard as plain text
"""
self.mainWindow.clipboard.setText(
self.document.toPlainText())
self.mainWindow.clipboard.setText(self.document.toPlainText())
def copyHtmlText(self):
"""

View File

@ -832,7 +832,7 @@ class ServiceManager(QtGui.QWidget):
"""
for item in self.serviceItems:
item[u'expanded'] = False
self.regenerateServiceItems()
self.serviceManagerList.collapseAll()
def collapsed(self, item):
"""
@ -848,7 +848,7 @@ class ServiceManager(QtGui.QWidget):
"""
for item in self.serviceItems:
item[u'expanded'] = True
self.regenerateServiceItems()
self.serviceManagerList.expandAll()
def expanded(self, item):
"""
@ -856,7 +856,7 @@ class ServiceManager(QtGui.QWidget):
correct state.
"""
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
self.serviceItems[pos -1 ][u'expanded'] = True
self.serviceItems[pos - 1][u'expanded'] = True
def onServiceTop(self):
"""

View File

@ -42,6 +42,10 @@ class ServiceNoteForm(QtGui.QDialog):
self.setupUi()
self.retranslateUi()
def exec_(self):
self.textEdit.setFocus()
return QtGui.QDialog.exec_(self)
def setupUi(self):
self.setObjectName(u'serviceNoteEdit')
self.dialogLayout = QtGui.QVBoxLayout(self)

View File

@ -98,6 +98,9 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
if event.modifiers() & QtCore.Qt.ShiftModifier == \
QtCore.Qt.ShiftModifier:
key_string = u'Shift+' + key_string
if event.modifiers() & QtCore.Qt.MetaModifier == \
QtCore.Qt.MetaModifier:
key_string = u'Meta+' + key_string
key_sequence = QtGui.QKeySequence(key_string)
if self._validiate_shortcut(self._currentItemAction(), key_sequence):
if self.primaryPushButton.isChecked():

View File

@ -500,7 +500,9 @@ class SlideController(QtGui.QWidget):
"""
Allows the live toolbar to be customised
"""
self.toolbar.setVisible(True)
# Work-around for OS X, hide and then show the toolbar
# See bug #791050
self.toolbar.hide()
self.mediabar.setVisible(False)
self.toolbar.makeWidgetsInvisible([u'Song Menu'])
self.toolbar.makeWidgetsInvisible(self.loopList)
@ -515,12 +517,18 @@ class SlideController(QtGui.QWidget):
if item.is_media():
self.toolbar.setVisible(False)
self.mediabar.setVisible(True)
else:
# Work-around for OS X, hide and then show the toolbar
# See bug #791050
self.toolbar.show()
def enablePreviewToolBar(self, item):
"""
Allows the Preview toolbar to be customised
"""
self.toolbar.setVisible(True)
# Work-around for OS X, hide and then show the toolbar
# See bug #791050
self.toolbar.hide()
self.mediabar.setVisible(False)
self.toolbar.makeWidgetsInvisible(self.songEditList)
if item.is_capable(ItemCapabilities.AllowsEdit) and item.from_plugin:
@ -529,6 +537,10 @@ class SlideController(QtGui.QWidget):
self.toolbar.setVisible(False)
self.mediabar.setVisible(True)
self.volumeSlider.setAudioOutput(self.audio)
if not item.is_media():
# Work-around for OS X, hide and then show the toolbar
# See bug #791050
self.toolbar.show()
def refreshServiceItem(self):
"""
@ -625,9 +637,7 @@ class SlideController(QtGui.QWidget):
label.setMargin(4)
label.setScaledContents(True)
if self.serviceItem.is_command():
image = resize_image(frame[u'image'],
self.parent().renderer.width,
self.parent().renderer.height)
image = QtGui.QImage(frame[u'image'])
else:
# If current slide set background to image
if framenumber == slideno:

View File

@ -299,7 +299,9 @@ class ThemeManager(QtGui.QWidget):
"""
item = self.themeListWidget.currentItem()
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
self.fileRenameForm.fileNameEdit.setText(oldThemeName)
self.fileRenameForm.fileNameEdit.setText(
unicode(translate('OpenLP.ThemeManager',
'Copy of %s','Copy of <theme name>')) % oldThemeName)
if self.fileRenameForm.exec_(True):
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
if self.checkIfThemeExists(newThemeName):

View File

@ -190,6 +190,14 @@ class OpenLPWizard(QtGui.QWizard):
self.preWizard()
self.performWizard()
self.postWizard()
else:
self.customPageChanged(pageId)
def customPageChanged(self, pageId):
"""
Called when changing to a page other than the progress page
"""
pass
def onErrorCopyToButtonClicked(self):
"""

View File

@ -46,7 +46,7 @@ class CustomPlugin(Plugin):
log.info(u'Custom Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Custom Slide', plugin_helpers,
Plugin.__init__(self, u'Custom', plugin_helpers,
CustomMediaItem, CustomTab)
self.weight = -5
self.manager = Manager(u'custom', init_schema)

View File

@ -93,7 +93,6 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
self.titleEdit.setText(u'')
self.creditEdit.setText(u'')
self.themeComboBox.setCurrentIndex(0)
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
else:
self.customSlide = self.manager.get_object(CustomSlide, id)
self.titleEdit.setText(self.customSlide.title)
@ -104,10 +103,9 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
self.slideListView.addItem(slide[1])
theme = self.customSlide.theme_name
find_and_set_in_combo_box(self.themeComboBox, theme)
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
# If not preview hide the preview button.
self.previewButton.setVisible(False)
if preview:
self.previewButton.setVisible(True)
self.previewButton.setVisible(preview)
def reject(self):
Receiver.send_message(u'custom_edit_clear')

View File

@ -200,6 +200,17 @@ class CustomMediaItem(MediaManagerItem):
Remove a custom item from the list and database
"""
if check_item_selected(self.listView, UiStrings().SelectDelete):
items = self.listView.selectedIndexes()
if QtGui.QMessageBox.question(self,
UiStrings().ConfirmDelete,
translate('CustomPlugin.MediaItem',
'Are you sure you want to delete the %n selected custom'
' slides(s)?', '',
QtCore.QCoreApplication.CodecForTr, len(items)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
return
row_list = [item.row() for item in self.listView.selectedIndexes()]
row_list.sort(reverse=True)
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]

View File

@ -95,6 +95,8 @@ class Controller(object):
if self.is_live:
self.doc.start_presentation()
if self.doc.slidenumber > 1:
if self.doc.slidenumber > self.doc.get_slide_count():
self.doc.slidenumber = self.doc.get_slide_count()
self.doc.goto_slide(self.doc.slidenumber)
def slide(self, slide):
@ -150,6 +152,11 @@ class Controller(object):
if self.doc.slidenumber < self.doc.get_slide_count():
self.doc.slidenumber = self.doc.slidenumber + 1
return
# The "End of slideshow" screen is after the last slide
# Note, we can't just stop on the last slide, since it may
# contain animations that need to be stepped through.
if self.doc.slidenumber > self.doc.get_slide_count():
return
self.activate()
self.doc.next_step()
self.doc.poll_slidenumber(self.is_live)

View File

@ -68,6 +68,8 @@ class Ui_EditSongDialog(object):
QtCore.Qt.AlignTop)
self.verseListWidget = QtGui.QTableWidget(self.lyricsTab)
self.verseListWidget.horizontalHeader().setVisible(False)
self.verseListWidget.horizontalHeader().setStretchLastSection(True)
self.verseListWidget.horizontalHeader().setMinimumSectionSize(16)
self.verseListWidget.setAlternatingRowColors(True)
self.verseListWidget.setColumnCount(1)
self.verseListWidget.setSelectionBehavior(

View File

@ -209,9 +209,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.alternativeEdit.setText(u'')
if self.song.song_book_id != 0:
book_name = self.manager.get_object(Book, self.song.song_book_id)
find_and_set_in_combo_box(self.songBookComboBox, unicode(book_name.name))
find_and_set_in_combo_box(
self.songBookComboBox, unicode(book_name.name))
if self.song.theme_name:
find_and_set_in_combo_box(self.themeComboBox, unicode(self.song.theme_name))
find_and_set_in_combo_box(
self.themeComboBox, unicode(self.song.theme_name))
if self.song.copyright:
self.copyrightEdit.setText(self.song.copyright)
else:
@ -233,7 +235,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
# lazy xml migration for now
self.verseListWidget.clear()
self.verseListWidget.setRowCount(0)
self.verseListWidget.setColumnWidth(0, self.width)
# This is just because occasionally the lyrics come back as a "buffer"
if isinstance(self.song.lyrics, buffer):
self.song.lyrics = unicode(self.song.lyrics)

View File

@ -185,7 +185,14 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
if self.hasSingleVerse:
value = unicode(self.getVerse()[0])
else:
value = self.getVerse()[0].split(u'\n')[1]
log.debug(unicode(self.getVerse()[0]).split(u'\n'))
value = unicode(self.getVerse()[0]).split(u'\n')[1]
if len(value) == 0:
lines = unicode(self.getVerse()[0]).split(u'\n')
index = 2
while index < len(lines) and len(value) == 0:
value = lines[index]
index += 1
if len(value) == 0:
critical_error_message_box(
message=translate('SongsPlugin.EditSongForm',

View File

@ -343,6 +343,13 @@ class SongImportForm(OpenLPWizard):
self.formatSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)
def customPageChanged(self, pageId):
"""
Called when changing to a page other than the progress page
"""
if self.page(pageId) == self.sourcePage:
self.onCurrentIndexChanged(self.formatStack.currentIndex())
def validateCurrentPage(self):
"""
Validate the current page before moving on to the next page.

View File

@ -73,15 +73,21 @@ class EasiSlidesImport(SongImport):
def _parse_song(self, song):
self._success = True
self._add_unicode_attribute(u'title', song.Title1, True)
self._add_unicode_attribute(u'alternate_title', song.Title2)
self._add_unicode_attribute(u'song_number', song.SongNumber)
if hasattr(song, u'Title2'):
self._add_unicode_attribute(u'alternate_title', song.Title2)
if hasattr(song, u'SongNumber'):
self._add_unicode_attribute(u'song_number', song.SongNumber)
if self.song_number == u'0':
self.song_number = u''
self._add_authors(song)
self._add_copyright(song.Copyright)
self._add_copyright(song.LicenceAdmin1)
self._add_copyright(song.LicenceAdmin2)
self._add_unicode_attribute(u'song_book_name', song.BookReference)
if hasattr(song, u'Copyright'):
self._add_copyright(song.Copyright)
if hasattr(song, u'LicenceAdmin1'):
self._add_copyright(song.LicenceAdmin1)
if hasattr(song, u'LicenceAdmin2'):
self._add_copyright(song.LicenceAdmin2)
if hasattr(song, u'BookReference'):
self._add_unicode_attribute(u'song_book_name', song.BookReference)
self._parse_and_add_lyrics(song)
if self._success:
if not self.finish():

View File

@ -353,13 +353,13 @@ class SongMediaItem(MediaManagerItem):
if check_item_selected(self.listView, UiStrings().SelectDelete):
items = self.listView.selectedIndexes()
if QtGui.QMessageBox.question(self,
translate('SongsPlugin.MediaItem', 'Delete Song(s)?'),
UiStrings().ConfirmDelete,
translate('SongsPlugin.MediaItem',
'Are you sure you want to delete the %n selected song(s)?', '',
QtCore.QCoreApplication.CodecForTr, len(items)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok |
QtGui.QMessageBox.Cancel),
QtGui.QMessageBox.Ok) == QtGui.QMessageBox.Cancel:
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
return
for item in items:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
@ -467,23 +467,20 @@ class SongMediaItem(MediaManagerItem):
search_results = self.plugin.manager.get_all_objects(Song,
Song.search_title == item.data_string[u'title'],
Song.search_title.asc())
author_list = item.data_string[u'authors'].split(u', ')
editId = 0
add_song = True
if search_results:
for song in search_results:
author_list = item.data_string[u'authors']
same_authors = True
# If the author counts are different, we do not have to do any
# further checking.
if len(song.authors) == len(author_list):
for author in song.authors:
if author.display_name not in author_list:
same_authors = False
else:
same_authors = False
# All authors are the same, so we can stop here and the song
# does not have to be saved.
if same_authors:
for author in song.authors:
if author.display_name in author_list:
author_list = author_list.replace(author.display_name,
u'', 1)
else:
same_authors = False
break
if same_authors and author_list.strip(u', ') == u'':
add_song = False
editId = song.id
break

View File

@ -37,14 +37,16 @@ log = logging.getLogger(__name__)
if os.name == u'nt':
from win32com.client import Dispatch
PAGE_BEFORE = 4
PAGE_AFTER = 5
PAGE_BOTH = 6
NoConnectException = Exception
else:
import uno
from com.sun.star.connection import NoConnectException
try:
from com.sun.star.style.BreakType import PAGE_BEFORE, PAGE_AFTER, PAGE_BOTH
except ImportError:
PAGE_BEFORE = 4
PAGE_AFTER = 5
PAGE_BOTH = 6
class OooImport(SongImport):
"""

View File

@ -70,10 +70,12 @@ class OpenLyricsExport(object):
song.title)
xml = openLyrics.song_to_xml(song)
tree = etree.ElementTree(etree.fromstring(xml))
filename = u'%s (%s).xml' % (song.title,
filename = u'%s (%s)' % (song.title,
u', '.join([author.display_name for author in song.authors]))
filename = re.sub(
r'[/\\?*|<>\[\]":<>+%]+', u'_', filename).strip(u'_')
# Ensure the filename isn't too long for some filesystems
filename = u'%s.xml' % filename[0:250 - len(self.save_path)]
# Pass a file object, because lxml does not cope with some special
# characters in the path (see lp:757673 and lp:744337).
tree.write(open(os.path.join(self.save_path, filename), u'w'),

View File

@ -41,20 +41,23 @@ from oooimport import OooImport
log = logging.getLogger(__name__)
if os.name == u'nt':
BOLD = 150.0
ITALIC = 2
from oooimport import PAGE_BEFORE, PAGE_AFTER, PAGE_BOTH
RuntimeException = Exception
else:
try:
from com.sun.star.awt.FontWeight import BOLD
from com.sun.star.awt.FontSlant import ITALIC
from com.sun.star.style.BreakType import PAGE_BEFORE, PAGE_AFTER, \
PAGE_BOTH
from com.sun.star.uno import RuntimeException
except ImportError:
pass
try:
from com.sun.star.awt.FontWeight import BOLD
except ImportError:
BOLD = 150.0
try:
from com.sun.star.awt.FontSlant import ITALIC
except ImportError:
ITALIC = 2
class SofImport(OooImport):
"""

View File

@ -165,8 +165,9 @@ class SongShowPlusImport(SongImport):
elif blockKey == VERSE_ORDER:
verseTag = self.toOpenLPVerseTag(data, True)
if verseTag:
self.sspVerseOrderList.append(unicode(verseTag,
u'cp1252'))
if not isinstance(verseTag, unicode):
verseTag = unicode(verseTag, u'cp1252')
self.sspVerseOrderList.append(verseTag)
elif blockKey == SONG_BOOK:
self.song_book_name = unicode(data, u'cp1252')
elif blockKey == SONG_NUMBER:

View File

@ -527,8 +527,7 @@ class OpenLyrics(object):
book = Book.populate(name=bookname, publisher=u'')
self.manager.save_object(book)
song.song_book_id = book.id
if hasattr(songbook, u'entry'):
song.song_number = self._get(songbook, u'entry')
song.song_number = self._get(songbook, u'entry')
# We only support one song book, so take the first one.
break

File diff suppressed because it is too large Load Diff

View File

@ -1,295 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DisplaysDialog</class>
<widget class="QWidget" name="DisplaysDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>620</width>
<height>716</height>
</rect>
</property>
<property name="windowTitle">
<string>Amend Display Settings</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>40</y>
<width>241</width>
<height>79</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="CurrentGroupBox">
<property name="title">
<string>Default Settings</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLabel" name="XLabel">
<property name="text">
<string>X</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="Xpos">
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QLabel" name="YLabel">
<property name="text">
<string>Y</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="Ypos">
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QLabel" name="HeightLabel">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Height</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="Height">
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QLabel" name="WidthLabel">
<property name="text">
<string>Width</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="Width">
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="CurrentGroupBox_2">
<property name="geometry">
<rect>
<x>0</x>
<y>130</y>
<width>248</width>
<height>87</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>500</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>Amend Settings</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="XAmendLabel">
<property name="text">
<string>X</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="XposEdit">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="maxLength">
<number>4</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="YAmendLabel">
<property name="text">
<string>Y</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="YposEdit">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="maxLength">
<number>4</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="HeightAmendLabel">
<property name="text">
<string>Height</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="HeightEdit">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="maxLength">
<number>4</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QLabel" name="WidthAmendLabel">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Width</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="WidthEdit">
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
<zorder>layoutWidget</zorder>
<zorder>YAmendLabel</zorder>
<zorder>HeightAmendLabel</zorder>
<zorder>WidthAmendLabel</zorder>
<zorder>YAmendLabel</zorder>
</widget>
<widget class="QCheckBox" name="OverrideCheckBox">
<property name="geometry">
<rect>
<x>0</x>
<y>10</y>
<width>191</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Override Output Display</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -242,10 +242,10 @@ def copy_windows_files():
os.path.join(dist_path, u'LICENSE.txt'))
copy(os.path.join(winres_path, u'psvince.dll'),
os.path.join(dist_path, u'psvince.dll'))
if os.path.isfile(os.path.join(helpfile_path, u'Openlp.chm')):
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'))
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'