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