forked from openlp/openlp
Merging
This commit is contained in:
commit
1aae38cb8e
@ -43,14 +43,15 @@ from traceback import format_exception
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Settings, ScreenList, UiStrings, Registry, check_directory_exists
|
||||
from openlp.core.common import AppLocation, Settings, UiStrings, check_directory_exists
|
||||
from openlp.core.lib import ScreenList, Registry
|
||||
from openlp.core.resources import qInitResources
|
||||
from openlp.core.ui.mainwindow import MainWindow
|
||||
from openlp.core.ui.firsttimelanguageform import FirstTimeLanguageForm
|
||||
from openlp.core.ui.firsttimeform import FirstTimeForm
|
||||
from openlp.core.ui.exceptionform import ExceptionForm
|
||||
from openlp.core.ui import SplashScreen
|
||||
from openlp.core.utils import AppLocation, LanguageManager, VersionThread, get_application_version
|
||||
from openlp.core.utils import LanguageManager, VersionThread, get_application_version
|
||||
|
||||
|
||||
__all__ = ['OpenLP', 'main']
|
||||
|
109
openlp/core/common/__init__.py
Normal file
109
openlp/core/common/__init__.py
Normal file
@ -0,0 +1,109 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2013 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2013 Tim Bentley, Gerald Britton, Jonathan #
|
||||
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
|
||||
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
|
||||
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
|
||||
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
|
||||
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
|
||||
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`common` module contains most of the components and libraries that make
|
||||
OpenLP work.
|
||||
"""
|
||||
import os
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def check_directory_exists(directory, do_not_log=False):
|
||||
"""
|
||||
Check a theme directory exists and if not create it
|
||||
|
||||
``directory``
|
||||
The directory to make sure exists
|
||||
|
||||
``do_not_log``
|
||||
To not log anything. This is need for the start up, when the log isn't ready.
|
||||
"""
|
||||
if not do_not_log:
|
||||
log.debug('check_directory_exists %s' % directory)
|
||||
try:
|
||||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
|
||||
def get_frozen_path(frozen_option, non_frozen_option):
|
||||
"""
|
||||
Return a path based on the system status.
|
||||
"""
|
||||
if hasattr(sys, 'frozen') and sys.frozen == 1:
|
||||
return frozen_option
|
||||
return non_frozen_option
|
||||
|
||||
|
||||
class ThemeLevel(object):
|
||||
"""
|
||||
Provides an enumeration for the level a theme applies to
|
||||
"""
|
||||
Global = 1
|
||||
Service = 2
|
||||
Song = 3
|
||||
|
||||
|
||||
def translate(context, text, comment=None, encoding=QtCore.QCoreApplication.CodecForTr, n=-1,
|
||||
qt_translate=QtCore.QCoreApplication.translate):
|
||||
"""
|
||||
A special shortcut method to wrap around the Qt4 translation functions. This abstracts the translation procedure so
|
||||
that we can change it if at a later date if necessary, without having to redo the whole of OpenLP.
|
||||
|
||||
``context``
|
||||
The translation context, used to give each string a context or a namespace.
|
||||
|
||||
``text``
|
||||
The text to put into the translation tables for translation.
|
||||
|
||||
``comment``
|
||||
An identifying string for when the same text is used in different roles within the same context.
|
||||
"""
|
||||
return qt_translate(context, text, comment, encoding, n)
|
||||
|
||||
|
||||
class SlideLimits(object):
|
||||
"""
|
||||
Provides an enumeration for behaviour of OpenLP at the end limits of each service item when pressing the up/down
|
||||
arrow keys
|
||||
"""
|
||||
End = 1
|
||||
Wrap = 2
|
||||
Next = 3
|
||||
|
||||
from .uistrings import UiStrings
|
||||
from .settings import Settings
|
||||
from .applocation import AppLocation
|
||||
|
@ -27,14 +27,13 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`openlp.core.utils.applocation` module provides an utility for OpenLP receiving the data path etc.
|
||||
The :mod:`openlp.core.common.applocation` module provides an utility for OpenLP receiving the data path etc.
|
||||
"""
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
from openlp.core.lib import Settings
|
||||
from openlp.core.utils import _get_frozen_path
|
||||
from openlp.core.common import Settings
|
||||
|
||||
|
||||
if sys.platform != 'win32' and sys.platform != 'darwin':
|
||||
@ -45,7 +44,7 @@ if sys.platform != 'win32' and sys.platform != 'darwin':
|
||||
XDG_BASE_AVAILABLE = False
|
||||
|
||||
import openlp
|
||||
from openlp.core.lib import check_directory_exists
|
||||
from openlp.core.common import check_directory_exists, get_frozen_path
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -74,15 +73,15 @@ class AppLocation(object):
|
||||
The directory type you want, for instance the data directory. Default *AppLocation.AppDir*
|
||||
"""
|
||||
if dir_type == AppLocation.AppDir:
|
||||
return _get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), os.path.split(openlp.__file__)[0])
|
||||
return get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), os.path.split(openlp.__file__)[0])
|
||||
elif dir_type == AppLocation.PluginsDir:
|
||||
app_path = os.path.abspath(os.path.split(sys.argv[0])[0])
|
||||
return _get_frozen_path(os.path.join(app_path, 'plugins'),
|
||||
return get_frozen_path(os.path.join(app_path, 'plugins'),
|
||||
os.path.join(os.path.split(openlp.__file__)[0], 'plugins'))
|
||||
elif dir_type == AppLocation.VersionDir:
|
||||
return _get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), os.path.split(openlp.__file__)[0])
|
||||
return get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), os.path.split(openlp.__file__)[0])
|
||||
elif dir_type == AppLocation.LanguageDir:
|
||||
app_path = _get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), _get_os_dir_path(dir_type))
|
||||
app_path = get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), _get_os_dir_path(dir_type))
|
||||
return os.path.join(app_path, 'i18n')
|
||||
elif dir_type == AppLocation.DataDir and AppLocation.BaseDir:
|
||||
return os.path.join(AppLocation.BaseDir, 'data')
|
||||
@ -171,4 +170,3 @@ def _get_os_dir_path(dir_type):
|
||||
if dir_type == AppLocation.DataDir:
|
||||
return os.path.join(str(os.getenv('HOME')), '.openlp', 'data')
|
||||
return os.path.join(str(os.getenv('HOME')), '.openlp')
|
||||
|
@ -36,8 +36,7 @@ import sys
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SlideLimits, UiStrings
|
||||
from openlp.core.lib.theme import ThemeLevel
|
||||
from openlp.core.common import ThemeLevel, SlideLimits, UiStrings
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
@ -31,7 +31,7 @@ The :mod:`uistrings` module provides standard strings for OpenLP.
|
||||
"""
|
||||
import logging
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
@ -37,6 +37,8 @@ import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui, Qt
|
||||
|
||||
from openlp.core.common import translate
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -72,16 +74,6 @@ class MediaType(object):
|
||||
Video = 2
|
||||
|
||||
|
||||
class SlideLimits(object):
|
||||
"""
|
||||
Provides an enumeration for behaviour of OpenLP at the end limits of each service item when pressing the up/down
|
||||
arrow keys
|
||||
"""
|
||||
End = 1
|
||||
Wrap = 2
|
||||
Next = 3
|
||||
|
||||
|
||||
class ServiceItemAction(object):
|
||||
"""
|
||||
Provides an enumeration for the required action moving between service items by left/right arrow keys
|
||||
@ -91,24 +83,6 @@ class ServiceItemAction(object):
|
||||
Next = 3
|
||||
|
||||
|
||||
def translate(context, text, comment=None, encoding=QtCore.QCoreApplication.CodecForTr, n=-1,
|
||||
qt_translate=QtCore.QCoreApplication.translate):
|
||||
"""
|
||||
A special shortcut method to wrap around the Qt4 translation functions. This abstracts the translation procedure so
|
||||
that we can change it if at a later date if necessary, without having to redo the whole of OpenLP.
|
||||
|
||||
``context``
|
||||
The translation context, used to give each string a context or a namespace.
|
||||
|
||||
``text``
|
||||
The text to put into the translation tables for translation.
|
||||
|
||||
``comment``
|
||||
An identifying string for when the same text is used in different roles within the same context.
|
||||
"""
|
||||
return qt_translate(context, text, comment, encoding, n)
|
||||
|
||||
|
||||
def get_text_file_string(text_file):
|
||||
"""
|
||||
Open a file and return its content as unicode string. If the supplied file name is not a file then the function
|
||||
@ -327,57 +301,36 @@ def expand_tags(text):
|
||||
return text
|
||||
|
||||
|
||||
def check_directory_exists(directory, do_not_log=False):
|
||||
"""
|
||||
Check a theme directory exists and if not create it
|
||||
|
||||
``directory``
|
||||
The directory to make sure exists
|
||||
|
||||
``do_not_log``
|
||||
To not log anything. This is need for the start up, when the log isn't ready.
|
||||
"""
|
||||
if not do_not_log:
|
||||
log.debug('check_directory_exists %s' % directory)
|
||||
try:
|
||||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
|
||||
def create_separated_list(stringlist):
|
||||
def create_separated_list(string_list):
|
||||
"""
|
||||
Returns a string that represents a join of a list of strings with a localized separator. This function corresponds
|
||||
to QLocale::createSeparatedList which was introduced in Qt 4.8 and implements the algorithm from
|
||||
http://www.unicode.org/reports/tr35/#ListPatterns
|
||||
|
||||
``stringlist``
|
||||
``string_list``
|
||||
List of unicode strings
|
||||
"""
|
||||
if LooseVersion(Qt.PYQT_VERSION_STR) >= LooseVersion('4.9') and \
|
||||
LooseVersion(Qt.qVersion()) >= LooseVersion('4.8'):
|
||||
return QtCore.QLocale().createSeparatedList(stringlist)
|
||||
if not stringlist:
|
||||
return QtCore.QLocale().createSeparatedList(string_list)
|
||||
if not string_list:
|
||||
return ''
|
||||
elif len(stringlist) == 1:
|
||||
return stringlist[0]
|
||||
elif len(stringlist) == 2:
|
||||
elif len(string_list) == 1:
|
||||
return string_list[0]
|
||||
elif len(string_list) == 2:
|
||||
return translate('OpenLP.core.lib', '%s and %s',
|
||||
'Locale list separator: 2 items') % (stringlist[0], stringlist[1])
|
||||
'Locale list separator: 2 items') % (string_list[0], string_list[1])
|
||||
else:
|
||||
merged = translate('OpenLP.core.lib', '%s, and %s',
|
||||
'Locale list separator: end') % (stringlist[-2], stringlist[-1])
|
||||
for index in reversed(list(range(1, len(stringlist) - 2))):
|
||||
'Locale list separator: end') % (string_list[-2], string_list[-1])
|
||||
for index in reversed(list(range(1, len(string_list) - 2))):
|
||||
merged = translate('OpenLP.core.lib', '%s, %s',
|
||||
'Locale list separator: middle') % (stringlist[index], merged)
|
||||
return translate('OpenLP.core.lib', '%s, %s', 'Locale list separator: start') % (stringlist[0], merged)
|
||||
'Locale list separator: middle') % (string_list[index], merged)
|
||||
return translate('OpenLP.core.lib', '%s, %s', 'Locale list separator: start') % (string_list[0], merged)
|
||||
|
||||
|
||||
from .registry import Registry
|
||||
from .uistrings import UiStrings
|
||||
from .screen import ScreenList
|
||||
from .settings import Settings
|
||||
from .listwidgetwithdnd import ListWidgetWithDnD
|
||||
from .treewidgetwithdnd import TreeWidgetWithDnD
|
||||
from .formattingtags import FormattingTags
|
||||
|
@ -41,9 +41,9 @@ from sqlalchemy.pool import NullPool
|
||||
from alembic.migration import MigrationContext
|
||||
from alembic.operations import Operations
|
||||
|
||||
from openlp.core.lib import translate, Settings
|
||||
from openlp.core.common import AppLocation, Settings, translate
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.core.utils import AppLocation, delete_file
|
||||
from openlp.core.utils import delete_file
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -31,7 +31,8 @@ Provide HTML Tag management and Formatting Tag access class
|
||||
"""
|
||||
import json
|
||||
|
||||
from openlp.core.lib import Settings, translate
|
||||
from openlp.core.common import Settings
|
||||
from openlp.core.lib import translate
|
||||
|
||||
|
||||
class FormattingTags(object):
|
||||
|
@ -26,7 +26,372 @@
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
This module is responsible for generating the HTML for :class:`~openlp.core.ui.maindisplay`. The ``build_html`` function
|
||||
is the function which has to be called from outside. The generated and returned HTML will look similar to this::
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>OpenLP Display</title>
|
||||
<style>
|
||||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
overflow: hidden;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
body {
|
||||
background-color: #000000;
|
||||
}
|
||||
.size {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#black {
|
||||
z-index: 8;
|
||||
background-color: black;
|
||||
display: none;
|
||||
}
|
||||
#bgimage {
|
||||
z-index: 1;
|
||||
}
|
||||
#image {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
#videobackboard {
|
||||
z-index:3;
|
||||
background-color: #000000;
|
||||
}
|
||||
#video {
|
||||
background-color: #000000;
|
||||
z-index:4;
|
||||
}
|
||||
|
||||
#flash {
|
||||
z-index:5;
|
||||
}
|
||||
|
||||
#alert {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
z-index: 10;
|
||||
width: 100%;
|
||||
vertical-align: bottom;
|
||||
font-family: DejaVu Sans;
|
||||
font-size: 40pt;
|
||||
color: #ffffff;
|
||||
background-color: #660000;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#footer {
|
||||
position: absolute;
|
||||
z-index: 6;
|
||||
|
||||
left: 10px;
|
||||
bottom: 0px;
|
||||
width: 1580px;
|
||||
font-family: Nimbus Sans L;
|
||||
font-size: 12pt;
|
||||
color: #FFFFFF;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
|
||||
}
|
||||
/* lyric css */
|
||||
|
||||
.lyricstable {
|
||||
z-index: 5;
|
||||
position: absolute;
|
||||
display: table;
|
||||
left: 10px; top: 0px;
|
||||
}
|
||||
.lyricscell {
|
||||
display: table-cell;
|
||||
word-wrap: break-word;
|
||||
-webkit-transition: opacity 0.4s ease;
|
||||
white-space:pre-wrap; word-wrap: break-word; text-align: left; vertical-align: top; font-family: Nimbus Sans L; font-size: 40pt; color: #FFFFFF; line-height: 100%; margin: 0;padding: 0; padding-bottom: 0; padding-left: 4px; width: 1580px; height: 810px;
|
||||
}
|
||||
.lyricsmain {
|
||||
-webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; text-shadow: #000000 5px 5px;
|
||||
}
|
||||
|
||||
sup {
|
||||
font-size: 0.6em;
|
||||
vertical-align: top;
|
||||
position: relative;
|
||||
top: -0.3em;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var timer = null;
|
||||
var transition = false;
|
||||
|
||||
function show_video(state, path, volume, loop, variable_value){
|
||||
// Sometimes video.currentTime stops slightly short of video.duration and video.ended is intermittent!
|
||||
|
||||
var video = document.getElementById('video');
|
||||
if(volume != null){
|
||||
video.volume = volume;
|
||||
}
|
||||
switch(state){
|
||||
case 'load':
|
||||
video.src = 'file:///' + path;
|
||||
if(loop == true) {
|
||||
video.loop = true;
|
||||
}
|
||||
video.load();
|
||||
break;
|
||||
case 'play':
|
||||
video.play();
|
||||
break;
|
||||
case 'pause':
|
||||
video.pause();
|
||||
break;
|
||||
case 'stop':
|
||||
show_video('pause');
|
||||
video.currentTime = 0;
|
||||
break;
|
||||
case 'close':
|
||||
show_video('stop');
|
||||
video.src = '';
|
||||
break;
|
||||
case 'length':
|
||||
return video.duration;
|
||||
case 'current_time':
|
||||
return video.currentTime;
|
||||
case 'seek':
|
||||
video.currentTime = variable_value;
|
||||
break;
|
||||
case 'isEnded':
|
||||
return video.ended;
|
||||
case 'setVisible':
|
||||
video.style.visibility = variable_value;
|
||||
break;
|
||||
case 'setBackBoard':
|
||||
var back = document.getElementById('videobackboard');
|
||||
back.style.visibility = variable_value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function getFlashMovieObject(movieName)
|
||||
{
|
||||
if (window.document[movieName]){
|
||||
return window.document[movieName];
|
||||
}
|
||||
if (document.embeds && document.embeds[movieName]){
|
||||
return document.embeds[movieName];
|
||||
}
|
||||
}
|
||||
|
||||
function show_flash(state, path, volume, variable_value){
|
||||
var text = document.getElementById('flash');
|
||||
var flashMovie = getFlashMovieObject("OpenLPFlashMovie");
|
||||
var src = "src = 'file:///" + path + "'";
|
||||
var view_parm = " wmode='opaque'" + " width='100%%'" + " height='100%%'";
|
||||
var swf_parm = " name='OpenLPFlashMovie'" + " autostart='true' loop='false' play='true'" +
|
||||
" hidden='false' swliveconnect='true' allowscriptaccess='always'" + " volume='" + volume + "'";
|
||||
|
||||
switch(state){
|
||||
case 'load':
|
||||
text.innerHTML = "<embed " + src + view_parm + swf_parm + "/>";
|
||||
flashMovie = getFlashMovieObject("OpenLPFlashMovie");
|
||||
flashMovie.Play();
|
||||
break;
|
||||
case 'play':
|
||||
flashMovie.Play();
|
||||
break;
|
||||
case 'pause':
|
||||
flashMovie.StopPlay();
|
||||
break;
|
||||
case 'stop':
|
||||
flashMovie.StopPlay();
|
||||
tempHtml = text.innerHTML;
|
||||
text.innerHTML = '';
|
||||
text.innerHTML = tempHtml;
|
||||
break;
|
||||
case 'close':
|
||||
flashMovie.StopPlay();
|
||||
text.innerHTML = '';
|
||||
break;
|
||||
case 'length':
|
||||
return flashMovie.TotalFrames();
|
||||
case 'current_time':
|
||||
return flashMovie.CurrentFrame();
|
||||
case 'seek':
|
||||
// flashMovie.GotoFrame(variable_value);
|
||||
break;
|
||||
case 'isEnded':
|
||||
//TODO check flash end
|
||||
return false;
|
||||
case 'setVisible':
|
||||
text.style.visibility = variable_value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function show_alert(alerttext, position){
|
||||
var text = document.getElementById('alert');
|
||||
text.innerHTML = alerttext;
|
||||
if(alerttext == '') {
|
||||
text.style.visibility = 'hidden';
|
||||
return 0;
|
||||
}
|
||||
if(position == ''){
|
||||
position = getComputedStyle(text, '').verticalAlign;
|
||||
}
|
||||
switch(position)
|
||||
{
|
||||
case 'top':
|
||||
text.style.top = '0px';
|
||||
break;
|
||||
case 'middle':
|
||||
text.style.top = ((window.innerHeight - text.clientHeight) / 2)
|
||||
+ 'px';
|
||||
break;
|
||||
case 'bottom':
|
||||
text.style.top = (window.innerHeight - text.clientHeight)
|
||||
+ 'px';
|
||||
break;
|
||||
}
|
||||
text.style.visibility = 'visible';
|
||||
return text.clientHeight;
|
||||
}
|
||||
|
||||
function update_css(align, font, size, color, bgcolor){
|
||||
var text = document.getElementById('alert');
|
||||
text.style.fontSize = size + "pt";
|
||||
text.style.fontFamily = font;
|
||||
text.style.color = color;
|
||||
text.style.backgroundColor = bgcolor;
|
||||
switch(align)
|
||||
{
|
||||
case 'top':
|
||||
text.style.top = '0px';
|
||||
break;
|
||||
case 'middle':
|
||||
text.style.top = ((window.innerHeight - text.clientHeight) / 2)
|
||||
+ 'px';
|
||||
break;
|
||||
case 'bottom':
|
||||
text.style.top = (window.innerHeight - text.clientHeight)
|
||||
+ 'px';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function show_image(src){
|
||||
var img = document.getElementById('image');
|
||||
img.src = src;
|
||||
if(src == '')
|
||||
img.style.display = 'none';
|
||||
else
|
||||
img.style.display = 'block';
|
||||
}
|
||||
|
||||
function show_blank(state){
|
||||
var black = 'none';
|
||||
var lyrics = '';
|
||||
switch(state){
|
||||
case 'theme':
|
||||
lyrics = 'hidden';
|
||||
break;
|
||||
case 'black':
|
||||
black = 'block';
|
||||
break;
|
||||
case 'desktop':
|
||||
break;
|
||||
}
|
||||
document.getElementById('black').style.display = black;
|
||||
document.getElementById('lyricsmain').style.visibility = lyrics;
|
||||
document.getElementById('image').style.visibility = lyrics;
|
||||
document.getElementById('footer').style.visibility = lyrics;
|
||||
}
|
||||
|
||||
function show_footer(footertext){
|
||||
document.getElementById('footer').innerHTML = footertext;
|
||||
}
|
||||
|
||||
function show_text(new_text){
|
||||
var match = /-webkit-text-fill-color:[^;"]+/gi;
|
||||
if(timer != null)
|
||||
clearTimeout(timer);
|
||||
/*
|
||||
QtWebkit bug with outlines and justify causing outline alignment
|
||||
problems. (Bug 859950) Surround each word with a <span> to workaround,
|
||||
but only in this scenario.
|
||||
*/
|
||||
var txt = document.getElementById('lyricsmain');
|
||||
if(window.getComputedStyle(txt).textAlign == 'justify'){
|
||||
if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){
|
||||
new_text = new_text.replace(/(\s| )+(?![^<]*>)/g,
|
||||
function(match) {
|
||||
return '</span>' + match + '<span>';
|
||||
});
|
||||
new_text = '<span>' + new_text + '</span>';
|
||||
}
|
||||
}
|
||||
text_fade('lyricsmain', new_text);
|
||||
}
|
||||
|
||||
function text_fade(id, new_text){
|
||||
/*
|
||||
Show the text.
|
||||
*/
|
||||
var text = document.getElementById(id);
|
||||
if(text == null) return;
|
||||
if(!transition){
|
||||
text.innerHTML = new_text;
|
||||
return;
|
||||
}
|
||||
// Fade text out. 0.1 to minimize the time "nothing" is shown on the screen.
|
||||
text.style.opacity = '0.1';
|
||||
// Fade new text in after the old text has finished fading out.
|
||||
timer = window.setTimeout(function(){_show_text(text, new_text)}, 400);
|
||||
}
|
||||
|
||||
function _show_text(text, new_text) {
|
||||
/*
|
||||
Helper function to show the new_text delayed.
|
||||
*/
|
||||
text.innerHTML = new_text;
|
||||
text.style.opacity = '1';
|
||||
// Wait until the text is completely visible. We want to save the timer id, to be able to call
|
||||
// clearTimeout(timer) when the text has changed before finishing fading.
|
||||
timer = window.setTimeout(function(){timer = null;}, 400);
|
||||
}
|
||||
|
||||
function show_text_completed(){
|
||||
return (timer == null);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<img id="bgimage" class="size" style="display:none;" />
|
||||
<img id="image" class="size" style="display:none;" />
|
||||
|
||||
<div id="videobackboard" class="size" style="visibility:hidden"></div>
|
||||
<video id="video" class="size" style="visibility:hidden" autobuffer preload></video>
|
||||
|
||||
<div id="flash" class="size" style="visibility:hidden"></div>
|
||||
|
||||
<div id="alert" style="visibility:hidden"></div>
|
||||
|
||||
<div class="lyricstable"><div id="lyricsmain" style="opacity:1" class="lyricscell lyricsmain"></div></div>
|
||||
<div id="footer" class="footer"></div>
|
||||
<div id="black" class="size"></div>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtWebKit
|
||||
@ -114,12 +479,6 @@ sup {
|
||||
document.getElementById('black').style.display = black;
|
||||
document.getElementById('lyricsmain').style.visibility = lyrics;
|
||||
document.getElementById('image').style.visibility = lyrics;
|
||||
outline = document.getElementById('lyricsoutline')
|
||||
if(outline != null)
|
||||
outline.style.visibility = lyrics;
|
||||
shadow = document.getElementById('lyricsshadow')
|
||||
if(shadow != null)
|
||||
shadow.style.visibility = lyrics;
|
||||
document.getElementById('footer').style.visibility = lyrics;
|
||||
}
|
||||
|
||||
@ -138,9 +497,6 @@ sup {
|
||||
*/
|
||||
var txt = document.getElementById('lyricsmain');
|
||||
if(window.getComputedStyle(txt).textAlign == 'justify'){
|
||||
var outline = document.getElementById('lyricsoutline');
|
||||
if(outline != null)
|
||||
txt = outline;
|
||||
if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){
|
||||
new_text = new_text.replace(/(\s| )+(?![^<]*>)/g,
|
||||
function(match) {
|
||||
@ -150,8 +506,6 @@ sup {
|
||||
}
|
||||
}
|
||||
text_fade('lyricsmain', new_text);
|
||||
text_fade('lyricsoutline', new_text);
|
||||
text_fade('lyricsshadow', new_text.replace(match, ''));
|
||||
}
|
||||
|
||||
function text_fade(id, new_text){
|
||||
@ -190,7 +544,7 @@ sup {
|
||||
<img id="bgimage" class="size" %s />
|
||||
<img id="image" class="size" %s />
|
||||
%s
|
||||
%s
|
||||
<div class="lyricstable"><div id="lyricsmain" style="opacity:1" class="lyricscell lyricsmain"></div></div>
|
||||
<div id="footer" class="footer"></div>
|
||||
<div id="black" class="size"></div>
|
||||
</body>
|
||||
@ -222,8 +576,7 @@ def build_html(item, screen, is_live, background, image=None, plugins=None):
|
||||
"""
|
||||
width = screen['size'].width()
|
||||
height = screen['size'].height()
|
||||
theme = item.themedata
|
||||
webkit_ver = webkit_version()
|
||||
theme_data = item.themedata
|
||||
# Image generated and poked in
|
||||
if background:
|
||||
bgimage_src = 'src="data:image/png;base64,%s"' % background
|
||||
@ -247,12 +600,12 @@ def build_html(item, screen, is_live, background, image=None, plugins=None):
|
||||
build_background_css(item, width),
|
||||
css_additions,
|
||||
build_footer_css(item, height),
|
||||
build_lyrics_css(item, webkit_ver),
|
||||
'true' if theme and theme.display_slide_transition and is_live else 'false',
|
||||
build_lyrics_css(item),
|
||||
'true' if theme_data and theme_data.display_slide_transition and is_live else 'false',
|
||||
js_additions,
|
||||
bgimage_src, image_src,
|
||||
html_additions,
|
||||
build_lyrics_html(item, webkit_ver)
|
||||
bgimage_src,
|
||||
image_src,
|
||||
html_additions
|
||||
)
|
||||
return html
|
||||
|
||||
@ -303,16 +656,13 @@ def build_background_css(item, width):
|
||||
return background
|
||||
|
||||
|
||||
def build_lyrics_css(item, webkit_ver):
|
||||
def build_lyrics_css(item):
|
||||
"""
|
||||
Build the lyrics display css
|
||||
|
||||
``item``
|
||||
Service Item containing theme and location information
|
||||
|
||||
``webkitvers``
|
||||
The version of qtwebkit we're using
|
||||
|
||||
"""
|
||||
style = """
|
||||
.lyricstable {
|
||||
@ -328,81 +678,44 @@ def build_lyrics_css(item, webkit_ver):
|
||||
%s
|
||||
}
|
||||
.lyricsmain {
|
||||
%s
|
||||
%s
|
||||
}
|
||||
.lyricsoutline {
|
||||
%s
|
||||
}
|
||||
.lyricsshadow {
|
||||
%s
|
||||
}
|
||||
"""
|
||||
theme = item.themedata
|
||||
"""
|
||||
theme_data = item.themedata
|
||||
lyricstable = ''
|
||||
lyrics = ''
|
||||
lyricsmain = ''
|
||||
outline = ''
|
||||
shadow = ''
|
||||
if theme and item.main:
|
||||
if theme_data and item.main:
|
||||
lyricstable = 'left: %spx; top: %spx;' % (item.main.x(), item.main.y())
|
||||
lyrics = build_lyrics_format_css(theme, item.main.width(), item.main.height())
|
||||
# For performance reasons we want to show as few DIV's as possible, especially when animating/transitions.
|
||||
# However some bugs in older versions of qtwebkit mean we need to perform workarounds and add extra divs. Only
|
||||
# do these when needed.
|
||||
#
|
||||
# Before 533.3 the webkit-text-fill colour wasn't displayed, only the stroke (outline) color. So put stroke
|
||||
# layer underneath the main text.
|
||||
#
|
||||
# Up to 534.3 the webkit-text-stroke was sometimes out of alignment with the fill, or normal text.
|
||||
# letter-spacing=1 is workaround https://bugs.webkit.org/show_bug.cgi?id=44403
|
||||
#
|
||||
# Up to 534.3 the text-shadow didn't get displayed when webkit-text-stroke was used. So use an offset text
|
||||
# layer underneath. https://bugs.webkit.org/show_bug.cgi?id=19728
|
||||
if webkit_ver >= 533.3:
|
||||
lyricsmain += build_lyrics_outline_css(theme)
|
||||
else:
|
||||
outline = build_lyrics_outline_css(theme)
|
||||
if theme.font_main_shadow:
|
||||
if theme.font_main_outline and webkit_ver <= 534.3:
|
||||
shadow = 'padding-left: %spx; padding-top: %spx;' % \
|
||||
(int(theme.font_main_shadow_size) + (int(theme.font_main_outline_size) * 2),
|
||||
theme.font_main_shadow_size)
|
||||
shadow += build_lyrics_outline_css(theme, True)
|
||||
else:
|
||||
lyricsmain += ' text-shadow: %s %spx %spx;' % \
|
||||
(theme.font_main_shadow_color, theme.font_main_shadow_size, theme.font_main_shadow_size)
|
||||
lyrics_css = style % (lyricstable, lyrics, lyricsmain, outline, shadow)
|
||||
lyrics = build_lyrics_format_css(theme_data, item.main.width(), item.main.height())
|
||||
lyricsmain += build_lyrics_outline_css(theme_data)
|
||||
if theme_data.font_main_shadow:
|
||||
lyricsmain += ' text-shadow: %s %spx %spx;' % \
|
||||
(theme_data.font_main_shadow_color, theme_data.font_main_shadow_size, theme_data.font_main_shadow_size)
|
||||
lyrics_css = style % (lyricstable, lyrics, lyricsmain)
|
||||
return lyrics_css
|
||||
|
||||
|
||||
def build_lyrics_outline_css(theme, is_shadow=False):
|
||||
def build_lyrics_outline_css(theme_data):
|
||||
"""
|
||||
Build the css which controls the theme outline. Also used by renderer for splitting verses
|
||||
|
||||
``theme``
|
||||
``theme_data``
|
||||
Object containing theme information
|
||||
|
||||
``is_shadow``
|
||||
If true, use the shadow colors instead
|
||||
"""
|
||||
if theme.font_main_outline:
|
||||
size = float(theme.font_main_outline_size) / 16
|
||||
if is_shadow:
|
||||
fill_color = theme.font_main_shadow_color
|
||||
outline_color = theme.font_main_shadow_color
|
||||
else:
|
||||
fill_color = theme.font_main_color
|
||||
outline_color = theme.font_main_outline_color
|
||||
if theme_data.font_main_outline:
|
||||
size = float(theme_data.font_main_outline_size) / 16
|
||||
fill_color = theme_data.font_main_color
|
||||
outline_color = theme_data.font_main_outline_color
|
||||
return ' -webkit-text-stroke: %sem %s; -webkit-text-fill-color: %s; ' % (size, outline_color, fill_color)
|
||||
else:
|
||||
return ''
|
||||
return ''
|
||||
|
||||
|
||||
def build_lyrics_format_css(theme, width, height):
|
||||
def build_lyrics_format_css(theme_data, width, height):
|
||||
"""
|
||||
Build the css which controls the theme format. Also used by renderer for splitting verses
|
||||
|
||||
``theme``
|
||||
``theme_data``
|
||||
Object containing theme information
|
||||
|
||||
``width``
|
||||
@ -411,17 +724,17 @@ def build_lyrics_format_css(theme, width, height):
|
||||
``height``
|
||||
Height of the lyrics block
|
||||
"""
|
||||
align = HorizontalType.Names[theme.display_horizontal_align]
|
||||
valign = VerticalType.Names[theme.display_vertical_align]
|
||||
if theme.font_main_outline:
|
||||
left_margin = int(theme.font_main_outline_size) * 2
|
||||
align = HorizontalType.Names[theme_data.display_horizontal_align]
|
||||
valign = VerticalType.Names[theme_data.display_vertical_align]
|
||||
if theme_data.font_main_outline:
|
||||
left_margin = int(theme_data.font_main_outline_size) * 2
|
||||
else:
|
||||
left_margin = 0
|
||||
justify = 'white-space:pre-wrap;'
|
||||
# fix tag incompatibilities
|
||||
if theme.display_horizontal_align == HorizontalType.Justify:
|
||||
if theme_data.display_horizontal_align == HorizontalType.Justify:
|
||||
justify = ''
|
||||
if theme.display_vertical_align == VerticalType.Bottom:
|
||||
if theme_data.display_vertical_align == VerticalType.Bottom:
|
||||
padding_bottom = '0.5em'
|
||||
else:
|
||||
padding_bottom = '0'
|
||||
@ -429,41 +742,13 @@ def build_lyrics_format_css(theme, width, height):
|
||||
'text-align: %s; vertical-align: %s; font-family: %s; ' \
|
||||
'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \
|
||||
'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx; height: %spx; ' % \
|
||||
(justify, align, valign, theme.font_main_name, theme.font_main_size,
|
||||
theme.font_main_color, 100 + int(theme.font_main_line_adjustment), padding_bottom, left_margin, width, height)
|
||||
if theme.font_main_outline:
|
||||
if webkit_version() <= 534.3:
|
||||
lyrics += ' letter-spacing: 1px;'
|
||||
if theme.font_main_italics:
|
||||
lyrics += ' font-style:italic; '
|
||||
if theme.font_main_bold:
|
||||
lyrics += ' font-weight:bold; '
|
||||
return lyrics
|
||||
|
||||
|
||||
def build_lyrics_html(item, webkitvers):
|
||||
"""
|
||||
Build the HTML required to show the lyrics
|
||||
|
||||
``item``
|
||||
Service Item containing theme and location information
|
||||
|
||||
``webkitvers``
|
||||
The version of qtwebkit we're using
|
||||
"""
|
||||
# Bugs in some versions of QtWebKit mean we sometimes need additional divs for outline and shadow, since the CSS
|
||||
# doesn't work. To support vertical alignment middle and bottom, nested div's using display:table/display:table-cell
|
||||
# are required for each lyric block.
|
||||
lyrics = ''
|
||||
theme = item.themedata
|
||||
if webkitvers <= 534.3 and theme and theme.font_main_outline:
|
||||
lyrics += '<div class="lyricstable"><div id="lyricsshadow" style="opacity:1" ' \
|
||||
'class="lyricscell lyricsshadow"></div></div>'
|
||||
if webkitvers < 533.3:
|
||||
lyrics += '<div class="lyricstable"><div id="lyricsoutline" style="opacity:1" ' \
|
||||
'class="lyricscell lyricsoutline"></div></div>'
|
||||
lyrics += '<div class="lyricstable"><div id="lyricsmain" style="opacity:1" ' \
|
||||
'class="lyricscell lyricsmain"></div></div>'
|
||||
(justify, align, valign, theme_data.font_main_name, theme_data.font_main_size,
|
||||
theme_data.font_main_color, 100 + int(theme_data.font_main_line_adjustment), padding_bottom,
|
||||
left_margin, width, height)
|
||||
if theme_data.font_main_italics:
|
||||
lyrics += 'font-style:italic; '
|
||||
if theme_data.font_main_bold:
|
||||
lyrics += 'font-weight:bold; '
|
||||
return lyrics
|
||||
|
||||
|
||||
|
59
openlp/core/lib/json/theme.json
Normal file
59
openlp/core/lib/json/theme.json
Normal file
@ -0,0 +1,59 @@
|
||||
{
|
||||
"background" : {
|
||||
"border_color": "#000000",
|
||||
"color": "#000000",
|
||||
"direction": "vertical",
|
||||
"end_color": "#000000",
|
||||
"filename": "",
|
||||
"start_color": "#000000",
|
||||
"type": "solid"
|
||||
},
|
||||
"display" :{
|
||||
"horizontal_align": 0,
|
||||
"slide_transition": false,
|
||||
"vertical_align": 0
|
||||
},
|
||||
"font": {
|
||||
"footer": {
|
||||
"bold": false,
|
||||
"color": "#FFFFFF",
|
||||
"height": 78,
|
||||
"italics": false,
|
||||
"line_adjustment": 0,
|
||||
"location": "",
|
||||
"name": "Arial",
|
||||
"outline": false,
|
||||
"outline_color": "#000000",
|
||||
"outline_size": 2,
|
||||
"override": false,
|
||||
"shadow": true,
|
||||
"shadow_color": "#000000",
|
||||
"shadow_size": 5,
|
||||
"size": 12,
|
||||
"width": 1004,
|
||||
"x": 10,
|
||||
"y": 690
|
||||
},
|
||||
"main": {
|
||||
"bold": false,
|
||||
"color": "#FFFFFF",
|
||||
"height": 690,
|
||||
"italics": false,
|
||||
"line_adjustment": 0,
|
||||
"location": "",
|
||||
"name": "Arial",
|
||||
"outline": false,
|
||||
"outline_color": "#000000",
|
||||
"outline_size": 2,
|
||||
"override": false,
|
||||
"shadow": true,
|
||||
"shadow_color": "#000000",
|
||||
"shadow_size": 5,
|
||||
"size": 40,
|
||||
"width": 1004,
|
||||
"x": 10,
|
||||
"y": 10
|
||||
}
|
||||
},
|
||||
"theme_name": ""
|
||||
}
|
@ -35,8 +35,9 @@ import re
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.common import Settings, UiStrings, translate
|
||||
from openlp.core.lib import OpenLPToolbar, ServiceItem, StringContent, ListWidgetWithDnD, \
|
||||
ServiceItemContext, Settings, Registry, UiStrings, translate
|
||||
ServiceItemContext, Registry
|
||||
from openlp.core.lib.searchedit import SearchEdit
|
||||
from openlp.core.lib.ui import create_widget_action, critical_error_message_box
|
||||
|
||||
|
@ -34,7 +34,8 @@ import os
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Settings, Registry, UiStrings
|
||||
from openlp.core.common import Settings, UiStrings
|
||||
from openlp.core.lib import Registry
|
||||
from openlp.core.utils import get_application_version
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -35,7 +35,7 @@ import logging
|
||||
import imp
|
||||
|
||||
from openlp.core.lib import Plugin, PluginStatus, Registry
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.core.common import AppLocation
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -31,9 +31,10 @@ import logging
|
||||
|
||||
from PyQt4 import QtGui, QtCore, QtWebKit
|
||||
|
||||
from openlp.core.lib import Settings, FormattingTags, ImageSource, ItemCapabilities, Registry, ScreenList, \
|
||||
from openlp.core.common import Settings
|
||||
from openlp.core.lib import FormattingTags, ImageSource, ItemCapabilities, Registry, ScreenList, \
|
||||
ServiceItem, expand_tags, build_lyrics_format_css, build_lyrics_outline_css
|
||||
from openlp.core.lib.theme import ThemeLevel
|
||||
from openlp.core.common import ThemeLevel
|
||||
from openlp.core.ui import MainDisplay
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -36,7 +36,8 @@ import copy
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Registry, translate
|
||||
from openlp.core.common import Settings, translate
|
||||
from openlp.core.lib import Registry
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -244,7 +245,6 @@ class ScreenList(object):
|
||||
"""
|
||||
Loads the screen size and the monitor number from the settings.
|
||||
"""
|
||||
from openlp.core.lib import Settings
|
||||
# Add the screen settings to the settings dict. This has to be done here due to cyclic dependency.
|
||||
# Do not do this anywhere else.
|
||||
screen_settings = {
|
||||
|
@ -39,7 +39,8 @@ import uuid
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import ImageSource, Settings, Registry, build_icon, clean_tags, expand_tags, translate
|
||||
from openlp.core.common import Settings, translate
|
||||
from openlp.core.lib import ImageSource, Registry, build_icon, clean_tags, expand_tags
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -32,69 +32,16 @@ Provide the theme XML and handling functions for OpenLP v2 themes.
|
||||
import os
|
||||
import re
|
||||
import logging
|
||||
import json
|
||||
|
||||
from xml.dom.minidom import Document
|
||||
from lxml import etree, objectify
|
||||
from openlp.core.common import AppLocation
|
||||
|
||||
from openlp.core.lib import str_to_bool, ScreenList
|
||||
from openlp.core.lib import str_to_bool, ScreenList, get_text_file_string
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
BLANK_THEME_XML = \
|
||||
'''<?xml version="1.0" encoding="utf-8"?>
|
||||
<theme version="1.0">
|
||||
<name> </name>
|
||||
<background type="image">
|
||||
<filename></filename>
|
||||
<borderColor>#000000</borderColor>
|
||||
</background>
|
||||
<background type="gradient">
|
||||
<startColor>#000000</startColor>
|
||||
<endColor>#000000</endColor>
|
||||
<direction>vertical</direction>
|
||||
</background>
|
||||
<background type="solid">
|
||||
<color>#000000</color>
|
||||
</background>
|
||||
<font type="main">
|
||||
<name>Arial</name>
|
||||
<color>#FFFFFF</color>
|
||||
<size>40</size>
|
||||
<bold>False</bold>
|
||||
<italics>False</italics>
|
||||
<line_adjustment>0</line_adjustment>
|
||||
<shadow shadowColor="#000000" shadowSize="5">True</shadow>
|
||||
<outline outlineColor="#000000" outlineSize="2">False</outline>
|
||||
<location override="False" x="10" y="10" width="1004" height="690"/>
|
||||
</font>
|
||||
<font type="footer">
|
||||
<name>Arial</name>
|
||||
<color>#FFFFFF</color>
|
||||
<size>12</size>
|
||||
<bold>False</bold>
|
||||
<italics>False</italics>
|
||||
<line_adjustment>0</line_adjustment>
|
||||
<shadow shadowColor="#000000" shadowSize="5">True</shadow>
|
||||
<outline outlineColor="#000000" outlineSize="2">False</outline>
|
||||
<location override="False" x="10" y="690" width="1004" height="78"/>
|
||||
</font>
|
||||
<display>
|
||||
<horizontalAlign>0</horizontalAlign>
|
||||
<verticalAlign>0</verticalAlign>
|
||||
<slideTransition>False</slideTransition>
|
||||
</display>
|
||||
</theme>
|
||||
'''
|
||||
|
||||
|
||||
class ThemeLevel(object):
|
||||
"""
|
||||
Provides an enumeration for the level a theme applies to
|
||||
"""
|
||||
Global = 1
|
||||
Service = 2
|
||||
Song = 3
|
||||
|
||||
|
||||
class BackgroundType(object):
|
||||
"""
|
||||
@ -217,9 +164,32 @@ class ThemeXML(object):
|
||||
"""
|
||||
Initialise the theme object.
|
||||
"""
|
||||
# Create the minidom document
|
||||
self.theme_xml = Document()
|
||||
self.parse_xml(BLANK_THEME_XML)
|
||||
# basic theme object with defaults
|
||||
json_dir = os.path.join(AppLocation.get_directory(AppLocation.AppDir), 'core', 'lib', 'json')
|
||||
json_file = os.path.join(json_dir, 'theme.json')
|
||||
jsn = get_text_file_string(json_file)
|
||||
jsn = json.loads(jsn)
|
||||
self.expand_json(jsn)
|
||||
|
||||
def expand_json(self, var, prev=None):
|
||||
"""
|
||||
Expand the json objects and make into variables.
|
||||
|
||||
``var``
|
||||
The array list to be processed.
|
||||
|
||||
``prev``
|
||||
The preceding string to add to the key to make the variable.
|
||||
"""
|
||||
for key, value in var.items():
|
||||
if prev:
|
||||
key = prev + "_" + key
|
||||
else:
|
||||
key = key
|
||||
if isinstance(value, dict):
|
||||
self.expand_json(value, key)
|
||||
else:
|
||||
setattr(self, key, value)
|
||||
|
||||
def extend_image_filename(self, path):
|
||||
"""
|
||||
|
@ -33,7 +33,8 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Registry, UiStrings, build_icon, translate
|
||||
from openlp.core.common import UiStrings, translate
|
||||
from openlp.core.lib import Registry, build_icon
|
||||
from openlp.core.utils.actions import ActionList
|
||||
|
||||
|
||||
|
@ -1,252 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2013 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2013 Tim Bentley, Gerald Britton, Jonathan #
|
||||
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
|
||||
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
|
||||
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
|
||||
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
|
||||
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
|
||||
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
OpenLP version 1 theme handling
|
||||
|
||||
Provides reference data, a default v1 XML theme and class wrapper for
|
||||
processing version 1 themes in OpenLP version 2.
|
||||
"""
|
||||
|
||||
from xml.etree.ElementTree import ElementTree, XML
|
||||
from PyQt4 import QtGui
|
||||
|
||||
DELPHI_COLORS = {
|
||||
'clAqua': 0x00FFFF,
|
||||
'clBlack': 0x000000,
|
||||
'clBlue': 0x0000FF,
|
||||
'clFuchsia': 0xFF00FF,
|
||||
'clGray': 0x808080,
|
||||
'clGreen': 0x008000,
|
||||
'clLime': 0x00FF00,
|
||||
'clMaroon': 0x800000,
|
||||
'clNavy': 0x000080,
|
||||
'clOlive': 0x808000,
|
||||
'clPurple': 0x800080,
|
||||
'clRed': 0xFF0000,
|
||||
'clSilver': 0xC0C0C0,
|
||||
'clTeal': 0x008080,
|
||||
'clWhite': 0xFFFFFF,
|
||||
'clYellow': 0xFFFF00
|
||||
}
|
||||
|
||||
BLANK_STYLE_XML = \
|
||||
'''<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<Theme>
|
||||
<Name>BlankStyle</Name>
|
||||
<BackgroundMode>1</BackgroundMode>
|
||||
<BackgroundType>0</BackgroundType>
|
||||
<BackgroundParameter1>$000000</BackgroundParameter1>
|
||||
<BackgroundParameter2/>
|
||||
<BackgroundParameter3/>
|
||||
<FontName>Arial</FontName>
|
||||
<FontColor>clWhite</FontColor>
|
||||
<FontProportion>30</FontProportion>
|
||||
<FontUnits>pixels</FontUnits>
|
||||
<Shadow>0</Shadow>
|
||||
<Outline>0</Outline>
|
||||
<HorizontalAlign>0</HorizontalAlign>
|
||||
<VerticalAlign>0</VerticalAlign>
|
||||
<WrapStyle>0</WrapStyle>
|
||||
</Theme>
|
||||
'''
|
||||
|
||||
|
||||
class Theme(object):
|
||||
"""
|
||||
Provide a class wrapper storing data from an XML theme
|
||||
|
||||
``name``
|
||||
Theme name
|
||||
|
||||
``BackgroundMode``
|
||||
The behaviour of the background. Valid modes are:
|
||||
|
||||
* ``0`` - Transparent
|
||||
* ``1`` - Opaque
|
||||
|
||||
``BackgroundType``
|
||||
The content of the background. Valid types are:
|
||||
|
||||
* ``0`` - solid color
|
||||
* ``1`` - gradient color
|
||||
* ``2`` - image
|
||||
|
||||
``BackgroundParameter1``
|
||||
Extra information about the background. The contents of this attribute
|
||||
depend on the BackgroundType:
|
||||
|
||||
* ``image`` - image filename
|
||||
* ``gradient`` - start color
|
||||
* ``solid`` - color
|
||||
|
||||
``BackgroundParameter2``
|
||||
Extra information about the background. The contents of this attribute
|
||||
depend on the BackgroundType:
|
||||
|
||||
* ``image`` - border color
|
||||
* ``gradient`` - end color
|
||||
* ``solid`` - N/A
|
||||
|
||||
``BackgroundParameter3``
|
||||
Extra information about the background. The contents of this attribute
|
||||
depend on the BackgroundType:
|
||||
|
||||
* ``image`` - N/A
|
||||
* ``gradient`` - The direction of the gradient. Valid entries are:
|
||||
|
||||
* ``0`` - vertical
|
||||
* ``1`` - horizontal
|
||||
|
||||
* ``solid`` - N/A
|
||||
|
||||
``FontName``
|
||||
Name of the font to use for the main font.
|
||||
|
||||
``FontColor``
|
||||
The color for the main font
|
||||
|
||||
``FontProportion``
|
||||
The size of the main font
|
||||
|
||||
``FontUnits``
|
||||
The units for FontProportion, either <pixels> or <points>
|
||||
|
||||
``Shadow``
|
||||
The shadow type to apply to the main font.
|
||||
|
||||
* ``0`` - no shadow
|
||||
* non-zero - use shadow
|
||||
|
||||
``ShadowColor``
|
||||
Color for the shadow
|
||||
|
||||
``Outline``
|
||||
The outline to apply to the main font
|
||||
|
||||
* ``0`` - no outline
|
||||
* non-zero - use outline
|
||||
|
||||
``OutlineColor``
|
||||
Color for the outline (or None if Outline is 0)
|
||||
|
||||
``HorizontalAlign``
|
||||
The horizontal alignment to apply to text. Valid alignments are:
|
||||
|
||||
* ``0`` - left align
|
||||
* ``1`` - right align
|
||||
* ``2`` - centre align
|
||||
|
||||
``VerticalAlign``
|
||||
The vertical alignment to apply to the text. Valid alignments are:
|
||||
|
||||
* ``0`` - top align
|
||||
* ``1`` - bottom align
|
||||
* ``2`` - centre align
|
||||
|
||||
``WrapStyle``
|
||||
The wrap style to apply to the text. Valid styles are:
|
||||
|
||||
* ``0`` - normal
|
||||
* ``1`` - lyrics
|
||||
"""
|
||||
|
||||
def __init__(self, xml):
|
||||
"""
|
||||
Initialise a theme with data from xml
|
||||
|
||||
``xml``
|
||||
The data to initialise the theme with
|
||||
"""
|
||||
# init to defaults
|
||||
self._set_from_xml(BLANK_STYLE_XML)
|
||||
self._set_from_xml(xml)
|
||||
|
||||
def _get_as_string(self):
|
||||
"""
|
||||
Return single line string representation of a theme
|
||||
"""
|
||||
theme_strings = []
|
||||
keys = dir(self)
|
||||
keys.sort()
|
||||
for key in keys:
|
||||
if key[0:1] != '_':
|
||||
theme_strings.append('_%s_' % (getattr(self, key)))
|
||||
return ''.join(theme_strings)
|
||||
|
||||
def _set_from_xml(self, xml):
|
||||
"""
|
||||
Set theme class attributes with data from XML
|
||||
|
||||
``xml``
|
||||
The data to apply to the theme
|
||||
"""
|
||||
root = ElementTree(element=XML(xml.encode('ascii', 'xmlcharrefreplace')))
|
||||
xml_iter = root.getiterator()
|
||||
for element in xml_iter:
|
||||
delphi_color_change = False
|
||||
if element.tag != 'Theme':
|
||||
element_text = element.text
|
||||
val = 0
|
||||
if element_text is None:
|
||||
val = element_text
|
||||
# strings need special handling to sort the colours out
|
||||
if isinstance(element_text, str):
|
||||
if element_text[0] == '$':
|
||||
# might be a hex number
|
||||
try:
|
||||
val = int(element_text[1:], 16)
|
||||
except ValueError:
|
||||
# nope
|
||||
pass
|
||||
elif element_text in DELPHI_COLORS:
|
||||
val = DELPHI_COLORS[element_text]
|
||||
delphi_color_change = True
|
||||
else:
|
||||
try:
|
||||
val = int(element_text)
|
||||
except ValueError:
|
||||
val = element_text
|
||||
if (element.tag.find('Color') > 0 or (element.tag.find('BackgroundParameter') == 0 and
|
||||
isinstance(val, int))):
|
||||
# convert to a wx.Colour
|
||||
if not delphi_color_change:
|
||||
val = QtGui.QColor(val & 0xFF, (val >> 8) & 0xFF, (val >> 16) & 0xFF)
|
||||
else:
|
||||
val = QtGui.QColor((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF)
|
||||
setattr(self, element.tag, val)
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
Provide Python string representation for the class (multiline output)
|
||||
"""
|
||||
theme_strings = []
|
||||
for key in dir(self):
|
||||
if key[0:1] != '_':
|
||||
theme_strings.append('%30s : %s' % (key, getattr(self, key)))
|
||||
return '\n'.join(theme_strings)
|
@ -99,10 +99,11 @@ from .formattingtagcontroller import FormattingTagController
|
||||
from .shortcutlistform import ShortcutListForm
|
||||
from .mediadockmanager import MediaDockManager
|
||||
from .servicemanager import ServiceManager
|
||||
from .thememanagerhelper import ThemeManagerHelper
|
||||
from .thememanager import ThemeManager
|
||||
|
||||
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay', 'SlideController', 'ServiceManager',
|
||||
'ThemeManager', 'MediaDockManager', 'ServiceItemEditForm', 'FirstTimeForm', 'FirstTimeLanguageForm', 'ThemeForm',
|
||||
'ThemeLayoutForm', 'FileRenameForm', 'StartTimeForm', 'MainDisplay', 'Display', 'ServiceNoteForm',
|
||||
'SlideController', 'DisplayController', 'GeneralTab', 'ThemesTab', 'AdvancedTab', 'PluginForm',
|
||||
'FormattingTagForm', 'ShortcutListForm', 'FormattingTagController']
|
||||
'FormattingTagForm', 'ShortcutListForm', 'FormattingTagController', 'ThemeManagerHelper']
|
||||
|
@ -29,7 +29,8 @@
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import UiStrings, build_icon, translate
|
||||
from openlp.core.common import UiStrings, translate
|
||||
from openlp.core.lib import build_icon
|
||||
from openlp.core.lib.ui import create_button, create_button_box
|
||||
|
||||
|
||||
|
@ -36,9 +36,9 @@ import sys
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, Settings, UiStrings, translate, build_icon
|
||||
from openlp.core.utils import AppLocation, format_time, get_images_filter
|
||||
from openlp.core.lib import SlideLimits
|
||||
from openlp.core.common import AppLocation, Settings, SlideLimits, UiStrings, translate
|
||||
from openlp.core.lib import SettingsTab, build_icon
|
||||
from openlp.core.utils import format_time, get_images_filter
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -85,7 +85,7 @@ try:
|
||||
except ImportError:
|
||||
VLC_VERSION = '-'
|
||||
|
||||
from openlp.core.lib import UiStrings, Settings, translate
|
||||
from openlp.core.common import Settings, UiStrings, translate
|
||||
from openlp.core.utils import get_application_version
|
||||
|
||||
from .exceptiondialog import Ui_ExceptionDialog
|
||||
|
@ -34,7 +34,8 @@ from PyQt4 import QtGui
|
||||
|
||||
from .filerenamedialog import Ui_FileRenameDialog
|
||||
|
||||
from openlp.core.lib import translate, Registry
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib import Registry
|
||||
|
||||
|
||||
class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
|
||||
|
@ -41,8 +41,9 @@ from configparser import SafeConfigParser
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import PluginStatus, Settings, Registry, build_icon, check_directory_exists, translate
|
||||
from openlp.core.utils import AppLocation, get_web_page
|
||||
from openlp.core.common import AppLocation, Settings, check_directory_exists, translate
|
||||
from openlp.core.lib import PluginStatus, Registry, build_icon
|
||||
from openlp.core.utils import get_web_page
|
||||
from .firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -31,7 +31,7 @@ The UI widgets of the language selection dialog.
|
||||
"""
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@ from PyQt4 import QtCore, QtGui
|
||||
|
||||
import sys
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib.ui import add_welcome_page
|
||||
|
||||
|
||||
|
@ -33,8 +33,8 @@ cannot be changed.
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
from openlp.core.lib import FormattingTags, translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib import FormattingTags
|
||||
|
||||
|
||||
class FormattingTagController(object):
|
||||
|
@ -31,7 +31,8 @@ The UI widgets for the formatting tags window.
|
||||
"""
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import UiStrings, translate, build_icon
|
||||
from openlp.core.common import UiStrings, translate
|
||||
from openlp.core.lib import build_icon
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
|
||||
|
||||
|
@ -34,7 +34,8 @@ Base Tags cannot be changed.
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import FormattingTags, translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib import FormattingTags
|
||||
from openlp.core.ui.formattingtagdialog import Ui_FormattingTagDialog
|
||||
from openlp.core.ui.formattingtagcontroller import FormattingTagController
|
||||
|
||||
|
@ -33,7 +33,8 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Registry, Settings, SettingsTab, ScreenList, UiStrings, translate
|
||||
from openlp.core.common import Settings, UiStrings, translate
|
||||
from openlp.core.lib import Registry, SettingsTab, ScreenList
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -44,8 +44,8 @@ import sys
|
||||
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import ServiceItem, Settings, ImageSource, Registry, build_html, expand_tags, \
|
||||
image_to_byte, translate
|
||||
from openlp.core.common import Settings, translate
|
||||
from openlp.core.lib import ServiceItem, ImageSource, Registry, build_html, expand_tags, image_to_byte
|
||||
from openlp.core.lib.theme import BackgroundType
|
||||
|
||||
from openlp.core.lib import ScreenList
|
||||
@ -243,8 +243,6 @@ class MainDisplay(Display):
|
||||
# Windows if there are many items in the service to re-render.
|
||||
# Setting the div elements direct seems to solve the issue
|
||||
self.frame.findFirstElement("#lyricsmain").setInnerXml(slide)
|
||||
self.frame.findFirstElement("#lyricsoutline").setInnerXml(slide)
|
||||
self.frame.findFirstElement("#lyricsshadow").setInnerXml(slide)
|
||||
|
||||
def alert(self, text, location):
|
||||
"""
|
||||
|
@ -42,12 +42,14 @@ from datetime import datetime
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Renderer, OpenLPDockWidget, PluginManager, ImageManager, PluginStatus, Registry, \
|
||||
Settings, ScreenList, build_icon, check_directory_exists, translate
|
||||
ScreenList, build_icon
|
||||
from openlp.core.lib.ui import UiStrings, create_action
|
||||
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, SlideController, PluginForm, \
|
||||
MediaDockManager, ShortcutListForm, FormattingTagForm
|
||||
|
||||
from openlp.core.common import AppLocation, Settings, check_directory_exists, translate
|
||||
from openlp.core.ui.media import MediaController
|
||||
from openlp.core.utils import AppLocation, LanguageManager, add_actions, get_application_version
|
||||
from openlp.core.utils import LanguageManager, add_actions, get_application_version
|
||||
from openlp.core.utils.actions import ActionList, CategoryOrder
|
||||
from openlp.core.ui.firsttimeform import FirstTimeForm
|
||||
|
||||
|
@ -31,7 +31,7 @@ The :mod:`~openlp.core.ui.media` module contains classes and objects for media p
|
||||
"""
|
||||
import logging
|
||||
|
||||
from openlp.core.lib import Settings
|
||||
from openlp.core.common import Settings
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
|
@ -35,11 +35,12 @@ import os
|
||||
import datetime
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, Settings, Registry, UiStrings, translate
|
||||
from openlp.core.common import Settings, UiStrings, translate
|
||||
from openlp.core.lib import OpenLPToolbar, Registry
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.core.ui.media import MediaState, MediaInfo, MediaType, get_media_players, set_media_players
|
||||
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.core.common import AppLocation
|
||||
from openlp.core.ui import DisplayControllerType
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -36,7 +36,8 @@ from datetime import datetime
|
||||
from PyQt4 import QtGui
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import Settings, translate
|
||||
from openlp.core.common import Settings
|
||||
from openlp.core.lib import translate
|
||||
|
||||
from openlp.core.ui.media import MediaState
|
||||
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||
@ -45,36 +46,22 @@ from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
ADDITIONAL_EXT = {
|
||||
'audio/ac3': ['.ac3'],
|
||||
'audio/flac': ['.flac'],
|
||||
'audio/x-m4a': ['.m4a'],
|
||||
'audio/midi': ['.mid', '.midi'],
|
||||
'audio/x-mp3': ['.mp3'],
|
||||
'audio/mpeg': ['.mp3', '.mp2', '.mpga', '.mpega', '.m4a'],
|
||||
'audio/qcelp': ['.qcp'],
|
||||
'audio/x-wma': ['.wma'],
|
||||
'audio/x-ms-wma': ['.wma'],
|
||||
'video/x-flv': ['.flv'],
|
||||
'video/x-matroska': ['.mpv', '.mkv'],
|
||||
'video/x-wmv': ['.wmv'],
|
||||
'video/x-mpg': ['.mpg'],
|
||||
'video/mpeg': ['.mp4', '.mts', '.mov'],
|
||||
'video/x-ms-wmv': ['.wmv']}
|
||||
|
||||
VIDEO_CSS = """
|
||||
#videobackboard {
|
||||
z-index:3;
|
||||
background-color: %(bgcolor)s;
|
||||
'audio/ac3': ['.ac3'],
|
||||
'audio/flac': ['.flac'],
|
||||
'audio/x-m4a': ['.m4a'],
|
||||
'audio/midi': ['.mid', '.midi'],
|
||||
'audio/x-mp3': ['.mp3'],
|
||||
'audio/mpeg': ['.mp3', '.mp2', '.mpga', '.mpega', '.m4a'],
|
||||
'audio/qcelp': ['.qcp'],
|
||||
'audio/x-wma': ['.wma'],
|
||||
'audio/x-ms-wma': ['.wma'],
|
||||
'video/x-flv': ['.flv'],
|
||||
'video/x-matroska': ['.mpv', '.mkv'],
|
||||
'video/x-wmv': ['.wmv'],
|
||||
'video/x-mpg': ['.mpg'],
|
||||
'video/mpeg': ['.mp4', '.mts', '.mov'],
|
||||
'video/x-ms-wmv': ['.wmv']
|
||||
}
|
||||
#video1 {
|
||||
background-color: %(bgcolor)s;
|
||||
z-index:4;
|
||||
}
|
||||
#video2 {
|
||||
background-color: %(bgcolor)s;
|
||||
z-index:4;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
class PhononPlayer(MediaPlayer):
|
||||
@ -268,8 +255,7 @@ class PhononPlayer(MediaPlayer):
|
||||
"""
|
||||
Add css style sheets to htmlbuilder
|
||||
"""
|
||||
background = QtGui.QColor(Settings().value('players/background color')).name()
|
||||
return VIDEO_CSS % {'bgcolor': background}
|
||||
return ''
|
||||
|
||||
def get_info(self):
|
||||
"""
|
||||
|
@ -31,7 +31,8 @@ The :mod:`~openlp.core.ui.media.playertab` module holds the configuration tab fo
|
||||
"""
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Registry, SettingsTab, Settings, UiStrings, translate
|
||||
from openlp.core.common import Settings, UiStrings, translate
|
||||
from openlp.core.lib import Registry, SettingsTab
|
||||
from openlp.core.lib.ui import create_button
|
||||
from openlp.core.ui.media import get_media_players, set_media_players
|
||||
|
||||
|
@ -37,7 +37,8 @@ import sys
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import Settings, translate
|
||||
from openlp.core.common import Settings
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.ui.media import MediaState
|
||||
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||
|
||||
|
@ -33,7 +33,8 @@ from PyQt4 import QtGui
|
||||
|
||||
import logging
|
||||
|
||||
from openlp.core.lib import Settings, translate
|
||||
from openlp.core.common import Settings
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.ui.media import MediaState
|
||||
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||
|
||||
|
@ -31,7 +31,7 @@ The UI widgets of the plugin view dialog
|
||||
#"""
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import UiStrings, translate
|
||||
from openlp.core.common import UiStrings, translate
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
|
||||
|
||||
|
@ -34,7 +34,8 @@ import os
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import PluginStatus, Registry, translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib import PluginStatus, Registry
|
||||
from .plugindialog import Ui_PluginViewDialog
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -31,7 +31,8 @@ The UI widgets of the print service dialog.
|
||||
"""
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SpellTextEdit, UiStrings, build_icon, translate
|
||||
from openlp.core.common import UiStrings, translate
|
||||
from openlp.core.lib import SpellTextEdit, build_icon
|
||||
|
||||
|
||||
class ZoomSize(object):
|
||||
|
@ -36,9 +36,10 @@ import os
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from lxml import html
|
||||
|
||||
from openlp.core.lib import Settings, UiStrings, Registry, translate, get_text_file_string
|
||||
from openlp.core.common import Settings, UiStrings, translate
|
||||
from openlp.core.lib import Registry, get_text_file_string
|
||||
from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.core.common import AppLocation
|
||||
|
||||
DEFAULT_CSS = """/*
|
||||
Edit this file to customize the service order print. Note, that not all CSS
|
||||
|
@ -31,7 +31,7 @@ The UI widgets for the service item edit dialog
|
||||
"""
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib.ui import create_button_box, create_button
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
"""
|
||||
The service item edit dialog
|
||||
"""
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4 import QtGui
|
||||
from openlp.core.lib import Registry
|
||||
|
||||
from .serviceitemeditdialog import Ui_ServiceItemEditDialog
|
||||
|
@ -42,13 +42,12 @@ log = logging.getLogger(__name__)
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, ServiceItem, ItemCapabilities, Settings, PluginStatus, Registry, \
|
||||
UiStrings, build_icon, translate, str_to_bool, check_directory_exists
|
||||
from openlp.core.lib.theme import ThemeLevel
|
||||
from openlp.core.common import AppLocation, Settings, ThemeLevel, check_directory_exists, UiStrings, translate
|
||||
from openlp.core.lib import OpenLPToolbar, ServiceItem, ItemCapabilities, PluginStatus, Registry, build_icon
|
||||
from openlp.core.lib.ui import critical_error_message_box, create_widget_action, find_and_set_in_combo_box
|
||||
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm
|
||||
from openlp.core.ui.printserviceform import PrintServiceForm
|
||||
from openlp.core.utils import AppLocation, delete_file, split_filename, format_time
|
||||
from openlp.core.utils import delete_file, split_filename, format_time
|
||||
from openlp.core.utils.actions import ActionList, CategoryOrder
|
||||
|
||||
|
||||
|
@ -31,7 +31,8 @@ The :mod:`~openlp.core.ui.servicenoteform` module contains the `ServiceNoteForm`
|
||||
"""
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import SpellTextEdit, Registry, translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib import SpellTextEdit, Registry
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
|
||||
|
||||
|
@ -31,7 +31,8 @@ The UI widgets of the settings dialog.
|
||||
"""
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, build_icon
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib import build_icon
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
|
||||
|
||||
|
@ -31,7 +31,8 @@ The list of shortcuts within a dialog.
|
||||
"""
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, build_icon
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib import build_icon
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
|
||||
|
||||
|
@ -33,8 +33,8 @@ import re
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Registry, Settings
|
||||
from openlp.core.utils import translate
|
||||
from openlp.core.lib import Registry
|
||||
from openlp.core.common import Settings, translate
|
||||
from openlp.core.utils.actions import ActionList
|
||||
from .shortcutlistdialog import Ui_ShortcutListDialog
|
||||
|
||||
|
@ -37,8 +37,9 @@ from collections import deque
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, ItemCapabilities, ServiceItem, ImageSource, SlideLimits, \
|
||||
ServiceItemAction, Settings, Registry, UiStrings, ScreenList, build_icon, build_html, translate
|
||||
from openlp.core.common import Settings, SlideLimits, UiStrings, translate
|
||||
from openlp.core.lib import OpenLPToolbar, ItemCapabilities, ServiceItem, ImageSource, ServiceItemAction, Registry, \
|
||||
ScreenList, build_icon, build_html
|
||||
from openlp.core.ui import HideMode, MainDisplay, Display, DisplayControllerType
|
||||
from openlp.core.lib.ui import create_action
|
||||
from openlp.core.utils.actions import ActionList, CategoryOrder
|
||||
|
@ -31,7 +31,7 @@ The UI widgets for the time dialog
|
||||
"""
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import UiStrings, translate
|
||||
from openlp.core.common import UiStrings, translate
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
|
||||
|
||||
|
@ -33,7 +33,8 @@ from PyQt4 import QtGui
|
||||
|
||||
from .starttimedialog import Ui_StartTimeDialog
|
||||
|
||||
from openlp.core.lib import UiStrings, Registry, translate
|
||||
from openlp.core.common import UiStrings, translate
|
||||
from openlp.core.lib import Registry
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
|
||||
|
||||
|
@ -34,7 +34,8 @@ import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import UiStrings, Registry, translate
|
||||
from openlp.core.common import UiStrings, translate
|
||||
from openlp.core.lib import Registry
|
||||
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.core.ui import ThemeLayoutForm
|
||||
|
@ -31,7 +31,7 @@ The layout of the theme
|
||||
"""
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
|
||||
|
||||
|
@ -38,18 +38,18 @@ import re
|
||||
from xml.etree.ElementTree import ElementTree, XML
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import ImageSource, OpenLPToolbar, Registry, Settings, UiStrings, get_text_file_string, \
|
||||
build_icon, translate, check_item_selected, check_directory_exists, create_thumb, validate_thumb
|
||||
from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, BackgroundGradientType
|
||||
from openlp.core.common import AppLocation, Settings, check_directory_exists, UiStrings, translate
|
||||
from openlp.core.lib import ImageSource, OpenLPToolbar, Registry, get_text_file_string, build_icon, \
|
||||
check_item_selected, create_thumb, validate_thumb
|
||||
from openlp.core.lib.theme import ThemeXML, BackgroundType
|
||||
from openlp.core.lib.ui import critical_error_message_box, create_widget_action
|
||||
from openlp.core.theme import Theme
|
||||
from openlp.core.ui import FileRenameForm, ThemeForm
|
||||
from openlp.core.utils import AppLocation, delete_file, get_locale_key, get_filesystem_encoding
|
||||
from openlp.core.ui import FileRenameForm, ThemeForm, ThemeManagerHelper
|
||||
from openlp.core.utils import delete_file, get_locale_key, get_filesystem_encoding
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ThemeManager(QtGui.QWidget):
|
||||
class ThemeManager(QtGui.QWidget, ThemeManagerHelper):
|
||||
"""
|
||||
Manages the orders of Theme.
|
||||
"""
|
||||
@ -328,8 +328,8 @@ class ThemeManager(QtGui.QWidget):
|
||||
try:
|
||||
encoding = get_filesystem_encoding()
|
||||
shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
|
||||
except OSError as xxx_todo_changeme1:
|
||||
shutil.Error = xxx_todo_changeme1
|
||||
except OSError as os_error:
|
||||
shutil.Error = os_error
|
||||
log.exception('Error deleting theme %s', theme)
|
||||
|
||||
def on_export_theme(self):
|
||||
@ -469,7 +469,7 @@ class ThemeManager(QtGui.QWidget):
|
||||
log.debug('No theme data - using default theme')
|
||||
return ThemeXML()
|
||||
else:
|
||||
return self._create_theme_fom_Xml(xml, self.path)
|
||||
return self._create_theme_from_Xml(xml, self.path)
|
||||
|
||||
def over_write_message_box(self, theme_name):
|
||||
"""
|
||||
@ -501,35 +501,30 @@ class ThemeManager(QtGui.QWidget):
|
||||
log.exception('Theme contains "%s" XML files' % len(xml_file))
|
||||
raise Exception('validation')
|
||||
xml_tree = ElementTree(element=XML(theme_zip.read(xml_file[0]))).getroot()
|
||||
v1_background = xml_tree.find('BackgroundType')
|
||||
if v1_background is not None:
|
||||
theme_name, file_xml, out_file, abort_import = \
|
||||
self.unzip_version_122(directory, theme_zip, xml_file[0], xml_tree, v1_background, out_file)
|
||||
theme_name = xml_tree.find('name').text.strip()
|
||||
theme_folder = os.path.join(directory, theme_name)
|
||||
theme_exists = os.path.exists(theme_folder)
|
||||
if theme_exists and not self.over_write_message_box(theme_name):
|
||||
abort_import = True
|
||||
return
|
||||
else:
|
||||
theme_name = xml_tree.find('name').text.strip()
|
||||
theme_folder = os.path.join(directory, theme_name)
|
||||
theme_exists = os.path.exists(theme_folder)
|
||||
if theme_exists and not self.over_write_message_box(theme_name):
|
||||
abort_import = True
|
||||
return
|
||||
abort_import = False
|
||||
for name in theme_zip.namelist():
|
||||
name = name.replace('/', os.path.sep)
|
||||
split_name = name.split(os.path.sep)
|
||||
if split_name[-1] == '' or len(split_name) == 1:
|
||||
# is directory or preview file
|
||||
continue
|
||||
full_name = os.path.join(directory, name)
|
||||
check_directory_exists(os.path.dirname(full_name))
|
||||
if os.path.splitext(name)[1].lower() == '.xml':
|
||||
file_xml = str(theme_zip.read(name), 'utf-8')
|
||||
out_file = open(full_name, 'w')
|
||||
out_file.write(file_xml)
|
||||
else:
|
||||
abort_import = False
|
||||
for name in theme_zip.namelist():
|
||||
name = name.replace('/', os.path.sep)
|
||||
split_name = name.split(os.path.sep)
|
||||
if split_name[-1] == '' or len(split_name) == 1:
|
||||
# is directory or preview file
|
||||
continue
|
||||
full_name = os.path.join(directory, name)
|
||||
check_directory_exists(os.path.dirname(full_name))
|
||||
if os.path.splitext(name)[1].lower() == '.xml':
|
||||
file_xml = str(theme_zip.read(name), 'utf-8')
|
||||
out_file = open(full_name, 'w')
|
||||
out_file.write(file_xml)
|
||||
else:
|
||||
out_file = open(full_name, 'wb')
|
||||
out_file.write(theme_zip.read(name))
|
||||
out_file.close()
|
||||
out_file = open(full_name, 'wb')
|
||||
out_file.write(theme_zip.read(name))
|
||||
out_file.close()
|
||||
except (IOError, zipfile.BadZipfile):
|
||||
log.exception('Importing theme from zip failed %s' % file_name)
|
||||
raise Exception('validation')
|
||||
@ -548,7 +543,7 @@ class ThemeManager(QtGui.QWidget):
|
||||
if not abort_import:
|
||||
# As all files are closed, we can create the Theme.
|
||||
if file_xml:
|
||||
theme = self._create_theme_fom_Xml(file_xml, self.path)
|
||||
theme = self._create_theme_from_Xml(file_xml, self.path)
|
||||
self.generate_and_save_image(directory, theme_name, theme)
|
||||
# Only show the error message, when IOError was not raised (in
|
||||
# this case the error message has already been shown).
|
||||
@ -558,38 +553,6 @@ class ThemeManager(QtGui.QWidget):
|
||||
translate('OpenLP.ThemeManager', 'File is not a valid theme.'))
|
||||
log.exception('Theme file does not contain XML data %s' % file_name)
|
||||
|
||||
def unzip_version_122(self, dir_name, zip_file, xml_file, xml_tree, background, out_file):
|
||||
"""
|
||||
Unzip openlp.org 1.2x theme file and upgrade the theme xml. When calling
|
||||
this method, please keep in mind, that some parameters are redundant.
|
||||
"""
|
||||
theme_name = xml_tree.find('Name').text.strip()
|
||||
theme_name = self.bad_v1_name_chars.sub('', theme_name)
|
||||
theme_folder = os.path.join(dir_name, theme_name)
|
||||
theme_exists = os.path.exists(theme_folder)
|
||||
if theme_exists and not self.over_write_message_box(theme_name):
|
||||
return '', '', '', True
|
||||
themedir = os.path.join(dir_name, theme_name)
|
||||
check_directory_exists(themedir)
|
||||
file_xml = str(zip_file.read(xml_file), 'utf-8')
|
||||
file_xml = self._migrate_version_122(file_xml)
|
||||
out_file = open(os.path.join(themedir, theme_name + '.xml'), 'w')
|
||||
out_file.write(file_xml.encode('utf-8'))
|
||||
out_file.close()
|
||||
if background.text.strip() == '2':
|
||||
image_name = xml_tree.find('BackgroundParameter1').text.strip()
|
||||
# image file has same extension and is in subfolder
|
||||
image_file = [name for name in zip_file.namelist() if os.path.splitext(name)[1].lower()
|
||||
== os.path.splitext(image_name)[1].lower() and name.find(r'/')]
|
||||
if len(image_file) >= 1:
|
||||
out_file = open(os.path.join(themedir, image_name), 'wb')
|
||||
out_file.write(zip_file.read(image_file[0]))
|
||||
out_file.close()
|
||||
else:
|
||||
log.exception('Theme file does not contain image file "%s"' % image_name.decode('utf-8', 'replace'))
|
||||
raise Exception('validation')
|
||||
return theme_name, file_xml, out_file, False
|
||||
|
||||
def check_if_theme_exists(self, theme_name):
|
||||
"""
|
||||
Check if theme already exists and displays error message
|
||||
@ -697,7 +660,7 @@ class ThemeManager(QtGui.QWidget):
|
||||
image = os.path.join(self.path, theme + '.png')
|
||||
return image
|
||||
|
||||
def _create_theme_fom_Xml(self, theme_xml, path):
|
||||
def _create_theme_from_Xml(self, theme_xml, path):
|
||||
"""
|
||||
Return a theme object using information parsed from XML
|
||||
|
||||
@ -741,55 +704,6 @@ class ThemeManager(QtGui.QWidget):
|
||||
return True
|
||||
return False
|
||||
|
||||
def _migrate_version_122(self, xml_data):
|
||||
"""
|
||||
Convert the xml data from version 1 format to the current format.
|
||||
|
||||
New fields are loaded with defaults to provide a complete, working
|
||||
theme containing all compatible customisations from the old theme.
|
||||
|
||||
``xml_data``
|
||||
Version 1 theme to convert
|
||||
"""
|
||||
theme = Theme(xml_data)
|
||||
new_theme = ThemeXML()
|
||||
new_theme.theme_name = self.bad_v1_name_chars.sub('', theme.Name)
|
||||
if theme.BackgroundType == BackgroundType.Solid:
|
||||
new_theme.background_type = BackgroundType.to_string(BackgroundType.Solid)
|
||||
new_theme.background_color = str(theme.BackgroundParameter1.name())
|
||||
elif theme.BackgroundType == BackgroundType.Horizontal:
|
||||
new_theme.background_type = BackgroundType.to_string(BackgroundType.Gradient)
|
||||
new_theme.background_direction = BackgroundGradientType.to_string(BackgroundGradientType.Horizontal)
|
||||
if theme.BackgroundParameter3.name() == 1:
|
||||
new_theme.background_direction = BackgroundGradientType.to_string(BackgroundGradientType.Horizontal)
|
||||
new_theme.background_start_color = str(theme.BackgroundParameter1.name())
|
||||
new_theme.background_end_color = str(theme.BackgroundParameter2.name())
|
||||
elif theme.BackgroundType == BackgroundType.Image:
|
||||
new_theme.background_type = BackgroundType.to_string(BackgroundType.Image)
|
||||
new_theme.background_filename = str(theme.BackgroundParameter1)
|
||||
elif theme.BackgroundType == BackgroundType.Transparent:
|
||||
new_theme.background_type = BackgroundType.to_string(BackgroundType.Transparent)
|
||||
new_theme.font_main_name = theme.FontName
|
||||
new_theme.font_main_color = str(theme.FontColor.name())
|
||||
new_theme.font_main_size = theme.FontProportion * 3
|
||||
new_theme.font_footer_name = theme.FontName
|
||||
new_theme.font_footer_color = str(theme.FontColor.name())
|
||||
new_theme.font_main_shadow = False
|
||||
if theme.Shadow == 1:
|
||||
new_theme.font_main_shadow = True
|
||||
new_theme.font_main_shadow_color = str(theme.ShadowColor.name())
|
||||
if theme.Outline == 1:
|
||||
new_theme.font_main_outline = True
|
||||
new_theme.font_main_outline_color = str(theme.OutlineColor.name())
|
||||
vAlignCorrection = VerticalType.Top
|
||||
if theme.VerticalAlign == 2:
|
||||
vAlignCorrection = VerticalType.Middle
|
||||
elif theme.VerticalAlign == 1:
|
||||
vAlignCorrection = VerticalType.Bottom
|
||||
new_theme.display_horizontal_align = theme.HorizontalAlign
|
||||
new_theme.display_vertical_align = vAlignCorrection
|
||||
return new_theme.extract_xml()
|
||||
|
||||
def _get_renderer(self):
|
||||
"""
|
||||
Adds the Renderer to the class dynamically
|
||||
|
@ -27,10 +27,12 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`~openlp.core.theme` module contains all the themeing functions used by
|
||||
OpenLP when displaying a song or a scripture.
|
||||
The Theme Controller helps manages adding, deleteing and modifying of themes.
|
||||
"""
|
||||
|
||||
from openlp.core.theme.theme import Theme
|
||||
|
||||
__all__ = ['Theme']
|
||||
class ThemeManagerHelper(object):
|
||||
"""
|
||||
Manages the non ui theme functions.
|
||||
"""
|
||||
pass
|
@ -33,8 +33,8 @@ The Themes configuration tab
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Registry, Settings, SettingsTab, UiStrings, translate
|
||||
from openlp.core.lib.theme import ThemeLevel
|
||||
from openlp.core.common import Settings, ThemeLevel, UiStrings, translate
|
||||
from openlp.core.lib import Registry, SettingsTab
|
||||
from openlp.core.lib.ui import find_and_set_in_combo_box
|
||||
|
||||
|
||||
|
@ -31,7 +31,8 @@ The Create/Edit theme wizard
|
||||
"""
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import UiStrings, build_icon, translate
|
||||
from openlp.core.common import UiStrings, translate
|
||||
from openlp.core.lib import build_icon
|
||||
from openlp.core.lib.theme import HorizontalType, BackgroundType, BackgroundGradientType
|
||||
from openlp.core.lib.ui import add_welcome_page, create_valign_selection_widgets
|
||||
|
||||
|
@ -32,9 +32,10 @@ The :mod:``wizard`` module provides generic wizard tools for OpenLP.
|
||||
import logging
|
||||
import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import Registry, Settings, UiStrings, build_icon, translate
|
||||
from openlp.core.common import Settings, UiStrings, translate
|
||||
from openlp.core.lib import Registry, build_icon
|
||||
from openlp.core.lib.ui import add_welcome_page
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -37,11 +37,14 @@ import os
|
||||
import re
|
||||
from subprocess import Popen, PIPE
|
||||
import sys
|
||||
import urllib.request, urllib.error, urllib.parse
|
||||
import urllib.request
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
|
||||
from PyQt4 import QtGui, QtCore
|
||||
|
||||
from openlp.core.lib import Registry, Settings
|
||||
from openlp.core.common import AppLocation, Settings
|
||||
from openlp.core.lib import Registry
|
||||
|
||||
|
||||
if sys.platform != 'win32' and sys.platform != 'darwin':
|
||||
@ -51,7 +54,7 @@ if sys.platform != 'win32' and sys.platform != 'darwin':
|
||||
except ImportError:
|
||||
XDG_BASE_AVAILABLE = False
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
APPLICATION_VERSION = {}
|
||||
@ -81,15 +84,6 @@ class VersionThread(QtCore.QThread):
|
||||
Registry().execute('openlp_version_check', '%s' % version)
|
||||
|
||||
|
||||
def _get_frozen_path(frozen_option, non_frozen_option):
|
||||
"""
|
||||
Return a path based on the system status.
|
||||
"""
|
||||
if hasattr(sys, 'frozen') and sys.frozen == 1:
|
||||
return frozen_option
|
||||
return non_frozen_option
|
||||
|
||||
|
||||
def get_application_version():
|
||||
"""
|
||||
Returns the application version of the running instance of OpenLP::
|
||||
@ -418,18 +412,17 @@ def get_natural_key(string):
|
||||
"""
|
||||
key = DIGITS_OR_NONDIGITS.findall(string)
|
||||
key = [int(part) if part.isdigit() else get_locale_key(part) for part in key]
|
||||
# Python 3 does not support comparision of different types anymore. So make sure, that we do not compare str
|
||||
# Python 3 does not support comparison of different types anymore. So make sure, that we do not compare str
|
||||
# and int.
|
||||
if string[0].isdigit():
|
||||
return [b''] + key
|
||||
return key
|
||||
|
||||
|
||||
from .applocation import AppLocation
|
||||
from .languagemanager import LanguageManager
|
||||
from .actions import ActionList
|
||||
|
||||
|
||||
__all__ = ['AppLocation', 'ActionList', 'LanguageManager', 'get_application_version', 'check_latest_version',
|
||||
__all__ = ['ActionList', 'LanguageManager', 'get_application_version', 'check_latest_version',
|
||||
'add_actions', 'get_filesystem_encoding', 'get_web_page', 'get_uno_command', 'get_uno_instance',
|
||||
'delete_file', 'clean_filename', 'format_time', 'get_locale_key', 'get_natural_key']
|
||||
|
@ -34,7 +34,7 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Settings
|
||||
from openlp.core.common import Settings
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -35,8 +35,7 @@ import sys
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.core.lib import Settings, translate
|
||||
from openlp.core.common import AppLocation, Settings, translate
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -31,7 +31,8 @@ import logging
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import Plugin, Settings, StringContent, build_icon, translate
|
||||
from openlp.core.common import Settings, translate
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon
|
||||
from openlp.core.lib.db import Manager
|
||||
from openlp.core.lib.ui import create_action, UiStrings
|
||||
from openlp.core.lib.theme import VerticalType
|
||||
|
@ -29,7 +29,8 @@
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib import build_icon
|
||||
from openlp.core.lib.ui import create_button, create_button_box
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
from PyQt4 import QtGui, QtCore
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.plugins.alerts.lib.db import AlertItem
|
||||
|
||||
from .alertdialog import Ui_AlertDialog
|
||||
|
@ -35,7 +35,8 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Registry, translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib import Registry
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -29,7 +29,8 @@
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, Settings, UiStrings, translate
|
||||
from openlp.core.common import Settings, UiStrings, translate
|
||||
from openlp.core.lib import SettingsTab
|
||||
from openlp.core.lib.ui import create_valign_selection_widgets
|
||||
|
||||
|
||||
|
@ -32,13 +32,13 @@ The bible import functions for OpenLP
|
||||
import logging
|
||||
import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import Settings, UiStrings, translate
|
||||
from openlp.core.common import AppLocation, Settings, UiStrings, translate
|
||||
from openlp.core.lib.db import delete_database
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||
from openlp.core.utils import AppLocation, get_locale_key
|
||||
from openlp.core.utils import get_locale_key
|
||||
from openlp.plugins.bibles.lib.manager import BibleFormat
|
||||
from openlp.plugins.bibles.lib.db import BiblesResourcesDB, clean_filename
|
||||
|
||||
|
@ -36,10 +36,11 @@ from tempfile import gettempdir
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Registry, Settings, UiStrings, translate, check_directory_exists
|
||||
from openlp.core.common import AppLocation, UiStrings, Settings, check_directory_exists, translate
|
||||
from openlp.core.lib import Registry
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||
from openlp.core.utils import AppLocation, delete_file
|
||||
from openlp.core.utils import delete_file
|
||||
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, BiblesResourcesDB
|
||||
from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
|
||||
class Ui_BookNameDialog(object):
|
||||
|
@ -36,7 +36,7 @@ import re
|
||||
from PyQt4.QtGui import QDialog
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.plugins.bibles.forms.booknamedialog import Ui_BookNameDialog
|
||||
from openlp.plugins.bibles.lib import BibleStrings
|
||||
|
@ -29,7 +29,8 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib import build_icon
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
from openlp.plugins.bibles.lib import LanguageSelection, BibleStrings
|
||||
from openlp.plugins.bibles.lib.db import BiblesResourcesDB
|
||||
|
@ -33,7 +33,8 @@ import re
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import Registry, UiStrings, translate
|
||||
from openlp.core.common import UiStrings, translate
|
||||
from openlp.core.lib import Registry
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from .editbibledialog import Ui_EditBibleDialog
|
||||
from openlp.plugins.bibles.lib import BibleStrings
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
|
||||
class Ui_LanguageDialog(object):
|
||||
|
@ -34,7 +34,7 @@ import logging
|
||||
|
||||
from PyQt4.QtGui import QDialog
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.plugins.bibles.forms.languagedialog import \
|
||||
Ui_LanguageDialog
|
||||
|
@ -33,7 +33,8 @@ plugin.
|
||||
import logging
|
||||
import re
|
||||
|
||||
from openlp.core.lib import Settings, translate
|
||||
from openlp.core.common import Settings
|
||||
from openlp.core.lib import translate
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -31,7 +31,8 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Registry, SettingsTab, Settings, UiStrings, translate
|
||||
from openlp.core.common import Settings, UiStrings, translate
|
||||
from openlp.core.lib import Registry, SettingsTab
|
||||
from openlp.core.lib.ui import find_and_set_in_combo_box
|
||||
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, update_reference_separators, \
|
||||
get_reference_separator, LanguageSelection
|
||||
|
@ -60,7 +60,7 @@ import logging
|
||||
import chardet
|
||||
import csv
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
|
||||
|
||||
|
||||
|
@ -38,10 +38,11 @@ from sqlalchemy import Column, ForeignKey, Table, or_, types, func
|
||||
from sqlalchemy.orm import class_mapper, mapper, relation
|
||||
from sqlalchemy.orm.exc import UnmappedClassError
|
||||
|
||||
from openlp.core.lib import Registry, translate
|
||||
from openlp.core.common import AppLocation, translate
|
||||
from openlp.core.lib import Registry
|
||||
from openlp.core.lib.db import BaseModel, init_db, Manager
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.core.utils import AppLocation, clean_filename
|
||||
from openlp.core.utils import clean_filename
|
||||
from . import upgrade
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -38,7 +38,8 @@ from html.parser import HTMLParseError
|
||||
|
||||
from bs4 import BeautifulSoup, NavigableString, Tag
|
||||
|
||||
from openlp.core.lib import Registry, translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib import Registry
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.core.utils import get_web_page
|
||||
from openlp.plugins.bibles.lib import SearchResults
|
||||
|
@ -30,8 +30,9 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
from openlp.core.lib import Registry, Settings, translate
|
||||
from openlp.core.utils import AppLocation, delete_file
|
||||
from openlp.core.common import AppLocation, Settings, translate
|
||||
from openlp.core.lib import Registry
|
||||
from openlp.core.utils import delete_file
|
||||
from openlp.plugins.bibles.lib import parse_reference, get_reference_separator, LanguageSelection
|
||||
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
|
||||
from .csvbible import CSVBible
|
||||
|
@ -31,8 +31,8 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, Settings, UiStrings, \
|
||||
create_separated_list, translate
|
||||
from openlp.core.common import Settings, UiStrings, translate
|
||||
from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, create_separated_list
|
||||
from openlp.core.lib.searchedit import SearchEdit
|
||||
from openlp.core.lib.ui import set_case_insensitive_completer, create_horizontal_adjusting_combo_box, \
|
||||
critical_error_message_box, find_and_set_in_combo_box, build_icon
|
||||
|
@ -30,7 +30,7 @@
|
||||
import logging
|
||||
from lxml import etree, objectify
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
|
||||
|
||||
|
@ -33,8 +33,7 @@ import chardet
|
||||
import codecs
|
||||
import re
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.core.common import AppLocation, translate
|
||||
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -27,6 +27,7 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
|
||||
class VerseReferenceList(object):
|
||||
"""
|
||||
The VerseReferenceList class encapsulates a list of verse references, but maintains the order in which they were
|
||||
|
@ -29,7 +29,8 @@
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import UiStrings, build_icon, translate
|
||||
from openlp.core.common import UiStrings, translate
|
||||
from openlp.core.lib import build_icon
|
||||
from openlp.core.lib.ui import create_button_box, create_button
|
||||
|
||||
|
||||
|
@ -29,7 +29,8 @@
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import SpellTextEdit, UiStrings, translate
|
||||
from openlp.core.common import UiStrings, translate
|
||||
from openlp.core.lib import SpellTextEdit
|
||||
from openlp.core.lib.ui import create_button, create_button_box
|
||||
|
||||
class Ui_CustomSlideEditDialog(object):
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from .editcustomslidedialog import Ui_CustomSlideEditDialog
|
||||
|
||||
|
@ -33,7 +33,8 @@ for the Custom Slides plugin, which is inserted into the configuration dialog.
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, Settings, translate
|
||||
from openlp.core.common import Settings, translate
|
||||
from openlp.core.lib import SettingsTab
|
||||
|
||||
|
||||
class CustomTab(SettingsTab):
|
||||
|
@ -32,8 +32,9 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from sqlalchemy.sql import or_, func, and_
|
||||
|
||||
from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, Settings, PluginStatus,\
|
||||
UiStrings, check_item_selected, translate
|
||||
from openlp.core.common import Settings, UiStrings, translate
|
||||
from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, PluginStatus,\
|
||||
check_item_selected
|
||||
from openlp.plugins.custom.forms.editcustomform import EditCustomForm
|
||||
from openlp.plugins.custom.lib import CustomXMLParser, CustomXMLBuilder
|
||||
from openlp.plugins.custom.lib.db import CustomSlide
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.plugins.images.forms.addgroupdialog import Ui_AddGroupDialog
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
|
||||
|
||||
|
@ -31,10 +31,11 @@ from PyQt4 import QtGui
|
||||
|
||||
import logging
|
||||
|
||||
from openlp.core.lib import Plugin, StringContent, Registry, ImageSource, Settings, build_icon, translate
|
||||
from openlp.core.common import Settings, translate
|
||||
from openlp.core.lib import Plugin, StringContent, Registry, ImageSource, build_icon
|
||||
from openlp.core.lib.db import Manager
|
||||
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
|
||||
from openlp.plugins.images.lib.db import init_schema, ImageFilenames
|
||||
from openlp.plugins.images.lib.db import init_schema
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -29,7 +29,8 @@
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import Registry, SettingsTab, Settings, UiStrings, translate
|
||||
from openlp.core.common import Settings, UiStrings, translate
|
||||
from openlp.core.lib import SettingsTab
|
||||
|
||||
|
||||
class ImageTab(SettingsTab):
|
||||
|
@ -32,11 +32,11 @@ import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import ItemCapabilities, MediaManagerItem, Registry, ServiceItemContext, Settings, \
|
||||
StringContent, TreeWidgetWithDnD, UiStrings, build_icon, check_directory_exists, check_item_selected, \
|
||||
create_thumb, translate, validate_thumb
|
||||
from openlp.core.common import AppLocation, Settings, UiStrings, check_directory_exists, translate
|
||||
from openlp.core.lib import ItemCapabilities, MediaManagerItem, Registry, ServiceItemContext, \
|
||||
StringContent, TreeWidgetWithDnD, build_icon, check_item_selected, create_thumb, validate_thumb
|
||||
from openlp.core.lib.ui import create_widget_action, critical_error_message_box
|
||||
from openlp.core.utils import AppLocation, delete_file, get_locale_key, get_images_filter
|
||||
from openlp.core.utils import delete_file, get_locale_key, get_images_filter
|
||||
from openlp.plugins.images.forms import AddGroupForm, ChooseGroupForm
|
||||
from openlp.plugins.images.lib.db import ImageFilenames, ImageGroups
|
||||
|
||||
|
@ -32,12 +32,13 @@ import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.common import AppLocation, Settings, check_directory_exists, UiStrings, translate
|
||||
from openlp.core.lib import ItemCapabilities, MediaManagerItem,MediaType, Registry, ServiceItem, ServiceItemContext, \
|
||||
Settings, UiStrings, build_icon, check_item_selected, check_directory_exists, translate
|
||||
build_icon, check_item_selected
|
||||
from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box
|
||||
from openlp.core.ui import DisplayController, Display, DisplayControllerType
|
||||
from openlp.core.ui.media import get_media_players, set_media_players
|
||||
from openlp.core.utils import AppLocation, get_locale_key
|
||||
from openlp.core.utils import get_locale_key
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -29,7 +29,8 @@
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import Settings, SettingsTab, UiStrings, translate
|
||||
from openlp.core.common import Settings, UiStrings, translate
|
||||
from openlp.core.lib import SettingsTab
|
||||
|
||||
|
||||
class MediaQ_check_box(QtGui.QCheckBox):
|
||||
|
@ -31,7 +31,8 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Plugin, Registry, StringContent, Settings, build_icon, translate
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib import Plugin, Registry, StringContent, build_icon
|
||||
from openlp.plugins.media.lib import MediaMediaItem, MediaTab
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user