forked from openlp/openlp
Core lib
This commit is contained in:
parent
ef24580493
commit
ae576251bd
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -114,8 +114,7 @@ class Settings(QtCore.QSettings):
|
|||
def __init__(self, *args):
|
||||
if not args and Settings.__filePath__ and \
|
||||
Settings.defaultFormat() == Settings.IniFormat:
|
||||
QtCore.QSettings.__init__(self, Settings.__filePath__,
|
||||
Settings.IniFormat)
|
||||
QtCore.QSettings.__init__(self, Settings.__filePath__, Settings.IniFormat)
|
||||
else:
|
||||
QtCore.QSettings.__init__(self, *args)
|
||||
|
||||
|
@ -236,14 +235,11 @@ def build_icon(icon):
|
|||
button_icon = icon
|
||||
elif isinstance(icon, basestring):
|
||||
if icon.startswith(u':/'):
|
||||
button_icon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
|
||||
QtGui.QIcon.Off)
|
||||
button_icon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
else:
|
||||
button_icon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
button_icon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
elif isinstance(icon, QtGui.QImage):
|
||||
button_icon.addPixmap(QtGui.QPixmap.fromImage(icon),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
button_icon.addPixmap(QtGui.QPixmap.fromImage(icon), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
return button_icon
|
||||
|
||||
|
||||
|
@ -361,12 +357,10 @@ def resize_image(image_path, width, height, background=u'#000000'):
|
|||
real_width = preview.width()
|
||||
real_height = preview.height()
|
||||
# and move it to the centre of the preview space
|
||||
new_image = QtGui.QImage(width, height,
|
||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||
new_image = QtGui.QImage(width, height, QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||
painter = QtGui.QPainter(new_image)
|
||||
painter.fillRect(new_image.rect(), QtGui.QColor(background))
|
||||
painter.drawImage(
|
||||
(width - real_width) / 2, (height - real_height) / 2, preview)
|
||||
painter.drawImage((width - real_width) / 2, (height - real_height) / 2, preview)
|
||||
return new_image
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -36,8 +36,7 @@ from urllib import quote_plus as urlquote
|
|||
|
||||
from PyQt4 import QtCore
|
||||
from sqlalchemy import Table, MetaData, Column, types, create_engine
|
||||
from sqlalchemy.exc import SQLAlchemyError, InvalidRequestError, DBAPIError, \
|
||||
OperationalError
|
||||
from sqlalchemy.exc import SQLAlchemyError, InvalidRequestError, DBAPIError, OperationalError
|
||||
from sqlalchemy.orm import scoped_session, sessionmaker, mapper
|
||||
from sqlalchemy.pool import NullPool
|
||||
|
||||
|
@ -111,8 +110,7 @@ def upgrade_db(url, upgrade):
|
|||
while hasattr(upgrade, u'upgrade_%d' % version):
|
||||
log.debug(u'Running upgrade_%d', version)
|
||||
try:
|
||||
getattr(upgrade, u'upgrade_%d' % version) \
|
||||
(session, metadata, tables)
|
||||
getattr(upgrade, u'upgrade_%d' % version) (session, metadata, tables)
|
||||
except (SQLAlchemyError, DBAPIError):
|
||||
log.exception(u'Could not run database upgrade script '
|
||||
'"upgrade_%s", upgrade process has been halted.', version)
|
||||
|
@ -140,11 +138,9 @@ def delete_database(plugin_name, db_file_name=None):
|
|||
"""
|
||||
db_file_path = None
|
||||
if db_file_name:
|
||||
db_file_path = os.path.join(
|
||||
AppLocation.get_section_data_path(plugin_name), db_file_name)
|
||||
db_file_path = os.path.join(AppLocation.get_section_data_path(plugin_name), db_file_name)
|
||||
else:
|
||||
db_file_path = os.path.join(
|
||||
AppLocation.get_section_data_path(plugin_name), plugin_name)
|
||||
db_file_path = os.path.join(AppLocation.get_section_data_path(plugin_name), plugin_name)
|
||||
return delete_file(db_file_path)
|
||||
|
||||
|
||||
|
@ -193,12 +189,9 @@ class Manager(object):
|
|||
db_type = settings.value(u'db type', u'sqlite')
|
||||
if db_type == u'sqlite':
|
||||
if db_file_name:
|
||||
self.db_url = u'sqlite:///%s/%s' % (
|
||||
AppLocation.get_section_data_path(plugin_name),
|
||||
db_file_name)
|
||||
self.db_url = u'sqlite:///%s/%s' % (AppLocation.get_section_data_path(plugin_name), db_file_name)
|
||||
else:
|
||||
self.db_url = u'sqlite:///%s/%s.sqlite' % (
|
||||
AppLocation.get_section_data_path(plugin_name), plugin_name)
|
||||
self.db_url = u'sqlite:///%s/%s.sqlite' % (AppLocation.get_section_data_path(plugin_name), plugin_name)
|
||||
else:
|
||||
self.db_url = u'%s://%s:%s@%s/%s' % (db_type,
|
||||
urlquote(settings.value(u'db username', u'')),
|
||||
|
@ -226,10 +219,8 @@ class Manager(object):
|
|||
self.session = init_schema(self.db_url)
|
||||
except (SQLAlchemyError, DBAPIError):
|
||||
log.exception(u'Error loading database: %s', self.db_url)
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.Manager', 'Database Error'),
|
||||
translate('OpenLP.Manager', 'OpenLP cannot load your '
|
||||
'database.\n\nDatabase: %s') % self.db_url
|
||||
critical_error_message_box(translate('OpenLP.Manager', 'Database Error'),
|
||||
translate('OpenLP.Manager', 'OpenLP cannot load your database.\n\nDatabase: %s') % self.db_url
|
||||
)
|
||||
|
||||
def save_object(self, object_instance, commit=True):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -31,8 +31,7 @@ import logging
|
|||
|
||||
from PyQt4 import QtWebKit
|
||||
|
||||
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, \
|
||||
VerticalType, HorizontalType
|
||||
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, VerticalType, HorizontalType
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -258,8 +257,7 @@ def build_html(item, screen, islive, background, image=None,
|
|||
css_additions,
|
||||
build_footer_css(item, height),
|
||||
build_lyrics_css(item, webkitvers),
|
||||
u'true' if theme and theme.display_slide_transition and islive \
|
||||
else u'false',
|
||||
u'true' if theme and theme.display_slide_transition and islive else u'false',
|
||||
js_additions,
|
||||
bgimage_src, image_src,
|
||||
html_additions,
|
||||
|
@ -290,49 +288,26 @@ def build_background_css(item, width, height):
|
|||
theme = item.themedata
|
||||
background = u'background-color: black'
|
||||
if theme:
|
||||
if theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Transparent):
|
||||
if theme.background_type == BackgroundType.to_string(BackgroundType.Transparent):
|
||||
background = u''
|
||||
elif theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Solid):
|
||||
elif theme.background_type == BackgroundType.to_string(BackgroundType.Solid):
|
||||
background = u'background-color: %s' % theme.background_color
|
||||
else:
|
||||
if theme.background_direction == BackgroundGradientType.to_string \
|
||||
(BackgroundGradientType.Horizontal):
|
||||
background = \
|
||||
u'background: ' \
|
||||
u'-webkit-gradient(linear, left top, left bottom, ' \
|
||||
'from(%s), to(%s)) fixed' % (theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
elif theme.background_direction == \
|
||||
BackgroundGradientType.to_string( \
|
||||
BackgroundGradientType.LeftTop):
|
||||
background = \
|
||||
u'background: ' \
|
||||
u'-webkit-gradient(linear, left top, right bottom, ' \
|
||||
'from(%s), to(%s)) fixed' % (theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
elif theme.background_direction == \
|
||||
BackgroundGradientType.to_string \
|
||||
(BackgroundGradientType.LeftBottom):
|
||||
background = \
|
||||
u'background: ' \
|
||||
u'-webkit-gradient(linear, left bottom, right top, ' \
|
||||
'from(%s), to(%s)) fixed' % (theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
elif theme.background_direction == \
|
||||
BackgroundGradientType.to_string \
|
||||
(BackgroundGradientType.Vertical):
|
||||
background = \
|
||||
u'background: -webkit-gradient(linear, left top, ' \
|
||||
u'right top, from(%s), to(%s)) fixed' % \
|
||||
if theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):
|
||||
background = u'background: -webkit-gradient(linear, left top, left bottom, from(%s), to(%s)) fixed' \
|
||||
% (theme.background_start_color, theme.background_end_color)
|
||||
elif theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.LeftTop):
|
||||
background = u'background: -webkit-gradient(linear, left top, right bottom, from(%s), to(%s)) fixed' \
|
||||
% (theme.background_start_color, theme.background_end_color)
|
||||
elif theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.LeftBottom):
|
||||
background = u'background: -webkit-gradient(linear, left bottom, right top, from(%s), to(%s)) fixed' \
|
||||
% (theme.background_start_color, theme.background_end_color)
|
||||
elif theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.Vertical):
|
||||
background = u'background: -webkit-gradient(linear, left top, right top, from(%s), to(%s)) fixed' % \
|
||||
(theme.background_start_color, theme.background_end_color)
|
||||
else:
|
||||
background = \
|
||||
u'background: -webkit-gradient(radial, %s 50%%, 100, %s ' \
|
||||
u'50%%, %s, from(%s), to(%s)) fixed' % (width, width,
|
||||
width, theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
background = u'background: -webkit-gradient(radial, %s 50%%, 100, %s 50%%, %s, from(%s), to(%s)) fixed'\
|
||||
% (width, width, width, theme.background_start_color, theme.background_end_color)
|
||||
return background
|
||||
|
||||
def build_lyrics_css(item, webkitvers):
|
||||
|
@ -376,8 +351,7 @@ def build_lyrics_css(item, webkitvers):
|
|||
shadow = u''
|
||||
if theme and item.main:
|
||||
lyricstable = u'left: %spx; top: %spx;' % (item.main.x(), item.main.y())
|
||||
lyrics = build_lyrics_format_css(theme, item.main.width(),
|
||||
item.main.height())
|
||||
lyrics = build_lyrics_format_css(theme, item.main.width(), item.main.height())
|
||||
# For performance reasons we want to show as few DIV's as possible,
|
||||
# especially when animating/transitions.
|
||||
# However some bugs in older versions of qtwebkit mean we need to
|
||||
|
@ -400,9 +374,8 @@ def build_lyrics_css(item, webkitvers):
|
|||
if theme.font_main_shadow:
|
||||
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),
|
||||
theme.font_main_shadow_size)
|
||||
(int(theme.font_main_shadow_size) + (int(theme.font_main_outline_size) * 2),
|
||||
theme.font_main_shadow_size)
|
||||
shadow += build_lyrics_outline_css(theme, True)
|
||||
else:
|
||||
lyricsmain += u' text-shadow: %s %spx %spx;' % \
|
||||
|
@ -430,8 +403,7 @@ def build_lyrics_outline_css(theme, is_shadow=False):
|
|||
else:
|
||||
fill_color = theme.font_main_color
|
||||
outline_color = theme.font_main_outline_color
|
||||
return u' -webkit-text-stroke: %sem %s; ' \
|
||||
u'-webkit-text-fill-color: %s; ' % (size, outline_color, fill_color)
|
||||
return u' -webkit-text-stroke: %sem %s; -webkit-text-fill-color: %s; ' % (size, outline_color, fill_color)
|
||||
else:
|
||||
return u''
|
||||
|
||||
|
@ -467,11 +439,9 @@ def build_lyrics_format_css(theme, width, height):
|
|||
lyrics = u'%s word-wrap: break-word; ' \
|
||||
'text-align: %s; vertical-align: %s; font-family: %s; ' \
|
||||
'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \
|
||||
'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx;' \
|
||||
'height: %spx; ' % \
|
||||
'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx; height: %spx; ' % \
|
||||
(justify, align, valign, theme.font_main_name, theme.font_main_size,
|
||||
theme.font_main_color, 100 + int(theme.font_main_line_adjustment),
|
||||
padding_bottom, left_margin, width, height)
|
||||
theme.font_main_color, 100 + int(theme.font_main_line_adjustment), padding_bottom, left_margin, width, height)
|
||||
if theme.font_main_outline:
|
||||
if webkit_version() <= 534.3:
|
||||
lyrics += u' letter-spacing: 1px;'
|
||||
|
@ -531,7 +501,6 @@ def build_footer_css(item, height):
|
|||
if not theme or not item.footer:
|
||||
return u''
|
||||
bottom = height - int(item.footer.y()) - int(item.footer.height())
|
||||
lyrics_html = style % (item.footer.x(), bottom,
|
||||
item.footer.width(), theme.font_footer_name,
|
||||
theme.font_footer_size, theme.font_footer_color)
|
||||
lyrics_html = style % (item.footer.x(), bottom, item.footer.width(),
|
||||
theme.font_footer_name, theme.font_footer_size, theme.font_footer_color)
|
||||
return lyrics_html
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -190,8 +190,7 @@ class ImageManager(QtCore.QObject):
|
|||
self.imageThread = ImageThread(self)
|
||||
self._conversionQueue = PriorityQueue()
|
||||
self.stopManager = False
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'config_updated'), self.processUpdates)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.processUpdates)
|
||||
|
||||
def updateDisplay(self):
|
||||
"""
|
||||
|
@ -293,14 +292,12 @@ class ImageManager(QtCore.QObject):
|
|||
if not (path, source) in self._cache:
|
||||
image = Image(path, source, background)
|
||||
self._cache[(path, source)] = image
|
||||
self._conversionQueue.put(
|
||||
(image.priority, image.secondary_priority, image))
|
||||
self._conversionQueue.put((image.priority, image.secondary_priority, image))
|
||||
# Check if the there are any images with the same path and check if the
|
||||
# timestamp has changed.
|
||||
for image in self._cache.values():
|
||||
if os.path.exists(path):
|
||||
if image.path == path and \
|
||||
image.timestamp != os.stat(path).st_mtime:
|
||||
if image.path == path and image.timestamp != os.stat(path).st_mtime:
|
||||
image.timestamp = os.stat(path).st_mtime
|
||||
self._resetImage(image)
|
||||
# We want only one thread.
|
||||
|
@ -324,8 +321,7 @@ class ImageManager(QtCore.QObject):
|
|||
image = self._conversionQueue.get()[2]
|
||||
# Generate the QImage for the image.
|
||||
if image.image is None:
|
||||
image.image = resize_image(image.path, self.width, self.height,
|
||||
image.background)
|
||||
image.image = resize_image(image.path, self.width, self.height, image.background)
|
||||
# Set the priority to Lowest and stop here as we need to process
|
||||
# more important images first.
|
||||
if image.priority == Priority.Normal:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -53,8 +53,7 @@ class ListWidgetWithDnD(QtGui.QListWidget):
|
|||
"""
|
||||
self.setAcceptDrops(True)
|
||||
self.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'%s_dnd' % self.mimeDataText),
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_dnd' % self.mimeDataText),
|
||||
self.parent().loadFile)
|
||||
|
||||
def mouseMoveEvent(self, event):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -35,12 +35,10 @@ import re
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, \
|
||||
StringContent, build_icon, translate, Receiver, ListWidgetWithDnD, \
|
||||
ServiceItemContext, Settings
|
||||
from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, StringContent, build_icon, translate, \
|
||||
Receiver, ListWidgetWithDnD, ServiceItemContext, Settings
|
||||
from openlp.core.lib.searchedit import SearchEdit
|
||||
from openlp.core.lib.ui import UiStrings, create_widget_action, \
|
||||
critical_error_message_box
|
||||
from openlp.core.lib.ui import UiStrings, create_widget_action, critical_error_message_box
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -116,8 +114,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
self.setupUi()
|
||||
self.retranslateUi()
|
||||
self.autoSelectId = -1
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'%s_service_load' % self.plugin.name),
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_service_load' % self.plugin.name),
|
||||
self.serviceLoad)
|
||||
|
||||
def requiredIcons(self):
|
||||
|
@ -204,8 +201,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
for action in toolbar_actions:
|
||||
if action[0] == StringContent.Preview:
|
||||
self.toolbar.addSeparator()
|
||||
self.toolbar.addToolbarAction(
|
||||
u'%s%sAction' % (self.plugin.name, action[0]),
|
||||
self.toolbar.addToolbarAction(u'%s%sAction' % (self.plugin.name, action[0]),
|
||||
text=self.plugin.getString(action[1])[u'title'], icon=action[2],
|
||||
tooltip=self.plugin.getString(action[1])[u'tooltip'],
|
||||
triggers=action[3])
|
||||
|
@ -217,8 +213,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
# Add the List widget
|
||||
self.listView = ListWidgetWithDnD(self, self.plugin.name)
|
||||
self.listView.setSpacing(1)
|
||||
self.listView.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.listView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.listView.setAlternatingRowColors(True)
|
||||
self.listView.setObjectName(u'%sListView' % self.plugin.name)
|
||||
# Add to pageLayout
|
||||
|
@ -255,22 +250,19 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
triggers=self.onAddClick)
|
||||
if self.addToServiceItem:
|
||||
create_widget_action(self.listView, separator=True)
|
||||
create_widget_action(self.listView, text=translate(
|
||||
'OpenLP.MediaManagerItem', '&Add to selected Service Item'),
|
||||
create_widget_action(self.listView,
|
||||
text=translate('OpenLP.MediaManagerItem', '&Add to selected Service Item'),
|
||||
icon=u':/general/general_add.png',
|
||||
triggers=self.onAddEditClick)
|
||||
self.addCustomContextActions()
|
||||
# Create the context menu and add all actions from the listView.
|
||||
self.menu = QtGui.QMenu()
|
||||
self.menu.addActions(self.listView.actions())
|
||||
QtCore.QObject.connect(self.listView,
|
||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||
QtCore.QObject.connect(self.listView, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||
self.onDoubleClicked)
|
||||
QtCore.QObject.connect(self.listView,
|
||||
QtCore.SIGNAL(u'itemSelectionChanged()'),
|
||||
QtCore.QObject.connect(self.listView, QtCore.SIGNAL(u'itemSelectionChanged()'),
|
||||
self.onSelectionChange)
|
||||
QtCore.QObject.connect(self.listView,
|
||||
QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
|
||||
QtCore.QObject.connect(self.listView, QtCore.SIGNAL(u'customContextMenuRequested(QPoint)'),
|
||||
self.contextMenu)
|
||||
|
||||
def addSearchToToolBar(self):
|
||||
|
@ -299,12 +291,9 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
self.searchLayout.addLayout(self.searchButtonLayout)
|
||||
self.pageLayout.addWidget(self.searchWidget)
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.searchTextEdit,
|
||||
QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClicked)
|
||||
QtCore.QObject.connect(self.searchTextButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onSearchTextButtonClicked)
|
||||
QtCore.QObject.connect(self.searchTextEdit,
|
||||
QtCore.SIGNAL(u'textChanged(const QString&)'),
|
||||
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClicked)
|
||||
QtCore.QObject.connect(self.searchTextButton, QtCore.SIGNAL(u'clicked()'), self.onSearchTextButtonClicked)
|
||||
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'textChanged(const QString&)'),
|
||||
self.onSearchTextEditChanged)
|
||||
|
||||
def addCustomContextActions(self):
|
||||
|
@ -337,10 +326,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
Add a file to the list widget to make it available for showing
|
||||
"""
|
||||
files = QtGui.QFileDialog.getOpenFileNames(
|
||||
self, self.onNewPrompt,
|
||||
SettingsManager.get_last_dir(self.settingsSection),
|
||||
self.onNewFileMasks)
|
||||
files = QtGui.QFileDialog.getOpenFileNames(self, self.onNewPrompt,
|
||||
SettingsManager.get_last_dir(self.settingsSection), self.onNewFileMasks)
|
||||
log.info(u'New files(s) %s', files)
|
||||
if files:
|
||||
Receiver.send_message(u'cursor_busy')
|
||||
|
@ -361,11 +348,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
type = file.split(u'.')[-1]
|
||||
if type.lower() not in self.onNewFileMasks:
|
||||
if not error_shown:
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'Invalid File Type'),
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'Invalid File %s.\nSuffix not supported') % file)
|
||||
critical_error_message_box(translate('OpenLP.MediaManagerItem', 'Invalid File Type'),
|
||||
translate('OpenLP.MediaManagerItem', 'Invalid File %s.\nSuffix not supported') % file)
|
||||
error_shown = True
|
||||
else:
|
||||
new_files.append(file)
|
||||
|
@ -402,10 +386,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
SettingsManager.set_list(self.settingsSection,
|
||||
self.settingsSection, self.getFileList())
|
||||
if duplicates_found:
|
||||
critical_error_message_box(
|
||||
UiStrings().Duplicate,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'Duplicate files were found on import and were ignored.'))
|
||||
critical_error_message_box(UiStrings().Duplicate,
|
||||
translate('OpenLP.MediaManagerItem', 'Duplicate files were found on import and were ignored.'))
|
||||
|
||||
def contextMenu(self, point):
|
||||
item = self.listView.itemAt(point)
|
||||
|
@ -430,8 +412,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
return file_list
|
||||
|
||||
def loadList(self, list):
|
||||
raise NotImplementedError(u'MediaManagerItem.loadList needs to be '
|
||||
u'defined by the plugin')
|
||||
raise NotImplementedError(u'MediaManagerItem.loadList needs to be defined by the plugin')
|
||||
|
||||
def onNewClick(self):
|
||||
"""
|
||||
|
@ -446,8 +427,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
pass
|
||||
|
||||
def onDeleteClick(self):
|
||||
raise NotImplementedError(u'MediaManagerItem.onDeleteClick needs to '
|
||||
u'be defined by the plugin')
|
||||
raise NotImplementedError(u'MediaManagerItem.onDeleteClick needs to be defined by the plugin')
|
||||
|
||||
def onFocus(self):
|
||||
"""
|
||||
|
@ -458,8 +438,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
|
||||
def generateSlideData(self, serviceItem, item=None, xmlVersion=False,
|
||||
remote=False, context=ServiceItemContext.Live):
|
||||
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs '
|
||||
u'to be defined by the plugin')
|
||||
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs to be defined by the plugin')
|
||||
|
||||
def onDoubleClicked(self):
|
||||
"""
|
||||
|
@ -474,10 +453,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
Allows the change of current item in the list to be actioned
|
||||
"""
|
||||
if Settings().value(u'advanced/single click preview',
|
||||
False) and self.quickPreviewAllowed \
|
||||
and self.listView.selectedIndexes() \
|
||||
and self.autoSelectId == -1:
|
||||
if Settings().value(u'advanced/single click preview', False) and self.quickPreviewAllowed \
|
||||
and self.listView.selectedIndexes() and self.autoSelectId == -1:
|
||||
self.onPreviewClick(True)
|
||||
|
||||
def onPreviewClick(self, keepFocus=False):
|
||||
|
@ -487,8 +464,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
||||
QtGui.QMessageBox.information(self, UiStrings().NISp,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'You must select one or more items to preview.'))
|
||||
translate('OpenLP.MediaManagerItem', 'You must select one or more items to preview.'))
|
||||
else:
|
||||
log.debug(u'%s Preview requested', self.plugin.name)
|
||||
serviceItem = self.buildServiceItem()
|
||||
|
@ -505,8 +481,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
if not self.listView.selectedIndexes():
|
||||
QtGui.QMessageBox.information(self, UiStrings().NISp,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'You must select one or more items to send live.'))
|
||||
translate('OpenLP.MediaManagerItem', 'You must select one or more items to send live.'))
|
||||
else:
|
||||
self.goLive()
|
||||
|
||||
|
@ -534,8 +509,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
||||
QtGui.QMessageBox.information(self, UiStrings().NISp,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'You must select one or more items to add.'))
|
||||
translate('OpenLP.MediaManagerItem', 'You must select one or more items to add.'))
|
||||
else:
|
||||
# Is it posssible to process multiple list items to generate
|
||||
# multiple service items?
|
||||
|
@ -548,12 +522,10 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
self.addToService(item)
|
||||
|
||||
def addToService(self, item=None, replace=None, remote=False):
|
||||
serviceItem = self.buildServiceItem(item, True, remote=remote,
|
||||
context=ServiceItemContext.Service)
|
||||
serviceItem = self.buildServiceItem(item, True, remote=remote, context=ServiceItemContext.Service)
|
||||
if serviceItem:
|
||||
serviceItem.from_plugin = False
|
||||
self.plugin.serviceManager.addServiceItem(serviceItem,
|
||||
replace=replace)
|
||||
self.plugin.serviceManager.addServiceItem(serviceItem, replace=replace)
|
||||
|
||||
def onAddEditClick(self):
|
||||
"""
|
||||
|
@ -561,29 +533,22 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
||||
QtGui.QMessageBox.information(self, UiStrings().NISp,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'You must select one or more items.'))
|
||||
translate('OpenLP.MediaManagerItem', 'You must select one or more items.'))
|
||||
else:
|
||||
log.debug(u'%s Add requested', self.plugin.name)
|
||||
serviceItem = self.plugin.serviceManager.getServiceItem()
|
||||
if not serviceItem:
|
||||
QtGui.QMessageBox.information(self, UiStrings().NISs,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'You must select an existing service item to add to.'))
|
||||
translate('OpenLP.MediaManagerItem', 'You must select an existing service item to add to.'))
|
||||
elif self.plugin.name == serviceItem.name:
|
||||
self.generateSlideData(serviceItem)
|
||||
self.plugin.serviceManager.addServiceItem(serviceItem,
|
||||
replace=True)
|
||||
self.plugin.serviceManager.addServiceItem(serviceItem, replace=True)
|
||||
else:
|
||||
# Turn off the remote edit update message indicator
|
||||
QtGui.QMessageBox.information(self,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'Invalid Service Item'),
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'You must select a %s service item.') % self.title)
|
||||
QtGui.QMessageBox.information(self, translate('OpenLP.MediaManagerItem', 'Invalid Service Item'),
|
||||
translate('OpenLP.MediaManagerItem', 'You must select a %s service item.') % self.title)
|
||||
|
||||
def buildServiceItem(self, item=None, xmlVersion=False, remote=False,
|
||||
context=ServiceItemContext.Live):
|
||||
def buildServiceItem(self, item=None, xmlVersion=False, remote=False, context=ServiceItemContext.Live):
|
||||
"""
|
||||
Common method for generating a service item
|
||||
"""
|
||||
|
@ -652,5 +617,4 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
Performs a plugin specific search for items containing ``string``
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
u'Plugin.search needs to be defined by the plugin')
|
||||
raise NotImplementedError(u'Plugin.search needs to be defined by the plugin')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -172,11 +172,9 @@ class Plugin(QtCore.QObject):
|
|||
self.pluginManager = plugin_helpers[u'pluginmanager']
|
||||
self.formParent = plugin_helpers[u'formparent']
|
||||
self.mediaController = plugin_helpers[u'mediacontroller']
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'%s_add_service_item' % self.name),
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_add_service_item' % self.name),
|
||||
self.processAddServiceEvent)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'%s_config_updated' % self.name),
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_config_updated' % self.name),
|
||||
self.configUpdated)
|
||||
|
||||
def checkPreConditions(self):
|
||||
|
@ -192,8 +190,7 @@ class Plugin(QtCore.QObject):
|
|||
"""
|
||||
Sets the status of the plugin
|
||||
"""
|
||||
self.status = Settings().value(
|
||||
self.settingsSection + u'/status', PluginStatus.Inactive)
|
||||
self.status = Settings().value(self.settingsSection + u'/status', PluginStatus.Inactive)
|
||||
|
||||
def toggleStatus(self, new_status):
|
||||
"""
|
||||
|
@ -220,8 +217,7 @@ class Plugin(QtCore.QObject):
|
|||
you need, and return it for integration into OpenLP.
|
||||
"""
|
||||
if self.mediaItemClass:
|
||||
self.mediaItem = self.mediaItemClass(self.mediaDock.media_dock,
|
||||
self, self.icon)
|
||||
self.mediaItem = self.mediaItemClass(self.mediaDock.media_dock, self, self.icon)
|
||||
|
||||
def addImportMenuItem(self, importMenu):
|
||||
"""
|
||||
|
@ -257,8 +253,7 @@ class Plugin(QtCore.QObject):
|
|||
"""
|
||||
if self.settingsTabClass:
|
||||
self.settingsTab = self.settingsTabClass(parent, self.name,
|
||||
self.getString(StringContent.VisibleName)[u'title'],
|
||||
self.iconPath)
|
||||
self.getString(StringContent.VisibleName)[u'title'], self.iconPath)
|
||||
|
||||
def addToMenu(self, menubar):
|
||||
"""
|
||||
|
@ -273,8 +268,7 @@ class Plugin(QtCore.QObject):
|
|||
"""
|
||||
Generic Drag and drop handler triggered from service_manager.
|
||||
"""
|
||||
log.debug(u'processAddServiceEvent event called for plugin %s' %
|
||||
self.name)
|
||||
log.debug(u'processAddServiceEvent event called for plugin %s' % self.name)
|
||||
if replace:
|
||||
self.mediaItem.onAddEditClick()
|
||||
else:
|
||||
|
@ -285,8 +279,7 @@ class Plugin(QtCore.QObject):
|
|||
Show a dialog when the user clicks on the 'About' button in the plugin
|
||||
manager.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
u'Plugin.about needs to be defined by the plugin')
|
||||
raise NotImplementedError(u'Plugin.about needs to be defined by the plugin')
|
||||
|
||||
def initialise(self):
|
||||
"""
|
||||
|
@ -305,7 +298,7 @@ class Plugin(QtCore.QObject):
|
|||
|
||||
def appStartup(self):
|
||||
"""
|
||||
Perform tasks on application starup
|
||||
Perform tasks on application startup
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -340,29 +333,21 @@ class Plugin(QtCore.QObject):
|
|||
Called to define all translatable texts of the plugin
|
||||
"""
|
||||
## Load Action ##
|
||||
self.__setNameTextString(StringContent.Load,
|
||||
UiStrings().Load, tooltips[u'load'])
|
||||
self.__setNameTextString(StringContent.Load, UiStrings().Load, tooltips[u'load'])
|
||||
## Import Action ##
|
||||
self.__setNameTextString(StringContent.Import,
|
||||
UiStrings().Import, tooltips[u'import'])
|
||||
self.__setNameTextString(StringContent.Import, UiStrings().Import, tooltips[u'import'])
|
||||
## New Action ##
|
||||
self.__setNameTextString(StringContent.New,
|
||||
UiStrings().Add, tooltips[u'new'])
|
||||
self.__setNameTextString(StringContent.New, UiStrings().Add, tooltips[u'new'])
|
||||
## Edit Action ##
|
||||
self.__setNameTextString(StringContent.Edit,
|
||||
UiStrings().Edit, tooltips[u'edit'])
|
||||
self.__setNameTextString(StringContent.Edit, UiStrings().Edit, tooltips[u'edit'])
|
||||
## Delete Action ##
|
||||
self.__setNameTextString(StringContent.Delete,
|
||||
UiStrings().Delete, tooltips[u'delete'])
|
||||
self.__setNameTextString(StringContent.Delete, UiStrings().Delete, tooltips[u'delete'])
|
||||
## Preview Action ##
|
||||
self.__setNameTextString(StringContent.Preview,
|
||||
UiStrings().Preview, tooltips[u'preview'])
|
||||
self.__setNameTextString(StringContent.Preview, UiStrings().Preview, tooltips[u'preview'])
|
||||
## Send Live Action ##
|
||||
self.__setNameTextString(StringContent.Live,
|
||||
UiStrings().Live, tooltips[u'live'])
|
||||
self.__setNameTextString(StringContent.Live, UiStrings().Live, tooltips[u'live'])
|
||||
## Add to Service Action ##
|
||||
self.__setNameTextString(StringContent.Service,
|
||||
UiStrings().Service, tooltips[u'service'])
|
||||
self.__setNameTextString(StringContent.Service, UiStrings().Service, tooltips[u'service'])
|
||||
|
||||
def __setNameTextString(self, name, title, tooltip):
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -107,13 +107,12 @@ class PluginManager(object):
|
|||
modulename = modulename[len(prefix) + 1:]
|
||||
modulename = modulename.replace(os.path.sep, '.')
|
||||
# import the modules
|
||||
log.debug(u'Importing %s from %s. Depth %d',
|
||||
modulename, path, thisdepth)
|
||||
log.debug(u'Importing %s from %s. Depth %d', modulename, path, thisdepth)
|
||||
try:
|
||||
__import__(modulename, globals(), locals(), [])
|
||||
except ImportError, e:
|
||||
log.exception(u'Failed to import module %s on path %s '
|
||||
'for reason %s', modulename, path, e.args[0])
|
||||
log.exception(u'Failed to import module %s on path %s for reason %s',
|
||||
modulename, path, e.args[0])
|
||||
plugin_classes = Plugin.__subclasses__()
|
||||
plugin_objects = []
|
||||
for p in plugin_classes:
|
||||
|
@ -197,8 +196,7 @@ class PluginManager(object):
|
|||
"""
|
||||
log.info(u'Initialise Plugins - Started')
|
||||
for plugin in self.plugins:
|
||||
log.info(u'initialising plugins %s in a %s state'
|
||||
% (plugin.name, plugin.isActive()))
|
||||
log.info(u'initialising plugins %s in a %s state' % (plugin.name, plugin.isActive()))
|
||||
if plugin.isActive():
|
||||
plugin.initialise()
|
||||
log.info(u'Initialisation Complete for %s ' % plugin.name)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -31,8 +31,7 @@ import logging
|
|||
|
||||
from PyQt4 import QtGui, QtCore, QtWebKit
|
||||
|
||||
from openlp.core.lib import ServiceItem, expand_tags, \
|
||||
build_lyrics_format_css, build_lyrics_outline_css, Receiver, \
|
||||
from openlp.core.lib import ServiceItem, expand_tags, build_lyrics_format_css, build_lyrics_outline_css, Receiver, \
|
||||
ItemCapabilities, FormattingTags, ImageSource
|
||||
from openlp.core.lib.theme import ThemeLevel
|
||||
from openlp.core.ui import MainDisplay, ScreenList
|
||||
|
@ -81,8 +80,7 @@ class Renderer(object):
|
|||
self.display.setup()
|
||||
self._theme_dimensions = {}
|
||||
self._calculate_default()
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'theme_update_global'), self.set_global_theme)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_global'), self.set_global_theme)
|
||||
self.web = QtWebKit.QWebView()
|
||||
self.web.setVisible(False)
|
||||
self.web_frame = self.web.page().mainFrame()
|
||||
|
@ -115,8 +113,7 @@ class Renderer(object):
|
|||
Only remove the given ``theme_name`` from the ``_theme_dimensions``
|
||||
list. This can be used when a theme is permanently deleted.
|
||||
"""
|
||||
if old_theme_name is not None and \
|
||||
old_theme_name in self._theme_dimensions:
|
||||
if old_theme_name is not None and old_theme_name in self._theme_dimensions:
|
||||
del self._theme_dimensions[old_theme_name]
|
||||
if theme_name in self._theme_dimensions:
|
||||
del self._theme_dimensions[theme_name]
|
||||
|
@ -134,16 +131,13 @@ class Renderer(object):
|
|||
theme_data = self.theme_manager.getThemeData(theme_name)
|
||||
main_rect = self.get_main_rectangle(theme_data)
|
||||
footer_rect = self.get_footer_rectangle(theme_data)
|
||||
self._theme_dimensions[theme_name] = \
|
||||
[theme_data, main_rect, footer_rect]
|
||||
self._theme_dimensions[theme_name] = [theme_data, main_rect, footer_rect]
|
||||
else:
|
||||
theme_data, main_rect, footer_rect = \
|
||||
self._theme_dimensions[theme_name]
|
||||
theme_data, main_rect, footer_rect = self._theme_dimensions[theme_name]
|
||||
# if No file do not update cache
|
||||
if theme_data.background_filename:
|
||||
self.image_manager.addImage(theme_data.background_filename,
|
||||
ImageSource.Theme,
|
||||
QtGui.QColor(theme_data.background_border_color))
|
||||
ImageSource.Theme, QtGui.QColor(theme_data.background_border_color))
|
||||
|
||||
def pre_render(self, override_theme_data=None):
|
||||
"""
|
||||
|
@ -172,8 +166,7 @@ class Renderer(object):
|
|||
if override_theme_data is None:
|
||||
if theme_to_use not in self._theme_dimensions:
|
||||
self._set_theme(theme_to_use)
|
||||
theme_data, main_rect, footer_rect = \
|
||||
self._theme_dimensions[theme_to_use]
|
||||
theme_data, main_rect, footer_rect = self._theme_dimensions[theme_to_use]
|
||||
else:
|
||||
# Ignore everything and use own theme data.
|
||||
theme_data = override_theme_data
|
||||
|
@ -305,13 +298,11 @@ class Renderer(object):
|
|||
text_contains_split = u'[---]' in text
|
||||
if text_contains_split:
|
||||
try:
|
||||
text_to_render, text = \
|
||||
text.split(u'\n[---]\n', 1)
|
||||
text_to_render, text = text.split(u'\n[---]\n', 1)
|
||||
except ValueError:
|
||||
text_to_render = text.split(u'\n[---]\n')[0]
|
||||
text = u''
|
||||
text_to_render, raw_tags, html_tags = \
|
||||
self._get_start_tags(text_to_render)
|
||||
text_to_render, raw_tags, html_tags = self._get_start_tags(text_to_render)
|
||||
if text:
|
||||
text = raw_tags + text
|
||||
else:
|
||||
|
@ -504,9 +495,8 @@ class Renderer(object):
|
|||
# the line will not fit as a whole.
|
||||
raw_words = self._words_split(line)
|
||||
html_words = map(expand_tags, raw_words)
|
||||
previous_html, previous_raw = self._binary_chop(
|
||||
formatted, previous_html, previous_raw, html_words,
|
||||
raw_words, u' ', line_end)
|
||||
previous_html, previous_raw = \
|
||||
self._binary_chop(formatted, previous_html, previous_raw, html_words, raw_words, u' ', line_end)
|
||||
else:
|
||||
previous_html += html_line + line_end
|
||||
previous_raw += line + line_end
|
||||
|
@ -537,13 +527,9 @@ class Renderer(object):
|
|||
for tag in FormattingTags.get_html_tags():
|
||||
if tag[u'start tag'] == u'{br}':
|
||||
continue
|
||||
if raw_text.count(tag[u'start tag']) != \
|
||||
raw_text.count(tag[u'end tag']):
|
||||
raw_tags.append(
|
||||
(raw_text.find(tag[u'start tag']), tag[u'start tag'],
|
||||
tag[u'end tag']))
|
||||
html_tags.append(
|
||||
(raw_text.find(tag[u'start tag']), tag[u'start html']))
|
||||
if raw_text.count(tag[u'start tag']) != raw_text.count(tag[u'end tag']):
|
||||
raw_tags.append((raw_text.find(tag[u'start tag']), tag[u'start tag'], tag[u'end tag']))
|
||||
html_tags.append((raw_text.find(tag[u'start tag']), tag[u'start html']))
|
||||
# Sort the lists, so that the tags which were opened first on the first
|
||||
# slide (the text we are checking) will be opened first on the next
|
||||
# slide as well.
|
||||
|
@ -558,11 +544,9 @@ class Renderer(object):
|
|||
end_tags.reverse()
|
||||
# Remove the indexes.
|
||||
html_tags = [tag[1] for tag in html_tags]
|
||||
return raw_text + u''.join(end_tags), u''.join(start_tags), \
|
||||
u''.join(html_tags)
|
||||
return raw_text + u''.join(end_tags), u''.join(start_tags), u''.join(html_tags)
|
||||
|
||||
def _binary_chop(self, formatted, previous_html, previous_raw, html_list,
|
||||
raw_list, separator, line_end):
|
||||
def _binary_chop(self, formatted, previous_html, previous_raw, html_list, raw_list, separator, line_end):
|
||||
"""
|
||||
This implements the binary chop algorithm for faster rendering. This
|
||||
algorithm works line based (line by line) and word based (word by word).
|
||||
|
@ -612,8 +596,7 @@ class Renderer(object):
|
|||
# We found the number of words which will fit.
|
||||
if smallest_index == index or highest_index == index:
|
||||
index = smallest_index
|
||||
text = previous_raw.rstrip(u'<br>') + \
|
||||
separator.join(raw_list[:index + 1])
|
||||
text = previous_raw.rstrip(u'<br>') + separator.join(raw_list[:index + 1])
|
||||
text, raw_tags, html_tags = self._get_start_tags(text)
|
||||
formatted.append(text)
|
||||
previous_html = u''
|
||||
|
@ -627,10 +610,8 @@ class Renderer(object):
|
|||
# Check if the remaining elements fit on the slide.
|
||||
if self._text_fits_on_slide(
|
||||
html_tags + separator.join(html_list[index + 1:]).strip()):
|
||||
previous_html = html_tags + separator.join(
|
||||
html_list[index + 1:]).strip() + line_end
|
||||
previous_raw = raw_tags + separator.join(
|
||||
raw_list[index + 1:]).strip() + line_end
|
||||
previous_html = html_tags + separator.join(html_list[index + 1:]).strip() + line_end
|
||||
previous_raw = raw_tags + separator.join(raw_list[index + 1:]).strip() + line_end
|
||||
break
|
||||
else:
|
||||
# The remaining elements do not fit, thus reset the indexes,
|
||||
|
@ -652,8 +633,7 @@ class Renderer(object):
|
|||
``text``
|
||||
The text to check. It may contain HTML tags.
|
||||
"""
|
||||
self.web_frame.evaluateJavaScript(u'show_text("%s")' %
|
||||
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
||||
self.web_frame.evaluateJavaScript(u'show_text("%s")' % text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
||||
return self.web_frame.contentsSize().height() <= self.empty_height
|
||||
|
||||
def _words_split(self, line):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -54,16 +54,8 @@ class SearchEdit(QtGui.QLineEdit):
|
|||
u'QToolButton { border: none; padding: 0px; }')
|
||||
self.clearButton.resize(18, 18)
|
||||
self.clearButton.hide()
|
||||
QtCore.QObject.connect(
|
||||
self.clearButton,
|
||||
QtCore.SIGNAL(u'clicked()'),
|
||||
self._onClearButtonClicked
|
||||
)
|
||||
QtCore.QObject.connect(
|
||||
self,
|
||||
QtCore.SIGNAL(u'textChanged(const QString&)'),
|
||||
self._onSearchEditTextChanged
|
||||
)
|
||||
QtCore.QObject.connect(self.clearButton, QtCore.SIGNAL(u'clicked()'), self._onClearButtonClicked)
|
||||
QtCore.QObject.connect(self, QtCore.SIGNAL(u'textChanged(const QString&)'), self._onSearchEditTextChanged)
|
||||
self._updateStyleSheet()
|
||||
self.setAcceptDrops(False)
|
||||
|
||||
|
@ -72,24 +64,16 @@ class SearchEdit(QtGui.QLineEdit):
|
|||
Internal method to update the stylesheet depending on which widgets are
|
||||
available and visible.
|
||||
"""
|
||||
frameWidth = self.style().pixelMetric(
|
||||
QtGui.QStyle.PM_DefaultFrameWidth)
|
||||
frameWidth = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
|
||||
rightPadding = self.clearButton.width() + frameWidth
|
||||
if hasattr(self, u'menuButton'):
|
||||
leftPadding = self.menuButton.width()
|
||||
self.setStyleSheet(
|
||||
u'QLineEdit { padding-left: %spx; padding-right: %spx; } ' %
|
||||
(leftPadding, rightPadding))
|
||||
self.setStyleSheet(u'QLineEdit { padding-left: %spx; padding-right: %spx; } ' % (leftPadding, rightPadding))
|
||||
else:
|
||||
self.setStyleSheet(u'QLineEdit { padding-right: %spx; } ' %
|
||||
rightPadding)
|
||||
self.setStyleSheet(u'QLineEdit { padding-right: %spx; } ' % rightPadding)
|
||||
msz = self.minimumSizeHint()
|
||||
self.setMinimumSize(
|
||||
max(msz.width(),
|
||||
self.clearButton.width() + (frameWidth * 2) + 2),
|
||||
max(msz.height(),
|
||||
self.clearButton.height() + (frameWidth * 2) + 2)
|
||||
)
|
||||
self.setMinimumSize(max(msz.width(), self.clearButton.width() + (frameWidth * 2) + 2),
|
||||
max(msz.height(), self.clearButton.height() + (frameWidth * 2) + 2))
|
||||
|
||||
def resizeEvent(self, event):
|
||||
"""
|
||||
|
@ -99,14 +83,12 @@ class SearchEdit(QtGui.QLineEdit):
|
|||
The event that happened.
|
||||
"""
|
||||
size = self.clearButton.size()
|
||||
frameWidth = self.style().pixelMetric(
|
||||
QtGui.QStyle.PM_DefaultFrameWidth)
|
||||
frameWidth = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
|
||||
self.clearButton.move(self.rect().right() - frameWidth - size.width(),
|
||||
(self.rect().bottom() + 1 - size.height()) / 2)
|
||||
if hasattr(self, u'menuButton'):
|
||||
size = self.menuButton.size()
|
||||
self.menuButton.move(self.rect().left() + frameWidth + 2,
|
||||
(self.rect().bottom() + 1 - size.height()) / 2)
|
||||
self.menuButton.move(self.rect().left() + frameWidth + 2, (self.rect().bottom() + 1 - size.height()) / 2)
|
||||
|
||||
def currentSearchType(self):
|
||||
"""
|
||||
|
@ -215,9 +197,7 @@ class SearchEdit(QtGui.QLineEdit):
|
|||
# setPlaceholderText has been implemented in Qt 4.7 and in at least
|
||||
# PyQt 4.9 (I am not sure, if it was implemented in PyQt 4.8).
|
||||
try:
|
||||
self.setPlaceholderText(
|
||||
self.menuButton.defaultAction().placeholderText)
|
||||
self.setPlaceholderText(self.menuButton.defaultAction().placeholderText)
|
||||
except AttributeError:
|
||||
pass
|
||||
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'),
|
||||
self._currentSearchType)
|
||||
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'), self._currentSearchType)
|
||||
|
|
|
@ -570,12 +570,10 @@ class ServiceItem(object):
|
|||
start = None
|
||||
end = None
|
||||
if self.start_time != 0:
|
||||
start = translate('OpenLP.ServiceItem',
|
||||
'<strong>Start</strong>: %s') % \
|
||||
start = translate('OpenLP.ServiceItem', '<strong>Start</strong>: %s') % \
|
||||
unicode(datetime.timedelta(seconds=self.start_time))
|
||||
if self.media_length != 0:
|
||||
end = translate('OpenLP.ServiceItem',
|
||||
'<strong>Length</strong>: %s') % \
|
||||
end = translate('OpenLP.ServiceItem', '<strong>Length</strong>: %s') % \
|
||||
unicode(datetime.timedelta(seconds=self.media_length))
|
||||
if not start and not end:
|
||||
return u''
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -81,10 +81,8 @@ class SettingsTab(QtGui.QWidget):
|
|||
if event:
|
||||
QtGui.QWidget.resizeEvent(self, event)
|
||||
width = self.width() - self.tabLayout.spacing() - \
|
||||
self.tabLayout.contentsMargins().left() - \
|
||||
self.tabLayout.contentsMargins().right()
|
||||
left_width = min(width - self.rightColumn.minimumSizeHint().width(),
|
||||
width / 2)
|
||||
self.tabLayout.contentsMargins().left() - self.tabLayout.contentsMargins().right()
|
||||
left_width = min(width - self.rightColumn.minimumSizeHint().width(), width / 2)
|
||||
left_width = max(left_width, self.leftColumn.minimumSizeHint().width())
|
||||
self.leftColumn.setFixedWidth(left_width)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -28,6 +28,7 @@
|
|||
###############################################################################
|
||||
import logging
|
||||
import re
|
||||
|
||||
try:
|
||||
import enchant
|
||||
from enchant import DictNotFoundError
|
||||
|
@ -72,8 +73,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
|
|||
# Rewrite the mouse event to a left button event so the cursor is
|
||||
# moved to the location of the pointer.
|
||||
event = QtGui.QMouseEvent(QtCore.QEvent.MouseButtonPress,
|
||||
event.pos(), QtCore.Qt.LeftButton, QtCore.Qt.LeftButton,
|
||||
QtCore.Qt.NoModifier)
|
||||
event.pos(), QtCore.Qt.LeftButton, QtCore.Qt.LeftButton, QtCore.Qt.NoModifier)
|
||||
QtGui.QPlainTextEdit.mousePressEvent(self, event)
|
||||
|
||||
def contextMenuEvent(self, event):
|
||||
|
@ -92,20 +92,17 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
|
|||
lang_menu = QtGui.QMenu(
|
||||
translate('OpenLP.SpellTextEdit', 'Language:'))
|
||||
for lang in enchant.list_languages():
|
||||
action = create_action(lang_menu, lang, text=lang,
|
||||
checked=lang == self.dictionary.tag)
|
||||
action = create_action(lang_menu, lang, text=lang, checked=lang == self.dictionary.tag)
|
||||
lang_menu.addAction(action)
|
||||
popupMenu.insertSeparator(popupMenu.actions()[0])
|
||||
popupMenu.insertMenu(popupMenu.actions()[0], lang_menu)
|
||||
QtCore.QObject.connect(lang_menu,
|
||||
QtCore.SIGNAL(u'triggered(QAction*)'), self.setLanguage)
|
||||
QtCore.QObject.connect(lang_menu, QtCore.SIGNAL(u'triggered(QAction*)'), self.setLanguage)
|
||||
# Check if the selected word is misspelled and offer spelling
|
||||
# suggestions if it is.
|
||||
if ENCHANT_AVAILABLE and self.textCursor().hasSelection():
|
||||
text = self.textCursor().selectedText()
|
||||
if not self.dictionary.check(text):
|
||||
spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit',
|
||||
'Spelling Suggestions'))
|
||||
spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Spelling Suggestions'))
|
||||
for word in self.dictionary.suggest(text):
|
||||
action = SpellAction(word, spell_menu)
|
||||
action.correct.connect(self.correctWord)
|
||||
|
@ -114,8 +111,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
|
|||
# suggestions.
|
||||
if spell_menu.actions():
|
||||
popupMenu.insertMenu(popupMenu.actions()[0], spell_menu)
|
||||
tagMenu = QtGui.QMenu(translate('OpenLP.SpellTextEdit',
|
||||
'Formatting Tags'))
|
||||
tagMenu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Formatting Tags'))
|
||||
if self.formattingTagsAllowed:
|
||||
for html in FormattingTags.get_html_tags():
|
||||
action = SpellAction(html[u'desc'], tagMenu)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -478,8 +478,7 @@ class ThemeXML(object):
|
|||
Pull out the XML string formatted for human consumption
|
||||
"""
|
||||
self._build_xml_from_attrs()
|
||||
return self.theme_xml.toprettyxml(indent=u' ', newl=u'\n',
|
||||
encoding=u'utf-8')
|
||||
return self.theme_xml.toprettyxml(indent=u' ', newl=u'\n', encoding=u'utf-8')
|
||||
|
||||
def parse(self, xml):
|
||||
"""
|
||||
|
@ -512,18 +511,15 @@ class ThemeXML(object):
|
|||
if element.tag == u'background':
|
||||
if element.attrib:
|
||||
for attr in element.attrib:
|
||||
self._create_attr(element.tag, attr, \
|
||||
element.attrib[attr])
|
||||
self._create_attr(element.tag, attr, element.attrib[attr])
|
||||
parent = element.getparent()
|
||||
if parent is not None:
|
||||
if parent.tag == u'font':
|
||||
master = parent.tag + u'_' + parent.attrib[u'type']
|
||||
# set up Outline and Shadow Tags and move to font_main
|
||||
if parent.tag == u'display':
|
||||
if element.tag.startswith(u'shadow') or \
|
||||
element.tag.startswith(u'outline'):
|
||||
self._create_attr(u'font_main', element.tag,
|
||||
element.text)
|
||||
if element.tag.startswith(u'shadow') or element.tag.startswith(u'outline'):
|
||||
self._create_attr(u'font_main', element.tag, element.text)
|
||||
master = parent.tag
|
||||
if parent.tag == u'background':
|
||||
master = parent.tag
|
||||
|
@ -533,12 +529,10 @@ class ThemeXML(object):
|
|||
for attr in element.attrib:
|
||||
base_element = attr
|
||||
# correction for the shadow and outline tags
|
||||
if element.tag == u'shadow' or \
|
||||
element.tag == u'outline':
|
||||
if element.tag == u'shadow' or element.tag == u'outline':
|
||||
if not attr.startswith(element.tag):
|
||||
base_element = element.tag + u'_' + attr
|
||||
self._create_attr(master, base_element,
|
||||
element.attrib[attr])
|
||||
self._create_attr(master, base_element, element.attrib[attr])
|
||||
else:
|
||||
if element.tag == u'name':
|
||||
self._create_attr(u'theme', element.tag, element.text)
|
||||
|
@ -570,8 +564,7 @@ class ThemeXML(object):
|
|||
"""
|
||||
Create the attributes with the correct data types and name format
|
||||
"""
|
||||
reject, master, element, value = \
|
||||
self._translate_tags(master, element, value)
|
||||
reject, master, element, value = self._translate_tags(master, element, value)
|
||||
if reject:
|
||||
return
|
||||
field = self._de_hump(element)
|
||||
|
@ -611,21 +604,17 @@ class ThemeXML(object):
|
|||
Build the XML from the varables in the object
|
||||
"""
|
||||
self._new_document(self.theme_name)
|
||||
if self.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Solid):
|
||||
if self.background_type == BackgroundType.to_string(BackgroundType.Solid):
|
||||
self.add_background_solid(self.background_color)
|
||||
elif self.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Gradient):
|
||||
elif self.background_type == BackgroundType.to_string(BackgroundType.Gradient):
|
||||
self.add_background_gradient(
|
||||
self.background_start_color,
|
||||
self.background_end_color,
|
||||
self.background_direction)
|
||||
elif self.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Image):
|
||||
elif self.background_type == BackgroundType.to_string(BackgroundType.Image):
|
||||
filename = os.path.split(self.background_filename)[1]
|
||||
self.add_background_image(filename, self.background_border_color)
|
||||
elif self.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Transparent):
|
||||
elif self.background_type == BackgroundType.to_string(BackgroundType.Transparent):
|
||||
self.add_background_transparent()
|
||||
self.add_font(self.font_main_name,
|
||||
self.font_main_color,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -80,13 +80,10 @@ class UiStrings(object):
|
|||
self.Error = translate('OpenLP.Ui', 'Error')
|
||||
self.Export = translate('OpenLP.Ui', 'Export')
|
||||
self.File = translate('OpenLP.Ui', 'File')
|
||||
self.FontSizePtUnit = translate('OpenLP.Ui', 'pt',
|
||||
'Abbreviated font pointsize unit')
|
||||
self.FontSizePtUnit = translate('OpenLP.Ui', 'pt', 'Abbreviated font pointsize unit')
|
||||
self.Help = translate('OpenLP.Ui', 'Help')
|
||||
self.Hours = translate('OpenLP.Ui', 'h',
|
||||
'The abbreviated unit for hours')
|
||||
self.IFdSs = translate('OpenLP.Ui', 'Invalid Folder Selected',
|
||||
'Singular')
|
||||
self.Hours = translate('OpenLP.Ui', 'h', 'The abbreviated unit for hours')
|
||||
self.IFdSs = translate('OpenLP.Ui', 'Invalid Folder Selected', 'Singular')
|
||||
self.IFSs = translate('OpenLP.Ui', 'Invalid File Selected', 'Singular')
|
||||
self.IFSp = translate('OpenLP.Ui', 'Invalid Files Selected', 'Plural')
|
||||
self.Image = translate('OpenLP.Ui', 'Image')
|
||||
|
@ -96,8 +93,7 @@ class UiStrings(object):
|
|||
self.LiveBGError = translate('OpenLP.Ui', 'Live Background Error')
|
||||
self.LiveToolbar = translate('OpenLP.Ui', 'Live Toolbar')
|
||||
self.Load = translate('OpenLP.Ui', 'Load')
|
||||
self.Minutes = translate('OpenLP.Ui', 'm',
|
||||
'The abbreviated unit for minutes')
|
||||
self.Minutes = translate('OpenLP.Ui', 'm', 'The abbreviated unit for minutes')
|
||||
self.Middle = translate('OpenLP.Ui', 'Middle')
|
||||
self.New = translate('OpenLP.Ui', 'New')
|
||||
self.NewService = translate('OpenLP.Ui', 'New Service')
|
||||
|
@ -111,8 +107,7 @@ class UiStrings(object):
|
|||
self.OLPV1 = translate('OpenLP.Ui', 'openlp.org 1.x')
|
||||
self.OLPV2 = translate('OpenLP.Ui', 'OpenLP 2')
|
||||
self.OLPV2x = translate('OpenLP.Ui', 'OpenLP 2.1')
|
||||
self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. '
|
||||
'Do you wish to continue?')
|
||||
self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. Do you wish to continue?')
|
||||
self.OpenService = translate('OpenLP.Ui', 'Open service.')
|
||||
self.PlaySlidesInLoop = translate('OpenLP.Ui','Play Slides in Loop')
|
||||
self.PlaySlidesToEnd = translate('OpenLP.Ui','Play Slides to End')
|
||||
|
@ -122,27 +117,21 @@ class UiStrings(object):
|
|||
self.ReplaceLiveBG = translate('OpenLP.Ui', 'Replace live background.')
|
||||
self.ResetBG = translate('OpenLP.Ui', 'Reset Background')
|
||||
self.ResetLiveBG = translate('OpenLP.Ui', 'Reset live background.')
|
||||
self.Seconds = translate('OpenLP.Ui', 's',
|
||||
'The abbreviated unit for seconds')
|
||||
self.Seconds = translate('OpenLP.Ui', 's', 'The abbreviated unit for seconds')
|
||||
self.SaveAndPreview = translate('OpenLP.Ui', 'Save && Preview')
|
||||
self.Search = translate('OpenLP.Ui', 'Search')
|
||||
self.SearchThemes = translate(
|
||||
'OpenLP.Ui', 'Search Themes...', 'Search bar place holder text ')
|
||||
self.SelectDelete = translate('OpenLP.Ui', 'You must select an item '
|
||||
'to delete.')
|
||||
self.SelectEdit = translate('OpenLP.Ui', 'You must select an item to '
|
||||
'edit.')
|
||||
self.SearchThemes = translate('OpenLP.Ui', 'Search Themes...', 'Search bar place holder text ')
|
||||
self.SelectDelete = translate('OpenLP.Ui', 'You must select an item to delete.')
|
||||
self.SelectEdit = translate('OpenLP.Ui', 'You must select an item to edit.')
|
||||
self.Settings = translate('OpenLP.Ui', 'Settings')
|
||||
self.SaveService = translate('OpenLP.Ui', 'Save Service')
|
||||
self.Service = translate('OpenLP.Ui', 'Service')
|
||||
self.Split = translate('OpenLP.Ui', 'Optional &Split')
|
||||
self.SplitToolTip = translate('OpenLP.Ui', 'Split a slide into two '
|
||||
'only if it does not fit on the screen as one slide.')
|
||||
self.SplitToolTip = translate('OpenLP.Ui',
|
||||
'Split a slide into two only if it does not fit on the screen as one slide.')
|
||||
self.StartTimeCode = translate('OpenLP.Ui', 'Start %s')
|
||||
self.StopPlaySlidesInLoop = translate('OpenLP.Ui',
|
||||
'Stop Play Slides in Loop')
|
||||
self.StopPlaySlidesToEnd = translate('OpenLP.Ui',
|
||||
'Stop Play Slides to End')
|
||||
self.StopPlaySlidesInLoop = translate('OpenLP.Ui', 'Stop Play Slides in Loop')
|
||||
self.StopPlaySlidesToEnd = translate('OpenLP.Ui', 'Stop Play Slides to End')
|
||||
self.Theme = translate('OpenLP.Ui', 'Theme', 'Singular')
|
||||
self.Themes = translate('OpenLP.Ui', 'Themes', 'Plural')
|
||||
self.Tools = translate('OpenLP.Ui', 'Tools')
|
||||
|
@ -166,8 +155,7 @@ def add_welcome_page(parent, image):
|
|||
A splash image for the wizard.
|
||||
"""
|
||||
parent.welcomePage = QtGui.QWizardPage()
|
||||
parent.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
|
||||
QtGui.QPixmap(image))
|
||||
parent.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(image))
|
||||
parent.welcomePage.setObjectName(u'WelcomePage')
|
||||
parent.welcomeLayout = QtGui.QVBoxLayout(parent.welcomePage)
|
||||
parent.welcomeLayout.setObjectName(u'WelcomeLayout')
|
||||
|
@ -223,15 +211,12 @@ def create_button_box(dialog, name, standard_buttons, custom_buttons=[]):
|
|||
button_box.addButton(button, QtGui.QDialogButtonBox.ActionRole)
|
||||
else:
|
||||
button_box.addButton(*button)
|
||||
QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'accepted()'),
|
||||
dialog.accept)
|
||||
QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'rejected()'),
|
||||
dialog.reject)
|
||||
QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'accepted()'), dialog.accept)
|
||||
QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'rejected()'), dialog.reject)
|
||||
return button_box
|
||||
|
||||
|
||||
def critical_error_message_box(title=None, message=None, parent=None,
|
||||
question=False):
|
||||
def critical_error_message_box(title=None, message=None, parent=None, question=False):
|
||||
"""
|
||||
Provides a standard critical message box for errors that OpenLP displays
|
||||
to users.
|
||||
|
@ -250,8 +235,7 @@ def critical_error_message_box(title=None, message=None, parent=None,
|
|||
"""
|
||||
if question:
|
||||
return QtGui.QMessageBox.critical(parent, UiStrings().Error, message,
|
||||
QtGui.QMessageBox.StandardButtons(
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
|
||||
data = {u'message': message}
|
||||
data[u'title'] = title if title else UiStrings().Error
|
||||
return Receiver.send_message(u'openlp_error_message', data)
|
||||
|
@ -306,16 +290,13 @@ def create_button(parent, name, **kwargs):
|
|||
role = kwargs.pop(u'role')
|
||||
if role == u'delete':
|
||||
kwargs.setdefault(u'text', UiStrings().Delete)
|
||||
kwargs.setdefault(u'tooltip',
|
||||
translate('OpenLP.Ui', 'Delete the selected item.'))
|
||||
kwargs.setdefault(u'tooltip', translate('OpenLP.Ui', 'Delete the selected item.'))
|
||||
elif role == u'up':
|
||||
kwargs.setdefault(u'icon', u':/services/service_up.png')
|
||||
kwargs.setdefault(u'tooltip',
|
||||
translate('OpenLP.Ui', 'Move selection up one position.'))
|
||||
kwargs.setdefault(u'tooltip', translate('OpenLP.Ui', 'Move selection up one position.'))
|
||||
elif role == u'down':
|
||||
kwargs.setdefault(u'icon', u':/services/service_down.png')
|
||||
kwargs.setdefault(u'tooltip',
|
||||
translate('OpenLP.Ui', 'Move selection down one position.'))
|
||||
kwargs.setdefault(u'tooltip', translate('OpenLP.Ui', 'Move selection down one position.'))
|
||||
else:
|
||||
log.warn(u'The role "%s" is not defined in create_push_button().',
|
||||
role)
|
||||
|
@ -333,8 +314,7 @@ def create_button(parent, name, **kwargs):
|
|||
if not kwargs.pop(u'enabled', True):
|
||||
button.setEnabled(False)
|
||||
if kwargs.get(u'click'):
|
||||
QtCore.QObject.connect(button, QtCore.SIGNAL(u'clicked()'),
|
||||
kwargs.pop(u'click'))
|
||||
QtCore.QObject.connect(button, QtCore.SIGNAL(u'clicked()'), kwargs.pop(u'click'))
|
||||
for key in kwargs.keys():
|
||||
if key not in [u'text', u'icon', u'tooltip', u'click']:
|
||||
log.warn(u'Parameter %s was not consumed in create_button().', key)
|
||||
|
@ -423,8 +403,7 @@ def create_action(parent, name, **kwargs):
|
|||
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'),
|
||||
kwargs.pop(u'triggers'))
|
||||
for key in kwargs.keys():
|
||||
if key not in [u'text', u'icon', u'tooltip', u'statustip', u'checked',
|
||||
u'shortcuts', u'category', u'triggers']:
|
||||
if key not in [u'text', u'icon', u'tooltip', u'statustip', u'checked', u'shortcuts', u'category', u'triggers']:
|
||||
log.warn(u'Parameter %s was not consumed in create_action().', key)
|
||||
return action
|
||||
|
||||
|
@ -469,8 +448,7 @@ def create_valign_selection_widgets(parent):
|
|||
label = QtGui.QLabel(parent)
|
||||
label.setText(translate('OpenLP.Ui', '&Vertical Align:'))
|
||||
combo_box = QtGui.QComboBox(parent)
|
||||
combo_box.addItems(
|
||||
[UiStrings().Top, UiStrings().Middle, UiStrings().Bottom])
|
||||
combo_box.addItems([UiStrings().Top, UiStrings().Middle, UiStrings().Bottom])
|
||||
label.setBuddy(combo_box)
|
||||
return label, combo_box
|
||||
|
||||
|
|
|
@ -87,8 +87,7 @@ class PlayerTab(SettingsTab):
|
|||
self.playerOrderGroupBox.setObjectName(u'playerOrderGroupBox')
|
||||
self.playerOrderLayout = QtGui.QHBoxLayout(self.playerOrderGroupBox)
|
||||
self.playerOrderLayout.setObjectName(u'playerOrderLayout')
|
||||
self.playerOrderlistWidget = QtGui.QListWidget(
|
||||
self.playerOrderGroupBox)
|
||||
self.playerOrderlistWidget = QtGui.QListWidget(self.playerOrderGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
|
|
|
@ -373,19 +373,16 @@ class WebkitPlayer(MediaPlayer):
|
|||
if display.hasAudio:
|
||||
vol = float(vol) / float(100)
|
||||
if not controller.media_info.is_flash:
|
||||
display.frame.evaluateJavaScript(
|
||||
u'show_video(null, null, %s);' % str(vol))
|
||||
display.frame.evaluateJavaScript(u'show_video(null, null, %s);' % str(vol))
|
||||
|
||||
def seek(self, display, seekVal):
|
||||
controller = display.controller
|
||||
if controller.media_info.is_flash:
|
||||
seek = seekVal
|
||||
display.frame.evaluateJavaScript(
|
||||
u'show_flash("seek", null, null, "%s");' % (seek))
|
||||
display.frame.evaluateJavaScript(u'show_flash("seek", null, null, "%s");' % (seek))
|
||||
else:
|
||||
seek = float(seekVal) / 1000
|
||||
display.frame.evaluateJavaScript(
|
||||
u'show_video("seek", null, null, null, "%f");' % (seek))
|
||||
display.frame.evaluateJavaScript(u'show_video("seek", null, null, null, "%f");' % (seek))
|
||||
|
||||
def reset(self, display):
|
||||
controller = display.controller
|
||||
|
@ -412,11 +409,9 @@ class WebkitPlayer(MediaPlayer):
|
|||
currentTime = display.frame.evaluateJavaScript(u'show_flash("currentTime");')
|
||||
length = display.frame.evaluateJavaScript(u'show_flash("length");')
|
||||
else:
|
||||
if display.frame.evaluateJavaScript(
|
||||
u'show_video("isEnded");') == 'true':
|
||||
if display.frame.evaluateJavaScript(u'show_video("isEnded");') == 'true':
|
||||
self.stop(display)
|
||||
(currentTime, ok) = display.frame.evaluateJavaScript(
|
||||
u'show_video("currentTime");')
|
||||
(currentTime, ok) = display.frame.evaluateJavaScript(u'show_video("currentTime");')
|
||||
# check if conversion was ok and value is not 'NaN'
|
||||
if ok and currentTime != float('inf'):
|
||||
currentTime = int(currentTime * 1000)
|
||||
|
|
|
@ -234,11 +234,9 @@ class ServiceManager(QtGui.QWidget):
|
|||
self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
|
||||
# build the drag and drop context menu
|
||||
self.dndMenu = QtGui.QMenu()
|
||||
self.newAction = self.dndMenu.addAction(
|
||||
translate('OpenLP.ServiceManager', '&Add New Item'))
|
||||
self.newAction = self.dndMenu.addAction(translate('OpenLP.ServiceManager', '&Add New Item'))
|
||||
self.newAction.setIcon(build_icon(u':/general/general_edit.png'))
|
||||
self.addToAction = self.dndMenu.addAction(
|
||||
translate('OpenLP.ServiceManager', '&Add to Selected Item'))
|
||||
self.addToAction = self.dndMenu.addAction(translate('OpenLP.ServiceManager', '&Add to Selected Item'))
|
||||
self.addToAction.setIcon(build_icon(u':/general/general_edit.png'))
|
||||
# build the context menu
|
||||
self.menu = QtGui.QMenu()
|
||||
|
@ -420,9 +418,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
basename = os.path.splitext(file_name)[0]
|
||||
service_file_name = '%s.osd' % basename
|
||||
log.debug(u'ServiceManager.saveFile - %s', path_file_name)
|
||||
SettingsManager.set_last_dir(
|
||||
self.mainwindow.serviceManagerSettingsSection,
|
||||
path)
|
||||
SettingsManager.set_last_dir(self.mainwindow.serviceManagerSettingsSection, path)
|
||||
service = []
|
||||
write_list = []
|
||||
missing_list = []
|
||||
|
@ -1289,9 +1285,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
if self.serviceItems[item][u'service_item'].is_valid:
|
||||
self.mainwindow.liveController.addServiceManagerItem(
|
||||
self.serviceItems[item][u'service_item'], child)
|
||||
if Settings().value(
|
||||
self.mainwindow.generalSettingsSection + u'/auto preview',
|
||||
False):
|
||||
if Settings().value(self.mainwindow.generalSettingsSection + u'/auto preview', False):
|
||||
item += 1
|
||||
if self.serviceItems and item < len(self.serviceItems) and \
|
||||
self.serviceItems[item][u'service_item'].is_capable(ItemCapabilities.CanPreview):
|
||||
|
|
|
@ -71,8 +71,8 @@ class MediaMediaItem(MediaManagerItem):
|
|||
self.displayController.previewDisplay.screen = {u'size':self.displayController.previewDisplay.geometry()}
|
||||
self.displayController.previewDisplay.setup()
|
||||
self.plugin.mediaController.setup_display(self.displayController.previewDisplay, False)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'video_background_replaced'), self.videobackgroundReplaced)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'video_background_replaced'),
|
||||
self.videobackgroundReplaced)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'mediaitem_media_rebuild'), self.rebuild_players)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'), self.displaySetup)
|
||||
# Allow DnD from the desktop
|
||||
|
|
Loading…
Reference in New Issue