mirror of https://gitlab.com/openlp/openlp.git
Merge master (including Settings() refactor).
This commit is contained in:
commit
b5fe0139ea
|
@ -27,7 +27,16 @@
|
|||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
import sip
|
||||
import sys
|
||||
sip.setapi(u'QDate', 2)
|
||||
sip.setapi(u'QDateTime', 2)
|
||||
sip.setapi(u'QString', 2)
|
||||
sip.setapi(u'QTextStream', 2)
|
||||
sip.setapi(u'QTime', 2)
|
||||
sip.setapi(u'QUrl', 2)
|
||||
sip.setapi(u'QVariant', 2)
|
||||
|
||||
from openlp.core import main
|
||||
|
||||
|
||||
|
|
|
@ -43,8 +43,7 @@ from traceback import format_exception
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver, check_directory_exists
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import Receiver, Settings, check_directory_exists
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
from openlp.core.resources import qInitResources
|
||||
from openlp.core.ui.mainwindow import MainWindow
|
||||
|
@ -119,13 +118,13 @@ class OpenLP(QtGui.QApplication):
|
|||
# Decide how many screens we have and their size
|
||||
screens = ScreenList.create(self.desktop())
|
||||
# First time checks in settings
|
||||
has_run_wizard = Settings().value(u'general/has run wizard', QtCore.QVariant(False)).toBool()
|
||||
has_run_wizard = Settings().value(u'general/has run wizard', False)
|
||||
if not has_run_wizard:
|
||||
if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
|
||||
Settings().setValue(u'general/has run wizard', QtCore.QVariant(True))
|
||||
Settings().setValue(u'general/has run wizard', True)
|
||||
# Correct stylesheet bugs
|
||||
application_stylesheet = u''
|
||||
if Settings().value(u'advanced/alternate rows', QtCore.QVariant(sys.platform.startswith(u'win'))).toBool():
|
||||
if Settings().value(u'advanced/alternate rows', sys.platform.startswith(u'win')):
|
||||
base_color = self.palette().color(QtGui.QPalette.Active, QtGui.QPalette.Base)
|
||||
alternate_rows_repair_stylesheet = \
|
||||
u'QTableWidget, QListWidget, QTreeWidget {alternate-background-color: ' + base_color.name() + ';}\n'
|
||||
|
@ -134,8 +133,7 @@ class OpenLP(QtGui.QApplication):
|
|||
application_stylesheet += nt_repair_stylesheet
|
||||
if application_stylesheet:
|
||||
self.setStyleSheet(application_stylesheet)
|
||||
# show the splashscreen
|
||||
show_splash = Settings().value(u'general/show splash', QtCore.QVariant(True)).toBool()
|
||||
show_splash = Settings().value(u'general/show splash', True)
|
||||
if show_splash:
|
||||
self.splash = SplashScreen()
|
||||
self.splash.show()
|
||||
|
@ -154,7 +152,7 @@ class OpenLP(QtGui.QApplication):
|
|||
self.processEvents()
|
||||
if not has_run_wizard:
|
||||
self.mainWindow.firstTime()
|
||||
update_check = Settings().value(u'general/update check', QtCore.QVariant(True)).toBool()
|
||||
update_check = Settings().value(u'general/update check', True)
|
||||
if update_check:
|
||||
VersionThread(self.mainWindow).start()
|
||||
Receiver.send_message(u'live_display_blank_check')
|
||||
|
@ -209,7 +207,7 @@ class OpenLP(QtGui.QApplication):
|
|||
if event.type() == QtCore.QEvent.FileOpen:
|
||||
file_name = event.file()
|
||||
log.debug(u'Got open file event for %s!', file_name)
|
||||
self.args.insert(0, unicode(file_name))
|
||||
self.args.insert(0, file_name)
|
||||
return True
|
||||
else:
|
||||
return QtGui.QApplication.event(self, event)
|
||||
|
@ -301,8 +299,7 @@ def main(args=None):
|
|||
if app.isAlreadyRunning():
|
||||
sys.exit()
|
||||
# First time checks in settings
|
||||
if not Settings().value(u'general/has run wizard',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
if not Settings().value(u'general/has run wizard', False):
|
||||
if not FirstTimeLanguageForm().exec_():
|
||||
# if cancel then stop processing
|
||||
sys.exit()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -90,6 +90,72 @@ class ServiceItemAction(object):
|
|||
Next = 3
|
||||
|
||||
|
||||
class Settings(QtCore.QSettings):
|
||||
"""
|
||||
Class to wrap QSettings.
|
||||
|
||||
* Exposes all the methods of QSettings.
|
||||
* Adds functionality for OpenLP Portable. If the ``defaultFormat`` is set to
|
||||
``IniFormat``, and the path to the Ini file is set using ``setFilename``,
|
||||
then the Settings constructor (without any arguments) will create a Settings
|
||||
object for accessing settings stored in that Ini file.
|
||||
"""
|
||||
__filePath__ = u''
|
||||
|
||||
@staticmethod
|
||||
def setFilename(iniFile):
|
||||
"""
|
||||
Sets the complete path to an Ini file to be used by Settings objects.
|
||||
|
||||
Does not affect existing Settings objects.
|
||||
"""
|
||||
Settings.__filePath__ = iniFile
|
||||
|
||||
def __init__(self, *args):
|
||||
if not args and Settings.__filePath__ and \
|
||||
Settings.defaultFormat() == Settings.IniFormat:
|
||||
QtCore.QSettings.__init__(self, Settings.__filePath__, Settings.IniFormat)
|
||||
else:
|
||||
QtCore.QSettings.__init__(self, *args)
|
||||
|
||||
def value(self, key, defaultValue):
|
||||
"""
|
||||
Returns the value for the given ``key``. The returned ``value`` is
|
||||
of the same type as the ``defaultValue``.
|
||||
|
||||
``key``
|
||||
The key to return the value from.
|
||||
|
||||
``defaultValue``
|
||||
The value to be returned if the given ``key`` is not present in the
|
||||
config. Note, the ``defaultValue``'s type defines the type the
|
||||
returned is converted to. In other words, if the ``defaultValue`` is
|
||||
a boolean, then the returned value will be converted to a boolean.
|
||||
|
||||
**Note**, this method only converts a few types and might need to be
|
||||
extended if a certain type is missing!
|
||||
"""
|
||||
# Check for none as u'' is passed as default and is valid! This is
|
||||
# needed because the settings export does not know the default values,
|
||||
# thus just passes None.
|
||||
if defaultValue is None and not super(Settings, self).contains(key):
|
||||
return None
|
||||
setting = super(Settings, self).value(key, defaultValue)
|
||||
# An empty list saved to the settings results in a None type being
|
||||
# returned.
|
||||
if setting is None:
|
||||
return []
|
||||
# Convert the setting to the correct type.
|
||||
if isinstance(defaultValue, bool):
|
||||
if isinstance(setting, bool):
|
||||
return setting
|
||||
# Sometimes setting is string instead of a boolean.
|
||||
return setting == u'true'
|
||||
if isinstance(defaultValue, int):
|
||||
return int(setting)
|
||||
return setting
|
||||
|
||||
|
||||
def translate(context, text, comment=None,
|
||||
encoding=QtCore.QCoreApplication.CodecForTr, n=-1,
|
||||
translate=QtCore.QCoreApplication.translate):
|
||||
|
@ -169,14 +235,11 @@ def build_icon(icon):
|
|||
button_icon = icon
|
||||
elif isinstance(icon, basestring):
|
||||
if icon.startswith(u':/'):
|
||||
button_icon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
|
||||
QtGui.QIcon.Off)
|
||||
button_icon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
else:
|
||||
button_icon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
button_icon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
elif isinstance(icon, QtGui.QImage):
|
||||
button_icon.addPixmap(QtGui.QPixmap.fromImage(icon),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
button_icon.addPixmap(QtGui.QPixmap.fromImage(icon), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
return button_icon
|
||||
|
||||
|
||||
|
@ -294,12 +357,10 @@ def resize_image(image_path, width, height, background=u'#000000'):
|
|||
real_width = preview.width()
|
||||
real_height = preview.height()
|
||||
# and move it to the centre of the preview space
|
||||
new_image = QtGui.QImage(width, height,
|
||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||
new_image = QtGui.QImage(width, height, QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||
painter = QtGui.QPainter(new_image)
|
||||
painter.fillRect(new_image.rect(), QtGui.QColor(background))
|
||||
painter.drawImage(
|
||||
(width - real_width) / 2, (height - real_height) / 2, preview)
|
||||
painter.drawImage((width - real_width) / 2, (height - real_height) / 2, preview)
|
||||
return new_image
|
||||
|
||||
|
||||
|
@ -369,22 +430,22 @@ def create_separated_list(stringlist):
|
|||
List of unicode strings
|
||||
"""
|
||||
if Qt.PYQT_VERSION_STR >= u'4.9' and Qt.qVersion() >= u'4.8':
|
||||
return unicode(QtCore.QLocale().createSeparatedList(stringlist))
|
||||
return QtCore.QLocale().createSeparatedList(stringlist)
|
||||
if not stringlist:
|
||||
return u''
|
||||
elif len(stringlist) == 1:
|
||||
return stringlist[0]
|
||||
elif len(stringlist) == 2:
|
||||
return unicode(translate('OpenLP.core.lib', '%1 and %2',
|
||||
'Locale list separator: 2 items').arg(stringlist[0], stringlist[1]))
|
||||
return translate('OpenLP.core.lib', '%1 and %2',
|
||||
'Locale list separator: 2 items') % (stringlist[0], stringlist[1])
|
||||
else:
|
||||
merged = unicode(translate('OpenLP.core.lib', '%1, and %2',
|
||||
u'Locale list separator: end').arg(stringlist[-2], stringlist[-1]))
|
||||
merged = translate('OpenLP.core.lib', '%1, and %2',
|
||||
u'Locale list separator: end') % (stringlist[-2], stringlist[-1])
|
||||
for index in reversed(range(1, len(stringlist) - 2)):
|
||||
merged = unicode(translate('OpenLP.core.lib', '%1, %2',
|
||||
u'Locale list separator: middle').arg(stringlist[index], merged))
|
||||
return unicode(translate('OpenLP.core.lib', '%1, %2',
|
||||
u'Locale list separator: start').arg(stringlist[0], merged))
|
||||
merged = translate('OpenLP.core.lib', '%1, %2',
|
||||
u'Locale list separator: middle') % (stringlist[index], merged)
|
||||
return translate('OpenLP.core.lib', '%1, %2',
|
||||
u'Locale list separator: start') % (stringlist[0], merged)
|
||||
|
||||
|
||||
from eventreceiver import Receiver
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -36,15 +36,13 @@ from urllib import quote_plus as urlquote
|
|||
|
||||
from PyQt4 import QtCore
|
||||
from sqlalchemy import Table, MetaData, Column, types, create_engine
|
||||
from sqlalchemy.exc import SQLAlchemyError, InvalidRequestError, DBAPIError, \
|
||||
OperationalError
|
||||
from sqlalchemy.exc import SQLAlchemyError, InvalidRequestError, DBAPIError, OperationalError
|
||||
from sqlalchemy.orm import scoped_session, sessionmaker, mapper
|
||||
from sqlalchemy.pool import NullPool
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import translate, Settings
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.core.utils import AppLocation, delete_file
|
||||
from openlp.core.lib.settings import Settings
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -112,8 +110,7 @@ def upgrade_db(url, upgrade):
|
|||
while hasattr(upgrade, u'upgrade_%d' % version):
|
||||
log.debug(u'Running upgrade_%d', version)
|
||||
try:
|
||||
getattr(upgrade, u'upgrade_%d' % version) \
|
||||
(session, metadata, tables)
|
||||
getattr(upgrade, u'upgrade_%d' % version) (session, metadata, tables)
|
||||
except (SQLAlchemyError, DBAPIError):
|
||||
log.exception(u'Could not run database upgrade script '
|
||||
'"upgrade_%s", upgrade process has been halted.', version)
|
||||
|
@ -141,11 +138,9 @@ def delete_database(plugin_name, db_file_name=None):
|
|||
"""
|
||||
db_file_path = None
|
||||
if db_file_name:
|
||||
db_file_path = os.path.join(
|
||||
AppLocation.get_section_data_path(plugin_name), db_file_name)
|
||||
db_file_path = os.path.join(AppLocation.get_section_data_path(plugin_name), db_file_name)
|
||||
else:
|
||||
db_file_path = os.path.join(
|
||||
AppLocation.get_section_data_path(plugin_name), plugin_name)
|
||||
db_file_path = os.path.join(AppLocation.get_section_data_path(plugin_name), plugin_name)
|
||||
return delete_file(db_file_path)
|
||||
|
||||
|
||||
|
@ -191,25 +186,20 @@ class Manager(object):
|
|||
self.db_url = u''
|
||||
self.is_dirty = False
|
||||
self.session = None
|
||||
db_type = unicode(
|
||||
settings.value(u'db type', QtCore.QVariant(u'sqlite')).toString())
|
||||
db_type = settings.value(u'db type', u'sqlite')
|
||||
if db_type == u'sqlite':
|
||||
if db_file_name:
|
||||
self.db_url = u'sqlite:///%s/%s' % (
|
||||
AppLocation.get_section_data_path(plugin_name),
|
||||
db_file_name)
|
||||
self.db_url = u'sqlite:///%s/%s' % (AppLocation.get_section_data_path(plugin_name), db_file_name)
|
||||
else:
|
||||
self.db_url = u'sqlite:///%s/%s.sqlite' % (
|
||||
AppLocation.get_section_data_path(plugin_name), plugin_name)
|
||||
self.db_url = u'sqlite:///%s/%s.sqlite' % (AppLocation.get_section_data_path(plugin_name), plugin_name)
|
||||
else:
|
||||
self.db_url = u'%s://%s:%s@%s/%s' % (db_type,
|
||||
urlquote(unicode(settings.value(u'db username').toString())),
|
||||
urlquote(unicode(settings.value(u'db password').toString())),
|
||||
urlquote(unicode(settings.value(u'db hostname').toString())),
|
||||
urlquote(unicode(settings.value(u'db database').toString())))
|
||||
urlquote(settings.value(u'db username', u'')),
|
||||
urlquote(settings.value(u'db password', u'')),
|
||||
urlquote(settings.value(u'db hostname', u'')),
|
||||
urlquote(settings.value(u'db database', u'')))
|
||||
if db_type == u'mysql':
|
||||
db_encoding = unicode(
|
||||
settings.value(u'db encoding', u'utf8').toString())
|
||||
db_encoding = settings.value(u'db encoding', u'utf8')
|
||||
self.db_url += u'?charset=%s' % urlquote(db_encoding)
|
||||
settings.endGroup()
|
||||
if upgrade_mod:
|
||||
|
@ -217,11 +207,11 @@ class Manager(object):
|
|||
if db_ver > up_ver:
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.Manager', 'Database Error'),
|
||||
unicode(translate('OpenLP.Manager', 'The database being '
|
||||
translate('OpenLP.Manager', 'The database being '
|
||||
'loaded was created in a more recent version of '
|
||||
'OpenLP. The database is version %d, while OpenLP '
|
||||
'expects version %d. The database will not be loaded.'
|
||||
'\n\nDatabase: %s')) % \
|
||||
'\n\nDatabase: %s') % \
|
||||
(db_ver, up_ver, self.db_url)
|
||||
)
|
||||
return
|
||||
|
@ -229,10 +219,8 @@ class Manager(object):
|
|||
self.session = init_schema(self.db_url)
|
||||
except (SQLAlchemyError, DBAPIError):
|
||||
log.exception(u'Error loading database: %s', self.db_url)
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.Manager', 'Database Error'),
|
||||
unicode(translate('OpenLP.Manager', 'OpenLP cannot load your '
|
||||
'database.\n\nDatabase: %s')) % self.db_url
|
||||
critical_error_message_box(translate('OpenLP.Manager', 'Database Error'),
|
||||
translate('OpenLP.Manager', 'OpenLP cannot load your database.\n\nDatabase: %s') % self.db_url
|
||||
)
|
||||
|
||||
def save_object(self, object_instance, commit=True):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -33,9 +33,7 @@ import cPickle
|
|||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib.settings import Settings
|
||||
|
||||
from openlp.core.lib import translate, Settings
|
||||
|
||||
class FormattingTags(object):
|
||||
"""
|
||||
|
@ -71,8 +69,7 @@ class FormattingTags(object):
|
|||
if isinstance(tag[element], unicode):
|
||||
tag[element] = tag[element].encode('utf8')
|
||||
# Formatting Tags were also known as display tags.
|
||||
Settings().setValue(u'displayTags/html_tags',
|
||||
QtCore.QVariant(cPickle.dumps(tags) if tags else u''))
|
||||
Settings().setValue(u'displayTags/html_tags', cPickle.dumps(tags) if tags else u'')
|
||||
|
||||
@staticmethod
|
||||
def load_tags():
|
||||
|
@ -167,8 +164,7 @@ class FormattingTags(object):
|
|||
FormattingTags.add_html_tags(temporary_tags)
|
||||
|
||||
# Formatting Tags were also known as display tags.
|
||||
user_expands = Settings().value(u'displayTags/html_tags',
|
||||
QtCore.QVariant(u'')).toString()
|
||||
user_expands = Settings().value(u'displayTags/html_tags', u'')
|
||||
# cPickle only accepts str not unicode strings
|
||||
user_expands_string = str(user_expands)
|
||||
if user_expands_string:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -31,8 +31,7 @@ import logging
|
|||
|
||||
from PyQt4 import QtWebKit
|
||||
|
||||
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, \
|
||||
VerticalType, HorizontalType
|
||||
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, VerticalType, HorizontalType
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -258,8 +257,7 @@ def build_html(item, screen, islive, background, image=None,
|
|||
css_additions,
|
||||
build_footer_css(item, height),
|
||||
build_lyrics_css(item, webkitvers),
|
||||
u'true' if theme and theme.display_slide_transition and islive \
|
||||
else u'false',
|
||||
u'true' if theme and theme.display_slide_transition and islive else u'false',
|
||||
js_additions,
|
||||
bgimage_src, image_src,
|
||||
html_additions,
|
||||
|
@ -290,49 +288,26 @@ def build_background_css(item, width, height):
|
|||
theme = item.themedata
|
||||
background = u'background-color: black'
|
||||
if theme:
|
||||
if theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Transparent):
|
||||
if theme.background_type == BackgroundType.to_string(BackgroundType.Transparent):
|
||||
background = u''
|
||||
elif theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Solid):
|
||||
elif theme.background_type == BackgroundType.to_string(BackgroundType.Solid):
|
||||
background = u'background-color: %s' % theme.background_color
|
||||
else:
|
||||
if theme.background_direction == BackgroundGradientType.to_string \
|
||||
(BackgroundGradientType.Horizontal):
|
||||
background = \
|
||||
u'background: ' \
|
||||
u'-webkit-gradient(linear, left top, left bottom, ' \
|
||||
'from(%s), to(%s)) fixed' % (theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
elif theme.background_direction == \
|
||||
BackgroundGradientType.to_string( \
|
||||
BackgroundGradientType.LeftTop):
|
||||
background = \
|
||||
u'background: ' \
|
||||
u'-webkit-gradient(linear, left top, right bottom, ' \
|
||||
'from(%s), to(%s)) fixed' % (theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
elif theme.background_direction == \
|
||||
BackgroundGradientType.to_string \
|
||||
(BackgroundGradientType.LeftBottom):
|
||||
background = \
|
||||
u'background: ' \
|
||||
u'-webkit-gradient(linear, left bottom, right top, ' \
|
||||
'from(%s), to(%s)) fixed' % (theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
elif theme.background_direction == \
|
||||
BackgroundGradientType.to_string \
|
||||
(BackgroundGradientType.Vertical):
|
||||
background = \
|
||||
u'background: -webkit-gradient(linear, left top, ' \
|
||||
u'right top, from(%s), to(%s)) fixed' % \
|
||||
if theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):
|
||||
background = u'background: -webkit-gradient(linear, left top, left bottom, from(%s), to(%s)) fixed' \
|
||||
% (theme.background_start_color, theme.background_end_color)
|
||||
elif theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.LeftTop):
|
||||
background = u'background: -webkit-gradient(linear, left top, right bottom, from(%s), to(%s)) fixed' \
|
||||
% (theme.background_start_color, theme.background_end_color)
|
||||
elif theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.LeftBottom):
|
||||
background = u'background: -webkit-gradient(linear, left bottom, right top, from(%s), to(%s)) fixed' \
|
||||
% (theme.background_start_color, theme.background_end_color)
|
||||
elif theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.Vertical):
|
||||
background = u'background: -webkit-gradient(linear, left top, right top, from(%s), to(%s)) fixed' % \
|
||||
(theme.background_start_color, theme.background_end_color)
|
||||
else:
|
||||
background = \
|
||||
u'background: -webkit-gradient(radial, %s 50%%, 100, %s ' \
|
||||
u'50%%, %s, from(%s), to(%s)) fixed' % (width, width,
|
||||
width, theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
background = u'background: -webkit-gradient(radial, %s 50%%, 100, %s 50%%, %s, from(%s), to(%s)) fixed'\
|
||||
% (width, width, width, theme.background_start_color, theme.background_end_color)
|
||||
return background
|
||||
|
||||
def build_lyrics_css(item, webkitvers):
|
||||
|
@ -376,8 +351,7 @@ def build_lyrics_css(item, webkitvers):
|
|||
shadow = u''
|
||||
if theme and item.main:
|
||||
lyricstable = u'left: %spx; top: %spx;' % (item.main.x(), item.main.y())
|
||||
lyrics = build_lyrics_format_css(theme, item.main.width(),
|
||||
item.main.height())
|
||||
lyrics = build_lyrics_format_css(theme, item.main.width(), item.main.height())
|
||||
# For performance reasons we want to show as few DIV's as possible,
|
||||
# especially when animating/transitions.
|
||||
# However some bugs in older versions of qtwebkit mean we need to
|
||||
|
@ -400,9 +374,8 @@ def build_lyrics_css(item, webkitvers):
|
|||
if theme.font_main_shadow:
|
||||
if theme.font_main_outline and webkitvers <= 534.3:
|
||||
shadow = u'padding-left: %spx; padding-top: %spx;' % \
|
||||
(int(theme.font_main_shadow_size) +
|
||||
(int(theme.font_main_outline_size) * 2),
|
||||
theme.font_main_shadow_size)
|
||||
(int(theme.font_main_shadow_size) + (int(theme.font_main_outline_size) * 2),
|
||||
theme.font_main_shadow_size)
|
||||
shadow += build_lyrics_outline_css(theme, True)
|
||||
else:
|
||||
lyricsmain += u' text-shadow: %s %spx %spx;' % \
|
||||
|
@ -430,8 +403,7 @@ def build_lyrics_outline_css(theme, is_shadow=False):
|
|||
else:
|
||||
fill_color = theme.font_main_color
|
||||
outline_color = theme.font_main_outline_color
|
||||
return u' -webkit-text-stroke: %sem %s; ' \
|
||||
u'-webkit-text-fill-color: %s; ' % (size, outline_color, fill_color)
|
||||
return u' -webkit-text-stroke: %sem %s; -webkit-text-fill-color: %s; ' % (size, outline_color, fill_color)
|
||||
else:
|
||||
return u''
|
||||
|
||||
|
@ -467,11 +439,9 @@ def build_lyrics_format_css(theme, width, height):
|
|||
lyrics = u'%s word-wrap: break-word; ' \
|
||||
'text-align: %s; vertical-align: %s; font-family: %s; ' \
|
||||
'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \
|
||||
'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx;' \
|
||||
'height: %spx; ' % \
|
||||
'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx; height: %spx; ' % \
|
||||
(justify, align, valign, theme.font_main_name, theme.font_main_size,
|
||||
theme.font_main_color, 100 + int(theme.font_main_line_adjustment),
|
||||
padding_bottom, left_margin, width, height)
|
||||
theme.font_main_color, 100 + int(theme.font_main_line_adjustment), padding_bottom, left_margin, width, height)
|
||||
if theme.font_main_outline:
|
||||
if webkit_version() <= 534.3:
|
||||
lyrics += u' letter-spacing: 1px;'
|
||||
|
@ -531,7 +501,6 @@ def build_footer_css(item, height):
|
|||
if not theme or not item.footer:
|
||||
return u''
|
||||
bottom = height - int(item.footer.y()) - int(item.footer.height())
|
||||
lyrics_html = style % (item.footer.x(), bottom,
|
||||
item.footer.width(), theme.font_footer_name,
|
||||
theme.font_footer_size, theme.font_footer_color)
|
||||
lyrics_html = style % (item.footer.x(), bottom, item.footer.width(),
|
||||
theme.font_footer_name, theme.font_footer_size, theme.font_footer_color)
|
||||
return lyrics_html
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -190,8 +190,7 @@ class ImageManager(QtCore.QObject):
|
|||
self.imageThread = ImageThread(self)
|
||||
self._conversionQueue = PriorityQueue()
|
||||
self.stopManager = False
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'config_updated'), self.processUpdates)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.processUpdates)
|
||||
|
||||
def updateDisplay(self):
|
||||
"""
|
||||
|
@ -293,14 +292,12 @@ class ImageManager(QtCore.QObject):
|
|||
if not (path, source) in self._cache:
|
||||
image = Image(path, source, background)
|
||||
self._cache[(path, source)] = image
|
||||
self._conversionQueue.put(
|
||||
(image.priority, image.secondary_priority, image))
|
||||
self._conversionQueue.put((image.priority, image.secondary_priority, image))
|
||||
# Check if the there are any images with the same path and check if the
|
||||
# timestamp has changed.
|
||||
for image in self._cache.values():
|
||||
if os.path.exists(path):
|
||||
if image.path == path and \
|
||||
image.timestamp != os.stat(path).st_mtime:
|
||||
if image.path == path and image.timestamp != os.stat(path).st_mtime:
|
||||
image.timestamp = os.stat(path).st_mtime
|
||||
self._resetImage(image)
|
||||
# We want only one thread.
|
||||
|
@ -324,8 +321,7 @@ class ImageManager(QtCore.QObject):
|
|||
image = self._conversionQueue.get()[2]
|
||||
# Generate the QImage for the image.
|
||||
if image.image is None:
|
||||
image.image = resize_image(image.path, self.width, self.height,
|
||||
image.background)
|
||||
image.image = resize_image(image.path, self.width, self.height, image.background)
|
||||
# Set the priority to Lowest and stop here as we need to process
|
||||
# more important images first.
|
||||
if image.priority == Priority.Normal:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -53,8 +53,7 @@ class ListWidgetWithDnD(QtGui.QListWidget):
|
|||
"""
|
||||
self.setAcceptDrops(True)
|
||||
self.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'%s_dnd' % self.mimeDataText),
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_dnd' % self.mimeDataText),
|
||||
self.parent().loadFile)
|
||||
|
||||
def mouseMoveEvent(self, event):
|
||||
|
@ -100,7 +99,7 @@ class ListWidgetWithDnD(QtGui.QListWidget):
|
|||
event.accept()
|
||||
files = []
|
||||
for url in event.mimeData().urls():
|
||||
localFile = unicode(url.toLocalFile())
|
||||
localFile = url.toLocalFile()
|
||||
if os.path.isfile(localFile):
|
||||
files.append(localFile)
|
||||
elif os.path.isdir(localFile):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -35,13 +35,10 @@ import re
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, \
|
||||
StringContent, build_icon, translate, Receiver, ListWidgetWithDnD, \
|
||||
ServiceItemContext
|
||||
from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, StringContent, build_icon, translate, \
|
||||
Receiver, ListWidgetWithDnD, ServiceItemContext, Settings
|
||||
from openlp.core.lib.searchedit import SearchEdit
|
||||
from openlp.core.lib.ui import UiStrings, create_widget_action, \
|
||||
critical_error_message_box
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib.ui import UiStrings, create_widget_action, critical_error_message_box
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -117,8 +114,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
self.setupUi()
|
||||
self.retranslateUi()
|
||||
self.autoSelectId = -1
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'%s_service_load' % self.plugin.name),
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_service_load' % self.plugin.name),
|
||||
self.serviceLoad)
|
||||
|
||||
def requiredIcons(self):
|
||||
|
@ -205,8 +201,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
for action in toolbar_actions:
|
||||
if action[0] == StringContent.Preview:
|
||||
self.toolbar.addSeparator()
|
||||
self.toolbar.addToolbarAction(
|
||||
u'%s%sAction' % (self.plugin.name, action[0]),
|
||||
self.toolbar.addToolbarAction(u'%s%sAction' % (self.plugin.name, action[0]),
|
||||
text=self.plugin.getString(action[1])[u'title'], icon=action[2],
|
||||
tooltip=self.plugin.getString(action[1])[u'tooltip'],
|
||||
triggers=action[3])
|
||||
|
@ -218,8 +213,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
# Add the List widget
|
||||
self.listView = ListWidgetWithDnD(self, self.plugin.name)
|
||||
self.listView.setSpacing(1)
|
||||
self.listView.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.listView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.listView.setAlternatingRowColors(True)
|
||||
self.listView.setObjectName(u'%sListView' % self.plugin.name)
|
||||
# Add to pageLayout
|
||||
|
@ -256,22 +250,19 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
triggers=self.onAddClick)
|
||||
if self.addToServiceItem:
|
||||
create_widget_action(self.listView, separator=True)
|
||||
create_widget_action(self.listView, text=translate(
|
||||
'OpenLP.MediaManagerItem', '&Add to selected Service Item'),
|
||||
create_widget_action(self.listView,
|
||||
text=translate('OpenLP.MediaManagerItem', '&Add to selected Service Item'),
|
||||
icon=u':/general/general_add.png',
|
||||
triggers=self.onAddEditClick)
|
||||
self.addCustomContextActions()
|
||||
# Create the context menu and add all actions from the listView.
|
||||
self.menu = QtGui.QMenu()
|
||||
self.menu.addActions(self.listView.actions())
|
||||
QtCore.QObject.connect(self.listView,
|
||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||
QtCore.QObject.connect(self.listView, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||
self.onDoubleClicked)
|
||||
QtCore.QObject.connect(self.listView,
|
||||
QtCore.SIGNAL(u'itemSelectionChanged()'),
|
||||
QtCore.QObject.connect(self.listView, QtCore.SIGNAL(u'itemSelectionChanged()'),
|
||||
self.onSelectionChange)
|
||||
QtCore.QObject.connect(self.listView,
|
||||
QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
|
||||
QtCore.QObject.connect(self.listView, QtCore.SIGNAL(u'customContextMenuRequested(QPoint)'),
|
||||
self.contextMenu)
|
||||
|
||||
def addSearchToToolBar(self):
|
||||
|
@ -300,12 +291,9 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
self.searchLayout.addLayout(self.searchButtonLayout)
|
||||
self.pageLayout.addWidget(self.searchWidget)
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.searchTextEdit,
|
||||
QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClicked)
|
||||
QtCore.QObject.connect(self.searchTextButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onSearchTextButtonClicked)
|
||||
QtCore.QObject.connect(self.searchTextEdit,
|
||||
QtCore.SIGNAL(u'textChanged(const QString&)'),
|
||||
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClicked)
|
||||
QtCore.QObject.connect(self.searchTextButton, QtCore.SIGNAL(u'clicked()'), self.onSearchTextButtonClicked)
|
||||
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'textChanged(const QString&)'),
|
||||
self.onSearchTextEditChanged)
|
||||
|
||||
def addCustomContextActions(self):
|
||||
|
@ -338,11 +326,9 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
Add a file to the list widget to make it available for showing
|
||||
"""
|
||||
files = QtGui.QFileDialog.getOpenFileNames(
|
||||
self, self.onNewPrompt,
|
||||
SettingsManager.get_last_dir(self.settingsSection),
|
||||
self.onNewFileMasks)
|
||||
log.info(u'New files(s) %s', unicode(files))
|
||||
files = QtGui.QFileDialog.getOpenFileNames(self, self.onNewPrompt,
|
||||
SettingsManager.get_last_dir(self.settingsSection), self.onNewFileMasks)
|
||||
log.info(u'New files(s) %s', files)
|
||||
if files:
|
||||
Receiver.send_message(u'cursor_busy')
|
||||
self.validateAndLoad(files)
|
||||
|
@ -362,12 +348,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
type = file.split(u'.')[-1]
|
||||
if type.lower() not in self.onNewFileMasks:
|
||||
if not error_shown:
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'Invalid File Type'),
|
||||
unicode(translate('OpenLP.MediaManagerItem',
|
||||
'Invalid File %s.\nSuffix not supported'))
|
||||
% file)
|
||||
critical_error_message_box(translate('OpenLP.MediaManagerItem', 'Invalid File Type'),
|
||||
translate('OpenLP.MediaManagerItem', 'Invalid File %s.\nSuffix not supported') % file)
|
||||
error_shown = True
|
||||
else:
|
||||
new_files.append(file)
|
||||
|
@ -385,9 +367,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
names = []
|
||||
full_list = []
|
||||
for count in range(self.listView.count()):
|
||||
names.append(unicode(self.listView.item(count).text()))
|
||||
full_list.append(unicode(self.listView.item(count).
|
||||
data(QtCore.Qt.UserRole).toString()))
|
||||
names.append(self.listView.item(count).text())
|
||||
full_list.append(self.listView.item(count).data(QtCore.Qt.UserRole))
|
||||
duplicates_found = False
|
||||
files_added = False
|
||||
for file in files:
|
||||
|
@ -405,10 +386,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
SettingsManager.set_list(self.settingsSection,
|
||||
self.settingsSection, self.getFileList())
|
||||
if duplicates_found:
|
||||
critical_error_message_box(
|
||||
UiStrings().Duplicate,
|
||||
unicode(translate('OpenLP.MediaManagerItem',
|
||||
'Duplicate files were found on import and were ignored.')))
|
||||
critical_error_message_box(UiStrings().Duplicate,
|
||||
translate('OpenLP.MediaManagerItem', 'Duplicate files were found on import and were ignored.'))
|
||||
|
||||
def contextMenu(self, point):
|
||||
item = self.listView.itemAt(point)
|
||||
|
@ -427,14 +406,13 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
file_list = []
|
||||
while count < self.listView.count():
|
||||
bitem = self.listView.item(count)
|
||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||
filename = bitem.data(QtCore.Qt.UserRole)
|
||||
file_list.append(filename)
|
||||
count += 1
|
||||
return file_list
|
||||
|
||||
def loadList(self, list):
|
||||
raise NotImplementedError(u'MediaManagerItem.loadList needs to be '
|
||||
u'defined by the plugin')
|
||||
raise NotImplementedError(u'MediaManagerItem.loadList needs to be defined by the plugin')
|
||||
|
||||
def onNewClick(self):
|
||||
"""
|
||||
|
@ -449,8 +427,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
pass
|
||||
|
||||
def onDeleteClick(self):
|
||||
raise NotImplementedError(u'MediaManagerItem.onDeleteClick needs to '
|
||||
u'be defined by the plugin')
|
||||
raise NotImplementedError(u'MediaManagerItem.onDeleteClick needs to be defined by the plugin')
|
||||
|
||||
def onFocus(self):
|
||||
"""
|
||||
|
@ -461,15 +438,13 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
|
||||
def generateSlideData(self, serviceItem, item=None, xmlVersion=False,
|
||||
remote=False, context=ServiceItemContext.Live):
|
||||
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs '
|
||||
u'to be defined by the plugin')
|
||||
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs to be defined by the plugin')
|
||||
|
||||
def onDoubleClicked(self):
|
||||
"""
|
||||
Allows the list click action to be determined dynamically
|
||||
"""
|
||||
if Settings().value(u'advanced/double click live',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
if Settings().value(u'advanced/double click live', False):
|
||||
self.onLiveClick()
|
||||
else:
|
||||
self.onPreviewClick()
|
||||
|
@ -478,9 +453,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
Allows the change of current item in the list to be actioned
|
||||
"""
|
||||
if Settings().value(u'advanced/single click preview',
|
||||
QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed and \
|
||||
self.listView.selectedIndexes() and self.autoSelectId == -1:
|
||||
if Settings().value(u'advanced/single click preview', False) and self.quickPreviewAllowed \
|
||||
and self.listView.selectedIndexes() and self.autoSelectId == -1:
|
||||
self.onPreviewClick(True)
|
||||
|
||||
def onPreviewClick(self, keepFocus=False):
|
||||
|
@ -490,8 +464,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
||||
QtGui.QMessageBox.information(self, UiStrings().NISp,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'You must select one or more items to preview.'))
|
||||
translate('OpenLP.MediaManagerItem', 'You must select one or more items to preview.'))
|
||||
else:
|
||||
log.debug(u'%s Preview requested', self.plugin.name)
|
||||
serviceItem = self.buildServiceItem()
|
||||
|
@ -508,8 +481,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
if not self.listView.selectedIndexes():
|
||||
QtGui.QMessageBox.information(self, UiStrings().NISp,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'You must select one or more items to send live.'))
|
||||
translate('OpenLP.MediaManagerItem', 'You must select one or more items to send live.'))
|
||||
else:
|
||||
self.goLive()
|
||||
|
||||
|
@ -528,7 +500,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
|
||||
def createItemFromId(self, item_id):
|
||||
item = QtGui.QListWidgetItem()
|
||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(item_id))
|
||||
item.setData(QtCore.Qt.UserRole, item_id)
|
||||
return item
|
||||
|
||||
def onAddClick(self):
|
||||
|
@ -537,8 +509,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
||||
QtGui.QMessageBox.information(self, UiStrings().NISp,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'You must select one or more items to add.'))
|
||||
translate('OpenLP.MediaManagerItem', 'You must select one or more items to add.'))
|
||||
else:
|
||||
# Is it posssible to process multiple list items to generate
|
||||
# multiple service items?
|
||||
|
@ -551,12 +522,10 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
self.addToService(item)
|
||||
|
||||
def addToService(self, item=None, replace=None, remote=False):
|
||||
serviceItem = self.buildServiceItem(item, True, remote=remote,
|
||||
context=ServiceItemContext.Service)
|
||||
serviceItem = self.buildServiceItem(item, True, remote=remote, context=ServiceItemContext.Service)
|
||||
if serviceItem:
|
||||
serviceItem.from_plugin = False
|
||||
self.plugin.serviceManager.addServiceItem(serviceItem,
|
||||
replace=replace)
|
||||
self.plugin.serviceManager.addServiceItem(serviceItem, replace=replace)
|
||||
|
||||
def onAddEditClick(self):
|
||||
"""
|
||||
|
@ -564,29 +533,22 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
||||
QtGui.QMessageBox.information(self, UiStrings().NISp,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'You must select one or more items.'))
|
||||
translate('OpenLP.MediaManagerItem', 'You must select one or more items.'))
|
||||
else:
|
||||
log.debug(u'%s Add requested', self.plugin.name)
|
||||
serviceItem = self.plugin.serviceManager.getServiceItem()
|
||||
if not serviceItem:
|
||||
QtGui.QMessageBox.information(self, UiStrings().NISs,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'You must select an existing service item to add to.'))
|
||||
translate('OpenLP.MediaManagerItem', 'You must select an existing service item to add to.'))
|
||||
elif self.plugin.name == serviceItem.name:
|
||||
self.generateSlideData(serviceItem)
|
||||
self.plugin.serviceManager.addServiceItem(serviceItem,
|
||||
replace=True)
|
||||
self.plugin.serviceManager.addServiceItem(serviceItem, replace=True)
|
||||
else:
|
||||
# Turn off the remote edit update message indicator
|
||||
QtGui.QMessageBox.information(self,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'Invalid Service Item'),
|
||||
unicode(translate('OpenLP.MediaManagerItem',
|
||||
'You must select a %s service item.')) % self.title)
|
||||
QtGui.QMessageBox.information(self, translate('OpenLP.MediaManagerItem', 'Invalid Service Item'),
|
||||
translate('OpenLP.MediaManagerItem', 'You must select a %s service item.') % self.title)
|
||||
|
||||
def buildServiceItem(self, item=None, xmlVersion=False, remote=False,
|
||||
context=ServiceItemContext.Live):
|
||||
def buildServiceItem(self, item=None, xmlVersion=False, remote=False, context=ServiceItemContext.Live):
|
||||
"""
|
||||
Common method for generating a service item
|
||||
"""
|
||||
|
@ -634,11 +596,11 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
item = self.listView.currentItem()
|
||||
if item is None:
|
||||
return False
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
item_id = item.data(QtCore.Qt.UserRole)
|
||||
else:
|
||||
item_id = remoteItem
|
||||
else:
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
item_id = item.data(QtCore.Qt.UserRole)
|
||||
return item_id
|
||||
|
||||
def saveAutoSelectId(self):
|
||||
|
@ -649,11 +611,10 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
if self.autoSelectId == -1:
|
||||
item = self.listView.currentItem()
|
||||
if item:
|
||||
self.autoSelectId = item.data(QtCore.Qt.UserRole).toInt()[0]
|
||||
self.autoSelectId = item.data(QtCore.Qt.UserRole)
|
||||
|
||||
def search(self, string, showError=True):
|
||||
"""
|
||||
Performs a plugin specific search for items containing ``string``
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
u'Plugin.search needs to be defined by the plugin')
|
||||
raise NotImplementedError(u'Plugin.search needs to be defined by the plugin')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -33,8 +33,7 @@ import logging
|
|||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Receiver
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import Receiver, Settings
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
from openlp.core.utils import get_application_version
|
||||
|
||||
|
@ -173,11 +172,9 @@ class Plugin(QtCore.QObject):
|
|||
self.pluginManager = plugin_helpers[u'pluginmanager']
|
||||
self.formParent = plugin_helpers[u'formparent']
|
||||
self.mediaController = plugin_helpers[u'mediacontroller']
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'%s_add_service_item' % self.name),
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_add_service_item' % self.name),
|
||||
self.processAddServiceEvent)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'%s_config_updated' % self.name),
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_config_updated' % self.name),
|
||||
self.configUpdated)
|
||||
|
||||
def checkPreConditions(self):
|
||||
|
@ -193,17 +190,14 @@ class Plugin(QtCore.QObject):
|
|||
"""
|
||||
Sets the status of the plugin
|
||||
"""
|
||||
self.status = Settings().value(
|
||||
self.settingsSection + u'/status',
|
||||
QtCore.QVariant(PluginStatus.Inactive)).toInt()[0]
|
||||
self.status = Settings().value(self.settingsSection + u'/status', PluginStatus.Inactive)
|
||||
|
||||
def toggleStatus(self, new_status):
|
||||
"""
|
||||
Changes the status of the plugin and remembers it
|
||||
"""
|
||||
self.status = new_status
|
||||
Settings().setValue(
|
||||
self.settingsSection + u'/status', QtCore.QVariant(self.status))
|
||||
Settings().setValue(self.settingsSection + u'/status', self.status)
|
||||
if new_status == PluginStatus.Active:
|
||||
self.initialise()
|
||||
elif new_status == PluginStatus.Inactive:
|
||||
|
@ -223,8 +217,7 @@ class Plugin(QtCore.QObject):
|
|||
you need, and return it for integration into OpenLP.
|
||||
"""
|
||||
if self.mediaItemClass:
|
||||
self.mediaItem = self.mediaItemClass(self.mediaDock.media_dock,
|
||||
self, self.icon)
|
||||
self.mediaItem = self.mediaItemClass(self.mediaDock.media_dock, self, self.icon)
|
||||
|
||||
def addImportMenuItem(self, importMenu):
|
||||
"""
|
||||
|
@ -260,8 +253,7 @@ class Plugin(QtCore.QObject):
|
|||
"""
|
||||
if self.settingsTabClass:
|
||||
self.settingsTab = self.settingsTabClass(parent, self.name,
|
||||
self.getString(StringContent.VisibleName)[u'title'],
|
||||
self.iconPath)
|
||||
self.getString(StringContent.VisibleName)[u'title'], self.iconPath)
|
||||
|
||||
def addToMenu(self, menubar):
|
||||
"""
|
||||
|
@ -276,8 +268,7 @@ class Plugin(QtCore.QObject):
|
|||
"""
|
||||
Generic Drag and drop handler triggered from service_manager.
|
||||
"""
|
||||
log.debug(u'processAddServiceEvent event called for plugin %s' %
|
||||
self.name)
|
||||
log.debug(u'processAddServiceEvent event called for plugin %s' % self.name)
|
||||
if replace:
|
||||
self.mediaItem.onAddEditClick()
|
||||
else:
|
||||
|
@ -288,8 +279,7 @@ class Plugin(QtCore.QObject):
|
|||
Show a dialog when the user clicks on the 'About' button in the plugin
|
||||
manager.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
u'Plugin.about needs to be defined by the plugin')
|
||||
raise NotImplementedError(u'Plugin.about needs to be defined by the plugin')
|
||||
|
||||
def initialise(self):
|
||||
"""
|
||||
|
@ -308,7 +298,7 @@ class Plugin(QtCore.QObject):
|
|||
|
||||
def appStartup(self):
|
||||
"""
|
||||
Perform tasks on application starup
|
||||
Perform tasks on application startup
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -343,29 +333,21 @@ class Plugin(QtCore.QObject):
|
|||
Called to define all translatable texts of the plugin
|
||||
"""
|
||||
## Load Action ##
|
||||
self.__setNameTextString(StringContent.Load,
|
||||
UiStrings().Load, tooltips[u'load'])
|
||||
self.__setNameTextString(StringContent.Load, UiStrings().Load, tooltips[u'load'])
|
||||
## Import Action ##
|
||||
self.__setNameTextString(StringContent.Import,
|
||||
UiStrings().Import, tooltips[u'import'])
|
||||
self.__setNameTextString(StringContent.Import, UiStrings().Import, tooltips[u'import'])
|
||||
## New Action ##
|
||||
self.__setNameTextString(StringContent.New,
|
||||
UiStrings().Add, tooltips[u'new'])
|
||||
self.__setNameTextString(StringContent.New, UiStrings().Add, tooltips[u'new'])
|
||||
## Edit Action ##
|
||||
self.__setNameTextString(StringContent.Edit,
|
||||
UiStrings().Edit, tooltips[u'edit'])
|
||||
self.__setNameTextString(StringContent.Edit, UiStrings().Edit, tooltips[u'edit'])
|
||||
## Delete Action ##
|
||||
self.__setNameTextString(StringContent.Delete,
|
||||
UiStrings().Delete, tooltips[u'delete'])
|
||||
self.__setNameTextString(StringContent.Delete, UiStrings().Delete, tooltips[u'delete'])
|
||||
## Preview Action ##
|
||||
self.__setNameTextString(StringContent.Preview,
|
||||
UiStrings().Preview, tooltips[u'preview'])
|
||||
self.__setNameTextString(StringContent.Preview, UiStrings().Preview, tooltips[u'preview'])
|
||||
## Send Live Action ##
|
||||
self.__setNameTextString(StringContent.Live,
|
||||
UiStrings().Live, tooltips[u'live'])
|
||||
self.__setNameTextString(StringContent.Live, UiStrings().Live, tooltips[u'live'])
|
||||
## Add to Service Action ##
|
||||
self.__setNameTextString(StringContent.Service,
|
||||
UiStrings().Service, tooltips[u'service'])
|
||||
self.__setNameTextString(StringContent.Service, UiStrings().Service, tooltips[u'service'])
|
||||
|
||||
def __setNameTextString(self, name, title, tooltip):
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -107,13 +107,12 @@ class PluginManager(object):
|
|||
modulename = modulename[len(prefix) + 1:]
|
||||
modulename = modulename.replace(os.path.sep, '.')
|
||||
# import the modules
|
||||
log.debug(u'Importing %s from %s. Depth %d',
|
||||
modulename, path, thisdepth)
|
||||
log.debug(u'Importing %s from %s. Depth %d', modulename, path, thisdepth)
|
||||
try:
|
||||
__import__(modulename, globals(), locals(), [])
|
||||
except ImportError, e:
|
||||
log.exception(u'Failed to import module %s on path %s '
|
||||
'for reason %s', modulename, path, e.args[0])
|
||||
log.exception(u'Failed to import module %s on path %s for reason %s',
|
||||
modulename, path, e.args[0])
|
||||
plugin_classes = Plugin.__subclasses__()
|
||||
plugin_objects = []
|
||||
for p in plugin_classes:
|
||||
|
@ -197,8 +196,7 @@ class PluginManager(object):
|
|||
"""
|
||||
log.info(u'Initialise Plugins - Started')
|
||||
for plugin in self.plugins:
|
||||
log.info(u'initialising plugins %s in a %s state'
|
||||
% (plugin.name, plugin.isActive()))
|
||||
log.info(u'initialising plugins %s in a %s state' % (plugin.name, plugin.isActive()))
|
||||
if plugin.isActive():
|
||||
plugin.initialise()
|
||||
log.info(u'Initialisation Complete for %s ' % plugin.name)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -31,8 +31,7 @@ import logging
|
|||
|
||||
from PyQt4 import QtGui, QtCore, QtWebKit
|
||||
|
||||
from openlp.core.lib import ServiceItem, expand_tags, \
|
||||
build_lyrics_format_css, build_lyrics_outline_css, Receiver, \
|
||||
from openlp.core.lib import ServiceItem, expand_tags, build_lyrics_format_css, build_lyrics_outline_css, Receiver, \
|
||||
ItemCapabilities, FormattingTags, ImageSource
|
||||
from openlp.core.lib.theme import ThemeLevel
|
||||
from openlp.core.ui import MainDisplay, ScreenList
|
||||
|
@ -81,8 +80,7 @@ class Renderer(object):
|
|||
self.display.setup()
|
||||
self._theme_dimensions = {}
|
||||
self._calculate_default()
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'theme_update_global'), self.set_global_theme)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_global'), self.set_global_theme)
|
||||
self.web = QtWebKit.QWebView()
|
||||
self.web.setVisible(False)
|
||||
self.web_frame = self.web.page().mainFrame()
|
||||
|
@ -115,8 +113,7 @@ class Renderer(object):
|
|||
Only remove the given ``theme_name`` from the ``_theme_dimensions``
|
||||
list. This can be used when a theme is permanently deleted.
|
||||
"""
|
||||
if old_theme_name is not None and \
|
||||
old_theme_name in self._theme_dimensions:
|
||||
if old_theme_name is not None and old_theme_name in self._theme_dimensions:
|
||||
del self._theme_dimensions[old_theme_name]
|
||||
if theme_name in self._theme_dimensions:
|
||||
del self._theme_dimensions[theme_name]
|
||||
|
@ -134,16 +131,13 @@ class Renderer(object):
|
|||
theme_data = self.theme_manager.getThemeData(theme_name)
|
||||
main_rect = self.get_main_rectangle(theme_data)
|
||||
footer_rect = self.get_footer_rectangle(theme_data)
|
||||
self._theme_dimensions[theme_name] = \
|
||||
[theme_data, main_rect, footer_rect]
|
||||
self._theme_dimensions[theme_name] = [theme_data, main_rect, footer_rect]
|
||||
else:
|
||||
theme_data, main_rect, footer_rect = \
|
||||
self._theme_dimensions[theme_name]
|
||||
theme_data, main_rect, footer_rect = self._theme_dimensions[theme_name]
|
||||
# if No file do not update cache
|
||||
if theme_data.background_filename:
|
||||
self.image_manager.addImage(theme_data.background_filename,
|
||||
ImageSource.Theme,
|
||||
QtGui.QColor(theme_data.background_border_color))
|
||||
ImageSource.Theme, QtGui.QColor(theme_data.background_border_color))
|
||||
|
||||
def pre_render(self, override_theme_data=None):
|
||||
"""
|
||||
|
@ -172,8 +166,7 @@ class Renderer(object):
|
|||
if override_theme_data is None:
|
||||
if theme_to_use not in self._theme_dimensions:
|
||||
self._set_theme(theme_to_use)
|
||||
theme_data, main_rect, footer_rect = \
|
||||
self._theme_dimensions[theme_to_use]
|
||||
theme_data, main_rect, footer_rect = self._theme_dimensions[theme_to_use]
|
||||
else:
|
||||
# Ignore everything and use own theme data.
|
||||
theme_data = override_theme_data
|
||||
|
@ -305,13 +298,11 @@ class Renderer(object):
|
|||
text_contains_split = u'[---]' in text
|
||||
if text_contains_split:
|
||||
try:
|
||||
text_to_render, text = \
|
||||
text.split(u'\n[---]\n', 1)
|
||||
text_to_render, text = text.split(u'\n[---]\n', 1)
|
||||
except ValueError:
|
||||
text_to_render = text.split(u'\n[---]\n')[0]
|
||||
text = u''
|
||||
text_to_render, raw_tags, html_tags = \
|
||||
self._get_start_tags(text_to_render)
|
||||
text_to_render, raw_tags, html_tags = self._get_start_tags(text_to_render)
|
||||
if text:
|
||||
text = raw_tags + text
|
||||
else:
|
||||
|
@ -504,9 +495,8 @@ class Renderer(object):
|
|||
# the line will not fit as a whole.
|
||||
raw_words = self._words_split(line)
|
||||
html_words = map(expand_tags, raw_words)
|
||||
previous_html, previous_raw = self._binary_chop(
|
||||
formatted, previous_html, previous_raw, html_words,
|
||||
raw_words, u' ', line_end)
|
||||
previous_html, previous_raw = \
|
||||
self._binary_chop(formatted, previous_html, previous_raw, html_words, raw_words, u' ', line_end)
|
||||
else:
|
||||
previous_html += html_line + line_end
|
||||
previous_raw += line + line_end
|
||||
|
@ -537,13 +527,9 @@ class Renderer(object):
|
|||
for tag in FormattingTags.get_html_tags():
|
||||
if tag[u'start tag'] == u'{br}':
|
||||
continue
|
||||
if raw_text.count(tag[u'start tag']) != \
|
||||
raw_text.count(tag[u'end tag']):
|
||||
raw_tags.append(
|
||||
(raw_text.find(tag[u'start tag']), tag[u'start tag'],
|
||||
tag[u'end tag']))
|
||||
html_tags.append(
|
||||
(raw_text.find(tag[u'start tag']), tag[u'start html']))
|
||||
if raw_text.count(tag[u'start tag']) != raw_text.count(tag[u'end tag']):
|
||||
raw_tags.append((raw_text.find(tag[u'start tag']), tag[u'start tag'], tag[u'end tag']))
|
||||
html_tags.append((raw_text.find(tag[u'start tag']), tag[u'start html']))
|
||||
# Sort the lists, so that the tags which were opened first on the first
|
||||
# slide (the text we are checking) will be opened first on the next
|
||||
# slide as well.
|
||||
|
@ -558,11 +544,9 @@ class Renderer(object):
|
|||
end_tags.reverse()
|
||||
# Remove the indexes.
|
||||
html_tags = [tag[1] for tag in html_tags]
|
||||
return raw_text + u''.join(end_tags), u''.join(start_tags), \
|
||||
u''.join(html_tags)
|
||||
return raw_text + u''.join(end_tags), u''.join(start_tags), u''.join(html_tags)
|
||||
|
||||
def _binary_chop(self, formatted, previous_html, previous_raw, html_list,
|
||||
raw_list, separator, line_end):
|
||||
def _binary_chop(self, formatted, previous_html, previous_raw, html_list, raw_list, separator, line_end):
|
||||
"""
|
||||
This implements the binary chop algorithm for faster rendering. This
|
||||
algorithm works line based (line by line) and word based (word by word).
|
||||
|
@ -612,8 +596,7 @@ class Renderer(object):
|
|||
# We found the number of words which will fit.
|
||||
if smallest_index == index or highest_index == index:
|
||||
index = smallest_index
|
||||
text = previous_raw.rstrip(u'<br>') + \
|
||||
separator.join(raw_list[:index + 1])
|
||||
text = previous_raw.rstrip(u'<br>') + separator.join(raw_list[:index + 1])
|
||||
text, raw_tags, html_tags = self._get_start_tags(text)
|
||||
formatted.append(text)
|
||||
previous_html = u''
|
||||
|
@ -627,10 +610,8 @@ class Renderer(object):
|
|||
# Check if the remaining elements fit on the slide.
|
||||
if self._text_fits_on_slide(
|
||||
html_tags + separator.join(html_list[index + 1:]).strip()):
|
||||
previous_html = html_tags + separator.join(
|
||||
html_list[index + 1:]).strip() + line_end
|
||||
previous_raw = raw_tags + separator.join(
|
||||
raw_list[index + 1:]).strip() + line_end
|
||||
previous_html = html_tags + separator.join(html_list[index + 1:]).strip() + line_end
|
||||
previous_raw = raw_tags + separator.join(raw_list[index + 1:]).strip() + line_end
|
||||
break
|
||||
else:
|
||||
# The remaining elements do not fit, thus reset the indexes,
|
||||
|
@ -652,8 +633,7 @@ class Renderer(object):
|
|||
``text``
|
||||
The text to check. It may contain HTML tags.
|
||||
"""
|
||||
self.web_frame.evaluateJavaScript(u'show_text("%s")' %
|
||||
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
||||
self.web_frame.evaluateJavaScript(u'show_text("%s")' % text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
||||
return self.web_frame.contentsSize().height() <= self.empty_height
|
||||
|
||||
def _words_split(self, line):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -54,16 +54,8 @@ class SearchEdit(QtGui.QLineEdit):
|
|||
u'QToolButton { border: none; padding: 0px; }')
|
||||
self.clearButton.resize(18, 18)
|
||||
self.clearButton.hide()
|
||||
QtCore.QObject.connect(
|
||||
self.clearButton,
|
||||
QtCore.SIGNAL(u'clicked()'),
|
||||
self._onClearButtonClicked
|
||||
)
|
||||
QtCore.QObject.connect(
|
||||
self,
|
||||
QtCore.SIGNAL(u'textChanged(const QString&)'),
|
||||
self._onSearchEditTextChanged
|
||||
)
|
||||
QtCore.QObject.connect(self.clearButton, QtCore.SIGNAL(u'clicked()'), self._onClearButtonClicked)
|
||||
QtCore.QObject.connect(self, QtCore.SIGNAL(u'textChanged(const QString&)'), self._onSearchEditTextChanged)
|
||||
self._updateStyleSheet()
|
||||
self.setAcceptDrops(False)
|
||||
|
||||
|
@ -72,24 +64,16 @@ class SearchEdit(QtGui.QLineEdit):
|
|||
Internal method to update the stylesheet depending on which widgets are
|
||||
available and visible.
|
||||
"""
|
||||
frameWidth = self.style().pixelMetric(
|
||||
QtGui.QStyle.PM_DefaultFrameWidth)
|
||||
frameWidth = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
|
||||
rightPadding = self.clearButton.width() + frameWidth
|
||||
if hasattr(self, u'menuButton'):
|
||||
leftPadding = self.menuButton.width()
|
||||
self.setStyleSheet(
|
||||
u'QLineEdit { padding-left: %spx; padding-right: %spx; } ' %
|
||||
(leftPadding, rightPadding))
|
||||
self.setStyleSheet(u'QLineEdit { padding-left: %spx; padding-right: %spx; } ' % (leftPadding, rightPadding))
|
||||
else:
|
||||
self.setStyleSheet(u'QLineEdit { padding-right: %spx; } ' %
|
||||
rightPadding)
|
||||
self.setStyleSheet(u'QLineEdit { padding-right: %spx; } ' % rightPadding)
|
||||
msz = self.minimumSizeHint()
|
||||
self.setMinimumSize(
|
||||
max(msz.width(),
|
||||
self.clearButton.width() + (frameWidth * 2) + 2),
|
||||
max(msz.height(),
|
||||
self.clearButton.height() + (frameWidth * 2) + 2)
|
||||
)
|
||||
self.setMinimumSize(max(msz.width(), self.clearButton.width() + (frameWidth * 2) + 2),
|
||||
max(msz.height(), self.clearButton.height() + (frameWidth * 2) + 2))
|
||||
|
||||
def resizeEvent(self, event):
|
||||
"""
|
||||
|
@ -99,14 +83,12 @@ class SearchEdit(QtGui.QLineEdit):
|
|||
The event that happened.
|
||||
"""
|
||||
size = self.clearButton.size()
|
||||
frameWidth = self.style().pixelMetric(
|
||||
QtGui.QStyle.PM_DefaultFrameWidth)
|
||||
frameWidth = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
|
||||
self.clearButton.move(self.rect().right() - frameWidth - size.width(),
|
||||
(self.rect().bottom() + 1 - size.height()) / 2)
|
||||
if hasattr(self, u'menuButton'):
|
||||
size = self.menuButton.size()
|
||||
self.menuButton.move(self.rect().left() + frameWidth + 2,
|
||||
(self.rect().bottom() + 1 - size.height()) / 2)
|
||||
self.menuButton.move(self.rect().left() + frameWidth + 2, (self.rect().bottom() + 1 - size.height()) / 2)
|
||||
|
||||
def currentSearchType(self):
|
||||
"""
|
||||
|
@ -123,7 +105,7 @@ class SearchEdit(QtGui.QLineEdit):
|
|||
"""
|
||||
menu = self.menuButton.menu()
|
||||
for action in menu.actions():
|
||||
if identifier == action.data().toInt()[0]:
|
||||
if identifier == action.data():
|
||||
# setPlaceholderText has been implemented in Qt 4.7 and in at
|
||||
# least PyQt 4.9 (I am not sure, if it was implemented in
|
||||
# PyQt 4.8).
|
||||
|
@ -187,7 +169,7 @@ class SearchEdit(QtGui.QLineEdit):
|
|||
A :class:`~PyQt4.QtCore.QString` instance which represents the text
|
||||
in the line edit.
|
||||
"""
|
||||
self.clearButton.setVisible(not text.isEmpty())
|
||||
self.clearButton.setVisible(bool(text))
|
||||
|
||||
def _onClearButtonClicked(self):
|
||||
"""
|
||||
|
@ -211,13 +193,11 @@ class SearchEdit(QtGui.QLineEdit):
|
|||
for action in self.menuButton.menu().actions():
|
||||
action.setChecked(False)
|
||||
self.menuButton.setDefaultAction(sender)
|
||||
self._currentSearchType = sender.data().toInt()[0]
|
||||
self._currentSearchType = sender.data()
|
||||
# setPlaceholderText has been implemented in Qt 4.7 and in at least
|
||||
# PyQt 4.9 (I am not sure, if it was implemented in PyQt 4.8).
|
||||
try:
|
||||
self.setPlaceholderText(
|
||||
self.menuButton.defaultAction().placeholderText)
|
||||
self.setPlaceholderText(self.menuButton.defaultAction().placeholderText)
|
||||
except AttributeError:
|
||||
pass
|
||||
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'),
|
||||
self._currentSearchType)
|
||||
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'), self._currentSearchType)
|
||||
|
|
|
@ -570,12 +570,10 @@ class ServiceItem(object):
|
|||
start = None
|
||||
end = None
|
||||
if self.start_time != 0:
|
||||
start = unicode(translate('OpenLP.ServiceItem',
|
||||
'<strong>Start</strong>: %s')) % \
|
||||
start = translate('OpenLP.ServiceItem', '<strong>Start</strong>: %s') % \
|
||||
unicode(datetime.timedelta(seconds=self.start_time))
|
||||
if self.media_length != 0:
|
||||
end = unicode(translate('OpenLP.ServiceItem',
|
||||
'<strong>Length</strong>: %s')) % \
|
||||
end = translate('OpenLP.ServiceItem', '<strong>Length</strong>: %s') % \
|
||||
unicode(datetime.timedelta(seconds=self.media_length))
|
||||
if not start and not end:
|
||||
return u''
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2012 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2012 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:``settings`` module provides a thin wrapper for QSettings, which OpenLP
|
||||
uses to manage settings persistence.
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
log = logging.getLogger()
|
||||
|
||||
class Settings(QtCore.QSettings):
|
||||
"""
|
||||
Class to wrap QSettings.
|
||||
|
||||
* Exposes all the methods of QSettings.
|
||||
* Adds functionality for OpenLP Portable. If the ``defaultFormat`` is set to
|
||||
``IniFormat``, and the path to the Ini file is set using ``setFilename``,
|
||||
then the Settings constructor (without any arguments) will create a Settings
|
||||
object for accessing settings stored in that Ini file.
|
||||
"""
|
||||
|
||||
__filePath = u''
|
||||
|
||||
@staticmethod
|
||||
def setFilename(iniFile):
|
||||
"""
|
||||
Sets the complete path to an Ini file to be used by Settings objects.
|
||||
|
||||
Does not affect existing Settings objects.
|
||||
"""
|
||||
Settings.__filePath = iniFile
|
||||
|
||||
def __init__(self, *args):
|
||||
if not args and Settings.__filePath and (Settings.defaultFormat() ==
|
||||
Settings.IniFormat):
|
||||
QtCore.QSettings.__init__(self, Settings.__filePath,
|
||||
Settings.IniFormat)
|
||||
else:
|
||||
QtCore.QSettings.__init__(self, *args)
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -36,7 +36,7 @@ import os
|
|||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import Settings
|
||||
from openlp.core.utils import AppLocation
|
||||
|
||||
class SettingsManager(object):
|
||||
|
@ -61,9 +61,7 @@ class SettingsManager(object):
|
|||
name = u'last directory %d' % num
|
||||
else:
|
||||
name = u'last directory'
|
||||
last_dir = unicode(Settings().value(
|
||||
section + u'/' + name, QtCore.QVariant(u'')).toString())
|
||||
return last_dir
|
||||
return Settings().value(section + u'/' + name, u'')
|
||||
|
||||
@staticmethod
|
||||
def set_last_dir(section, directory, num=None):
|
||||
|
@ -84,8 +82,7 @@ class SettingsManager(object):
|
|||
name = u'last directory %d' % num
|
||||
else:
|
||||
name = u'last directory'
|
||||
Settings().setValue(
|
||||
section + u'/' + name, QtCore.QVariant(directory))
|
||||
Settings().setValue(section + u'/' + name, directory)
|
||||
|
||||
@staticmethod
|
||||
def set_list(section, name, list):
|
||||
|
@ -103,13 +100,11 @@ class SettingsManager(object):
|
|||
"""
|
||||
settings = Settings()
|
||||
settings.beginGroup(section)
|
||||
old_count = settings.value(
|
||||
u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
|
||||
old_count = settings.value(u'%s count' % name, 0)
|
||||
new_count = len(list)
|
||||
settings.setValue(u'%s count' % name, QtCore.QVariant(new_count))
|
||||
settings.setValue(u'%s count' % name, new_count)
|
||||
for counter in range(new_count):
|
||||
settings.setValue(
|
||||
u'%s %d' % (name, counter), QtCore.QVariant(list[counter-1]))
|
||||
settings.setValue(u'%s %d' % (name, counter), list[counter - 1])
|
||||
if old_count > new_count:
|
||||
# Tidy up any old list items
|
||||
for counter in range(new_count, old_count):
|
||||
|
@ -129,13 +124,11 @@ class SettingsManager(object):
|
|||
"""
|
||||
settings = Settings()
|
||||
settings.beginGroup(section)
|
||||
list_count = settings.value(
|
||||
u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
|
||||
list_count = settings.value(u'%s count' % name, 0)
|
||||
list = []
|
||||
if list_count:
|
||||
for counter in range(list_count):
|
||||
item = unicode(
|
||||
settings.value(u'%s %d' % (name, counter)).toString())
|
||||
item = settings.value(u'%s %d' % (name, counter), u'')
|
||||
if item:
|
||||
list.append(item)
|
||||
settings.endGroup()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -81,10 +81,8 @@ class SettingsTab(QtGui.QWidget):
|
|||
if event:
|
||||
QtGui.QWidget.resizeEvent(self, event)
|
||||
width = self.width() - self.tabLayout.spacing() - \
|
||||
self.tabLayout.contentsMargins().left() - \
|
||||
self.tabLayout.contentsMargins().right()
|
||||
left_width = min(width - self.rightColumn.minimumSizeHint().width(),
|
||||
width / 2)
|
||||
self.tabLayout.contentsMargins().left() - self.tabLayout.contentsMargins().right()
|
||||
left_width = min(width - self.rightColumn.minimumSizeHint().width(), width / 2)
|
||||
left_width = max(left_width, self.leftColumn.minimumSizeHint().width())
|
||||
self.leftColumn.setFixedWidth(left_width)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -28,6 +28,7 @@
|
|||
###############################################################################
|
||||
import logging
|
||||
import re
|
||||
|
||||
try:
|
||||
import enchant
|
||||
from enchant import DictNotFoundError
|
||||
|
@ -72,8 +73,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
|
|||
# Rewrite the mouse event to a left button event so the cursor is
|
||||
# moved to the location of the pointer.
|
||||
event = QtGui.QMouseEvent(QtCore.QEvent.MouseButtonPress,
|
||||
event.pos(), QtCore.Qt.LeftButton, QtCore.Qt.LeftButton,
|
||||
QtCore.Qt.NoModifier)
|
||||
event.pos(), QtCore.Qt.LeftButton, QtCore.Qt.LeftButton, QtCore.Qt.NoModifier)
|
||||
QtGui.QPlainTextEdit.mousePressEvent(self, event)
|
||||
|
||||
def contextMenuEvent(self, event):
|
||||
|
@ -92,20 +92,17 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
|
|||
lang_menu = QtGui.QMenu(
|
||||
translate('OpenLP.SpellTextEdit', 'Language:'))
|
||||
for lang in enchant.list_languages():
|
||||
action = create_action(lang_menu, lang, text=lang,
|
||||
checked=lang == self.dictionary.tag)
|
||||
action = create_action(lang_menu, lang, text=lang, checked=lang == self.dictionary.tag)
|
||||
lang_menu.addAction(action)
|
||||
popupMenu.insertSeparator(popupMenu.actions()[0])
|
||||
popupMenu.insertMenu(popupMenu.actions()[0], lang_menu)
|
||||
QtCore.QObject.connect(lang_menu,
|
||||
QtCore.SIGNAL(u'triggered(QAction*)'), self.setLanguage)
|
||||
QtCore.QObject.connect(lang_menu, QtCore.SIGNAL(u'triggered(QAction*)'), self.setLanguage)
|
||||
# Check if the selected word is misspelled and offer spelling
|
||||
# suggestions if it is.
|
||||
if ENCHANT_AVAILABLE and self.textCursor().hasSelection():
|
||||
text = unicode(self.textCursor().selectedText())
|
||||
text = self.textCursor().selectedText()
|
||||
if not self.dictionary.check(text):
|
||||
spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit',
|
||||
'Spelling Suggestions'))
|
||||
spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Spelling Suggestions'))
|
||||
for word in self.dictionary.suggest(text):
|
||||
action = SpellAction(word, spell_menu)
|
||||
action.correct.connect(self.correctWord)
|
||||
|
@ -114,8 +111,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
|
|||
# suggestions.
|
||||
if spell_menu.actions():
|
||||
popupMenu.insertMenu(popupMenu.actions()[0], spell_menu)
|
||||
tagMenu = QtGui.QMenu(translate('OpenLP.SpellTextEdit',
|
||||
'Formatting Tags'))
|
||||
tagMenu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Formatting Tags'))
|
||||
if self.formattingTagsAllowed:
|
||||
for html in FormattingTags.get_html_tags():
|
||||
action = SpellAction(html[u'desc'], tagMenu)
|
||||
|
@ -202,5 +198,4 @@ class SpellAction(QtGui.QAction):
|
|||
|
||||
def __init__(self, *args):
|
||||
QtGui.QAction.__init__(self, *args)
|
||||
self.triggered.connect(lambda x: self.correct.emit(
|
||||
unicode(self.text())))
|
||||
self.triggered.connect(lambda x: self.correct.emit(self.text()))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -478,8 +478,7 @@ class ThemeXML(object):
|
|||
Pull out the XML string formatted for human consumption
|
||||
"""
|
||||
self._build_xml_from_attrs()
|
||||
return self.theme_xml.toprettyxml(indent=u' ', newl=u'\n',
|
||||
encoding=u'utf-8')
|
||||
return self.theme_xml.toprettyxml(indent=u' ', newl=u'\n', encoding=u'utf-8')
|
||||
|
||||
def parse(self, xml):
|
||||
"""
|
||||
|
@ -512,18 +511,15 @@ class ThemeXML(object):
|
|||
if element.tag == u'background':
|
||||
if element.attrib:
|
||||
for attr in element.attrib:
|
||||
self._create_attr(element.tag, attr, \
|
||||
element.attrib[attr])
|
||||
self._create_attr(element.tag, attr, element.attrib[attr])
|
||||
parent = element.getparent()
|
||||
if parent is not None:
|
||||
if parent.tag == u'font':
|
||||
master = parent.tag + u'_' + parent.attrib[u'type']
|
||||
# set up Outline and Shadow Tags and move to font_main
|
||||
if parent.tag == u'display':
|
||||
if element.tag.startswith(u'shadow') or \
|
||||
element.tag.startswith(u'outline'):
|
||||
self._create_attr(u'font_main', element.tag,
|
||||
element.text)
|
||||
if element.tag.startswith(u'shadow') or element.tag.startswith(u'outline'):
|
||||
self._create_attr(u'font_main', element.tag, element.text)
|
||||
master = parent.tag
|
||||
if parent.tag == u'background':
|
||||
master = parent.tag
|
||||
|
@ -533,12 +529,10 @@ class ThemeXML(object):
|
|||
for attr in element.attrib:
|
||||
base_element = attr
|
||||
# correction for the shadow and outline tags
|
||||
if element.tag == u'shadow' or \
|
||||
element.tag == u'outline':
|
||||
if element.tag == u'shadow' or element.tag == u'outline':
|
||||
if not attr.startswith(element.tag):
|
||||
base_element = element.tag + u'_' + attr
|
||||
self._create_attr(master, base_element,
|
||||
element.attrib[attr])
|
||||
self._create_attr(master, base_element, element.attrib[attr])
|
||||
else:
|
||||
if element.tag == u'name':
|
||||
self._create_attr(u'theme', element.tag, element.text)
|
||||
|
@ -570,8 +564,7 @@ class ThemeXML(object):
|
|||
"""
|
||||
Create the attributes with the correct data types and name format
|
||||
"""
|
||||
reject, master, element, value = \
|
||||
self._translate_tags(master, element, value)
|
||||
reject, master, element, value = self._translate_tags(master, element, value)
|
||||
if reject:
|
||||
return
|
||||
field = self._de_hump(element)
|
||||
|
@ -611,21 +604,17 @@ class ThemeXML(object):
|
|||
Build the XML from the varables in the object
|
||||
"""
|
||||
self._new_document(self.theme_name)
|
||||
if self.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Solid):
|
||||
if self.background_type == BackgroundType.to_string(BackgroundType.Solid):
|
||||
self.add_background_solid(self.background_color)
|
||||
elif self.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Gradient):
|
||||
elif self.background_type == BackgroundType.to_string(BackgroundType.Gradient):
|
||||
self.add_background_gradient(
|
||||
self.background_start_color,
|
||||
self.background_end_color,
|
||||
self.background_direction)
|
||||
elif self.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Image):
|
||||
elif self.background_type == BackgroundType.to_string(BackgroundType.Image):
|
||||
filename = os.path.split(self.background_filename)[1]
|
||||
self.add_background_image(filename, self.background_border_color)
|
||||
elif self.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Transparent):
|
||||
elif self.background_type == BackgroundType.to_string(BackgroundType.Transparent):
|
||||
self.add_background_transparent()
|
||||
self.add_font(self.font_main_name,
|
||||
self.font_main_color,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -68,7 +68,7 @@ class OpenLPToolbar(QtGui.QToolBar):
|
|||
Add a widget and store it's handle under the widgets object name.
|
||||
"""
|
||||
action = self.addWidget(widget)
|
||||
self.actions[unicode(widget.objectName())] = action
|
||||
self.actions[widget.objectName()] = action
|
||||
|
||||
def setWidgetVisible(self, widgets, visible=True):
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -70,7 +70,7 @@ class UiStrings(object):
|
|||
self.CreateService = translate('OpenLP.Ui', 'Create a new service.')
|
||||
self.ConfirmDelete = translate('OpenLP.Ui', 'Confirm Delete')
|
||||
self.Continuous = translate('OpenLP.Ui', 'Continuous')
|
||||
self.Default = unicode(translate('OpenLP.Ui', 'Default'))
|
||||
self.Default = translate('OpenLP.Ui', 'Default')
|
||||
self.DefaultColor = translate('OpenLP.Ui', 'Default Color:')
|
||||
self.Delete = translate('OpenLP.Ui', '&Delete')
|
||||
self.DisplayStyle = translate('OpenLP.Ui', 'Display style:')
|
||||
|
@ -80,13 +80,10 @@ class UiStrings(object):
|
|||
self.Error = translate('OpenLP.Ui', 'Error')
|
||||
self.Export = translate('OpenLP.Ui', 'Export')
|
||||
self.File = translate('OpenLP.Ui', 'File')
|
||||
self.FontSizePtUnit = translate('OpenLP.Ui', 'pt',
|
||||
'Abbreviated font pointsize unit')
|
||||
self.FontSizePtUnit = translate('OpenLP.Ui', 'pt', 'Abbreviated font pointsize unit')
|
||||
self.Help = translate('OpenLP.Ui', 'Help')
|
||||
self.Hours = translate('OpenLP.Ui', 'h',
|
||||
'The abbreviated unit for hours')
|
||||
self.IFdSs = translate('OpenLP.Ui', 'Invalid Folder Selected',
|
||||
'Singular')
|
||||
self.Hours = translate('OpenLP.Ui', 'h', 'The abbreviated unit for hours')
|
||||
self.IFdSs = translate('OpenLP.Ui', 'Invalid Folder Selected', 'Singular')
|
||||
self.IFSs = translate('OpenLP.Ui', 'Invalid File Selected', 'Singular')
|
||||
self.IFSp = translate('OpenLP.Ui', 'Invalid Files Selected', 'Plural')
|
||||
self.Image = translate('OpenLP.Ui', 'Image')
|
||||
|
@ -96,8 +93,7 @@ class UiStrings(object):
|
|||
self.LiveBGError = translate('OpenLP.Ui', 'Live Background Error')
|
||||
self.LiveToolbar = translate('OpenLP.Ui', 'Live Toolbar')
|
||||
self.Load = translate('OpenLP.Ui', 'Load')
|
||||
self.Minutes = translate('OpenLP.Ui', 'm',
|
||||
'The abbreviated unit for minutes')
|
||||
self.Minutes = translate('OpenLP.Ui', 'm', 'The abbreviated unit for minutes')
|
||||
self.Middle = translate('OpenLP.Ui', 'Middle')
|
||||
self.New = translate('OpenLP.Ui', 'New')
|
||||
self.NewService = translate('OpenLP.Ui', 'New Service')
|
||||
|
@ -111,8 +107,7 @@ class UiStrings(object):
|
|||
self.OLPV1 = translate('OpenLP.Ui', 'openlp.org 1.x')
|
||||
self.OLPV2 = translate('OpenLP.Ui', 'OpenLP 2')
|
||||
self.OLPV2x = translate('OpenLP.Ui', 'OpenLP 2.1')
|
||||
self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. '
|
||||
'Do you wish to continue?')
|
||||
self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. Do you wish to continue?')
|
||||
self.OpenService = translate('OpenLP.Ui', 'Open service.')
|
||||
self.PlaySlidesInLoop = translate('OpenLP.Ui','Play Slides in Loop')
|
||||
self.PlaySlidesToEnd = translate('OpenLP.Ui','Play Slides to End')
|
||||
|
@ -122,27 +117,21 @@ class UiStrings(object):
|
|||
self.ReplaceLiveBG = translate('OpenLP.Ui', 'Replace live background.')
|
||||
self.ResetBG = translate('OpenLP.Ui', 'Reset Background')
|
||||
self.ResetLiveBG = translate('OpenLP.Ui', 'Reset live background.')
|
||||
self.Seconds = translate('OpenLP.Ui', 's',
|
||||
'The abbreviated unit for seconds')
|
||||
self.Seconds = translate('OpenLP.Ui', 's', 'The abbreviated unit for seconds')
|
||||
self.SaveAndPreview = translate('OpenLP.Ui', 'Save && Preview')
|
||||
self.Search = translate('OpenLP.Ui', 'Search')
|
||||
self.SearchThemes = translate(
|
||||
'OpenLP.Ui', 'Search Themes...', 'Search bar place holder text ')
|
||||
self.SelectDelete = translate('OpenLP.Ui', 'You must select an item '
|
||||
'to delete.')
|
||||
self.SelectEdit = translate('OpenLP.Ui', 'You must select an item to '
|
||||
'edit.')
|
||||
self.SearchThemes = translate('OpenLP.Ui', 'Search Themes...', 'Search bar place holder text ')
|
||||
self.SelectDelete = translate('OpenLP.Ui', 'You must select an item to delete.')
|
||||
self.SelectEdit = translate('OpenLP.Ui', 'You must select an item to edit.')
|
||||
self.Settings = translate('OpenLP.Ui', 'Settings')
|
||||
self.SaveService = translate('OpenLP.Ui', 'Save Service')
|
||||
self.Service = translate('OpenLP.Ui', 'Service')
|
||||
self.Split = translate('OpenLP.Ui', 'Optional &Split')
|
||||
self.SplitToolTip = translate('OpenLP.Ui', 'Split a slide into two '
|
||||
'only if it does not fit on the screen as one slide.')
|
||||
self.StartTimeCode = unicode(translate('OpenLP.Ui', 'Start %s'))
|
||||
self.StopPlaySlidesInLoop = translate('OpenLP.Ui',
|
||||
'Stop Play Slides in Loop')
|
||||
self.StopPlaySlidesToEnd = translate('OpenLP.Ui',
|
||||
'Stop Play Slides to End')
|
||||
self.SplitToolTip = translate('OpenLP.Ui',
|
||||
'Split a slide into two only if it does not fit on the screen as one slide.')
|
||||
self.StartTimeCode = translate('OpenLP.Ui', 'Start %s')
|
||||
self.StopPlaySlidesInLoop = translate('OpenLP.Ui', 'Stop Play Slides in Loop')
|
||||
self.StopPlaySlidesToEnd = translate('OpenLP.Ui', 'Stop Play Slides to End')
|
||||
self.Theme = translate('OpenLP.Ui', 'Theme', 'Singular')
|
||||
self.Themes = translate('OpenLP.Ui', 'Themes', 'Plural')
|
||||
self.Tools = translate('OpenLP.Ui', 'Tools')
|
||||
|
@ -166,8 +155,7 @@ def add_welcome_page(parent, image):
|
|||
A splash image for the wizard.
|
||||
"""
|
||||
parent.welcomePage = QtGui.QWizardPage()
|
||||
parent.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
|
||||
QtGui.QPixmap(image))
|
||||
parent.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(image))
|
||||
parent.welcomePage.setObjectName(u'WelcomePage')
|
||||
parent.welcomeLayout = QtGui.QVBoxLayout(parent.welcomePage)
|
||||
parent.welcomeLayout.setObjectName(u'WelcomeLayout')
|
||||
|
@ -223,15 +211,12 @@ def create_button_box(dialog, name, standard_buttons, custom_buttons=[]):
|
|||
button_box.addButton(button, QtGui.QDialogButtonBox.ActionRole)
|
||||
else:
|
||||
button_box.addButton(*button)
|
||||
QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'accepted()'),
|
||||
dialog.accept)
|
||||
QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'rejected()'),
|
||||
dialog.reject)
|
||||
QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'accepted()'), dialog.accept)
|
||||
QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'rejected()'), dialog.reject)
|
||||
return button_box
|
||||
|
||||
|
||||
def critical_error_message_box(title=None, message=None, parent=None,
|
||||
question=False):
|
||||
def critical_error_message_box(title=None, message=None, parent=None, question=False):
|
||||
"""
|
||||
Provides a standard critical message box for errors that OpenLP displays
|
||||
to users.
|
||||
|
@ -250,8 +235,7 @@ def critical_error_message_box(title=None, message=None, parent=None,
|
|||
"""
|
||||
if question:
|
||||
return QtGui.QMessageBox.critical(parent, UiStrings().Error, message,
|
||||
QtGui.QMessageBox.StandardButtons(
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
|
||||
data = {u'message': message}
|
||||
data[u'title'] = title if title else UiStrings().Error
|
||||
return Receiver.send_message(u'openlp_error_message', data)
|
||||
|
@ -306,16 +290,13 @@ def create_button(parent, name, **kwargs):
|
|||
role = kwargs.pop(u'role')
|
||||
if role == u'delete':
|
||||
kwargs.setdefault(u'text', UiStrings().Delete)
|
||||
kwargs.setdefault(u'tooltip',
|
||||
translate('OpenLP.Ui', 'Delete the selected item.'))
|
||||
kwargs.setdefault(u'tooltip', translate('OpenLP.Ui', 'Delete the selected item.'))
|
||||
elif role == u'up':
|
||||
kwargs.setdefault(u'icon', u':/services/service_up.png')
|
||||
kwargs.setdefault(u'tooltip',
|
||||
translate('OpenLP.Ui', 'Move selection up one position.'))
|
||||
kwargs.setdefault(u'tooltip', translate('OpenLP.Ui', 'Move selection up one position.'))
|
||||
elif role == u'down':
|
||||
kwargs.setdefault(u'icon', u':/services/service_down.png')
|
||||
kwargs.setdefault(u'tooltip',
|
||||
translate('OpenLP.Ui', 'Move selection down one position.'))
|
||||
kwargs.setdefault(u'tooltip', translate('OpenLP.Ui', 'Move selection down one position.'))
|
||||
else:
|
||||
log.warn(u'The role "%s" is not defined in create_push_button().',
|
||||
role)
|
||||
|
@ -333,8 +314,7 @@ def create_button(parent, name, **kwargs):
|
|||
if not kwargs.pop(u'enabled', True):
|
||||
button.setEnabled(False)
|
||||
if kwargs.get(u'click'):
|
||||
QtCore.QObject.connect(button, QtCore.SIGNAL(u'clicked()'),
|
||||
kwargs.pop(u'click'))
|
||||
QtCore.QObject.connect(button, QtCore.SIGNAL(u'clicked()'), kwargs.pop(u'click'))
|
||||
for key in kwargs.keys():
|
||||
if key not in [u'text', u'icon', u'tooltip', u'click']:
|
||||
log.warn(u'Parameter %s was not consumed in create_button().', key)
|
||||
|
@ -377,7 +357,7 @@ def create_action(parent, name, **kwargs):
|
|||
True in case the action will be considered a separator.
|
||||
|
||||
``data``
|
||||
Data which is set as QVariant type.
|
||||
The action's data.
|
||||
|
||||
``shortcuts``
|
||||
A QList<QKeySequence> (or a list of strings) which are set as shortcuts.
|
||||
|
@ -411,7 +391,7 @@ def create_action(parent, name, **kwargs):
|
|||
if kwargs.pop(u'separator', False):
|
||||
action.setSeparator(True)
|
||||
if u'data' in kwargs:
|
||||
action.setData(QtCore.QVariant(kwargs.pop(u'data')))
|
||||
action.setData(kwargs.pop(u'data'))
|
||||
if kwargs.get(u'shortcuts'):
|
||||
action.setShortcuts(kwargs.pop(u'shortcuts'))
|
||||
if u'context' in kwargs:
|
||||
|
@ -423,8 +403,7 @@ def create_action(parent, name, **kwargs):
|
|||
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'),
|
||||
kwargs.pop(u'triggers'))
|
||||
for key in kwargs.keys():
|
||||
if key not in [u'text', u'icon', u'tooltip', u'statustip', u'checked',
|
||||
u'shortcuts', u'category', u'triggers']:
|
||||
if key not in [u'text', u'icon', u'tooltip', u'statustip', u'checked', u'shortcuts', u'category', u'triggers']:
|
||||
log.warn(u'Parameter %s was not consumed in create_action().', key)
|
||||
return action
|
||||
|
||||
|
@ -469,8 +448,7 @@ def create_valign_selection_widgets(parent):
|
|||
label = QtGui.QLabel(parent)
|
||||
label.setText(translate('OpenLP.Ui', '&Vertical Align:'))
|
||||
combo_box = QtGui.QComboBox(parent)
|
||||
combo_box.addItems(
|
||||
[UiStrings().Top, UiStrings().Middle, UiStrings().Bottom])
|
||||
combo_box.addItems([UiStrings().Top, UiStrings().Middle, UiStrings().Bottom])
|
||||
label.setBuddy(combo_box)
|
||||
return label, combo_box
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -194,8 +194,7 @@ class Theme(object):
|
|||
``xml``
|
||||
The data to apply to the theme
|
||||
"""
|
||||
root = ElementTree(element=XML(xml.encode(u'ascii',
|
||||
u'xmlcharrefreplace')))
|
||||
root = ElementTree(element=XML(xml.encode(u'ascii', u'xmlcharrefreplace')))
|
||||
xml_iter = root.getiterator()
|
||||
for element in xml_iter:
|
||||
delphi_color_change = False
|
||||
|
@ -219,16 +218,13 @@ class Theme(object):
|
|||
val = int(element_text)
|
||||
except ValueError:
|
||||
val = element_text
|
||||
if (element.tag.find(u'Color') > 0 or
|
||||
(element.tag.find(u'BackgroundParameter') == 0 and
|
||||
if (element.tag.find(u'Color') > 0 or (element.tag.find(u'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)
|
||||
val = QtGui.QColor(val&0xFF, (val>>8)&0xFF, (val>>16)&0xFF)
|
||||
else:
|
||||
val = QtGui.QColor(
|
||||
(val>>16)&0xFF, (val>>8)&0xFF, val&0xFF)
|
||||
val = QtGui.QColor((val>>16)&0xFF, (val>>8)&0xFF, val&0xFF)
|
||||
setattr(self, element.tag, val)
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -39,8 +39,7 @@ class Ui_AboutDialog(object):
|
|||
self.aboutDialogLayout = QtGui.QVBoxLayout(aboutDialog)
|
||||
self.aboutDialogLayout.setObjectName(u'aboutDialogLayout')
|
||||
self.logoLabel = QtGui.QLabel(aboutDialog)
|
||||
self.logoLabel.setPixmap(
|
||||
QtGui.QPixmap(u':/graphics/openlp-about-logo.png'))
|
||||
self.logoLabel.setPixmap(QtGui.QPixmap(u':/graphics/openlp-about-logo.png'))
|
||||
self.logoLabel.setObjectName(u'logoLabel')
|
||||
self.aboutDialogLayout.addWidget(self.logoLabel)
|
||||
self.aboutNotebook = QtGui.QTabWidget(aboutDialog)
|
||||
|
@ -73,10 +72,8 @@ class Ui_AboutDialog(object):
|
|||
self.licenseTabLayout.addWidget(self.licenseTextEdit)
|
||||
self.aboutNotebook.addTab(self.licenseTab, u'')
|
||||
self.aboutDialogLayout.addWidget(self.aboutNotebook)
|
||||
self.volunteerButton = create_button(None, u'volunteerButton',
|
||||
icon=u':/system/system_volunteer.png')
|
||||
self.buttonBox = create_button_box(aboutDialog, u'buttonBox',
|
||||
[u'close'], [self.volunteerButton])
|
||||
self.volunteerButton = create_button(None, u'volunteerButton', icon=u':/system/system_volunteer.png')
|
||||
self.buttonBox = create_button_box(aboutDialog, u'buttonBox', [u'close'], [self.volunteerButton])
|
||||
self.aboutDialogLayout.addWidget(self.buttonBox)
|
||||
self.retranslateUi(aboutDialog)
|
||||
self.aboutNotebook.setCurrentIndex(0)
|
||||
|
@ -99,8 +96,7 @@ class Ui_AboutDialog(object):
|
|||
'like to see more free Christian software being written, please '
|
||||
'consider volunteering by using the button below.'
|
||||
))
|
||||
self.aboutNotebook.setTabText(
|
||||
self.aboutNotebook.indexOf(self.aboutTab), UiStrings().About)
|
||||
self.aboutNotebook.setTabText(self.aboutNotebook.indexOf(self.aboutTab), UiStrings().About)
|
||||
lead = u'Raoul "superfly" Snyman'
|
||||
developers = [u'Tim "TRB143" Bentley', u'Jonathan "gushie" Corwin',
|
||||
u'Michael "cocooncrash" Gorven',
|
||||
|
@ -158,7 +154,7 @@ class Ui_AboutDialog(object):
|
|||
}
|
||||
documentors = [u'Wesley "wrst" Stout',
|
||||
u'John "jseagull1" Cegalis (lead)']
|
||||
self.creditsTextEdit.setPlainText(unicode(translate('OpenLP.AboutForm',
|
||||
self.creditsTextEdit.setPlainText(translate('OpenLP.AboutForm',
|
||||
'Project Lead\n'
|
||||
' %s\n'
|
||||
'\n'
|
||||
|
@ -237,7 +233,7 @@ class Ui_AboutDialog(object):
|
|||
' God our Father, for sending His Son to die\n'
|
||||
' on the cross, setting us free from sin. We\n'
|
||||
' bring this software to you for free because\n'
|
||||
' He has set us free.')) % (lead, u'\n '.join(developers),
|
||||
' He has set us free.') % (lead, u'\n '.join(developers),
|
||||
u'\n '.join(contributors), u'\n '.join(testers),
|
||||
u'\n '.join(packagers), u'\n '.join(translators[u'af']),
|
||||
u'\n '.join(translators[u'cs']),
|
||||
|
@ -261,12 +257,11 @@ class Ui_AboutDialog(object):
|
|||
u'\n '.join(translators[u'ta_LK']),
|
||||
u'\n '.join(translators[u'zh_CN']),
|
||||
u'\n '.join(documentors)))
|
||||
self.aboutNotebook.setTabText(
|
||||
self.aboutNotebook.indexOf(self.creditsTab),
|
||||
self.aboutNotebook.setTabText(self.aboutNotebook.indexOf(self.creditsTab),
|
||||
translate('OpenLP.AboutForm', 'Credits'))
|
||||
copyright = unicode(translate('OpenLP.AboutForm',
|
||||
copyright = translate('OpenLP.AboutForm',
|
||||
'Copyright \xa9 2004-2012 %s\n'
|
||||
'Portions copyright \xa9 2004-2012 %s')) % (u'Raoul Snyman',
|
||||
'Portions copyright \xa9 2004-2012 %s') % (u'Raoul Snyman',
|
||||
u'Tim Bentley, Gerald Britton, Jonathan Corwin, Samuel Findlay, '
|
||||
u'Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, '
|
||||
u'Armin K\xf6hler, Erik Lundin, Edwin Lunando, Joshua Miller, '
|
||||
|
@ -656,10 +651,7 @@ class Ui_AboutDialog(object):
|
|||
'linking proprietary applications with the library. If this is '
|
||||
'what you want to do, use the GNU Lesser General Public License '
|
||||
'instead of this License.')
|
||||
self.licenseTextEdit.setPlainText(u'%s\n\n%s\n\n%s\n\n\n%s' %
|
||||
(copyright, licence, disclaimer, gpltext))
|
||||
self.aboutNotebook.setTabText(
|
||||
self.aboutNotebook.indexOf(self.licenseTab),
|
||||
self.licenseTextEdit.setPlainText(u'%s\n\n%s\n\n%s\n\n\n%s' % (copyright, licence, disclaimer, gpltext))
|
||||
self.aboutNotebook.setTabText(self.aboutNotebook.indexOf(self.licenseTab),
|
||||
translate('OpenLP.AboutForm', 'License'))
|
||||
self.volunteerButton.setText(translate('OpenLP.AboutForm',
|
||||
'Volunteer'))
|
||||
self.volunteerButton.setText(translate('OpenLP.AboutForm', 'Volunteer'))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -46,17 +46,14 @@ class AboutForm(QtGui.QDialog, Ui_AboutDialog):
|
|||
applicationVersion = get_application_version()
|
||||
self.setupUi(self)
|
||||
about_text = self.aboutTextEdit.toPlainText()
|
||||
about_text = about_text.replace(u'<version>',
|
||||
applicationVersion[u'version'])
|
||||
about_text = about_text.replace(u'<version>', applicationVersion[u'version'])
|
||||
if applicationVersion[u'build']:
|
||||
build_text = unicode(translate('OpenLP.AboutForm', ' build %s')) % \
|
||||
applicationVersion[u'build']
|
||||
build_text = translate('OpenLP.AboutForm', ' build %s') % applicationVersion[u'build']
|
||||
else:
|
||||
build_text = u''
|
||||
about_text = about_text.replace(u'<revision>', build_text)
|
||||
self.aboutTextEdit.setPlainText(about_text)
|
||||
QtCore.QObject.connect(self.volunteerButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onVolunteerButtonClicked)
|
||||
QtCore.QObject.connect(self.volunteerButton, QtCore.SIGNAL(u'clicked()'), self.onVolunteerButtonClicked)
|
||||
|
||||
def onVolunteerButtonClicked(self):
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -36,8 +36,7 @@ import sys
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate, build_icon, Receiver
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import SettingsTab, translate, build_icon, Receiver, Settings
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
from openlp.core.utils import get_images_filter, AppLocation, format_time
|
||||
from openlp.core.lib import SlideLimits
|
||||
|
@ -59,12 +58,12 @@ class AdvancedTab(SettingsTab):
|
|||
# 11 o'clock is the most popular time for morning service.
|
||||
self.defaultServiceHour = 11
|
||||
self.defaultServiceMinute = 0
|
||||
self.defaultServiceName = unicode(translate('OpenLP.AdvancedTab',
|
||||
self.defaultServiceName = translate('OpenLP.AdvancedTab',
|
||||
'Service %Y-%m-%d %H-%M',
|
||||
'This may not contain any of the following characters: '
|
||||
'/\\?*|<>\[\]":+\n'
|
||||
'See http://docs.python.org/library/datetime.html'
|
||||
'#strftime-strptime-behavior for more information.'))
|
||||
'#strftime-strptime-behavior for more information.')
|
||||
self.defaultImage = u':/graphics/openlp-splash-screen.png'
|
||||
self.defaultColor = u'#ffffff'
|
||||
self.dataExists = False
|
||||
|
@ -95,12 +94,10 @@ class AdvancedTab(SettingsTab):
|
|||
self.doubleClickLiveCheckBox.setObjectName(u'doubleClickLiveCheckBox')
|
||||
self.uiLayout.addRow(self.doubleClickLiveCheckBox)
|
||||
self.singleClickPreviewCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||
self.singleClickPreviewCheckBox.setObjectName(
|
||||
u'singleClickPreviewCheckBox')
|
||||
self.singleClickPreviewCheckBox.setObjectName(u'singleClickPreviewCheckBox')
|
||||
self.uiLayout.addRow(self.singleClickPreviewCheckBox)
|
||||
self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||
self.expandServiceItemCheckBox.setObjectName(
|
||||
u'expandServiceItemCheckBox')
|
||||
self.expandServiceItemCheckBox.setObjectName(u'expandServiceItemCheckBox')
|
||||
self.uiLayout.addRow(self.expandServiceItemCheckBox)
|
||||
self.enableAutoCloseCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||
self.enableAutoCloseCheckBox.setObjectName(u'enableAutoCloseCheckBox')
|
||||
|
@ -125,33 +122,25 @@ class AdvancedTab(SettingsTab):
|
|||
self.serviceNameTimeHBox.setObjectName(u'serviceNameTimeHBox')
|
||||
self.serviceNameTimeHBox.addWidget(self.serviceNameDay)
|
||||
self.serviceNameTimeHBox.addWidget(self.serviceNameTime)
|
||||
self.serviceNameLayout.addRow(self.serviceNameTimeLabel,
|
||||
self.serviceNameTimeHBox)
|
||||
self.serviceNameLayout.addRow(self.serviceNameTimeLabel, self.serviceNameTimeHBox)
|
||||
self.serviceNameLabel = QtGui.QLabel(self.serviceNameGroupBox)
|
||||
self.serviceNameLabel.setObjectName(u'serviceNameLabel')
|
||||
self.serviceNameEdit = QtGui.QLineEdit(self.serviceNameGroupBox)
|
||||
self.serviceNameEdit.setObjectName(u'serviceNameEdit')
|
||||
self.serviceNameEdit.setValidator(QtGui.QRegExpValidator(
|
||||
QtCore.QRegExp(r'[^/\\?*|<>\[\]":+]+'), self))
|
||||
self.serviceNameRevertButton = QtGui.QToolButton(
|
||||
self.serviceNameGroupBox)
|
||||
self.serviceNameRevertButton.setObjectName(
|
||||
u'serviceNameRevertButton')
|
||||
self.serviceNameRevertButton.setIcon(
|
||||
build_icon(u':/general/general_revert.png'))
|
||||
self.serviceNameEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+]+'), self))
|
||||
self.serviceNameRevertButton = QtGui.QToolButton(self.serviceNameGroupBox)
|
||||
self.serviceNameRevertButton.setObjectName(u'serviceNameRevertButton')
|
||||
self.serviceNameRevertButton.setIcon(build_icon(u':/general/general_revert.png'))
|
||||
self.serviceNameHBox = QtGui.QHBoxLayout()
|
||||
self.serviceNameHBox.setObjectName(u'serviceNameHBox')
|
||||
self.serviceNameHBox.addWidget(self.serviceNameEdit)
|
||||
self.serviceNameHBox.addWidget(self.serviceNameRevertButton)
|
||||
self.serviceNameLayout.addRow(self.serviceNameLabel,
|
||||
self.serviceNameHBox)
|
||||
self.serviceNameLayout.addRow(self.serviceNameLabel, self.serviceNameHBox)
|
||||
self.serviceNameExampleLabel = QtGui.QLabel(self.serviceNameGroupBox)
|
||||
self.serviceNameExampleLabel.setObjectName(
|
||||
u'serviceNameExampleLabel')
|
||||
self.serviceNameExampleLabel.setObjectName(u'serviceNameExampleLabel')
|
||||
self.serviceNameExample = QtGui.QLabel(self.serviceNameGroupBox)
|
||||
self.serviceNameExample.setObjectName(u'serviceNameExample')
|
||||
self.serviceNameLayout.addRow(self.serviceNameExampleLabel,
|
||||
self.serviceNameExample)
|
||||
self.serviceNameLayout.addRow(self.serviceNameExampleLabel, self.serviceNameExample)
|
||||
self.leftLayout.addWidget(self.serviceNameGroupBox)
|
||||
# Data Directory
|
||||
self.dataDirectoryGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||
|
@ -159,8 +148,7 @@ class AdvancedTab(SettingsTab):
|
|||
self.dataDirectoryLayout = QtGui.QFormLayout(self.dataDirectoryGroupBox)
|
||||
self.dataDirectoryLayout.setObjectName(u'dataDirectoryLayout')
|
||||
self.dataDirectoryCurrentLabel = QtGui.QLabel(self.dataDirectoryGroupBox)
|
||||
self.dataDirectoryCurrentLabel.setObjectName(
|
||||
u'dataDirectoryCurrentLabel')
|
||||
self.dataDirectoryCurrentLabel.setObjectName( u'dataDirectoryCurrentLabel')
|
||||
self.dataDirectoryLabel = QtGui.QLabel(self.dataDirectoryGroupBox)
|
||||
self.dataDirectoryLabel.setObjectName(u'dataDirectoryLabel')
|
||||
self.dataDirectoryNewLabel = QtGui.QLabel(self.dataDirectoryGroupBox)
|
||||
|
@ -168,52 +156,32 @@ class AdvancedTab(SettingsTab):
|
|||
self.newDataDirectoryEdit = QtGui.QLineEdit(self.dataDirectoryGroupBox)
|
||||
self.newDataDirectoryEdit.setObjectName(u'newDataDirectoryEdit')
|
||||
self.newDataDirectoryEdit.setReadOnly(True)
|
||||
self.newDataDirectoryHasFilesLabel = QtGui.QLabel(
|
||||
self.dataDirectoryGroupBox)
|
||||
self.newDataDirectoryHasFilesLabel.setObjectName(
|
||||
u'newDataDirectoryHasFilesLabel')
|
||||
self.newDataDirectoryHasFilesLabel = QtGui.QLabel(self.dataDirectoryGroupBox)
|
||||
self.newDataDirectoryHasFilesLabel.setObjectName(u'newDataDirectoryHasFilesLabel')
|
||||
self.newDataDirectoryHasFilesLabel.setWordWrap(True)
|
||||
self.dataDirectoryBrowseButton = QtGui.QToolButton(
|
||||
self.dataDirectoryGroupBox)
|
||||
self.dataDirectoryBrowseButton.setObjectName(
|
||||
u'dataDirectoryBrowseButton')
|
||||
self.dataDirectoryBrowseButton.setIcon(
|
||||
build_icon(u':/general/general_open.png'))
|
||||
self.dataDirectoryDefaultButton = QtGui.QToolButton(
|
||||
self.dataDirectoryGroupBox)
|
||||
self.dataDirectoryDefaultButton.setObjectName(
|
||||
u'dataDirectoryDefaultButton')
|
||||
self.dataDirectoryDefaultButton.setIcon(
|
||||
build_icon(u':/general/general_revert.png'))
|
||||
self.dataDirectoryCancelButton = QtGui.QToolButton(
|
||||
self.dataDirectoryGroupBox)
|
||||
self.dataDirectoryCancelButton.setObjectName(
|
||||
u'dataDirectoryCancelButton')
|
||||
self.dataDirectoryCancelButton.setIcon(
|
||||
build_icon(u':/general/general_delete.png'))
|
||||
self.dataDirectoryBrowseButton = QtGui.QToolButton(self.dataDirectoryGroupBox)
|
||||
self.dataDirectoryBrowseButton.setObjectName(u'dataDirectoryBrowseButton')
|
||||
self.dataDirectoryBrowseButton.setIcon(build_icon(u':/general/general_open.png'))
|
||||
self.dataDirectoryDefaultButton = QtGui.QToolButton(self.dataDirectoryGroupBox)
|
||||
self.dataDirectoryDefaultButton.setObjectName(u'dataDirectoryDefaultButton')
|
||||
self.dataDirectoryDefaultButton.setIcon(build_icon(u':/general/general_revert.png'))
|
||||
self.dataDirectoryCancelButton = QtGui.QToolButton(self.dataDirectoryGroupBox)
|
||||
self.dataDirectoryCancelButton.setObjectName(u'dataDirectoryCancelButton')
|
||||
self.dataDirectoryCancelButton.setIcon(build_icon(u':/general/general_delete.png'))
|
||||
self.newDataDirectoryLabelHBox = QtGui.QHBoxLayout()
|
||||
self.newDataDirectoryLabelHBox.setObjectName(
|
||||
u'newDataDirectoryLabelHBox')
|
||||
self.newDataDirectoryLabelHBox.setObjectName(u'newDataDirectoryLabelHBox')
|
||||
self.newDataDirectoryLabelHBox.addWidget(self.newDataDirectoryEdit)
|
||||
self.newDataDirectoryLabelHBox.addWidget(self.dataDirectoryBrowseButton)
|
||||
self.newDataDirectoryLabelHBox.addWidget(
|
||||
self.dataDirectoryDefaultButton)
|
||||
self.newDataDirectoryLabelHBox.addWidget(self.dataDirectoryDefaultButton)
|
||||
self.dataDirectoryCopyCheckHBox = QtGui.QHBoxLayout()
|
||||
self.dataDirectoryCopyCheckHBox.setObjectName(
|
||||
u'dataDirectoryCopyCheckHBox')
|
||||
self.dataDirectoryCopyCheckBox = QtGui.QCheckBox(
|
||||
self.dataDirectoryGroupBox)
|
||||
self.dataDirectoryCopyCheckBox.setObjectName(
|
||||
u'dataDirectoryCopyCheckBox')
|
||||
self.dataDirectoryCopyCheckHBox.addWidget(
|
||||
self.dataDirectoryCopyCheckBox)
|
||||
self.dataDirectoryCopyCheckHBox.setObjectName(u'dataDirectoryCopyCheckHBox')
|
||||
self.dataDirectoryCopyCheckBox = QtGui.QCheckBox(self.dataDirectoryGroupBox)
|
||||
self.dataDirectoryCopyCheckBox.setObjectName(u'dataDirectoryCopyCheckBox')
|
||||
self.dataDirectoryCopyCheckHBox.addWidget(self.dataDirectoryCopyCheckBox)
|
||||
self.dataDirectoryCopyCheckHBox.addStretch()
|
||||
self.dataDirectoryCopyCheckHBox.addWidget(
|
||||
self.dataDirectoryCancelButton)
|
||||
self.dataDirectoryLayout.addRow(self.dataDirectoryCurrentLabel,
|
||||
self.dataDirectoryLabel)
|
||||
self.dataDirectoryLayout.addRow(self.dataDirectoryNewLabel,
|
||||
self.newDataDirectoryLabelHBox)
|
||||
self.dataDirectoryCopyCheckHBox.addWidget(self.dataDirectoryCancelButton)
|
||||
self.dataDirectoryLayout.addRow(self.dataDirectoryCurrentLabel, self.dataDirectoryLabel)
|
||||
self.dataDirectoryLayout.addRow(self.dataDirectoryNewLabel, self.newDataDirectoryLabelHBox)
|
||||
self.dataDirectoryLayout.addRow(self.dataDirectoryCopyCheckHBox)
|
||||
self.dataDirectoryLayout.addRow(self.newDataDirectoryHasFilesLabel)
|
||||
self.leftLayout.addWidget(self.dataDirectoryGroupBox)
|
||||
|
@ -227,27 +195,23 @@ class AdvancedTab(SettingsTab):
|
|||
self.defaultColorLabel.setObjectName(u'defaultColorLabel')
|
||||
self.defaultColorButton = QtGui.QPushButton(self.defaultImageGroupBox)
|
||||
self.defaultColorButton.setObjectName(u'defaultColorButton')
|
||||
self.defaultImageLayout.addRow(self.defaultColorLabel,
|
||||
self.defaultColorButton)
|
||||
self.defaultImageLayout.addRow(self.defaultColorLabel, self.defaultColorButton)
|
||||
self.defaultFileLabel = QtGui.QLabel(self.defaultImageGroupBox)
|
||||
self.defaultFileLabel.setObjectName(u'defaultFileLabel')
|
||||
self.defaultFileEdit = QtGui.QLineEdit(self.defaultImageGroupBox)
|
||||
self.defaultFileEdit.setObjectName(u'defaultFileEdit')
|
||||
self.defaultBrowseButton = QtGui.QToolButton(self.defaultImageGroupBox)
|
||||
self.defaultBrowseButton.setObjectName(u'defaultBrowseButton')
|
||||
self.defaultBrowseButton.setIcon(
|
||||
build_icon(u':/general/general_open.png'))
|
||||
self.defaultBrowseButton.setIcon(build_icon(u':/general/general_open.png'))
|
||||
self.defaultRevertButton = QtGui.QToolButton(self.defaultImageGroupBox)
|
||||
self.defaultRevertButton.setObjectName(u'defaultRevertButton')
|
||||
self.defaultRevertButton.setIcon(
|
||||
build_icon(u':/general/general_revert.png'))
|
||||
self.defaultRevertButton.setIcon(build_icon(u':/general/general_revert.png'))
|
||||
self.defaultFileLayout = QtGui.QHBoxLayout()
|
||||
self.defaultFileLayout.setObjectName(u'defaultFileLayout')
|
||||
self.defaultFileLayout.addWidget(self.defaultFileEdit)
|
||||
self.defaultFileLayout.addWidget(self.defaultBrowseButton)
|
||||
self.defaultFileLayout.addWidget(self.defaultRevertButton)
|
||||
self.defaultImageLayout.addRow(self.defaultFileLabel,
|
||||
self.defaultFileLayout)
|
||||
self.defaultImageLayout.addRow(self.defaultFileLabel, self.defaultFileLayout)
|
||||
self.rightLayout.addWidget(self.defaultImageGroupBox)
|
||||
# Hide mouse
|
||||
self.hideMouseGroupBox = QtGui.QGroupBox(self.rightColumn)
|
||||
|
@ -290,48 +254,33 @@ class AdvancedTab(SettingsTab):
|
|||
self.rightLayout.addWidget(self.workaroundGroupBox)
|
||||
self.rightLayout.addStretch()
|
||||
self.shouldUpdateServiceNameExample = False
|
||||
QtCore.QObject.connect(self.serviceNameCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.serviceNameCheckBoxToggled)
|
||||
QtCore.QObject.connect(self.serviceNameDay,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
QtCore.QObject.connect(self.serviceNameCheckBox, QtCore.SIGNAL(u'toggled(bool)'),
|
||||
self.serviceNameCheckBoxToggled)
|
||||
QtCore.QObject.connect(self.serviceNameDay, QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
self.onServiceNameDayChanged)
|
||||
QtCore.QObject.connect(self.serviceNameTime,
|
||||
QtCore.SIGNAL(u'timeChanged(QTime)'),
|
||||
QtCore.QObject.connect(self.serviceNameTime, QtCore.SIGNAL(u'timeChanged(QTime)'),
|
||||
self.updateServiceNameExample)
|
||||
QtCore.QObject.connect(self.serviceNameEdit,
|
||||
QtCore.SIGNAL(u'textChanged(QString)'),
|
||||
QtCore.QObject.connect(self.serviceNameEdit, QtCore.SIGNAL(u'textChanged(QString)'),
|
||||
self.updateServiceNameExample)
|
||||
QtCore.QObject.connect(self.serviceNameRevertButton,
|
||||
QtCore.SIGNAL(u'clicked()'),
|
||||
QtCore.QObject.connect(self.serviceNameRevertButton, QtCore.SIGNAL(u'clicked()'),
|
||||
self.onServiceNameRevertButtonClicked)
|
||||
QtCore.QObject.connect(self.defaultColorButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onDefaultColorButtonClicked)
|
||||
QtCore.QObject.connect(self.defaultBrowseButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onDefaultBrowseButtonClicked)
|
||||
QtCore.QObject.connect(self.defaultRevertButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onDefaultRevertButtonClicked)
|
||||
QtCore.QObject.connect(self.x11BypassCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.onX11BypassCheckBoxToggled)
|
||||
QtCore.QObject.connect(self.defaultColorButton, QtCore.SIGNAL(u'clicked()'), self.onDefaultColorButtonClicked)
|
||||
QtCore.QObject.connect(self.defaultBrowseButton, QtCore.SIGNAL(u'clicked()'), self.onDefaultBrowseButtonClicked)
|
||||
QtCore.QObject.connect(self.defaultRevertButton, QtCore.SIGNAL(u'clicked()'), self.onDefaultRevertButtonClicked)
|
||||
QtCore.QObject.connect(self.x11BypassCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.onX11BypassCheckBoxToggled)
|
||||
QtCore.QObject.connect(self.alternateRowsCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.onAlternateRowsCheckBoxToggled)
|
||||
QtCore.QObject.connect(self.dataDirectoryBrowseButton,
|
||||
QtCore.SIGNAL(u'clicked()'),
|
||||
QtCore.QObject.connect(self.dataDirectoryBrowseButton, QtCore.SIGNAL(u'clicked()'),
|
||||
self.onDataDirectoryBrowseButtonClicked)
|
||||
QtCore.QObject.connect(self.dataDirectoryDefaultButton,
|
||||
QtCore.SIGNAL(u'clicked()'),
|
||||
QtCore.QObject.connect(self.dataDirectoryDefaultButton, QtCore.SIGNAL(u'clicked()'),
|
||||
self.onDataDirectoryDefaultButtonClicked)
|
||||
QtCore.QObject.connect(self.dataDirectoryCancelButton,
|
||||
QtCore.SIGNAL(u'clicked()'),
|
||||
QtCore.QObject.connect(self.dataDirectoryCancelButton, QtCore.SIGNAL(u'clicked()'),
|
||||
self.onDataDirectoryCancelButtonClicked)
|
||||
QtCore.QObject.connect(self.dataDirectoryCopyCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'),
|
||||
self.onDataDirectoryCopyCheckBoxToggled)
|
||||
QtCore.QObject.connect(self.endSlideRadioButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onEndSlideButtonClicked)
|
||||
QtCore.QObject.connect(self.wrapSlideRadioButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onWrapSlideButtonClicked)
|
||||
QtCore.QObject.connect(self.nextItemRadioButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onnextItemButtonClicked)
|
||||
QtCore.QObject.connect(self.dataDirectoryCopyCheckBox, QtCore.SIGNAL(u'toggled(bool)'),
|
||||
self.onDataDirectoryCopyCheckBoxToggled)
|
||||
QtCore.QObject.connect(self.endSlideRadioButton, QtCore.SIGNAL(u'clicked()'), self.onEndSlideButtonClicked)
|
||||
QtCore.QObject.connect(self.wrapSlideRadioButton, QtCore.SIGNAL(u'clicked()'), self.onWrapSlideButtonClicked)
|
||||
QtCore.QObject.connect(self.nextItemRadioButton, QtCore.SIGNAL(u'clicked()'), self.onnextItemButtonClicked)
|
||||
|
||||
def retranslateUi(self):
|
||||
"""
|
||||
|
@ -339,11 +288,8 @@ class AdvancedTab(SettingsTab):
|
|||
"""
|
||||
self.tabTitleVisible = UiStrings().Advanced
|
||||
self.uiGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings'))
|
||||
self.dataDirectoryGroupBox.setTitle(
|
||||
translate('OpenLP.AdvancedTab', 'Data Location'))
|
||||
self.recentLabel.setText(
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'Number of recent files to display:'))
|
||||
self.dataDirectoryGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Data Location'))
|
||||
self.recentLabel.setText(translate('OpenLP.AdvancedTab', 'Number of recent files to display:'))
|
||||
self.mediaPluginCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||
'Remember active media manager tab on startup'))
|
||||
self.doubleClickLiveCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||
|
@ -354,98 +300,56 @@ class AdvancedTab(SettingsTab):
|
|||
'Expand new service items on creation'))
|
||||
self.enableAutoCloseCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||
'Enable application exit confirmation'))
|
||||
self.serviceNameGroupBox.setTitle(
|
||||
translate('OpenLP.AdvancedTab', 'Default Service Name'))
|
||||
self.serviceNameCheckBox.setText(
|
||||
translate('OpenLP.AdvancedTab', 'Enable default service name'))
|
||||
self.serviceNameTimeLabel.setText(
|
||||
translate('OpenLP.AdvancedTab', 'Date and Time:'))
|
||||
self.serviceNameDay.setItemText(0,
|
||||
translate('OpenLP.AdvancedTab', 'Monday'))
|
||||
self.serviceNameDay.setItemText(1,
|
||||
translate('OpenLP.AdvancedTab', 'Tuesday'))
|
||||
self.serviceNameDay.setItemText(2,
|
||||
translate('OpenLP.AdvancedTab', 'Wednesday'))
|
||||
self.serviceNameDay.setItemText(3,
|
||||
translate('OpenLP.AdvancedTab', 'Thurdsday'))
|
||||
self.serviceNameDay.setItemText(4,
|
||||
translate('OpenLP.AdvancedTab', 'Friday'))
|
||||
self.serviceNameDay.setItemText(5,
|
||||
translate('OpenLP.AdvancedTab', 'Saturday'))
|
||||
self.serviceNameDay.setItemText(6,
|
||||
translate('OpenLP.AdvancedTab', 'Sunday'))
|
||||
self.serviceNameDay.setItemText(7,
|
||||
translate('OpenLP.AdvancedTab', 'Now'))
|
||||
self.serviceNameGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Default Service Name'))
|
||||
self.serviceNameCheckBox.setText(translate('OpenLP.AdvancedTab', 'Enable default service name'))
|
||||
self.serviceNameTimeLabel.setText(translate('OpenLP.AdvancedTab', 'Date and Time:'))
|
||||
self.serviceNameDay.setItemText(0, translate('OpenLP.AdvancedTab', 'Monday'))
|
||||
self.serviceNameDay.setItemText(1, translate('OpenLP.AdvancedTab', 'Tuesday'))
|
||||
self.serviceNameDay.setItemText(2, translate('OpenLP.AdvancedTab', 'Wednesday'))
|
||||
self.serviceNameDay.setItemText(3, translate('OpenLP.AdvancedTab', 'Thurdsday'))
|
||||
self.serviceNameDay.setItemText(4, translate('OpenLP.AdvancedTab', 'Friday'))
|
||||
self.serviceNameDay.setItemText(5, translate('OpenLP.AdvancedTab', 'Saturday'))
|
||||
self.serviceNameDay.setItemText(6, translate('OpenLP.AdvancedTab', 'Sunday'))
|
||||
self.serviceNameDay.setItemText(7, translate('OpenLP.AdvancedTab', 'Now'))
|
||||
self.serviceNameTime.setToolTip(translate('OpenLP.AdvancedTab',
|
||||
'Time when usual service starts.'))
|
||||
self.serviceNameLabel.setText(
|
||||
translate('OpenLP.AdvancedTab', 'Name:'))
|
||||
self.serviceNameEdit.setToolTip(translate('OpenLP.AdvancedTab',
|
||||
'Consult the OpenLP manual for usage.'))
|
||||
self.serviceNameRevertButton.setToolTip(unicode(
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'Revert to the default service name "%s".')) %
|
||||
self.defaultServiceName)
|
||||
self.serviceNameExampleLabel.setText(translate('OpenLP.AdvancedTab',
|
||||
'Example:'))
|
||||
self.hideMouseGroupBox.setTitle(translate('OpenLP.AdvancedTab',
|
||||
'Mouse Cursor'))
|
||||
self.hideMouseCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||
'Hide mouse cursor when over display window'))
|
||||
self.defaultImageGroupBox.setTitle(translate('OpenLP.AdvancedTab',
|
||||
'Default Image'))
|
||||
self.defaultColorLabel.setText(translate('OpenLP.AdvancedTab',
|
||||
'Background color:'))
|
||||
self.defaultColorButton.setToolTip(translate('OpenLP.AdvancedTab',
|
||||
'Click to select a color.'))
|
||||
self.defaultFileLabel.setText(translate('OpenLP.AdvancedTab',
|
||||
'Image file:'))
|
||||
self.defaultBrowseButton.setToolTip(translate('OpenLP.AdvancedTab',
|
||||
'Browse for an image file to display.'))
|
||||
self.defaultRevertButton.setToolTip(translate('OpenLP.AdvancedTab',
|
||||
'Revert to the default OpenLP logo.'))
|
||||
self.dataDirectoryCurrentLabel.setText(translate('OpenLP.AdvancedTab',
|
||||
'Current path:'))
|
||||
self.dataDirectoryNewLabel.setText(translate('OpenLP.AdvancedTab',
|
||||
'Custom path:'))
|
||||
self.dataDirectoryBrowseButton.setToolTip(
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'Browse for new data file location.'))
|
||||
self.serviceNameLabel.setText(translate('OpenLP.AdvancedTab', 'Name:'))
|
||||
self.serviceNameEdit.setToolTip(translate('OpenLP.AdvancedTab', 'Consult the OpenLP manual for usage.'))
|
||||
self.serviceNameRevertButton.setToolTip(
|
||||
translate('OpenLP.AdvancedTab', 'Revert to the default service name "%s".') % self.defaultServiceName)
|
||||
self.serviceNameExampleLabel.setText(translate('OpenLP.AdvancedTab', 'Example:'))
|
||||
self.hideMouseGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Mouse Cursor'))
|
||||
self.hideMouseCheckBox.setText(translate('OpenLP.AdvancedTab', 'Hide mouse cursor when over display window'))
|
||||
self.defaultImageGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Default Image'))
|
||||
self.defaultColorLabel.setText(translate('OpenLP.AdvancedTab', 'Background color:'))
|
||||
self.defaultColorButton.setToolTip(translate('OpenLP.AdvancedTab', 'Click to select a color.'))
|
||||
self.defaultFileLabel.setText(translate('OpenLP.AdvancedTab', 'Image file:'))
|
||||
self.defaultBrowseButton.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for an image file to display.'))
|
||||
self.defaultRevertButton.setToolTip(translate('OpenLP.AdvancedTab', 'Revert to the default OpenLP logo.'))
|
||||
self.dataDirectoryCurrentLabel.setText(translate('OpenLP.AdvancedTab', 'Current path:'))
|
||||
self.dataDirectoryNewLabel.setText(translate('OpenLP.AdvancedTab', 'Custom path:'))
|
||||
self.dataDirectoryBrowseButton.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for new data file location.'))
|
||||
self.dataDirectoryDefaultButton.setToolTip(
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'Set the data location to the default.'))
|
||||
self.dataDirectoryCancelButton.setText(
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'Cancel'))
|
||||
translate('OpenLP.AdvancedTab', 'Set the data location to the default.'))
|
||||
self.dataDirectoryCancelButton.setText(translate('OpenLP.AdvancedTab', 'Cancel'))
|
||||
self.dataDirectoryCancelButton.setToolTip(
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'Cancel OpenLP data directory location change.'))
|
||||
self.dataDirectoryCopyCheckBox.setText(
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'Copy data to new location.'))
|
||||
self.dataDirectoryCopyCheckBox.setToolTip(
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'Copy the OpenLP data files to the new location.'))
|
||||
translate('OpenLP.AdvancedTab', 'Cancel OpenLP data directory location change.'))
|
||||
self.dataDirectoryCopyCheckBox.setText(translate('OpenLP.AdvancedTab', 'Copy data to new location.'))
|
||||
self.dataDirectoryCopyCheckBox.setToolTip(translate(
|
||||
'OpenLP.AdvancedTab', 'Copy the OpenLP data files to the new location.'))
|
||||
self.newDataDirectoryHasFilesLabel.setText(
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'<strong>WARNING:</strong> New data directory location contains '
|
||||
'OpenLP data files. These files WILL be replaced during a copy.'))
|
||||
translate('OpenLP.AdvancedTab', '<strong>WARNING:</strong> New data directory location contains '
|
||||
'OpenLP data files. These files WILL be replaced during a copy.'))
|
||||
self.workaroundGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Workarounds'))
|
||||
self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||
'Bypass X11 Window Manager'))
|
||||
self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab','Bypass X11 Window Manager'))
|
||||
self.alternateRowsCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||
'Disable alternating row colors in lists'))
|
||||
# Slide Limits
|
||||
self.slideGroupBox.setTitle(
|
||||
translate('OpenLP.GeneralTab', 'Service Item Slide Limits'))
|
||||
self.slideLabel.setText(translate('OpenLP.GeneralTab',
|
||||
'Behavior of next/previous on the last/first slide:'))
|
||||
self.endSlideRadioButton.setText(
|
||||
translate('OpenLP.GeneralTab', '&Remain on Slide'))
|
||||
self.wrapSlideRadioButton.setText(
|
||||
translate('OpenLP.GeneralTab', '&Wrap around'))
|
||||
self.nextItemRadioButton.setText(translate('OpenLP.GeneralTab',
|
||||
'&Move to next/previous service item'))
|
||||
self.slideGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Service Item Slide Limits'))
|
||||
self.slideLabel.setText(translate('OpenLP.GeneralTab', 'Behavior of next/previous on the last/first slide:'))
|
||||
self.endSlideRadioButton.setText(translate('OpenLP.GeneralTab', '&Remain on Slide'))
|
||||
self.wrapSlideRadioButton.setText(translate('OpenLP.GeneralTab', '&Wrap around'))
|
||||
self.nextItemRadioButton.setText(translate('OpenLP.GeneralTab', '&Move to next/previous service item'))
|
||||
|
||||
def load(self):
|
||||
"""
|
||||
|
@ -456,40 +360,21 @@ class AdvancedTab(SettingsTab):
|
|||
# The max recent files value does not have an interface and so never
|
||||
# gets actually stored in the settings therefore the default value of
|
||||
# 20 will always be used.
|
||||
self.recentSpinBox.setMaximum(Settings().value(
|
||||
u'max recent files', QtCore.QVariant(20)).toInt()[0])
|
||||
self.recentSpinBox.setValue(settings.value(u'recent file count',
|
||||
QtCore.QVariant(4)).toInt()[0])
|
||||
self.mediaPluginCheckBox.setChecked(
|
||||
settings.value(u'save current plugin',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.doubleClickLiveCheckBox.setChecked(
|
||||
settings.value(u'double click live',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.singleClickPreviewCheckBox.setChecked(
|
||||
settings.value(u'single click preview',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.expandServiceItemCheckBox.setChecked(
|
||||
settings.value(u'expand service item',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.enableAutoCloseCheckBox.setChecked(
|
||||
settings.value(u'enable exit confirmation',
|
||||
QtCore.QVariant(True)).toBool())
|
||||
self.hideMouseCheckBox.setChecked(
|
||||
settings.value(u'hide mouse', QtCore.QVariant(True)).toBool())
|
||||
self.serviceNameDay.setCurrentIndex(
|
||||
settings.value(u'default service day',
|
||||
QtCore.QVariant(self.defaultServiceDay)).toInt()[0])
|
||||
self.serviceNameTime.setTime(QtCore.QTime(
|
||||
settings.value(u'default service hour',
|
||||
self.defaultServiceHour).toInt()[0],
|
||||
settings.value(u'default service minute',
|
||||
self.defaultServiceMinute).toInt()[0]))
|
||||
self.recentSpinBox.setMaximum(settings.value(u'max recent files', 20))
|
||||
self.recentSpinBox.setValue(settings.value(u'recent file count', 4))
|
||||
self.mediaPluginCheckBox.setChecked(settings.value(u'save current plugin', False))
|
||||
self.doubleClickLiveCheckBox.setChecked(settings.value(u'double click live', False))
|
||||
self.singleClickPreviewCheckBox.setChecked(settings.value(u'single click preview', False))
|
||||
self.expandServiceItemCheckBox.setChecked(settings.value(u'expand service item', False))
|
||||
self.enableAutoCloseCheckBox.setChecked(settings.value(u'enable exit confirmation', True))
|
||||
self.hideMouseCheckBox.setChecked(settings.value(u'hide mouse', True))
|
||||
self.serviceNameDay.setCurrentIndex(settings.value(u'default service day', self.defaultServiceDay))
|
||||
self.serviceNameTime.setTime(QtCore.QTime(settings.value(u'default service hour', self.defaultServiceHour),
|
||||
settings.value(u'default service minute',self.defaultServiceMinute)))
|
||||
self.shouldUpdateServiceNameExample = True
|
||||
self.serviceNameEdit.setText(settings.value(u'default service name',
|
||||
self.defaultServiceName).toString())
|
||||
default_service_enabled = settings.value(u'default service enabled',
|
||||
QtCore.QVariant(True)).toBool()
|
||||
self.defaultServiceName))
|
||||
default_service_enabled = settings.value(u'default service enabled', True)
|
||||
self.serviceNameCheckBox.setChecked(default_service_enabled)
|
||||
self.serviceNameCheckBoxToggled(default_service_enabled)
|
||||
# Fix for bug #1014422.
|
||||
|
@ -498,21 +383,18 @@ class AdvancedTab(SettingsTab):
|
|||
# Default to False on Gnome.
|
||||
x11_bypass_default = bool(not
|
||||
os.environ.get(u'GNOME_DESKTOP_SESSION_ID'))
|
||||
self.x11BypassCheckBox.setChecked(settings.value(
|
||||
u'x11 bypass wm', QtCore.QVariant(x11_bypass_default)).toBool())
|
||||
# Default to False on XFce
|
||||
if os.environ.get(u'DESKTOP_SESSION') == u'xfce':
|
||||
x11_bypass_default = False
|
||||
self.x11BypassCheckBox.setChecked(settings.value(u'x11 bypass wm', x11_bypass_default))
|
||||
# Fix for bug #936281.
|
||||
# Prevent the dialog displayed by the alternateRowsCheckBox to display.
|
||||
signalsBlocked = self.alternateRowsCheckBox.blockSignals(True)
|
||||
self.alternateRowsCheckBox.setChecked(settings.value(
|
||||
u'alternate rows', QtCore.QVariant(
|
||||
sys.platform.startswith(u'win'))).toBool())
|
||||
self.alternateRowsCheckBox.setChecked(settings.value(u'alternate rows', sys.platform.startswith(u'win')))
|
||||
self.alternateRowsCheckBox.blockSignals(signalsBlocked)
|
||||
self.defaultColor = settings.value(u'default color',
|
||||
QtCore.QVariant(u'#ffffff')).toString()
|
||||
self.defaultFileEdit.setText(settings.value(u'default image',
|
||||
QtCore.QVariant(u':/graphics/openlp-splash-screen.png')).toString())
|
||||
self.slide_limits = settings.value(
|
||||
u'slide limits', QtCore.QVariant(SlideLimits.End)).toInt()[0]
|
||||
self.defaultColor = settings.value(u'default color', u'#ffffff')
|
||||
self.defaultFileEdit.setText(settings.value(u'default image', u':/graphics/openlp-splash-screen.png'))
|
||||
self.slide_limits = settings.value(u'slide limits', SlideLimits.End)
|
||||
if self.slide_limits == SlideLimits.End:
|
||||
self.endSlideRadioButton.setChecked(True)
|
||||
elif self.slide_limits == SlideLimits.Wrap:
|
||||
|
@ -550,14 +432,11 @@ class AdvancedTab(SettingsTab):
|
|||
# Set data location to default.
|
||||
settings.remove(u'advanced/data path')
|
||||
self.currentDataPath = AppLocation.get_data_path()
|
||||
log.warning(u'User requested data path set to default %s'
|
||||
% self.currentDataPath)
|
||||
log.warning(u'User requested data path set to default %s' % self.currentDataPath)
|
||||
self.dataDirectoryLabel.setText(os.path.abspath(self.currentDataPath))
|
||||
self.defaultColorButton.setStyleSheet(
|
||||
u'background-color: %s' % self.defaultColor)
|
||||
self.defaultColorButton.setStyleSheet(u'background-color: %s' % self.defaultColor)
|
||||
# Don't allow data directory move if running portable.
|
||||
if Settings().value(u'advanced/is portable',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
if settings.value(u'advanced/is portable', False):
|
||||
self.dataDirectoryGroupBox.hide()
|
||||
|
||||
def save(self):
|
||||
|
@ -568,40 +447,28 @@ class AdvancedTab(SettingsTab):
|
|||
settings.beginGroup(self.settingsSection)
|
||||
settings.setValue(u'default service enabled',
|
||||
self.serviceNameCheckBox.isChecked())
|
||||
service_name = unicode(self.serviceNameEdit.text())
|
||||
service_name = self.serviceNameEdit.text()
|
||||
preset_is_valid = self.generateServiceNameExample()[0]
|
||||
if service_name == self.defaultServiceName or not preset_is_valid:
|
||||
settings.remove(u'default service name')
|
||||
self.serviceNameEdit.setText(service_name)
|
||||
else:
|
||||
settings.setValue(u'default service name', service_name)
|
||||
settings.setValue(u'default service day',
|
||||
self.serviceNameDay.currentIndex())
|
||||
settings.setValue(u'default service hour',
|
||||
self.serviceNameTime.time().hour())
|
||||
settings.setValue(u'default service minute',
|
||||
self.serviceNameTime.time().minute())
|
||||
settings.setValue(u'recent file count',
|
||||
QtCore.QVariant(self.recentSpinBox.value()))
|
||||
settings.setValue(u'save current plugin',
|
||||
QtCore.QVariant(self.mediaPluginCheckBox.isChecked()))
|
||||
settings.setValue(u'double click live',
|
||||
QtCore.QVariant(self.doubleClickLiveCheckBox.isChecked()))
|
||||
settings.setValue(u'single click preview',
|
||||
QtCore.QVariant(self.singleClickPreviewCheckBox.isChecked()))
|
||||
settings.setValue(u'expand service item',
|
||||
QtCore.QVariant(self.expandServiceItemCheckBox.isChecked()))
|
||||
settings.setValue(u'enable exit confirmation',
|
||||
QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked()))
|
||||
settings.setValue(u'hide mouse',
|
||||
QtCore.QVariant(self.hideMouseCheckBox.isChecked()))
|
||||
settings.setValue(u'x11 bypass wm',
|
||||
QtCore.QVariant(self.x11BypassCheckBox.isChecked()))
|
||||
settings.setValue(u'alternate rows',
|
||||
QtCore.QVariant(self.alternateRowsCheckBox.isChecked()))
|
||||
settings.setValue(u'default service day', self.serviceNameDay.currentIndex())
|
||||
settings.setValue(u'default service hour', self.serviceNameTime.time().hour())
|
||||
settings.setValue(u'default service minute', self.serviceNameTime.time().minute())
|
||||
settings.setValue(u'recent file count', self.recentSpinBox.value())
|
||||
settings.setValue(u'save current plugin', self.mediaPluginCheckBox.isChecked())
|
||||
settings.setValue(u'double click live', self.doubleClickLiveCheckBox.isChecked())
|
||||
settings.setValue(u'single click preview', self.singleClickPreviewCheckBox.isChecked())
|
||||
settings.setValue(u'expand service item', self.expandServiceItemCheckBox.isChecked())
|
||||
settings.setValue(u'enable exit confirmation', self.enableAutoCloseCheckBox.isChecked())
|
||||
settings.setValue(u'hide mouse', self.hideMouseCheckBox.isChecked())
|
||||
settings.setValue(u'x11 bypass wm', self.x11BypassCheckBox.isChecked())
|
||||
settings.setValue(u'alternate rows', self.alternateRowsCheckBox.isChecked())
|
||||
settings.setValue(u'default color', self.defaultColor)
|
||||
settings.setValue(u'default image', self.defaultFileEdit.text())
|
||||
settings.setValue(u'slide limits', QtCore.QVariant(self.slide_limits))
|
||||
settings.setValue(u'slide limits', self.slide_limits)
|
||||
settings.endGroup()
|
||||
if self.displayChanged:
|
||||
Receiver.send_message(u'config_screen_changed')
|
||||
|
@ -615,8 +482,7 @@ class AdvancedTab(SettingsTab):
|
|||
|
||||
def serviceNameCheckBoxToggled(self, default_service_enabled):
|
||||
self.serviceNameDay.setEnabled(default_service_enabled)
|
||||
time_enabled = default_service_enabled and \
|
||||
self.serviceNameDay.currentIndex() is not 7
|
||||
time_enabled = default_service_enabled and self.serviceNameDay.currentIndex() is not 7
|
||||
self.serviceNameTime.setEnabled(time_enabled)
|
||||
self.serviceNameEdit.setEnabled(default_service_enabled)
|
||||
self.serviceNameRevertButton.setEnabled(default_service_enabled)
|
||||
|
@ -634,12 +500,10 @@ class AdvancedTab(SettingsTab):
|
|||
local_time = time.replace(hour = self.serviceNameTime.time().hour(),
|
||||
minute = self.serviceNameTime.time().minute())
|
||||
try:
|
||||
service_name_example = format_time(unicode(
|
||||
self.serviceNameEdit.text()), local_time)
|
||||
service_name_example = format_time(unicode(self.serviceNameEdit.text()), local_time)
|
||||
except ValueError:
|
||||
preset_is_valid = False
|
||||
service_name_example = translate('OpenLP.AdvancedTab',
|
||||
'Syntax error.')
|
||||
service_name_example = translate('OpenLP.AdvancedTab', 'Syntax error.')
|
||||
return preset_is_valid, service_name_example
|
||||
|
||||
def updateServiceNameExample(self, returned_value):
|
||||
|
@ -661,8 +525,7 @@ class AdvancedTab(SettingsTab):
|
|||
QtGui.QColor(self.defaultColor), self)
|
||||
if new_color.isValid():
|
||||
self.defaultColor = new_color.name()
|
||||
self.defaultColorButton.setStyleSheet(
|
||||
u'background-color: %s' % self.defaultColor)
|
||||
self.defaultColorButton.setStyleSheet(u'background-color: %s' % self.defaultColor)
|
||||
|
||||
def onDefaultBrowseButtonClicked(self):
|
||||
file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(),
|
||||
|
@ -680,8 +543,7 @@ class AdvancedTab(SettingsTab):
|
|||
old_root_path = unicode(self.dataDirectoryLabel.text())
|
||||
# Get the new directory location.
|
||||
new_data_path = unicode(QtGui.QFileDialog.getExistingDirectory(self,
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'Select Data Directory Location'), old_root_path,
|
||||
translate('OpenLP.AdvancedTab', 'Select Data Directory Location'), old_root_path,
|
||||
options = QtGui.QFileDialog.ShowDirsOnly))
|
||||
# Set the new data path.
|
||||
if new_data_path:
|
||||
|
@ -694,15 +556,10 @@ class AdvancedTab(SettingsTab):
|
|||
# Make sure they want to change the data.
|
||||
answer = QtGui.QMessageBox.question(self,
|
||||
translate('OpenLP.AdvancedTab', 'Confirm Data Directory Change'),
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'Are you sure you want to change the location of the OpenLP '
|
||||
'data directory to:\n\n%s\n\n'
|
||||
'The data directory will be changed when OpenLP is closed.'
|
||||
).replace('%s', new_data_path),
|
||||
QtGui.QMessageBox.StandardButtons(
|
||||
QtGui.QMessageBox.Yes |
|
||||
QtGui.QMessageBox.No),
|
||||
QtGui.QMessageBox.No)
|
||||
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the location of the OpenLP '
|
||||
'data directory to:\n\n%s\n\n '
|
||||
'The data directory will be changed when OpenLP is closed.').replace('%s', new_data_path),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.No)
|
||||
if answer != QtGui.QMessageBox.Yes:
|
||||
return
|
||||
# Check if data already exists here.
|
||||
|
@ -722,14 +579,9 @@ class AdvancedTab(SettingsTab):
|
|||
# default.
|
||||
answer = QtGui.QMessageBox.question(self,
|
||||
translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'Are you sure you want to change the location of the OpenLP '
|
||||
'data directory to the default location?\n\n'
|
||||
'This location will be used after OpenLP is closed.'),
|
||||
QtGui.QMessageBox.StandardButtons(
|
||||
QtGui.QMessageBox.Yes |
|
||||
QtGui.QMessageBox.No),
|
||||
QtGui.QMessageBox.No)
|
||||
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the location of the OpenLP '
|
||||
'data directory to the default location?\n\nThis location will be used after OpenLP is closed.'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.No)
|
||||
if answer != QtGui.QMessageBox.Yes:
|
||||
return
|
||||
self.checkDataOverwrite(new_data_path)
|
||||
|
@ -758,16 +610,10 @@ class AdvancedTab(SettingsTab):
|
|||
# Check is they want to replace existing data.
|
||||
answer = QtGui.QMessageBox.warning(self,
|
||||
translate('OpenLP.AdvancedTab', 'Overwrite Existing Data'),
|
||||
translate('OpenLP.AdvancedTab',
|
||||
'WARNING: \n\n'
|
||||
'The location you have selected \n\n%s\n\n'
|
||||
'appears to contain OpenLP data files. Do you wish to replace '
|
||||
'these files with the current data files?'
|
||||
translate('OpenLP.AdvancedTab', 'WARNING: \n\nThe location you have selected \n\n%s\n\n'
|
||||
'appears to contain OpenLP data files. Do you wish to replace these files with the current data files?'
|
||||
).replace('%s', os.path.abspath(data_path,)),
|
||||
QtGui.QMessageBox.StandardButtons(
|
||||
QtGui.QMessageBox.Yes |
|
||||
QtGui.QMessageBox.No),
|
||||
QtGui.QMessageBox.No)
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.No)
|
||||
if answer == QtGui.QMessageBox.Yes:
|
||||
self.dataDirectoryCopyCheckBox.setChecked(True)
|
||||
self.newDataDirectoryHasFilesLabel.show()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -42,8 +42,7 @@ class Ui_ExceptionDialog(object):
|
|||
self.messageLayout.addSpacing(12)
|
||||
self.bugLabel = QtGui.QLabel(exceptionDialog)
|
||||
self.bugLabel.setPixmap(QtGui.QPixmap(u':/graphics/exception.png'))
|
||||
self.bugLabel.setSizePolicy(QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Fixed)
|
||||
self.bugLabel.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.bugLabel.setObjectName(u'bugLabel')
|
||||
self.messageLayout.addWidget(self.bugLabel)
|
||||
self.messageLayout.addSpacing(12)
|
||||
|
@ -65,18 +64,14 @@ class Ui_ExceptionDialog(object):
|
|||
self.exceptionTextEdit.setReadOnly(True)
|
||||
self.exceptionTextEdit.setObjectName(u'exceptionTextEdit')
|
||||
self.exceptionLayout.addWidget(self.exceptionTextEdit)
|
||||
self.sendReportButton = create_button(exceptionDialog,
|
||||
u'sendReportButton', icon=u':/general/general_email.png',
|
||||
click=self.onSendReportButtonClicked)
|
||||
self.saveReportButton = create_button(exceptionDialog,
|
||||
u'saveReportButton', icon=u':/general/general_save.png',
|
||||
click=self.onSaveReportButtonClicked)
|
||||
self.attachFileButton = create_button(exceptionDialog,
|
||||
u'attachFileButton', icon=u':/general/general_open.png',
|
||||
click=self.onAttachFileButtonClicked)
|
||||
self.sendReportButton = create_button(exceptionDialog, u'sendReportButton',
|
||||
icon=u':/general/general_email.png', click=self.onSendReportButtonClicked)
|
||||
self.saveReportButton = create_button(exceptionDialog,u'saveReportButton',
|
||||
icon=u':/general/general_save.png', click=self.onSaveReportButtonClicked)
|
||||
self.attachFileButton = create_button(exceptionDialog, u'attachFileButton',
|
||||
icon=u':/general/general_open.png', click=self.onAttachFileButtonClicked)
|
||||
self.buttonBox = create_button_box(exceptionDialog, u'buttonBox',
|
||||
[u'close'], [self.sendReportButton, self.saveReportButton,
|
||||
self.attachFileButton])
|
||||
[u'close'], [self.sendReportButton, self.saveReportButton, self.attachFileButton])
|
||||
self.exceptionLayout.addWidget(self.buttonBox)
|
||||
|
||||
self.retranslateUi(exceptionDialog)
|
||||
|
@ -84,8 +79,7 @@ class Ui_ExceptionDialog(object):
|
|||
QtCore.SIGNAL(u'textChanged()'), self.onDescriptionUpdated)
|
||||
|
||||
def retranslateUi(self, exceptionDialog):
|
||||
exceptionDialog.setWindowTitle(
|
||||
translate('OpenLP.ExceptionDialog', 'Error Occurred'))
|
||||
exceptionDialog.setWindowTitle(translate('OpenLP.ExceptionDialog', 'Error Occurred'))
|
||||
self.descriptionExplanation.setText(translate('OpenLP.ExceptionDialog',
|
||||
'Please enter a description of what you were doing to cause this '
|
||||
'error \n(Minimum 20 characters)'))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -72,10 +72,8 @@ try:
|
|||
arg.Name = u'nodepath'
|
||||
arg.Value = u'/org.openoffice.Setup/Product'
|
||||
context = uno.getComponentContext()
|
||||
provider = context.ServiceManager.createInstance(
|
||||
u'com.sun.star.configuration.ConfigurationProvider')
|
||||
node = provider.createInstanceWithArguments(
|
||||
u'com.sun.star.configuration.ConfigurationAccess', (arg,))
|
||||
provider = context.ServiceManager.createInstance(u'com.sun.star.configuration.ConfigurationProvider')
|
||||
node = provider.createInstanceWithArguments(u'com.sun.star.configuration.ConfigurationAccess', (arg,))
|
||||
UNO_VERSION = node.getByName(u'ooSetupVersion')
|
||||
except ImportError:
|
||||
UNO_VERSION = u'-'
|
||||
|
@ -112,10 +110,9 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||
|
||||
def _createReport(self):
|
||||
openlp_version = get_application_version()
|
||||
description = unicode(self.descriptionTextEdit.toPlainText())
|
||||
traceback = unicode(self.exceptionTextEdit.toPlainText())
|
||||
system = unicode(translate('OpenLP.ExceptionForm',
|
||||
'Platform: %s\n')) % platform.platform()
|
||||
description = self.descriptionTextEdit.toPlainText()
|
||||
traceback = self.exceptionTextEdit.toPlainText()
|
||||
system = translate('OpenLP.ExceptionForm', 'Platform: %s\n') % platform.platform()
|
||||
libraries = u'Python: %s\n' % platform.python_version() + \
|
||||
u'Qt4: %s\n' % Qt.qVersion() + \
|
||||
u'Phonon: %s\n' % PHONON_VERSION + \
|
||||
|
@ -139,15 +136,15 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||
|
||||
def onSaveReportButtonClicked(self):
|
||||
"""
|
||||
Saving exception log and system informations to a file.
|
||||
Saving exception log and system information to a file.
|
||||
"""
|
||||
report_text = unicode(translate('OpenLP.ExceptionForm',
|
||||
report_text = translate('OpenLP.ExceptionForm',
|
||||
'**OpenLP Bug Report**\n'
|
||||
'Version: %s\n\n'
|
||||
'--- Details of the Exception. ---\n\n%s\n\n '
|
||||
'--- Exception Traceback ---\n%s\n'
|
||||
'--- System information ---\n%s\n'
|
||||
'--- Library Versions ---\n%s\n'))
|
||||
'--- Library Versions ---\n%s\n')
|
||||
filename = QtGui.QFileDialog.getSaveFileName(self,
|
||||
translate('OpenLP.ExceptionForm', 'Save Crash Report'),
|
||||
SettingsManager.get_last_dir(self.settingsSection),
|
||||
|
@ -155,8 +152,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||
'Text files (*.txt *.log *.text)'))
|
||||
if filename:
|
||||
filename = unicode(filename).replace(u'/', os.path.sep)
|
||||
SettingsManager.set_last_dir(self.settingsSection, os.path.dirname(
|
||||
filename))
|
||||
SettingsManager.set_last_dir(self.settingsSection, os.path.dirname(filename))
|
||||
report_text = report_text % self._createReport()
|
||||
try:
|
||||
report_file = open(filename, u'w')
|
||||
|
@ -178,7 +174,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||
Opening systems default email client and inserting exception log and
|
||||
system informations.
|
||||
"""
|
||||
body = unicode(translate('OpenLP.ExceptionForm',
|
||||
body = translate('OpenLP.ExceptionForm',
|
||||
'*OpenLP Bug Report*\n'
|
||||
'Version: %s\n\n'
|
||||
'--- Details of the Exception. ---\n\n%s\n\n '
|
||||
|
@ -186,7 +182,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||
'--- System information ---\n%s\n'
|
||||
'--- Library Versions ---\n%s\n',
|
||||
'Please add the information that bug reports are favoured written '
|
||||
'in English.'))
|
||||
'in English.')
|
||||
content = self._createReport()
|
||||
source = u''
|
||||
exception = u''
|
||||
|
@ -211,15 +207,12 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||
else:
|
||||
self.__buttonState(False)
|
||||
self.descriptionWordCount.setText(
|
||||
unicode(translate('OpenLP.ExceptionDialog',
|
||||
'Description characters to enter : %s')) % count)
|
||||
translate('OpenLP.ExceptionDialog', 'Description characters to enter : %s') % count)
|
||||
|
||||
def onAttachFileButtonClicked(self):
|
||||
files = QtGui.QFileDialog.getOpenFileName(
|
||||
self,translate('ImagePlugin.ExceptionDialog',
|
||||
'Select Attachment'),
|
||||
SettingsManager.get_last_dir(u'exceptions'),
|
||||
u'%s (*.*) (*)' % UiStrings().AllFiles)
|
||||
self, translate('ImagePlugin.ExceptionDialog', 'Select Attachment'),
|
||||
SettingsManager.get_last_dir(u'exceptions'), u'%s (*.*) (*)' % UiStrings().AllFiles)
|
||||
log.info(u'New files(s) %s', unicode(files))
|
||||
if files:
|
||||
self.fileAttachment = unicode(files)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -42,16 +42,13 @@ class Ui_FileRenameDialog(object):
|
|||
self.fileNameLabel.setObjectName(u'fileNameLabel')
|
||||
self.dialogLayout.addWidget(self.fileNameLabel, 0, 0)
|
||||
self.fileNameEdit = QtGui.QLineEdit(fileRenameDialog)
|
||||
self.fileNameEdit.setValidator(QtGui.QRegExpValidator(
|
||||
QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self))
|
||||
self.fileNameEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self))
|
||||
self.fileNameEdit.setObjectName(u'fileNameEdit')
|
||||
self.dialogLayout.addWidget(self.fileNameEdit, 0, 1)
|
||||
self.buttonBox = create_button_box(fileRenameDialog, u'buttonBox',
|
||||
[u'cancel', u'ok'])
|
||||
self.buttonBox = create_button_box(fileRenameDialog, u'buttonBox', [u'cancel', u'ok'])
|
||||
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
|
||||
self.retranslateUi(fileRenameDialog)
|
||||
self.setMaximumHeight(self.sizeHint().height())
|
||||
|
||||
def retranslateUi(self, fileRenameDialog):
|
||||
self.fileNameLabel.setText(translate('OpenLP.FileRenameForm',
|
||||
'New File Name:'))
|
||||
self.fileNameLabel.setText(translate('OpenLP.FileRenameForm', 'New File Name:'))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -46,9 +46,7 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
|
|||
Run the Dialog with correct heading.
|
||||
"""
|
||||
if copy:
|
||||
self.setWindowTitle(translate('OpenLP.FileRenameForm',
|
||||
'File Copy'))
|
||||
self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Copy'))
|
||||
else:
|
||||
self.setWindowTitle(translate('OpenLP.FileRenameForm',
|
||||
'File Rename'))
|
||||
self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Rename'))
|
||||
return QtGui.QDialog.exec_(self)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -39,9 +39,7 @@ from ConfigParser import SafeConfigParser
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, \
|
||||
check_directory_exists
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, check_directory_exists, Settings
|
||||
from openlp.core.utils import get_web_page, AppLocation, get_filesystem_encoding
|
||||
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
|
||||
|
||||
|
@ -66,10 +64,9 @@ class ThemeScreenshotThread(QtCore.QThread):
|
|||
filename = config.get(u'theme_%s' % theme, u'filename')
|
||||
screenshot = config.get(u'theme_%s' % theme, u'screenshot')
|
||||
urllib.urlretrieve(u'%s%s' % (self.parent().web, screenshot),
|
||||
os.path.join(unicode(gettempdir(), get_filesystem_encoding()),
|
||||
u'openlp', screenshot))
|
||||
os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp', screenshot))
|
||||
item = QtGui.QListWidgetItem(title, self.parent().themesListWidget)
|
||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(filename))
|
||||
item.setData(QtCore.Qt.UserRole, filename)
|
||||
item.setCheckState(QtCore.Qt.Unchecked)
|
||||
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
|
||||
|
||||
|
@ -94,16 +91,14 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
self.config.readfp(io.BytesIO(files))
|
||||
self.updateScreenListCombo()
|
||||
self.downloadCancelled = False
|
||||
self.downloading = unicode(translate('OpenLP.FirstTimeWizard',
|
||||
'Downloading %s...'))
|
||||
self.downloading = translate('OpenLP.FirstTimeWizard', 'Downloading %s...')
|
||||
QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
|
||||
self.onCancelButtonClicked)
|
||||
QtCore.QObject.connect(self.noInternetFinishButton,
|
||||
QtCore.SIGNAL('clicked()'), self.onNoInternetFinishButtonClicked)
|
||||
QtCore.QObject.connect(self,
|
||||
QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'config_screen_changed'), self.updateScreenListCombo)
|
||||
QtCore.QObject.connect(self.noInternetFinishButton, QtCore.SIGNAL('clicked()'),
|
||||
self.onNoInternetFinishButtonClicked)
|
||||
QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'),
|
||||
self.updateScreenListCombo)
|
||||
|
||||
def exec_(self):
|
||||
"""
|
||||
|
@ -121,39 +116,30 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
unicode(gettempdir(), get_filesystem_encoding()), u'openlp'))
|
||||
self.noInternetFinishButton.setVisible(False)
|
||||
# Check if this is a re-run of the wizard.
|
||||
self.hasRunWizard = Settings().value(
|
||||
u'general/has run wizard', QtCore.QVariant(False)).toBool()
|
||||
self.hasRunWizard = Settings().value(u'general/has run wizard', False)
|
||||
# Sort out internet access for downloads
|
||||
if self.webAccess:
|
||||
songs = self.config.get(u'songs', u'languages')
|
||||
songs = songs.split(u',')
|
||||
for song in songs:
|
||||
title = unicode(self.config.get(
|
||||
u'songs_%s' % song, u'title'), u'utf8')
|
||||
filename = unicode(self.config.get(
|
||||
u'songs_%s' % song, u'filename'), u'utf8')
|
||||
title = unicode(self.config.get(u'songs_%s' % song, u'title'), u'utf8')
|
||||
filename = unicode(self.config.get(u'songs_%s' % song, u'filename'), u'utf8')
|
||||
item = QtGui.QListWidgetItem(title, self.songsListWidget)
|
||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(filename))
|
||||
item.setData(QtCore.Qt.UserRole, filename)
|
||||
item.setCheckState(QtCore.Qt.Unchecked)
|
||||
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
|
||||
bible_languages = self.config.get(u'bibles', u'languages')
|
||||
bible_languages = bible_languages.split(u',')
|
||||
for lang in bible_languages:
|
||||
language = unicode(self.config.get(
|
||||
u'bibles_%s' % lang, u'title'), u'utf8')
|
||||
langItem = QtGui.QTreeWidgetItem(
|
||||
self.biblesTreeWidget, QtCore.QStringList(language))
|
||||
language = unicode(self.config.get(u'bibles_%s' % lang, u'title'), u'utf8')
|
||||
langItem = QtGui.QTreeWidgetItem(self.biblesTreeWidget, [language])
|
||||
bibles = self.config.get(u'bibles_%s' % lang, u'translations')
|
||||
bibles = bibles.split(u',')
|
||||
for bible in bibles:
|
||||
title = unicode(self.config.get(
|
||||
u'bible_%s' % bible, u'title'), u'utf8')
|
||||
filename = unicode(self.config.get(
|
||||
u'bible_%s' % bible, u'filename'))
|
||||
item = QtGui.QTreeWidgetItem(
|
||||
langItem, QtCore.QStringList(title))
|
||||
item.setData(0, QtCore.Qt.UserRole,
|
||||
QtCore.QVariant(filename))
|
||||
title = unicode(self.config.get(u'bible_%s' % bible, u'title'), u'utf8')
|
||||
filename = unicode(self.config.get(u'bible_%s' % bible, u'filename'))
|
||||
item = QtGui.QTreeWidgetItem(langItem, [title])
|
||||
item.setData(0, QtCore.Qt.UserRole, filename)
|
||||
item.setCheckState(0, QtCore.Qt.Unchecked)
|
||||
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
|
||||
self.biblesTreeWidget.expandAll()
|
||||
|
@ -203,8 +189,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
if self.hasRunWizard:
|
||||
self.noInternetLabel.setText(self.noInternetText)
|
||||
else:
|
||||
self.noInternetLabel.setText(self.noInternetText +
|
||||
self.cancelWizardText)
|
||||
self.noInternetLabel.setText(self.noInternetText + self.cancelWizardText)
|
||||
elif pageId == FirstTimePage.Defaults:
|
||||
self.themeComboBox.clear()
|
||||
for iter in xrange(self.themesListWidget.count()):
|
||||
|
@ -217,9 +202,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
index = self.themeComboBox.findText(theme)
|
||||
if index == -1:
|
||||
self.themeComboBox.addItem(theme)
|
||||
default_theme = unicode(Settings().value(
|
||||
u'themes/global theme',
|
||||
QtCore.QVariant(u'')).toString())
|
||||
default_theme = Settings().value(u'themes/global theme', u'')
|
||||
# Pre-select the current default theme.
|
||||
index = self.themeComboBox.findText(default_theme)
|
||||
self.themeComboBox.setCurrentIndex(index)
|
||||
|
@ -255,7 +238,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
Process the triggering of the cancel button.
|
||||
"""
|
||||
if self.lastId == FirstTimePage.NoInternet or \
|
||||
(self.lastId <= FirstTimePage.Plugins and not self.hasRunWizard):
|
||||
(self.lastId <= FirstTimePage.Plugins and not self.hasRunWizard):
|
||||
QtCore.QCoreApplication.exit()
|
||||
sys.exit()
|
||||
self.downloadCancelled = True
|
||||
|
@ -271,7 +254,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
self._performWizard()
|
||||
Receiver.send_message(u'cursor_normal')
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
Settings().setValue(u'general/has run wizard', QtCore.QVariant(True))
|
||||
Settings().setValue(u'general/has run wizard', True)
|
||||
self.close()
|
||||
|
||||
def urlGetFile(self, url, fpath):
|
||||
|
@ -308,10 +291,10 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
screenshot = self.config.get(u'theme_%s' % theme, u'screenshot')
|
||||
for index in xrange(self.themesListWidget.count()):
|
||||
item = self.themesListWidget.item(index)
|
||||
if item.data(QtCore.Qt.UserRole) == QtCore.QVariant(filename):
|
||||
if item.data(QtCore.Qt.UserRole) == filename:
|
||||
break
|
||||
item.setIcon(build_icon(os.path.join(unicode(gettempdir(),
|
||||
get_filesystem_encoding()), u'openlp', screenshot)))
|
||||
item.setIcon(build_icon(os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp',
|
||||
screenshot)))
|
||||
|
||||
def _getFileSize(self, url):
|
||||
site = urllib.urlopen(url)
|
||||
|
@ -351,7 +334,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
Receiver.send_message(u'openlp_process_events')
|
||||
item = self.songsListWidget.item(i)
|
||||
if item.checkState() == QtCore.Qt.Checked:
|
||||
filename = item.data(QtCore.Qt.UserRole).toString()
|
||||
filename = item.data(QtCore.Qt.UserRole)
|
||||
size = self._getFileSize(u'%s%s' % (self.web, filename))
|
||||
self.max_progress += size
|
||||
# Loop through the Bibles list and increase for each selected item
|
||||
|
@ -360,7 +343,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
Receiver.send_message(u'openlp_process_events')
|
||||
item = iterator.value()
|
||||
if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
|
||||
filename = item.data(0, QtCore.Qt.UserRole).toString()
|
||||
filename = item.data(0, QtCore.Qt.UserRole)
|
||||
size = self._getFileSize(u'%s%s' % (self.web, filename))
|
||||
self.max_progress += size
|
||||
iterator += 1
|
||||
|
@ -369,7 +352,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
Receiver.send_message(u'openlp_process_events')
|
||||
item = self.themesListWidget.item(i)
|
||||
if item.checkState() == QtCore.Qt.Checked:
|
||||
filename = item.data(QtCore.Qt.UserRole).toString()
|
||||
filename = item.data(QtCore.Qt.UserRole)
|
||||
size = self._getFileSize(u'%s%s' % (self.web, filename))
|
||||
self.max_progress += size
|
||||
if self.max_progress:
|
||||
|
@ -378,15 +361,12 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
self.progressBar.setValue(0)
|
||||
self.progressBar.setMinimum(0)
|
||||
self.progressBar.setMaximum(self.max_progress)
|
||||
self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Setting Up And Downloading'))
|
||||
self.progressPage.setSubTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Please wait while OpenLP is set up '
|
||||
'and your data is downloaded.'))
|
||||
self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Setting Up And Downloading'))
|
||||
self.progressPage.setSubTitle(
|
||||
translate('OpenLP.FirstTimeWizard', 'Please wait while OpenLP is set up and your data is downloaded.'))
|
||||
else:
|
||||
self.progressBar.setVisible(False)
|
||||
self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Setting Up'))
|
||||
self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Setting Up'))
|
||||
self.progressPage.setSubTitle(u'Setup complete.')
|
||||
self.repaint()
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
|
@ -401,12 +381,10 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
self.progressBar.setValue(self.progressBar.maximum())
|
||||
if self.hasRunWizard:
|
||||
self.progressLabel.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Download complete.'
|
||||
' Click the finish button to return to OpenLP.'))
|
||||
'Download complete. Click the finish button to return to OpenLP.'))
|
||||
else:
|
||||
self.progressLabel.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Download complete.'
|
||||
' Click the finish button to start OpenLP.'))
|
||||
'Download complete. Click the finish button to start OpenLP.'))
|
||||
else:
|
||||
if self.hasRunWizard:
|
||||
self.progressLabel.setText(translate('OpenLP.FirstTimeWizard',
|
||||
|
@ -425,15 +403,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
Run the tasks in the wizard.
|
||||
"""
|
||||
# Set plugin states
|
||||
self._incrementProgressBar(translate('OpenLP.FirstTimeWizard',
|
||||
'Enabling selected plugins...'))
|
||||
self._incrementProgressBar(translate('OpenLP.FirstTimeWizard', 'Enabling selected plugins...'))
|
||||
self._setPluginStatus(self.songsCheckBox, u'songs/status')
|
||||
self._setPluginStatus(self.bibleCheckBox, u'bibles/status')
|
||||
# TODO Presentation plugin is not yet working on Mac OS X.
|
||||
# For now just ignore it.
|
||||
if sys.platform != 'darwin':
|
||||
self._setPluginStatus(self.presentationCheckBox,
|
||||
u'presentations/status')
|
||||
self._setPluginStatus(self.presentationCheckBox, u'presentations/status')
|
||||
self._setPluginStatus(self.imageCheckBox, u'images/status')
|
||||
self._setPluginStatus(self.mediaCheckBox, u'media/status')
|
||||
self._setPluginStatus(self.remoteCheckBox, u'remotes/status')
|
||||
|
@ -450,11 +426,10 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
for i in xrange(self.songsListWidget.count()):
|
||||
item = self.songsListWidget.item(i)
|
||||
if item.checkState() == QtCore.Qt.Checked:
|
||||
filename = item.data(QtCore.Qt.UserRole).toString()
|
||||
filename = item.data(QtCore.Qt.UserRole)
|
||||
self._incrementProgressBar(self.downloading % filename, 0)
|
||||
self.previous_size = 0
|
||||
destination = os.path.join(songs_destination,
|
||||
unicode(filename))
|
||||
destination = os.path.join(songs_destination, unicode(filename))
|
||||
self.urlGetFile(u'%s%s' % (self.web, filename), destination)
|
||||
# Download Bibles
|
||||
bibles_iterator = QtGui.QTreeWidgetItemIterator(
|
||||
|
@ -462,33 +437,27 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
while bibles_iterator.value():
|
||||
item = bibles_iterator.value()
|
||||
if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
|
||||
bible = unicode(item.data(0, QtCore.Qt.UserRole).toString())
|
||||
bible = item.data(0, QtCore.Qt.UserRole)
|
||||
self._incrementProgressBar(self.downloading % bible, 0)
|
||||
self.previous_size = 0
|
||||
self.urlGetFile(u'%s%s' % (self.web, bible),
|
||||
os.path.join(bibles_destination, bible))
|
||||
self.urlGetFile(u'%s%s' % (self.web, bible), os.path.join(bibles_destination, bible))
|
||||
bibles_iterator += 1
|
||||
# Download themes
|
||||
for i in xrange(self.themesListWidget.count()):
|
||||
item = self.themesListWidget.item(i)
|
||||
if item.checkState() == QtCore.Qt.Checked:
|
||||
theme = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
theme = item.data(QtCore.Qt.UserRole)
|
||||
self._incrementProgressBar(self.downloading % theme, 0)
|
||||
self.previous_size = 0
|
||||
self.urlGetFile(u'%s%s' % (self.web, theme),
|
||||
os.path.join(themes_destination, theme))
|
||||
self.urlGetFile(u'%s%s' % (self.web, theme), os.path.join(themes_destination, theme))
|
||||
# Set Default Display
|
||||
if self.displayComboBox.currentIndex() != -1:
|
||||
Settings().setValue(u'General/monitor',
|
||||
QtCore.QVariant(self.displayComboBox.currentIndex()))
|
||||
self.screens.set_current_display(
|
||||
self.displayComboBox.currentIndex())
|
||||
Settings().setValue(u'General/monitor', self.displayComboBox.currentIndex())
|
||||
self.screens.set_current_display(self.displayComboBox.currentIndex())
|
||||
# Set Global Theme
|
||||
if self.themeComboBox.currentIndex() != -1:
|
||||
Settings().setValue(u'themes/global theme',
|
||||
QtCore.QVariant(self.themeComboBox.currentText()))
|
||||
Settings().setValue(u'themes/global theme', self.themeComboBox.currentText())
|
||||
|
||||
def _setPluginStatus(self, field, tag):
|
||||
status = PluginStatus.Active if field.checkState() \
|
||||
== QtCore.Qt.Checked else PluginStatus.Inactive
|
||||
Settings().setValue(tag, QtCore.QVariant(status))
|
||||
status = PluginStatus.Active if field.checkState() == QtCore.Qt.Checked else PluginStatus.Inactive
|
||||
Settings().setValue(tag, status)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -49,22 +49,17 @@ class Ui_FirstTimeLanguageDialog(object):
|
|||
self.languageLabel.setObjectName(u'languageLabel')
|
||||
self.languageLayout.addWidget(self.languageLabel)
|
||||
self.languageComboBox = QtGui.QComboBox(languageDialog)
|
||||
self.languageComboBox.setSizeAdjustPolicy(
|
||||
QtGui.QComboBox.AdjustToContents)
|
||||
self.languageComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
|
||||
self.languageComboBox.setObjectName("languageComboBox")
|
||||
self.languageLayout.addWidget(self.languageComboBox)
|
||||
self.dialogLayout.addLayout(self.languageLayout)
|
||||
self.buttonBox = create_button_box(languageDialog, u'buttonBox',
|
||||
[u'cancel', u'ok'])
|
||||
self.buttonBox = create_button_box(languageDialog, u'buttonBox', [u'cancel', u'ok'])
|
||||
self.dialogLayout.addWidget(self.buttonBox)
|
||||
|
||||
self.retranslateUi(languageDialog)
|
||||
self.setMaximumHeight(self.sizeHint().height())
|
||||
|
||||
def retranslateUi(self, languageDialog):
|
||||
self.setWindowTitle(translate('OpenLP.FirstTimeLanguageForm',
|
||||
'Select Translation'))
|
||||
self.infoLabel.setText(translate('OpenLP.FirstTimeLanguageForm',
|
||||
'Choose the translation you\'d like to use in OpenLP.'))
|
||||
self.languageLabel.setText(translate('OpenLP.FirstTimeLanguageForm',
|
||||
'Translation:'))
|
||||
self.setWindowTitle(translate('OpenLP.FirstTimeLanguageForm', 'Select Translation'))
|
||||
self.infoLabel.setText(
|
||||
translate('OpenLP.FirstTimeLanguageForm', 'Choose the translation you\'d like to use in OpenLP.'))
|
||||
self.languageLabel.setText(translate('OpenLP.FirstTimeLanguageForm', 'Translation:'))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -51,10 +51,8 @@ class Ui_FirstTimeWizard(object):
|
|||
FirstTimeWizard.resize(550, 386)
|
||||
FirstTimeWizard.setModal(True)
|
||||
FirstTimeWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
|
||||
FirstTimeWizard.setOptions(QtGui.QWizard.IndependentPages |
|
||||
QtGui.QWizard.NoBackButtonOnStartPage |
|
||||
QtGui.QWizard.NoBackButtonOnLastPage |
|
||||
QtGui.QWizard.HaveCustomButton1)
|
||||
FirstTimeWizard.setOptions(QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage |
|
||||
QtGui.QWizard.NoBackButtonOnLastPage |QtGui.QWizard.HaveCustomButton1)
|
||||
self.finishButton = self.button(QtGui.QWizard.FinishButton)
|
||||
self.noInternetFinishButton = self.button(QtGui.QWizard.CustomButton1)
|
||||
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
|
||||
|
@ -175,8 +173,7 @@ class Ui_FirstTimeWizard(object):
|
|||
self.themeComboBox = QtGui.QComboBox(self.defaultsPage)
|
||||
self.themeComboBox.setEditable(False)
|
||||
self.themeComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
|
||||
self.themeComboBox.setSizeAdjustPolicy(
|
||||
QtGui.QComboBox.AdjustToContents)
|
||||
self.themeComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
|
||||
self.themeComboBox.setObjectName(u'themeComboBox')
|
||||
self.defaultsLayout.addRow(self.themeLabel, self.themeComboBox)
|
||||
FirstTimeWizard.setPage(FirstTimePage.Defaults, self.defaultsPage)
|
||||
|
@ -198,41 +195,27 @@ class Ui_FirstTimeWizard(object):
|
|||
def retranslateUi(self, FirstTimeWizard):
|
||||
FirstTimeWizard.setWindowTitle(translate(
|
||||
'OpenLP.FirstTimeWizard', 'First Time Wizard'))
|
||||
self.titleLabel.setText(
|
||||
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
|
||||
translate('OpenLP.FirstTimeWizard',
|
||||
'Welcome to the First Time Wizard'))
|
||||
self.titleLabel.setText(u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
|
||||
translate('OpenLP.FirstTimeWizard', 'Welcome to the First Time Wizard'))
|
||||
self.informationLabel.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'This wizard will help you to configure OpenLP for initial use.'
|
||||
' Click the next button below to start.'))
|
||||
self.pluginPage.setTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Activate required Plugins'))
|
||||
self.pluginPage.setSubTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Select the Plugins you wish to use. '))
|
||||
self.pluginPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Activate required Plugins'))
|
||||
self.pluginPage.setSubTitle(translate('OpenLP.FirstTimeWizard','Select the Plugins you wish to use. '))
|
||||
self.songsCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Songs'))
|
||||
self.customCheckBox.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Custom Slides'))
|
||||
self.customCheckBox.setText(translate('OpenLP.FirstTimeWizard','Custom Slides'))
|
||||
self.bibleCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Bible'))
|
||||
self.imageCheckBox.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Images'))
|
||||
self.imageCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Images'))
|
||||
# TODO Presentation plugin is not yet working on Mac OS X.
|
||||
# For now just ignore it.
|
||||
if sys.platform != 'darwin':
|
||||
self.presentationCheckBox.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Presentations'))
|
||||
self.mediaCheckBox.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Media (Audio and Video)'))
|
||||
self.remoteCheckBox.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Allow remote access'))
|
||||
self.songUsageCheckBox.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Monitor Song Usage'))
|
||||
self.alertCheckBox.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Allow Alerts'))
|
||||
self.noInternetPage.setTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'No Internet Connection'))
|
||||
self.noInternetPage.setSubTitle(translate(
|
||||
'OpenLP.FirstTimeWizard',
|
||||
'Unable to detect an Internet connection.'))
|
||||
self.presentationCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Presentations'))
|
||||
self.mediaCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Media (Audio and Video)'))
|
||||
self.remoteCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Allow remote access'))
|
||||
self.songUsageCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Monitor Song Usage'))
|
||||
self.alertCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Allow Alerts'))
|
||||
self.noInternetPage.setTitle(translate('OpenLP.FirstTimeWizard', 'No Internet Connection'))
|
||||
self.noInternetPage.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Unable to detect an Internet connection.'))
|
||||
self.noInternetText = translate('OpenLP.FirstTimeWizard',
|
||||
'No Internet connection was found. The First Time Wizard needs an '
|
||||
'Internet connection in order to be able to download sample '
|
||||
|
@ -244,27 +227,16 @@ class Ui_FirstTimeWizard(object):
|
|||
self.cancelWizardText = translate('OpenLP.FirstTimeWizard',
|
||||
'\n\nTo cancel the First Time Wizard completely (and not start '
|
||||
'OpenLP), click the Cancel button now.')
|
||||
self.songsPage.setTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Sample Songs'))
|
||||
self.songsPage.setSubTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Select and download public domain songs.'))
|
||||
self.biblesPage.setTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Sample Bibles'))
|
||||
self.biblesPage.setSubTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Select and download free Bibles.'))
|
||||
self.themesPage.setTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Sample Themes'))
|
||||
self.themesPage.setSubTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Select and download sample themes.'))
|
||||
self.defaultsPage.setTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Default Settings'))
|
||||
self.songsPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Songs'))
|
||||
self.songsPage.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select and download public domain songs.'))
|
||||
self.biblesPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Bibles'))
|
||||
self.biblesPage.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select and download free Bibles.'))
|
||||
self.themesPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Themes'))
|
||||
self.themesPage.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select and download sample themes.'))
|
||||
self.defaultsPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Default Settings'))
|
||||
self.defaultsPage.setSubTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Set up default settings to be used by OpenLP.'))
|
||||
self.displayLabel.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Default output display:'))
|
||||
self.themeLabel.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Select default theme:'))
|
||||
self.progressLabel.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Starting configuration process...'))
|
||||
FirstTimeWizard.setButtonText(QtGui.QWizard.CustomButton1,
|
||||
translate('OpenLP.FirstTimeWizard', 'Finish'))
|
||||
self.displayLabel.setText(translate('OpenLP.FirstTimeWizard', 'Default output display:'))
|
||||
self.themeLabel.setText(translate('OpenLP.FirstTimeWizard', 'Select default theme:'))
|
||||
self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', 'Starting configuration process...'))
|
||||
FirstTimeWizard.setButtonText(QtGui.QWizard.CustomButton1, translate('OpenLP.FirstTimeWizard', 'Finish'))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -41,15 +41,11 @@ class Ui_FormattingTagDialog(object):
|
|||
self.listdataGridLayout.setMargin(8)
|
||||
self.listdataGridLayout.setObjectName(u'listdataGridLayout')
|
||||
self.tagTableWidget = QtGui.QTableWidget(formattingTagDialog)
|
||||
self.tagTableWidget.setHorizontalScrollBarPolicy(
|
||||
QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.tagTableWidget.setEditTriggers(
|
||||
QtGui.QAbstractItemView.NoEditTriggers)
|
||||
self.tagTableWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.tagTableWidget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
|
||||
self.tagTableWidget.setAlternatingRowColors(True)
|
||||
self.tagTableWidget.setSelectionMode(
|
||||
QtGui.QAbstractItemView.SingleSelection)
|
||||
self.tagTableWidget.setSelectionBehavior(
|
||||
QtGui.QAbstractItemView.SelectRows)
|
||||
self.tagTableWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
|
||||
self.tagTableWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
|
||||
self.tagTableWidget.setCornerButtonEnabled(False)
|
||||
self.tagTableWidget.setObjectName(u'tagTableWidget')
|
||||
self.tagTableWidget.setColumnCount(4)
|
||||
|
@ -66,8 +62,7 @@ class Ui_FormattingTagDialog(object):
|
|||
self.listdataGridLayout.addWidget(self.tagTableWidget, 0, 0, 1, 1)
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(u'horizontalLayout')
|
||||
spacerItem = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem)
|
||||
self.deletePushButton = QtGui.QPushButton(formattingTagDialog)
|
||||
self.deletePushButton.setObjectName(u'deletePushButton')
|
||||
|
@ -114,36 +109,25 @@ class Ui_FormattingTagDialog(object):
|
|||
self.savePushButton.setObjectName(u'savePushButton')
|
||||
self.dataGridLayout.addWidget(self.savePushButton, 4, 2, 1, 1)
|
||||
self.listdataGridLayout.addWidget(self.editGroupBox, 2, 0, 1, 1)
|
||||
self.buttonBox = create_button_box(formattingTagDialog, 'buttonBox',
|
||||
[u'close'])
|
||||
self.buttonBox = create_button_box(formattingTagDialog, u'buttonBox', [u'close'])
|
||||
self.listdataGridLayout.addWidget(self.buttonBox, 3, 0, 1, 1)
|
||||
|
||||
self.retranslateUi(formattingTagDialog)
|
||||
|
||||
def retranslateUi(self, formattingTagDialog):
|
||||
formattingTagDialog.setWindowTitle(translate(
|
||||
'OpenLP.FormattingTagDialog', 'Configure Formatting Tags'))
|
||||
self.editGroupBox.setTitle(
|
||||
translate('OpenLP.FormattingTagDialog', 'Edit Selection'))
|
||||
self.savePushButton.setText(
|
||||
translate('OpenLP.FormattingTagDialog', 'Save'))
|
||||
self.descriptionLabel.setText(
|
||||
translate('OpenLP.FormattingTagDialog', 'Description'))
|
||||
formattingTagDialog.setWindowTitle(translate('OpenLP.FormattingTagDialog', 'Configure Formatting Tags'))
|
||||
self.editGroupBox.setTitle(translate('OpenLP.FormattingTagDialog', 'Edit Selection'))
|
||||
self.savePushButton.setText(translate('OpenLP.FormattingTagDialog', 'Save'))
|
||||
self.descriptionLabel.setText(translate('OpenLP.FormattingTagDialog', 'Description'))
|
||||
self.tagLabel.setText(translate('OpenLP.FormattingTagDialog', 'Tag'))
|
||||
self.startTagLabel.setText(
|
||||
translate('OpenLP.FormattingTagDialog', 'Start HTML'))
|
||||
self.endTagLabel.setText(
|
||||
translate('OpenLP.FormattingTagDialog', 'End HTML'))
|
||||
self.startTagLabel.setText(translate('OpenLP.FormattingTagDialog', 'Start HTML'))
|
||||
self.endTagLabel.setText(translate('OpenLP.FormattingTagDialog', 'End HTML'))
|
||||
self.deletePushButton.setText(UiStrings().Delete)
|
||||
self.newPushButton.setText(UiStrings().New)
|
||||
self.tagTableWidget.horizontalHeaderItem(0).setText(
|
||||
translate('OpenLP.FormattingTagDialog', 'Description'))
|
||||
self.tagTableWidget.horizontalHeaderItem(1).setText(
|
||||
translate('OpenLP.FormattingTagDialog', 'Tag'))
|
||||
self.tagTableWidget.horizontalHeaderItem(2).setText(
|
||||
translate('OpenLP.FormattingTagDialog', 'Start HTML'))
|
||||
self.tagTableWidget.horizontalHeaderItem(3).setText(
|
||||
translate('OpenLP.FormattingTagDialog', 'End HTML'))
|
||||
self.tagTableWidget.horizontalHeaderItem(0).setText(translate('OpenLP.FormattingTagDialog', 'Description'))
|
||||
self.tagTableWidget.horizontalHeaderItem(1).setText(translate('OpenLP.FormattingTagDialog', 'Tag'))
|
||||
self.tagTableWidget.horizontalHeaderItem(2).setText(translate('OpenLP.FormattingTagDialog', 'Start HTML'))
|
||||
self.tagTableWidget.horizontalHeaderItem(3).setText(translate('OpenLP.FormattingTagDialog', 'End HTML'))
|
||||
self.tagTableWidget.setColumnWidth(0, 120)
|
||||
self.tagTableWidget.setColumnWidth(1, 80)
|
||||
self.tagTableWidget.setColumnWidth(2, 330)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -49,24 +49,15 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
|
|||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
QtCore.QObject.connect(self.tagTableWidget,
|
||||
QtCore.SIGNAL(u'itemSelectionChanged()'),self.onRowSelected)
|
||||
QtCore.QObject.connect(self.newPushButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onNewClicked)
|
||||
QtCore.QObject.connect(self.savePushButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onSavedClicked)
|
||||
QtCore.QObject.connect(self.deletePushButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onDeleteClicked)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
|
||||
self.close)
|
||||
QtCore.QObject.connect(self.descriptionLineEdit,
|
||||
QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
||||
QtCore.QObject.connect(self.tagLineEdit,
|
||||
QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
||||
QtCore.QObject.connect(self.startTagLineEdit,
|
||||
QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
||||
QtCore.QObject.connect(self.endTagLineEdit,
|
||||
QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
||||
QtCore.QObject.connect(self.tagTableWidget, QtCore.SIGNAL(u'itemSelectionChanged()'),self.onRowSelected)
|
||||
QtCore.QObject.connect(self.newPushButton, QtCore.SIGNAL(u'clicked()'), self.onNewClicked)
|
||||
QtCore.QObject.connect(self.savePushButton, QtCore.SIGNAL(u'clicked()'), self.onSavedClicked)
|
||||
QtCore.QObject.connect(self.deletePushButton, QtCore.SIGNAL(u'clicked()'), self.onDeleteClicked)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), self.close)
|
||||
QtCore.QObject.connect(self.descriptionLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
||||
QtCore.QObject.connect(self.tagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
||||
QtCore.QObject.connect(self.startTagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
||||
QtCore.QObject.connect(self.endTagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
||||
# Forces reloading of tags from openlp configuration.
|
||||
FormattingTags.load_tags()
|
||||
|
||||
|
@ -118,8 +109,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
|
|||
if self._strip(html[u'start tag']) == u'n':
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.FormattingTagForm', 'Update Error'),
|
||||
translate('OpenLP.FormattingTagForm',
|
||||
'Tag "n" already defined.'))
|
||||
translate('OpenLP.FormattingTagForm', 'Tag "n" already defined.'))
|
||||
return
|
||||
# Add new tag to list
|
||||
tag = {
|
||||
|
@ -160,18 +150,16 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
|
|||
html_expands = FormattingTags.get_html_tags()
|
||||
if self.selected != -1:
|
||||
html = html_expands[self.selected]
|
||||
tag = unicode(self.tagLineEdit.text())
|
||||
tag = self.tagLineEdit.text()
|
||||
for linenumber, html1 in enumerate(html_expands):
|
||||
if self._strip(html1[u'start tag']) == tag and \
|
||||
linenumber != self.selected:
|
||||
if self._strip(html1[u'start tag']) == tag and linenumber != self.selected:
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.FormattingTagForm', 'Update Error'),
|
||||
unicode(translate('OpenLP.FormattingTagForm',
|
||||
'Tag %s already defined.')) % tag)
|
||||
translate('OpenLP.FormattingTagForm', 'Tag %s already defined.') % tag)
|
||||
return
|
||||
html[u'desc'] = unicode(self.descriptionLineEdit.text())
|
||||
html[u'start html'] = unicode(self.startTagLineEdit.text())
|
||||
html[u'end html'] = unicode(self.endTagLineEdit.text())
|
||||
html[u'desc'] = self.descriptionLineEdit.text()
|
||||
html[u'start html'] = self.startTagLineEdit.text()
|
||||
html[u'end html'] = self.endTagLineEdit.text()
|
||||
html[u'start tag'] = u'{%s}' % tag
|
||||
html[u'end tag'] = u'{/%s}' % tag
|
||||
# Keep temporary tags when the user changes one.
|
||||
|
@ -191,14 +179,10 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
|
|||
self.deletePushButton.setEnabled(False)
|
||||
for linenumber, html in enumerate(FormattingTags.get_html_tags()):
|
||||
self.tagTableWidget.setRowCount(self.tagTableWidget.rowCount() + 1)
|
||||
self.tagTableWidget.setItem(linenumber, 0,
|
||||
QtGui.QTableWidgetItem(html[u'desc']))
|
||||
self.tagTableWidget.setItem(linenumber, 1,
|
||||
QtGui.QTableWidgetItem(self._strip(html[u'start tag'])))
|
||||
self.tagTableWidget.setItem(linenumber, 2,
|
||||
QtGui.QTableWidgetItem(html[u'start html']))
|
||||
self.tagTableWidget.setItem(linenumber, 3,
|
||||
QtGui.QTableWidgetItem(html[u'end html']))
|
||||
self.tagTableWidget.setItem(linenumber, 0, QtGui.QTableWidgetItem(html[u'desc']))
|
||||
self.tagTableWidget.setItem(linenumber, 1, QtGui.QTableWidgetItem(self._strip(html[u'start tag'])))
|
||||
self.tagTableWidget.setItem(linenumber, 2, QtGui.QTableWidgetItem(html[u'start html']))
|
||||
self.tagTableWidget.setItem(linenumber, 3, QtGui.QTableWidgetItem(html[u'end html']))
|
||||
# Permanent (persistent) tags do not have this key.
|
||||
if u'temporary' not in html:
|
||||
html[u'temporary'] = False
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -30,9 +30,8 @@ import logging
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, Receiver, translate
|
||||
from openlp.core.lib import Receiver, Settings, SettingsTab, translate
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.ui import ScreenList
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -190,21 +189,15 @@ class GeneralTab(SettingsTab):
|
|||
self.rightLayout.addWidget(self.settingsGroupBox)
|
||||
self.rightLayout.addStretch()
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.overrideRadioButton,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideRadioButtonPressed)
|
||||
QtCore.QObject.connect(self.customHeightValueEdit,
|
||||
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
|
||||
QtCore.QObject.connect(self.customWidthValueEdit,
|
||||
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
|
||||
QtCore.QObject.connect(self.customYValueEdit,
|
||||
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
|
||||
QtCore.QObject.connect(self.customXValueEdit,
|
||||
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
|
||||
QtCore.QObject.connect(self.monitorComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'), self.onDisplayChanged)
|
||||
QtCore.QObject.connect(self.overrideRadioButton, QtCore.SIGNAL(u'toggled(bool)'),
|
||||
self.onOverrideRadioButtonPressed)
|
||||
QtCore.QObject.connect(self.customHeightValueEdit, QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
|
||||
QtCore.QObject.connect(self.customWidthValueEdit, QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
|
||||
QtCore.QObject.connect(self.customYValueEdit, QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
|
||||
QtCore.QObject.connect(self.customXValueEdit, QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
|
||||
QtCore.QObject.connect(self.monitorComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.onDisplayChanged)
|
||||
# Reload the tab, as the screen resolution/count may have changed.
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'config_screen_changed'), self.load)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'), self.load)
|
||||
# Remove for now
|
||||
self.usernameLabel.setVisible(False)
|
||||
self.usernameEdit.setVisible(False)
|
||||
|
@ -216,40 +209,25 @@ class GeneralTab(SettingsTab):
|
|||
Translate the general settings tab to the currently selected language
|
||||
"""
|
||||
self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General')
|
||||
self.monitorGroupBox.setTitle(translate('OpenLP.GeneralTab',
|
||||
'Monitors'))
|
||||
self.monitorRadioButton.setText(translate('OpenLP.GeneralTab',
|
||||
'Select monitor for output display:'))
|
||||
self.displayOnMonitorCheck.setText(
|
||||
translate('OpenLP.GeneralTab', 'Display if a single screen'))
|
||||
self.startupGroupBox.setTitle(
|
||||
translate('OpenLP.GeneralTab', 'Application Startup'))
|
||||
self.warningCheckBox.setText(
|
||||
translate('OpenLP.GeneralTab', 'Show blank screen warning'))
|
||||
self.autoOpenCheckBox.setText(translate('OpenLP.GeneralTab',
|
||||
'Automatically open the last service'))
|
||||
self.showSplashCheckBox.setText(
|
||||
translate('OpenLP.GeneralTab', 'Show the splash screen'))
|
||||
self.checkForUpdatesCheckBox.setText(
|
||||
translate('OpenLP.GeneralTab', 'Check for updates to OpenLP'))
|
||||
self.settingsGroupBox.setTitle(
|
||||
translate('OpenLP.GeneralTab', 'Application Settings'))
|
||||
self.monitorGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Monitors'))
|
||||
self.monitorRadioButton.setText(translate('OpenLP.GeneralTab', 'Select monitor for output display:'))
|
||||
self.displayOnMonitorCheck.setText(translate('OpenLP.GeneralTab', 'Display if a single screen'))
|
||||
self.startupGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Application Startup'))
|
||||
self.warningCheckBox.setText(translate('OpenLP.GeneralTab', 'Show blank screen warning'))
|
||||
self.autoOpenCheckBox.setText(translate('OpenLP.GeneralTab', 'Automatically open the last service'))
|
||||
self.showSplashCheckBox.setText(translate('OpenLP.GeneralTab', 'Show the splash screen'))
|
||||
self.checkForUpdatesCheckBox.setText(translate('OpenLP.GeneralTab', 'Check for updates to OpenLP'))
|
||||
self.settingsGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Application Settings'))
|
||||
self.saveCheckServiceCheckBox.setText(translate('OpenLP.GeneralTab',
|
||||
'Prompt to save before starting a new service'))
|
||||
self.autoUnblankCheckBox.setText(translate('OpenLP.GeneralTab',
|
||||
'Unblank display when adding new live item'))
|
||||
self.autoPreviewCheckBox.setText(translate('OpenLP.GeneralTab',
|
||||
'Automatically preview next item in service'))
|
||||
self.timeoutLabel.setText(translate('OpenLP.GeneralTab',
|
||||
'Timed slide interval:'))
|
||||
self.autoUnblankCheckBox.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item'))
|
||||
self.autoPreviewCheckBox.setText(translate('OpenLP.GeneralTab', 'Automatically preview next item in service'))
|
||||
self.timeoutLabel.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:'))
|
||||
self.timeoutSpinBox.setSuffix(translate('OpenLP.GeneralTab', ' sec'))
|
||||
self.ccliGroupBox.setTitle(
|
||||
translate('OpenLP.GeneralTab', 'CCLI Details'))
|
||||
self.ccliGroupBox.setTitle(translate('OpenLP.GeneralTab', 'CCLI Details'))
|
||||
self.numberLabel.setText(UiStrings().CCLINumberLabel)
|
||||
self.usernameLabel.setText(
|
||||
translate('OpenLP.GeneralTab', 'SongSelect username:'))
|
||||
self.passwordLabel.setText(
|
||||
translate('OpenLP.GeneralTab', 'SongSelect password:'))
|
||||
self.usernameLabel.setText(translate('OpenLP.GeneralTab', 'SongSelect username:'))
|
||||
self.passwordLabel.setText(translate('OpenLP.GeneralTab', 'SongSelect password:'))
|
||||
# Moved from display tab
|
||||
self.overrideRadioButton.setText(translate('OpenLP.GeneralTab',
|
||||
'Override display position:'))
|
||||
|
@ -257,12 +235,9 @@ class GeneralTab(SettingsTab):
|
|||
self.customYLabel.setText(translate('OpenLP.GeneralTab', 'Y'))
|
||||
self.customHeightLabel.setText(translate('OpenLP.GeneralTab', 'Height'))
|
||||
self.customWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width'))
|
||||
self.audioGroupBox.setTitle(
|
||||
translate('OpenLP.GeneralTab', 'Background Audio'))
|
||||
self.startPausedCheckBox.setText(
|
||||
translate('OpenLP.GeneralTab', 'Start background audio paused'))
|
||||
self.repeatListCheckBox.setText(
|
||||
translate('OpenLP.GeneralTab', 'Repeat track list'))
|
||||
self.audioGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Background Audio'))
|
||||
self.startPausedCheckBox.setText(translate('OpenLP.GeneralTab', 'Start background audio paused'))
|
||||
self.repeatListCheckBox.setText(translate('OpenLP.GeneralTab', 'Repeat track list'))
|
||||
|
||||
def load(self):
|
||||
"""
|
||||
|
@ -272,57 +247,34 @@ class GeneralTab(SettingsTab):
|
|||
settings.beginGroup(self.settingsSection)
|
||||
self.monitorComboBox.clear()
|
||||
self.monitorComboBox.addItems(self.screens.get_screen_list())
|
||||
monitorNumber = settings.value(u'monitor',
|
||||
QtCore.QVariant(self.screens.display_count - 1)).toInt()[0]
|
||||
monitorNumber = settings.value(u'monitor', self.screens.display_count - 1)
|
||||
self.monitorComboBox.setCurrentIndex(monitorNumber)
|
||||
self.numberEdit.setText(unicode(settings.value(
|
||||
u'ccli number', QtCore.QVariant(u'')).toString()))
|
||||
self.usernameEdit.setText(unicode(settings.value(
|
||||
u'songselect username', QtCore.QVariant(u'')).toString()))
|
||||
self.passwordEdit.setText(unicode(settings.value(
|
||||
u'songselect password', QtCore.QVariant(u'')).toString()))
|
||||
self.saveCheckServiceCheckBox.setChecked(settings.value(u'save prompt',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.autoUnblankCheckBox.setChecked(settings.value(u'auto unblank',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.numberEdit.setText(settings.value(u'ccli number', u''))
|
||||
self.usernameEdit.setText(settings.value(u'songselect username', u''))
|
||||
self.passwordEdit.setText(settings.value(u'songselect password', u''))
|
||||
self.saveCheckServiceCheckBox.setChecked(settings.value(u'save prompt', False))
|
||||
self.autoUnblankCheckBox.setChecked(settings.value(u'auto unblank', False))
|
||||
self.displayOnMonitorCheck.setChecked(self.screens.display)
|
||||
self.warningCheckBox.setChecked(settings.value(u'blank warning',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.autoOpenCheckBox.setChecked(settings.value(u'auto open',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.showSplashCheckBox.setChecked(settings.value(u'show splash',
|
||||
QtCore.QVariant(True)).toBool())
|
||||
self.checkForUpdatesCheckBox.setChecked(settings.value(u'update check',
|
||||
QtCore.QVariant(True)).toBool())
|
||||
self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.timeoutSpinBox.setValue(settings.value(u'loop delay',
|
||||
QtCore.QVariant(5)).toInt()[0])
|
||||
self.monitorRadioButton.setChecked(
|
||||
not settings.value(u'override position',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.overrideRadioButton.setChecked(settings.value(u'override position',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.customXValueEdit.setValue(settings.value(u'x position',
|
||||
QtCore.QVariant(self.screens.current[u'size'].x())).toInt()[0])
|
||||
self.customYValueEdit.setValue(settings.value(u'y position',
|
||||
QtCore.QVariant(self.screens.current[u'size'].y())).toInt()[0])
|
||||
self.customHeightValueEdit.setValue(settings.value(u'height',
|
||||
QtCore.QVariant(self.screens.current[u'size'].height())).toInt()[0])
|
||||
self.customWidthValueEdit.setValue(settings.value(u'width',
|
||||
QtCore.QVariant(self.screens.current[u'size'].width())).toInt()[0])
|
||||
self.startPausedCheckBox.setChecked(settings.value(
|
||||
u'audio start paused', QtCore.QVariant(True)).toBool())
|
||||
self.repeatListCheckBox.setChecked(settings.value(
|
||||
u'audio repeat list', QtCore.QVariant(False)).toBool())
|
||||
self.warningCheckBox.setChecked(settings.value(u'blank warning', False))
|
||||
self.autoOpenCheckBox.setChecked(settings.value(u'auto open', False))
|
||||
self.showSplashCheckBox.setChecked(settings.value(u'show splash', True))
|
||||
self.checkForUpdatesCheckBox.setChecked(settings.value(u'update check', True))
|
||||
self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview', False))
|
||||
self.timeoutSpinBox.setValue(settings.value(u'loop delay', 5))
|
||||
self.monitorRadioButton.setChecked(not settings.value(u'override position', False))
|
||||
self.overrideRadioButton.setChecked(settings.value(u'override position', False))
|
||||
self.customXValueEdit.setValue(settings.value(u'x position', self.screens.current[u'size'].x()))
|
||||
self.customYValueEdit.setValue(settings.value(u'y position', self.screens.current[u'size'].y()))
|
||||
self.customHeightValueEdit.setValue(settings.value(u'height', self.screens.current[u'size'].height()))
|
||||
self.customWidthValueEdit.setValue(settings.value(u'width', self.screens.current[u'size'].width()))
|
||||
self.startPausedCheckBox.setChecked(settings.value(u'audio start paused', True))
|
||||
self.repeatListCheckBox.setChecked(settings.value(u'audio repeat list', False))
|
||||
settings.endGroup()
|
||||
self.monitorComboBox.setDisabled(self.overrideRadioButton.isChecked())
|
||||
self.customXValueEdit.setEnabled(self.overrideRadioButton.isChecked())
|
||||
self.customYValueEdit.setEnabled(self.overrideRadioButton.isChecked())
|
||||
self.customHeightValueEdit.setEnabled(
|
||||
self.overrideRadioButton.isChecked())
|
||||
self.customWidthValueEdit.setEnabled(
|
||||
self.overrideRadioButton.isChecked())
|
||||
self.customHeightValueEdit.setEnabled(self.overrideRadioButton.isChecked())
|
||||
self.customWidthValueEdit.setEnabled(self.overrideRadioButton.isChecked())
|
||||
self.display_changed = False
|
||||
settings.beginGroup(self.settingsSection)
|
||||
|
||||
|
@ -332,46 +284,26 @@ class GeneralTab(SettingsTab):
|
|||
"""
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
settings.setValue(u'monitor',
|
||||
QtCore.QVariant(self.monitorComboBox.currentIndex()))
|
||||
settings.setValue(u'display on monitor',
|
||||
QtCore.QVariant(self.displayOnMonitorCheck.isChecked()))
|
||||
settings.setValue(u'blank warning',
|
||||
QtCore.QVariant(self.warningCheckBox.isChecked()))
|
||||
settings.setValue(u'auto open',
|
||||
QtCore.QVariant(self.autoOpenCheckBox.isChecked()))
|
||||
settings.setValue(u'show splash',
|
||||
QtCore.QVariant(self.showSplashCheckBox.isChecked()))
|
||||
settings.setValue(u'update check',
|
||||
QtCore.QVariant(self.checkForUpdatesCheckBox.isChecked()))
|
||||
settings.setValue(u'save prompt',
|
||||
QtCore.QVariant(self.saveCheckServiceCheckBox.isChecked()))
|
||||
settings.setValue(u'auto unblank',
|
||||
QtCore.QVariant(self.autoUnblankCheckBox.isChecked()))
|
||||
settings.setValue(u'auto preview',
|
||||
QtCore.QVariant(self.autoPreviewCheckBox.isChecked()))
|
||||
settings.setValue(u'loop delay',
|
||||
QtCore.QVariant(self.timeoutSpinBox.value()))
|
||||
settings.setValue(u'ccli number',
|
||||
QtCore.QVariant(self.numberEdit.displayText()))
|
||||
settings.setValue(u'songselect username',
|
||||
QtCore.QVariant(self.usernameEdit.displayText()))
|
||||
settings.setValue(u'songselect password',
|
||||
QtCore.QVariant(self.passwordEdit.displayText()))
|
||||
settings.setValue(u'x position',
|
||||
QtCore.QVariant(self.customXValueEdit.value()))
|
||||
settings.setValue(u'y position',
|
||||
QtCore.QVariant(self.customYValueEdit.value()))
|
||||
settings.setValue(u'height',
|
||||
QtCore.QVariant(self.customHeightValueEdit.value()))
|
||||
settings.setValue(u'width',
|
||||
QtCore.QVariant(self.customWidthValueEdit.value()))
|
||||
settings.setValue(u'override position',
|
||||
QtCore.QVariant(self.overrideRadioButton.isChecked()))
|
||||
settings.setValue(u'audio start paused',
|
||||
QtCore.QVariant(self.startPausedCheckBox.isChecked()))
|
||||
settings.setValue(u'audio repeat list',
|
||||
QtCore.QVariant(self.repeatListCheckBox.isChecked()))
|
||||
settings.setValue(u'monitor', self.monitorComboBox.currentIndex())
|
||||
settings.setValue(u'display on monitor', self.displayOnMonitorCheck.isChecked())
|
||||
settings.setValue(u'blank warning', self.warningCheckBox.isChecked())
|
||||
settings.setValue(u'auto open', self.autoOpenCheckBox.isChecked())
|
||||
settings.setValue(u'show splash', self.showSplashCheckBox.isChecked())
|
||||
settings.setValue(u'update check', self.checkForUpdatesCheckBox.isChecked())
|
||||
settings.setValue(u'save prompt', self.saveCheckServiceCheckBox.isChecked())
|
||||
settings.setValue(u'auto unblank', self.autoUnblankCheckBox.isChecked())
|
||||
settings.setValue(u'auto preview', self.autoPreviewCheckBox.isChecked())
|
||||
settings.setValue(u'loop delay', self.timeoutSpinBox.value())
|
||||
settings.setValue(u'ccli number', self.numberEdit.displayText())
|
||||
settings.setValue(u'songselect username', self.usernameEdit.displayText())
|
||||
settings.setValue(u'songselect password', self.passwordEdit.displayText())
|
||||
settings.setValue(u'x position', self.customXValueEdit.value())
|
||||
settings.setValue(u'y position', self.customYValueEdit.value())
|
||||
settings.setValue(u'height', self.customHeightValueEdit.value())
|
||||
settings.setValue(u'width', self.customWidthValueEdit.value())
|
||||
settings.setValue(u'override position', self.overrideRadioButton.isChecked())
|
||||
settings.setValue(u'audio start paused', self.startPausedCheckBox.isChecked())
|
||||
settings.setValue(u'audio repeat list', self.repeatListCheckBox.isChecked())
|
||||
settings.endGroup()
|
||||
# On save update the screens as well
|
||||
self.postSetUp(True)
|
||||
|
@ -381,8 +313,7 @@ class GeneralTab(SettingsTab):
|
|||
Apply settings after settings tab has loaded and most of the
|
||||
system so must be delayed
|
||||
"""
|
||||
Receiver.send_message(u'slidecontroller_live_spin_delay',
|
||||
self.timeoutSpinBox.value())
|
||||
Receiver.send_message(u'slidecontroller_live_spin_delay', self.timeoutSpinBox.value())
|
||||
# Do not continue on start up.
|
||||
if not postUpdate:
|
||||
return
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -38,10 +38,9 @@ import sys
|
|||
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
|
||||
translate, PluginManager, expand_tags, ImageSource
|
||||
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, translate, PluginManager, expand_tags,\
|
||||
Settings, ImageSource
|
||||
from openlp.core.lib.theme import BackgroundType
|
||||
from openlp.core.lib.settings import Settings
|
||||
|
||||
from openlp.core.ui import HideMode, ScreenList, AlertLocation
|
||||
|
||||
|
@ -82,10 +81,8 @@ class Display(QtGui.QGraphicsView):
|
|||
self.setGeometry(self.screen[u'size'])
|
||||
log.debug(u'Setup webView')
|
||||
self.webView = QtWebKit.QWebView(self)
|
||||
self.webView.setGeometry(0, 0,
|
||||
self.screen[u'size'].width(), self.screen[u'size'].height())
|
||||
self.webView.settings().setAttribute(
|
||||
QtWebKit.QWebSettings.PluginsEnabled, True)
|
||||
self.webView.setGeometry(0, 0, self.screen[u'size'].width(), self.screen[u'size'].height())
|
||||
self.webView.settings().setAttribute(QtWebKit.QWebSettings.PluginsEnabled, True)
|
||||
palette = self.webView.palette()
|
||||
palette.setBrush(QtGui.QPalette.Base, QtCore.Qt.transparent)
|
||||
self.webView.page().setPalette(palette)
|
||||
|
@ -93,8 +90,7 @@ class Display(QtGui.QGraphicsView):
|
|||
self.page = self.webView.page()
|
||||
self.frame = self.page.mainFrame()
|
||||
if self.isLive and log.getEffectiveLevel() == logging.DEBUG:
|
||||
self.webView.settings().setAttribute(
|
||||
QtWebKit.QWebSettings.DeveloperExtrasEnabled, True)
|
||||
self.webView.settings().setAttribute(QtWebKit.QWebSettings.DeveloperExtrasEnabled, True)
|
||||
QtCore.QObject.connect(self.webView,
|
||||
QtCore.SIGNAL(u'loadFinished(bool)'), self.isWebLoaded)
|
||||
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
|
@ -143,8 +139,10 @@ class MainDisplay(Display):
|
|||
# Default to False on Gnome.
|
||||
x11_bypass_default = bool(not
|
||||
os.environ.get(u'GNOME_DESKTOP_SESSION_ID'))
|
||||
if Settings().value(u'advanced/x11 bypass wm',
|
||||
QtCore.QVariant(x11_bypass_default)).toBool():
|
||||
# Default to False on XFce
|
||||
if os.environ.get(u'DESKTOP_SESSION') == u'xfce':
|
||||
x11_bypass_default = False
|
||||
if Settings().value(u'advanced/x11 bypass wm', x11_bypass_default):
|
||||
windowFlags |= QtCore.Qt.X11BypassWindowManagerHint
|
||||
# TODO: The following combination of windowFlags works correctly
|
||||
# on Mac OS X. For next OpenLP version we should test it on other
|
||||
|
@ -160,14 +158,10 @@ class MainDisplay(Display):
|
|||
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
||||
self.setTransparency(False)
|
||||
if self.isLive:
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'live_display_hide'), self.hideDisplay)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'live_display_show'), self.showDisplay)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'update_display_css'), self.cssChanged)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'config_updated'), self.configChanged)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_hide'), self.hideDisplay)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_show'), self.showDisplay)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'update_display_css'), self.cssChanged)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configChanged)
|
||||
|
||||
def setTransparency(self, enabled):
|
||||
if enabled:
|
||||
|
@ -210,14 +204,10 @@ class MainDisplay(Display):
|
|||
if self.isLive:
|
||||
# Build the initial frame.
|
||||
background_color = QtGui.QColor()
|
||||
background_color.setNamedColor(Settings().value(
|
||||
u'advanced/default color',
|
||||
QtCore.QVariant(u'#ffffff')).toString())
|
||||
background_color.setNamedColor(Settings().value(u'advanced/default color', u'#ffffff'))
|
||||
if not background_color.isValid():
|
||||
background_color = QtCore.Qt.white
|
||||
image_file = Settings().value(u'advanced/default image',
|
||||
QtCore.QVariant(u':/graphics/openlp-splash-screen.png'))\
|
||||
.toString()
|
||||
image_file = Settings().value(u'advanced/default image', u':/graphics/openlp-splash-screen.png')
|
||||
splash_image = QtGui.QImage(image_file)
|
||||
self.initialFrame = QtGui.QImage(
|
||||
self.screen[u'size'].width(),
|
||||
|
@ -253,8 +243,7 @@ class MainDisplay(Display):
|
|||
Receiver.send_message(u'openlp_process_events')
|
||||
self.setGeometry(self.screen[u'size'])
|
||||
if animate:
|
||||
self.frame.evaluateJavaScript(u'show_text("%s")' %
|
||||
slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
||||
self.frame.evaluateJavaScript(u'show_text("%s")' % slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
||||
else:
|
||||
# This exists for https://bugs.launchpad.net/openlp/+bug/1016843
|
||||
# For unknown reasons if evaluateJavaScript is called
|
||||
|
@ -275,10 +264,8 @@ class MainDisplay(Display):
|
|||
log.debug(u'alert to display')
|
||||
# First we convert <>& marks to html variants, then apply
|
||||
# formattingtags, finally we double all backslashes for JavaScript.
|
||||
text_prepared = expand_tags(
|
||||
cgi.escape(text)).replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')
|
||||
if self.height() != self.screen[u'size'].height() or not \
|
||||
self.isVisible():
|
||||
text_prepared = expand_tags(cgi.escape(text)).replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')
|
||||
if self.height() != self.screen[u'size'].height() or not self.isVisible():
|
||||
shrink = True
|
||||
js = u'show_alert("%s", "%s")' % (text_prepared, u'top')
|
||||
else:
|
||||
|
@ -287,15 +274,13 @@ class MainDisplay(Display):
|
|||
height = self.frame.evaluateJavaScript(js)
|
||||
if shrink:
|
||||
if text:
|
||||
alert_height = int(height.toString())
|
||||
alert_height = int(height)
|
||||
self.resize(self.width(), alert_height)
|
||||
self.setVisible(True)
|
||||
if location == AlertLocation.Middle:
|
||||
self.move(self.screen[u'size'].left(),
|
||||
(self.screen[u'size'].height() - alert_height) / 2)
|
||||
self.move(self.screen[u'size'].left(), (self.screen[u'size'].height() - alert_height) / 2)
|
||||
elif location == AlertLocation.Bottom:
|
||||
self.move(self.screen[u'size'].left(),
|
||||
self.screen[u'size'].height() - alert_height)
|
||||
self.move(self.screen[u'size'].left(), self.screen[u'size'].height() - alert_height)
|
||||
else:
|
||||
self.setVisible(False)
|
||||
self.setGeometry(self.screen[u'size'])
|
||||
|
@ -364,10 +349,8 @@ class MainDisplay(Display):
|
|||
if self.isLive and hasattr(self, u'serviceItem'):
|
||||
# Wait for the fade to finish before geting the preview.
|
||||
# Important otherwise preview will have incorrect text if at all!
|
||||
if self.serviceItem.themedata and \
|
||||
self.serviceItem.themedata.display_slide_transition:
|
||||
while self.frame.evaluateJavaScript(u'show_text_complete()') \
|
||||
.toString() == u'false':
|
||||
if self.serviceItem.themedata and self.serviceItem.themedata.display_slide_transition:
|
||||
while self.frame.evaluateJavaScript(u'show_text_complete()') == u'false':
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
# Wait for the webview to update before getting the preview.
|
||||
# Important otherwise first preview will miss the background !
|
||||
|
@ -381,8 +364,7 @@ class MainDisplay(Display):
|
|||
# Single screen active
|
||||
if self.screens.display_count == 1:
|
||||
# Only make visible if setting enabled.
|
||||
if Settings().value(u'general/display on monitor',
|
||||
QtCore.QVariant(True)).toBool():
|
||||
if Settings().value(u'general/display on monitor', True):
|
||||
self.setVisible(True)
|
||||
else:
|
||||
self.setVisible(True)
|
||||
|
@ -405,27 +387,22 @@ class MainDisplay(Display):
|
|||
Receiver.send_message(u'video_background_replaced')
|
||||
self.override = {}
|
||||
# We have a different theme.
|
||||
elif self.override[u'theme'] != \
|
||||
serviceItem.themedata.background_filename:
|
||||
elif self.override[u'theme'] != serviceItem.themedata.background_filename:
|
||||
Receiver.send_message(u'live_theme_changed')
|
||||
self.override = {}
|
||||
else:
|
||||
# replace the background
|
||||
background = self.imageManager.getImageBytes(
|
||||
self.override[u'image'], ImageSource.ImagePlugin)
|
||||
background = self.imageManager.getImageBytes(self.override[u'image'], ImageSource.ImagePlugin)
|
||||
self.setTransparency(self.serviceItem.themedata.background_type ==
|
||||
BackgroundType.to_string(BackgroundType.Transparent))
|
||||
if self.serviceItem.themedata.background_filename:
|
||||
self.serviceItem.bg_image_bytes = self.imageManager.getImageBytes(
|
||||
self.serviceItem.themedata.background_filename,
|
||||
ImageSource.Theme)
|
||||
self.serviceItem.themedata.background_filename,ImageSource.Theme)
|
||||
if image_path:
|
||||
image_bytes = self.imageManager.getImageBytes(
|
||||
image_path, ImageSource.ImagePlugin)
|
||||
image_bytes = self.imageManager.getImageBytes(image_path, ImageSource.ImagePlugin)
|
||||
else:
|
||||
image_bytes = None
|
||||
html = build_html(self.serviceItem, self.screen, self.isLive,
|
||||
background, image_bytes, self.plugins)
|
||||
html = build_html(self.serviceItem, self.screen, self.isLive, background, image_bytes, self.plugins)
|
||||
log.debug(u'buildHtml - pre setHtml')
|
||||
self.webView.setHtml(html)
|
||||
log.debug(u'buildHtml - post setHtml')
|
||||
|
@ -433,8 +410,7 @@ class MainDisplay(Display):
|
|||
self.footer(serviceItem.foot_text)
|
||||
# if was hidden keep it hidden
|
||||
if self.hideMode and self.isLive and not serviceItem.is_media():
|
||||
if Settings().value(u'general/auto unblank',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
if Settings().value(u'general/auto unblank', False):
|
||||
Receiver.send_message(u'slidecontroller_live_unblank')
|
||||
else:
|
||||
self.hideDisplay(self.hideMode)
|
||||
|
@ -445,8 +421,7 @@ class MainDisplay(Display):
|
|||
Display the Footer
|
||||
"""
|
||||
log.debug(u'footer')
|
||||
js = u'show_footer(\'' + \
|
||||
text.replace(u'\\', u'\\\\').replace(u'\'', u'\\\'') + u'\')'
|
||||
js = u'show_footer(\'' + text.replace(u'\\', u'\\\\').replace(u'\'', u'\\\'') + u'\')'
|
||||
self.frame.evaluateJavaScript(js)
|
||||
|
||||
def hideDisplay(self, mode=HideMode.Screen):
|
||||
|
@ -457,8 +432,7 @@ class MainDisplay(Display):
|
|||
log.debug(u'hideDisplay mode = %d', mode)
|
||||
if self.screens.display_count == 1:
|
||||
# Only make visible if setting enabled.
|
||||
if not Settings().value(u'general/display on monitor',
|
||||
QtCore.QVariant(True)).toBool():
|
||||
if not Settings().value(u'general/display on monitor', True):
|
||||
return
|
||||
if mode == HideMode.Screen:
|
||||
self.frame.evaluateJavaScript(u'show_blank("desktop");')
|
||||
|
@ -482,8 +456,7 @@ class MainDisplay(Display):
|
|||
log.debug(u'showDisplay')
|
||||
if self.screens.display_count == 1:
|
||||
# Only make visible if setting enabled.
|
||||
if not Settings().value(u'general/display on monitor',
|
||||
QtCore.QVariant(True)).toBool():
|
||||
if not Settings().value(u'general/display on monitor', True):
|
||||
return
|
||||
self.frame.evaluateJavaScript('show_blank("show");')
|
||||
if self.isHidden():
|
||||
|
@ -497,8 +470,7 @@ class MainDisplay(Display):
|
|||
"""
|
||||
Hide mouse cursor when moved over display.
|
||||
"""
|
||||
if Settings().value(u'advanced/hide mouse',
|
||||
QtCore.QVariant(True)).toBool():
|
||||
if Settings().value(u'advanced/hide mouse', True):
|
||||
self.setCursor(QtCore.Qt.BlankCursor)
|
||||
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
|
||||
else:
|
||||
|
@ -529,10 +501,8 @@ class AudioPlayer(QtCore.QObject):
|
|||
self.mediaObject.setTickInterval(100)
|
||||
self.audioObject = Phonon.AudioOutput(Phonon.VideoCategory)
|
||||
Phonon.createPath(self.mediaObject, self.audioObject)
|
||||
QtCore.QObject.connect(self.mediaObject,
|
||||
QtCore.SIGNAL(u'aboutToFinish()'), self.onAboutToFinish)
|
||||
QtCore.QObject.connect(self.mediaObject,
|
||||
QtCore.SIGNAL(u'finished()'), self.onFinished)
|
||||
QtCore.QObject.connect(self.mediaObject, QtCore.SIGNAL(u'aboutToFinish()'), self.onAboutToFinish)
|
||||
QtCore.QObject.connect(self.mediaObject, QtCore.SIGNAL(u'finished()'), self.onFinished)
|
||||
|
||||
def __del__(self):
|
||||
"""
|
||||
|
@ -627,5 +597,6 @@ class AudioPlayer(QtCore.QObject):
|
|||
if isPlaying:
|
||||
self.mediaObject.play()
|
||||
|
||||
#@todo is this used?
|
||||
def connectSlot(self, signal, slot):
|
||||
QtCore.QObject.connect(self.mediaObject, signal, slot)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -28,7 +28,7 @@
|
|||
###############################################################################
|
||||
import logging
|
||||
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import Settings
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
|
@ -76,13 +76,10 @@ def get_media_players():
|
|||
from the settings.
|
||||
"""
|
||||
log.debug(u'get_media_players')
|
||||
saved_players = unicode(Settings().value(u'media/players').toString())
|
||||
if not saved_players:
|
||||
# we must always have a player and Webkit is the core one.
|
||||
saved_players = u'webkit'
|
||||
saved_players = Settings().value(u'media/players', u'webkit')
|
||||
reg_ex = QtCore.QRegExp(".*\[(.*)\].*")
|
||||
if Settings().value(u'media/override player',
|
||||
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == QtCore.Qt.Checked:
|
||||
QtCore.Qt.Unchecked)== QtCore.Qt.Checked:
|
||||
if reg_ex.exactMatch(saved_players):
|
||||
overridden_player = u'%s' % reg_ex.cap(1)
|
||||
else:
|
||||
|
@ -106,10 +103,10 @@ def set_media_players(players_list, overridden_player=u'auto'):
|
|||
"""
|
||||
log.debug(u'set_media_players')
|
||||
players = u','.join(players_list)
|
||||
if Settings().value(u'media/override player', QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == \
|
||||
QtCore.Qt.Checked and overridden_player != u'auto':
|
||||
if Settings().value(u'media/override player', QtCore.Qt.Unchecked) == QtCore.Qt.Checked and \
|
||||
overridden_player != u'auto':
|
||||
players = players.replace(overridden_player, u'[%s]' % overridden_player)
|
||||
Settings().setValue(u'media/players', QtCore.QVariant(players))
|
||||
Settings().setValue(u'media/players', players)
|
||||
|
||||
from mediacontroller import MediaController
|
||||
from playertab import PlayerTab
|
||||
|
|
|
@ -32,8 +32,7 @@ import os
|
|||
import sys
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, Receiver, translate
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import OpenLPToolbar, Receiver, translate, Settings
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||
from openlp.core.ui.media import MediaState, MediaInfo, MediaType, \
|
||||
get_media_players, set_media_players
|
||||
|
@ -369,7 +368,7 @@ class MediaController(object):
|
|||
if not isValid:
|
||||
# Media could not be loaded correctly
|
||||
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
||||
unicode(translate('MediaPlugin.MediaItem', 'Unsupported File')))
|
||||
translate('MediaPlugin.MediaItem', 'Unsupported File'))
|
||||
return False
|
||||
# dont care about actual theme, set a black background
|
||||
if controller.isLive and not controller.media_info.is_background:
|
||||
|
@ -383,12 +382,12 @@ class MediaController(object):
|
|||
elif not hidden or controller.media_info.is_background or serviceItem.will_auto_start:
|
||||
autoplay = True
|
||||
# Unblank on load set
|
||||
elif Settings().value(u'general/auto unblank', QtCore.QVariant(False)).toBool():
|
||||
elif Settings().value(u'general/auto unblank', False):
|
||||
autoplay = True
|
||||
if autoplay:
|
||||
if not self.media_play(controller):
|
||||
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
||||
unicode(translate('MediaPlugin.MediaItem', 'Unsupported File')))
|
||||
translate('MediaPlugin.MediaItem', 'Unsupported File'))
|
||||
return False
|
||||
self.set_controls_visible(controller, True)
|
||||
log.debug(u'use %s controller' % self.currentMediaPlayer[controller.controllerType])
|
||||
|
@ -412,11 +411,11 @@ class MediaController(object):
|
|||
if not self._check_file_type(controller, display, serviceItem):
|
||||
# Media could not be loaded correctly
|
||||
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
||||
unicode(translate('MediaPlugin.MediaItem', 'Unsupported File')))
|
||||
translate('MediaPlugin.MediaItem', 'Unsupported File'))
|
||||
return False
|
||||
if not self.media_play(controller):
|
||||
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
||||
unicode(translate('MediaPlugin.MediaItem', 'Unsupported File')))
|
||||
translate('MediaPlugin.MediaItem', 'Unsupported File'))
|
||||
return False
|
||||
serviceItem.set_media_length(controller.media_info.length)
|
||||
self.media_stop(controller)
|
||||
|
@ -437,7 +436,7 @@ class MediaController(object):
|
|||
if serviceItem.title != UiStrings().Automatic:
|
||||
usedPlayers = [serviceItem.title.lower()]
|
||||
if controller.media_info.file_info.isFile():
|
||||
suffix = u'*.%s' % controller.media_info.file_info.suffix().toLower()
|
||||
suffix = u'*.%s' % controller.media_info.file_info.suffix().lower()
|
||||
for title in usedPlayers:
|
||||
player = self.mediaPlayers[title]
|
||||
if suffix in player.video_extensions_list:
|
||||
|
|
|
@ -34,8 +34,7 @@ from datetime import datetime
|
|||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import Receiver, translate
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import Receiver, translate, Settings
|
||||
|
||||
from openlp.core.ui.media import MediaState
|
||||
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||
|
@ -223,8 +222,7 @@ class PhononPlayer(MediaPlayer):
|
|||
"""
|
||||
Add css style sheets to htmlbuilder
|
||||
"""
|
||||
background = unicode(QtGui.QColor(Settings().value(u'players/background color',
|
||||
QtCore.QVariant(u'#000000'))).name())
|
||||
background = QtGui.QColor(Settings().value(u'players/background color', u'#000000')).name()
|
||||
return VIDEO_CSS % (background,background,background)
|
||||
|
||||
def get_info(self):
|
||||
|
@ -233,4 +231,4 @@ class PhononPlayer(MediaPlayer):
|
|||
u'<br/> <strong>' + translate('Media.player', 'Audio') +
|
||||
u'</strong><br/>' + unicode(self.audio_extensions_list) +
|
||||
u'<br/><strong>' + translate('Media.player', 'Video') +
|
||||
u'</strong><br/>' + unicode(self.video_extensions_list) + u'<br/>')
|
||||
u'</strong><br/>' + unicode(self.video_extensions_list) + u'<br/>')
|
||||
|
|
|
@ -29,9 +29,8 @@
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver, Settings
|
||||
from openlp.core.lib.ui import UiStrings, create_button
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.ui.media import get_media_players, set_media_players
|
||||
|
||||
class MediaQCheckBox(QtGui.QCheckBox):
|
||||
|
@ -88,8 +87,7 @@ class PlayerTab(SettingsTab):
|
|||
self.playerOrderGroupBox.setObjectName(u'playerOrderGroupBox')
|
||||
self.playerOrderLayout = QtGui.QHBoxLayout(self.playerOrderGroupBox)
|
||||
self.playerOrderLayout.setObjectName(u'playerOrderLayout')
|
||||
self.playerOrderlistWidget = QtGui.QListWidget(
|
||||
self.playerOrderGroupBox)
|
||||
self.playerOrderlistWidget = QtGui.QListWidget(self.playerOrderGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
|
@ -179,7 +177,7 @@ class PlayerTab(SettingsTab):
|
|||
settings = Settings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
self.updatePlayerList()
|
||||
self.bg_color = unicode(settings.value(u'background color', QtCore.QVariant(u'#000000')).toString())
|
||||
self.bg_color = settings.value(u'background color', u'#000000')
|
||||
self.initial_color = self.bg_color
|
||||
settings.endGroup()
|
||||
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)
|
||||
|
@ -188,7 +186,7 @@ class PlayerTab(SettingsTab):
|
|||
player_string_changed = False
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
|
||||
settings.setValue(u'background color', self.bg_color)
|
||||
settings.endGroup()
|
||||
old_players, override_player = get_media_players()
|
||||
if self.usedPlayers != old_players:
|
||||
|
@ -233,4 +231,4 @@ class PlayerTab(SettingsTab):
|
|||
if player.available:
|
||||
checkbox.setText(player.display_name)
|
||||
else:
|
||||
checkbox.setText(unicode(translate('OpenLP.PlayerTab', '%s (unavailable)')) % player.display_name)
|
||||
checkbox.setText(translate('OpenLP.PlayerTab', '%s (unavailable)') % player.display_name)
|
||||
|
|
|
@ -35,8 +35,7 @@ import sys
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver, translate
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import Receiver, translate, Settings
|
||||
from openlp.core.ui.media import MediaState
|
||||
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||
|
||||
|
@ -114,7 +113,7 @@ class VlcPlayer(MediaPlayer):
|
|||
command_line_options = u'--no-video-title-show'
|
||||
if not display.hasAudio:
|
||||
command_line_options += u' --no-audio --no-video-title-show'
|
||||
if Settings().value(u'advanced/hide mouse', QtCore.QVariant(True)).toBool() and display.controller.isLive:
|
||||
if Settings().value(u'advanced/hide mouse', True) and display.controller.isLive:
|
||||
command_line_options += u' --mouse-hide-timeout=0'
|
||||
display.vlcInstance = vlc.Instance(command_line_options)
|
||||
display.vlcInstance.set_log_verbosity(2)
|
||||
|
@ -147,7 +146,7 @@ class VlcPlayer(MediaPlayer):
|
|||
log.debug(u'load vid in Vlc Controller')
|
||||
controller = display.controller
|
||||
volume = controller.media_info.volume
|
||||
file_path = str(controller.media_info.file_info.absoluteFilePath().toUtf8())
|
||||
file_path = str(controller.media_info.file_info.absoluteFilePath())
|
||||
path = os.path.normcase(file_path)
|
||||
# create the media
|
||||
display.vlcMedia = display.vlcInstance.media_new_path(path)
|
||||
|
@ -159,7 +158,7 @@ class VlcPlayer(MediaPlayer):
|
|||
# We need to set media_info.length during load because we want
|
||||
# to avoid start and stop the video twice. Once for real playback
|
||||
# and once to just get media length.
|
||||
#
|
||||
#
|
||||
# Media plugin depends on knowing media length before playback.
|
||||
controller.media_info.length = int(display.vlcMediaPlayer.get_media().get_duration() / 1000)
|
||||
return True
|
||||
|
@ -243,4 +242,4 @@ class VlcPlayer(MediaPlayer):
|
|||
u'<br/> <strong>' + translate('Media.player', 'Audio') +
|
||||
u'</strong><br/>' + unicode(AUDIO_EXT) + u'<br/><strong>' +
|
||||
translate('Media.player', 'Video') + u'</strong><br/>' +
|
||||
unicode(VIDEO_EXT) + u'<br/>')
|
||||
unicode(VIDEO_EXT) + u'<br/>')
|
||||
|
|
|
@ -31,10 +31,9 @@ from PyQt4 import QtCore, QtGui
|
|||
|
||||
import logging
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import translate, Settings
|
||||
from openlp.core.ui.media import MediaState
|
||||
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||
from openlp.core.lib.settings import Settings
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -283,8 +282,7 @@ class WebkitPlayer(MediaPlayer):
|
|||
"""
|
||||
Add css style sheets to htmlbuilder
|
||||
"""
|
||||
background = unicode(QtGui.QColor(Settings().value(u'players/background color',
|
||||
QtCore.QVariant(u'#000000'))).name())
|
||||
background = QtGui.QColor(Settings().value(u'players/background color', u'#000000')).name()
|
||||
css = VIDEO_CSS % (background,background,background)
|
||||
return css + FLASH_CSS
|
||||
|
||||
|
@ -375,19 +373,16 @@ class WebkitPlayer(MediaPlayer):
|
|||
if display.hasAudio:
|
||||
vol = float(vol) / float(100)
|
||||
if not controller.media_info.is_flash:
|
||||
display.frame.evaluateJavaScript(
|
||||
u'show_video(null, null, %s);' % str(vol))
|
||||
display.frame.evaluateJavaScript(u'show_video(null, null, %s);' % str(vol))
|
||||
|
||||
def seek(self, display, seekVal):
|
||||
controller = display.controller
|
||||
if controller.media_info.is_flash:
|
||||
seek = seekVal
|
||||
display.frame.evaluateJavaScript(
|
||||
u'show_flash("seek", null, null, "%s");' % (seek))
|
||||
display.frame.evaluateJavaScript(u'show_flash("seek", null, null, "%s");' % (seek))
|
||||
else:
|
||||
seek = float(seekVal) / 1000
|
||||
display.frame.evaluateJavaScript(
|
||||
u'show_video("seek", null, null, null, "%f");' % (seek))
|
||||
display.frame.evaluateJavaScript(u'show_video("seek", null, null, null, "%f");' % (seek))
|
||||
|
||||
def reset(self, display):
|
||||
controller = display.controller
|
||||
|
@ -411,18 +406,16 @@ class WebkitPlayer(MediaPlayer):
|
|||
def update_ui(self, display):
|
||||
controller = display.controller
|
||||
if controller.media_info.is_flash:
|
||||
currentTime = display.frame.evaluateJavaScript(u'show_flash("currentTime");').toInt()[0]
|
||||
length = display.frame.evaluateJavaScript(u'show_flash("length");').toInt()[0]
|
||||
currentTime = display.frame.evaluateJavaScript(u'show_flash("currentTime");')
|
||||
length = display.frame.evaluateJavaScript(u'show_flash("length");')
|
||||
else:
|
||||
if display.frame.evaluateJavaScript(
|
||||
u'show_video("isEnded");').toString() == 'true':
|
||||
if display.frame.evaluateJavaScript(u'show_video("isEnded");') == 'true':
|
||||
self.stop(display)
|
||||
(currentTime, ok) = display.frame.evaluateJavaScript(
|
||||
u'show_video("currentTime");').toFloat()
|
||||
(currentTime, ok) = display.frame.evaluateJavaScript(u'show_video("currentTime");')
|
||||
# check if conversion was ok and value is not 'NaN'
|
||||
if ok and currentTime != float('inf'):
|
||||
currentTime = int(currentTime * 1000)
|
||||
(length, ok) = display.frame.evaluateJavaScript(u'show_video("length");').toFloat()
|
||||
(length, ok) = display.frame.evaluateJavaScript(u'show_video("length");')
|
||||
# check if conversion was ok and value is not 'NaN'
|
||||
if ok and length != float('inf'):
|
||||
length = int(length * 1000)
|
||||
|
@ -439,4 +432,4 @@ class WebkitPlayer(MediaPlayer):
|
|||
u'<br/> <strong>' + translate('Media.player', 'Audio') +
|
||||
u'</strong><br/>' + unicode(AUDIO_EXT) + u'<br/><strong>' +
|
||||
translate('Media.player', 'Video') + u'</strong><br/>' +
|
||||
unicode(VIDEO_EXT) + u'<br/>')
|
||||
unicode(VIDEO_EXT) + u'<br/>')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -67,8 +67,7 @@ class MediaDockManager(object):
|
|||
log.debug(u'Inserting %s dock' % visible_title[u'title'])
|
||||
match = False
|
||||
for dock_index in range(self.media_dock.count()):
|
||||
if self.media_dock.widget(dock_index).settingsSection == \
|
||||
media_item.plugin.name:
|
||||
if self.media_dock.widget(dock_index).settingsSection == media_item.plugin.name:
|
||||
match = True
|
||||
break
|
||||
if not match:
|
||||
|
@ -85,7 +84,6 @@ class MediaDockManager(object):
|
|||
log.debug(u'remove %s dock' % visible_title[u'title'])
|
||||
for dock_index in range(self.media_dock.count()):
|
||||
if self.media_dock.widget(dock_index):
|
||||
if self.media_dock.widget(dock_index).settingsSection == \
|
||||
media_item.plugin.name:
|
||||
if self.media_dock.widget(dock_index).settingsSection == media_item.plugin.name:
|
||||
self.media_dock.widget(dock_index).setVisible(False)
|
||||
self.media_dock.removeItem(dock_index)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -61,27 +61,20 @@ class Ui_PluginViewDialog(object):
|
|||
self.aboutLabel = QtGui.QLabel(self.pluginInfoGroupBox)
|
||||
self.aboutLabel.setObjectName(u'aboutLabel')
|
||||
self.aboutTextBrowser = QtGui.QTextBrowser(self.pluginInfoGroupBox)
|
||||
self.aboutTextBrowser.setTextInteractionFlags(
|
||||
QtCore.Qt.LinksAccessibleByMouse)
|
||||
self.aboutTextBrowser.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse)
|
||||
self.aboutTextBrowser.setObjectName(u'aboutTextBrowser')
|
||||
self.pluginInfoLayout.addRow(self.aboutLabel, self.aboutTextBrowser)
|
||||
self.listLayout.addWidget(self.pluginInfoGroupBox)
|
||||
self.pluginLayout.addLayout(self.listLayout)
|
||||
self.buttonBox = create_button_box(pluginViewDialog, u'buttonBox',
|
||||
[u'ok'])
|
||||
self.buttonBox = create_button_box(pluginViewDialog, u'buttonBox', [u'ok'])
|
||||
self.pluginLayout.addWidget(self.buttonBox)
|
||||
self.retranslateUi(pluginViewDialog)
|
||||
|
||||
def retranslateUi(self, pluginViewDialog):
|
||||
pluginViewDialog.setWindowTitle(
|
||||
translate('OpenLP.PluginForm', 'Plugin List'))
|
||||
self.pluginInfoGroupBox.setTitle(
|
||||
translate('OpenLP.PluginForm', 'Plugin Details'))
|
||||
pluginViewDialog.setWindowTitle(translate('OpenLP.PluginForm', 'Plugin List'))
|
||||
self.pluginInfoGroupBox.setTitle(translate('OpenLP.PluginForm', 'Plugin Details'))
|
||||
self.versionLabel.setText(u'%s:' % UiStrings().Version)
|
||||
self.aboutLabel.setText(u'%s:' % UiStrings().About)
|
||||
self.statusLabel.setText(
|
||||
translate('OpenLP.PluginForm', 'Status:'))
|
||||
self.statusComboBox.setItemText(0,
|
||||
translate('OpenLP.PluginForm', 'Active'))
|
||||
self.statusComboBox.setItemText(1,
|
||||
translate('OpenLP.PluginForm', 'Inactive'))
|
||||
self.statusLabel.setText(translate('OpenLP.PluginForm', 'Status:'))
|
||||
self.statusComboBox.setItemText(0, translate('OpenLP.PluginForm', 'Active'))
|
||||
self.statusComboBox.setItemText(1, translate('OpenLP.PluginForm', 'Inactive'))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -48,13 +48,9 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||
self.load()
|
||||
self._clearDetails()
|
||||
# Right, now let's put some signals and slots together!
|
||||
QtCore.QObject.connect(
|
||||
self.pluginListWidget,
|
||||
QtCore.SIGNAL(u'itemSelectionChanged()'),
|
||||
QtCore.QObject.connect(self.pluginListWidget, QtCore.SIGNAL(u'itemSelectionChanged()'),
|
||||
self.onPluginListWidgetSelectionChanged)
|
||||
QtCore.QObject.connect(
|
||||
self.statusComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
QtCore.QObject.connect(self.statusComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
self.onStatusComboBoxChanged)
|
||||
|
||||
def load(self):
|
||||
|
@ -73,25 +69,20 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||
plugin.status = int(plugin.status)
|
||||
# Set the little status text in brackets next to the plugin name.
|
||||
if plugin.status == PluginStatus.Disabled:
|
||||
status_text = unicode(
|
||||
translate('OpenLP.PluginForm', '%s (Disabled)'))
|
||||
status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
|
||||
elif plugin.status == PluginStatus.Active:
|
||||
status_text = unicode(
|
||||
translate('OpenLP.PluginForm', '%s (Active)'))
|
||||
status_text = translate('OpenLP.PluginForm', '%s (Active)')
|
||||
else:
|
||||
# PluginStatus.Inactive
|
||||
status_text = unicode(
|
||||
translate('OpenLP.PluginForm', '%s (Inactive)'))
|
||||
status_text = translate('OpenLP.PluginForm', '%s (Inactive)')
|
||||
item.setText(status_text % plugin.nameStrings[u'singular'])
|
||||
# If the plugin has an icon, set it!
|
||||
if plugin.icon:
|
||||
item.setIcon(plugin.icon)
|
||||
self.pluginListWidget.addItem(item)
|
||||
pluginListWidth = max(pluginListWidth, self.fontMetrics().width(
|
||||
unicode(translate('OpenLP.PluginForm', '%s (Inactive)')) %
|
||||
plugin.nameStrings[u'singular']))
|
||||
self.pluginListWidget.setFixedWidth(pluginListWidth +
|
||||
self.pluginListWidget.iconSize().width() + 48)
|
||||
translate('OpenLP.PluginForm', '%s (Inactive)') % plugin.nameStrings[u'singular']))
|
||||
self.pluginListWidget.setFixedWidth(pluginListWidth + self.pluginListWidget.iconSize().width() + 48)
|
||||
|
||||
def _clearDetails(self):
|
||||
self.statusComboBox.setCurrentIndex(-1)
|
||||
|
@ -138,16 +129,12 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||
self.activePlugin.appStartup()
|
||||
else:
|
||||
self.activePlugin.toggleStatus(PluginStatus.Inactive)
|
||||
status_text = unicode(
|
||||
translate('OpenLP.PluginForm', '%s (Inactive)'))
|
||||
status_text = translate('OpenLP.PluginForm', '%s (Inactive)')
|
||||
if self.activePlugin.status == PluginStatus.Active:
|
||||
status_text = unicode(
|
||||
translate('OpenLP.PluginForm', '%s (Active)'))
|
||||
status_text = translate('OpenLP.PluginForm', '%s (Active)')
|
||||
elif self.activePlugin.status == PluginStatus.Inactive:
|
||||
status_text = unicode(
|
||||
translate('OpenLP.PluginForm', '%s (Inactive)'))
|
||||
status_text = translate('OpenLP.PluginForm', '%s (Inactive)')
|
||||
elif self.activePlugin.status == PluginStatus.Disabled:
|
||||
status_text = unicode(
|
||||
translate('OpenLP.PluginForm', '%s (Disabled)'))
|
||||
status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
|
||||
self.pluginListWidget.currentItem().setText(
|
||||
status_text % self.activePlugin.nameStrings[u'singular'])
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -55,21 +55,17 @@ class Ui_PrintServiceDialog(object):
|
|||
self.toolbar = QtGui.QToolBar(printServiceDialog)
|
||||
self.toolbar.setIconSize(QtCore.QSize(22, 22))
|
||||
self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||
self.printButton = self.toolbar.addAction(
|
||||
build_icon(u':/general/general_print.png'),
|
||||
self.printButton = self.toolbar.addAction(build_icon(u':/general/general_print.png'),
|
||||
translate('OpenLP.PrintServiceForm', 'Print'))
|
||||
self.optionsButton = QtGui.QToolButton(self.toolbar)
|
||||
self.optionsButton.setToolButtonStyle(
|
||||
QtCore.Qt.ToolButtonTextBesideIcon)
|
||||
self.optionsButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||
self.optionsButton.setIcon(build_icon(u':/system/system_configure.png'))
|
||||
self.optionsButton.setCheckable(True)
|
||||
self.toolbar.addWidget(self.optionsButton)
|
||||
self.toolbar.addSeparator()
|
||||
self.plainCopy = self.toolbar.addAction(
|
||||
build_icon(u':/system/system_edit_copy.png'),
|
||||
self.plainCopy = self.toolbar.addAction(build_icon(u':/system/system_edit_copy.png'),
|
||||
translate('OpenLP.PrintServiceForm', 'Copy'))
|
||||
self.htmlCopy = self.toolbar.addAction(
|
||||
build_icon(u':/system/system_edit_copy.png'),
|
||||
self.htmlCopy = self.toolbar.addAction(build_icon(u':/system/system_edit_copy.png'),
|
||||
translate('OpenLP.PrintServiceForm', 'Copy as HTML'))
|
||||
self.toolbar.addSeparator()
|
||||
self.zoomInButton = QtGui.QToolButton(self.toolbar)
|
||||
|
@ -78,14 +74,12 @@ class Ui_PrintServiceDialog(object):
|
|||
self.zoomInButton.setIconSize(QtCore.QSize(22, 22))
|
||||
self.toolbar.addWidget(self.zoomInButton)
|
||||
self.zoomOutButton = QtGui.QToolButton(self.toolbar)
|
||||
self.zoomOutButton.setIcon(
|
||||
build_icon(u':/general/general_zoom_out.png'))
|
||||
self.zoomOutButton.setIcon(build_icon(u':/general/general_zoom_out.png'))
|
||||
self.zoomOutButton.setObjectName(u'zoomOutButton')
|
||||
self.zoomOutButton.setIconSize(QtCore.QSize(22, 22))
|
||||
self.toolbar.addWidget(self.zoomOutButton)
|
||||
self.zoomOriginalButton = QtGui.QToolButton(self.toolbar)
|
||||
self.zoomOriginalButton.setIcon(
|
||||
build_icon(u':/general/general_zoom_original.png'))
|
||||
self.zoomOriginalButton.setIcon(build_icon(u':/general/general_zoom_original.png'))
|
||||
self.zoomOriginalButton.setObjectName(u'zoomOriginalButton')
|
||||
self.zoomOriginalButton.setIconSize(QtCore.QSize(22, 22))
|
||||
self.toolbar.addWidget(self.zoomOriginalButton)
|
||||
|
@ -128,34 +122,22 @@ class Ui_PrintServiceDialog(object):
|
|||
self.optionsLayout.addWidget(self.optionsGroupBox)
|
||||
|
||||
self.retranslateUi(printServiceDialog)
|
||||
QtCore.QObject.connect(self.optionsButton,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.toggleOptions)
|
||||
QtCore.QObject.connect(self.optionsButton,QtCore.SIGNAL(u'toggled(bool)'), self.toggleOptions)
|
||||
|
||||
def retranslateUi(self, printServiceDialog):
|
||||
printServiceDialog.setWindowTitle(UiStrings().PrintService)
|
||||
self.zoomOutButton.setToolTip(translate('OpenLP.PrintServiceForm',
|
||||
'Zoom Out'))
|
||||
self.zoomOriginalButton.setToolTip(translate('OpenLP.PrintServiceForm',
|
||||
'Zoom Original'))
|
||||
self.zoomInButton.setToolTip(translate('OpenLP.PrintServiceForm',
|
||||
'Zoom In'))
|
||||
self.optionsButton.setText(translate('OpenLP.PrintServiceForm',
|
||||
'Options'))
|
||||
self.zoomOutButton.setToolTip(translate('OpenLP.PrintServiceForm', 'Zoom Out'))
|
||||
self.zoomOriginalButton.setToolTip(translate('OpenLP.PrintServiceForm', 'Zoom Original'))
|
||||
self.zoomInButton.setToolTip(translate('OpenLP.PrintServiceForm', 'Zoom In'))
|
||||
self.optionsButton.setText(translate('OpenLP.PrintServiceForm', 'Options'))
|
||||
self.titleLabel.setText(translate('OpenLP.PrintServiceForm', 'Title:'))
|
||||
self.footerLabel.setText(translate('OpenLP.PrintServiceForm',
|
||||
'Custom Footer Text:'))
|
||||
self.optionsGroupBox.setTitle(
|
||||
translate('OpenLP.PrintServiceForm','Other Options'))
|
||||
self.slideTextCheckBox.setText(translate('OpenLP.PrintServiceForm',
|
||||
'Include slide text if available'))
|
||||
self.pageBreakAfterText.setText(translate('OpenLP.PrintServiceForm',
|
||||
'Add page break before each text item'))
|
||||
self.notesCheckBox.setText(translate('OpenLP.PrintServiceForm',
|
||||
'Include service item notes'))
|
||||
self.metaDataCheckBox.setText(translate('OpenLP.PrintServiceForm',
|
||||
'Include play length of media items'))
|
||||
self.titleLineEdit.setText(translate('OpenLP.PrintServiceForm',
|
||||
'Service Sheet'))
|
||||
self.footerLabel.setText(translate('OpenLP.PrintServiceForm', 'Custom Footer Text:'))
|
||||
self.optionsGroupBox.setTitle(translate('OpenLP.PrintServiceForm','Other Options'))
|
||||
self.slideTextCheckBox.setText(translate('OpenLP.PrintServiceForm', 'Include slide text if available'))
|
||||
self.pageBreakAfterText.setText(translate('OpenLP.PrintServiceForm', 'Add page break before each text item'))
|
||||
self.notesCheckBox.setText(translate('OpenLP.PrintServiceForm', 'Include service item notes'))
|
||||
self.metaDataCheckBox.setText(translate('OpenLP.PrintServiceForm', 'Include play length of media items'))
|
||||
self.titleLineEdit.setText(translate('OpenLP.PrintServiceForm', 'Service Sheet'))
|
||||
# Do not change the order.
|
||||
self.zoomComboBox.addItems([
|
||||
translate('OpenLP.PrintServiceDialog', 'Fit Page'),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -33,9 +33,8 @@ import os
|
|||
from PyQt4 import QtCore, QtGui
|
||||
from lxml import html
|
||||
|
||||
from openlp.core.lib import translate, get_text_file_string, Receiver
|
||||
from openlp.core.lib import translate, get_text_file_string, Receiver, Settings
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize
|
||||
from openlp.core.utils import AppLocation
|
||||
|
||||
|
@ -125,39 +124,24 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
# Load the settings for the dialog.
|
||||
settings = Settings()
|
||||
settings.beginGroup(u'advanced')
|
||||
self.slideTextCheckBox.setChecked(settings.value(
|
||||
u'print slide text', QtCore.QVariant(False)).toBool())
|
||||
self.pageBreakAfterText.setChecked(settings.value(
|
||||
u'add page break', QtCore.QVariant(False)).toBool())
|
||||
self.slideTextCheckBox.setChecked(settings.value(u'print slide text', False))
|
||||
self.pageBreakAfterText.setChecked(settings.value(u'add page break', False))
|
||||
if not self.slideTextCheckBox.isChecked():
|
||||
self.pageBreakAfterText.setDisabled(True)
|
||||
self.metaDataCheckBox.setChecked(settings.value(
|
||||
u'print file meta data', QtCore.QVariant(False)).toBool())
|
||||
self.notesCheckBox.setChecked(settings.value(
|
||||
u'print notes', QtCore.QVariant(False)).toBool())
|
||||
self.zoomComboBox.setCurrentIndex(settings.value(
|
||||
u'display size', QtCore.QVariant(0)).toInt()[0])
|
||||
self.metaDataCheckBox.setChecked(settings.value(u'print file meta data', False))
|
||||
self.notesCheckBox.setChecked(settings.value(u'print notes', False))
|
||||
self.zoomComboBox.setCurrentIndex(settings.value(u'display size', 0))
|
||||
settings.endGroup()
|
||||
# Signals
|
||||
QtCore.QObject.connect(self.printButton,
|
||||
QtCore.SIGNAL(u'triggered()'), self.printServiceOrder)
|
||||
QtCore.QObject.connect(self.zoomOutButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.zoomOut)
|
||||
QtCore.QObject.connect(self.zoomInButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.zoomIn)
|
||||
QtCore.QObject.connect(self.zoomOriginalButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.zoomOriginal)
|
||||
QtCore.QObject.connect(self.previewWidget,
|
||||
QtCore.SIGNAL(u'paintRequested(QPrinter *)'), self.paintRequested)
|
||||
QtCore.QObject.connect(self.zoomComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'), self.displaySizeChanged)
|
||||
QtCore.QObject.connect(self.plainCopy,
|
||||
QtCore.SIGNAL(u'triggered()'), self.copyText)
|
||||
QtCore.QObject.connect(self.htmlCopy,
|
||||
QtCore.SIGNAL(u'triggered()'), self.copyHtmlText)
|
||||
QtCore.QObject.connect(self.slideTextCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onSlideTextCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.printButton, QtCore.SIGNAL(u'triggered()'), self.printServiceOrder)
|
||||
QtCore.QObject.connect(self.zoomOutButton, QtCore.SIGNAL(u'clicked()'), self.zoomOut)
|
||||
QtCore.QObject.connect(self.zoomInButton, QtCore.SIGNAL(u'clicked()'), self.zoomIn)
|
||||
QtCore.QObject.connect(self.zoomOriginalButton, QtCore.SIGNAL(u'clicked()'), self.zoomOriginal)
|
||||
QtCore.QObject.connect(self.previewWidget, QtCore.SIGNAL(u'paintRequested(QPrinter *)'), self.paintRequested)
|
||||
QtCore.QObject.connect(self.zoomComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.displaySizeChanged)
|
||||
QtCore.QObject.connect(self.plainCopy, QtCore.SIGNAL(u'triggered()'), self.copyText)
|
||||
QtCore.QObject.connect(self.htmlCopy, QtCore.SIGNAL(u'triggered()'), self.copyHtmlText)
|
||||
QtCore.QObject.connect(self.slideTextCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onSlideTextCheckBoxChanged)
|
||||
self.updatePreviewText()
|
||||
|
||||
def toggleOptions(self, checked):
|
||||
|
@ -177,29 +161,24 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
"""
|
||||
html_data = self._addElement(u'html')
|
||||
self._addElement(u'head', parent=html_data)
|
||||
self._addElement(u'title', unicode(self.titleLineEdit.text()),
|
||||
html_data.head)
|
||||
css_path = os.path.join(
|
||||
AppLocation.get_data_path(), u'service_print.css')
|
||||
self._addElement(u'title', self.titleLineEdit.text(), html_data.head)
|
||||
css_path = os.path.join(AppLocation.get_data_path(), u'service_print.css')
|
||||
custom_css = get_text_file_string(css_path)
|
||||
if not custom_css:
|
||||
custom_css = DEFAULT_CSS
|
||||
self._addElement(u'style', custom_css, html_data.head,
|
||||
attribute=(u'type', u'text/css'))
|
||||
self._addElement(u'body', parent=html_data)
|
||||
self._addElement(u'h1', cgi.escape(unicode(self.titleLineEdit.text())),
|
||||
self._addElement(u'h1', cgi.escape(self.titleLineEdit.text()),
|
||||
html_data.body, classId=u'serviceTitle')
|
||||
for index, item in enumerate(self.serviceManager.serviceItems):
|
||||
self._addPreviewItem(html_data.body, item[u'service_item'], index)
|
||||
# Add the custom service notes:
|
||||
if self.footerTextEdit.toPlainText():
|
||||
div = self._addElement(u'div', parent=html_data.body,
|
||||
classId=u'customNotes')
|
||||
self._addElement(u'span', translate('OpenLP.ServiceManager',
|
||||
'Custom Service Notes: '), div, classId=u'customNotesTitle')
|
||||
self._addElement(u'span',
|
||||
cgi.escape(self.footerTextEdit.toPlainText()),
|
||||
div, classId=u'customNotesText')
|
||||
div = self._addElement(u'div', parent=html_data.body, classId=u'customNotes')
|
||||
self._addElement(u'span', translate('OpenLP.ServiceManager', 'Custom Service Notes: '), div,
|
||||
classId=u'customNotesTitle')
|
||||
self._addElement(u'span', cgi.escape(self.footerTextEdit.toPlainText()), div, classId=u'customNotesText')
|
||||
self.document.setHtml(html.tostring(html_data))
|
||||
self.previewWidget.updatePreview()
|
||||
|
||||
|
@ -207,18 +186,15 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
div = self._addElement(u'div', classId=u'item', parent=body)
|
||||
# Add the title of the service item.
|
||||
item_title = self._addElement(u'h2', parent=div, classId=u'itemTitle')
|
||||
self._addElement(u'img', parent=item_title,
|
||||
attribute=(u'src', item.icon))
|
||||
self._addElement(u'span',
|
||||
u' ' + cgi.escape(item.get_display_title()), item_title)
|
||||
self._addElement(u'img', parent=item_title, attribute=(u'src', item.icon))
|
||||
self._addElement(u'span', u' ' + cgi.escape(item.get_display_title()), item_title)
|
||||
if self.slideTextCheckBox.isChecked():
|
||||
# Add the text of the service item.
|
||||
if item.is_text():
|
||||
verse_def = None
|
||||
for slide in item.get_frames():
|
||||
if not verse_def or verse_def != slide[u'verseTag']:
|
||||
text_div = self._addElement(u'div', parent=div,
|
||||
classId=u'itemText')
|
||||
text_div = self._addElement(u'div', parent=div, classId=u'itemText')
|
||||
else:
|
||||
self._addElement(u'br', parent=text_div)
|
||||
self._addElement(u'span', slide[u'html'], text_div)
|
||||
|
@ -236,26 +212,22 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
foot_text = foot_text.partition(u'<br>')[2]
|
||||
if foot_text:
|
||||
foot_text = cgi.escape(foot_text.replace(u'<br>', u'\n'))
|
||||
self._addElement(u'div', foot_text.replace(u'\n', u'<br>'),
|
||||
parent=div, classId=u'itemFooter')
|
||||
self._addElement(u'div', foot_text.replace(u'\n', u'<br>'), parent=div, classId=u'itemFooter')
|
||||
# Add service items' notes.
|
||||
if self.notesCheckBox.isChecked():
|
||||
if item.notes:
|
||||
p = self._addElement(u'div', classId=u'itemNotes', parent=div)
|
||||
self._addElement(u'span',
|
||||
translate('OpenLP.ServiceManager', 'Notes: '), p,
|
||||
self._addElement(u'span', translate('OpenLP.ServiceManager', 'Notes: '), p,
|
||||
classId=u'itemNotesTitle')
|
||||
self._addElement(u'span',
|
||||
cgi.escape(unicode(item.notes)).replace(u'\n', u'<br>'), p,
|
||||
classId=u'itemNotesText')
|
||||
self._addElement(u'span', cgi.escape(item.notes).replace(u'\n', u'<br>'), p, classId=u'itemNotesText')
|
||||
# Add play length of media files.
|
||||
if item.is_media() and self.metaDataCheckBox.isChecked():
|
||||
tme = item.media_length
|
||||
if item.end_time > 0:
|
||||
tme = item.end_time - item.start_time
|
||||
title = self._addElement(u'div', classId=u'media', parent=div)
|
||||
self._addElement(u'span', translate('OpenLP.ServiceManager',
|
||||
'Playing time: '), title, classId=u'mediaTitle')
|
||||
self._addElement(u'span', translate('OpenLP.ServiceManager', 'Playing time: '), title,
|
||||
classId=u'mediaTitle')
|
||||
self._addElement(u'span', unicode(datetime.timedelta(seconds=tme)),
|
||||
title, classId=u'mediaText')
|
||||
|
||||
|
@ -323,7 +295,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
self.previewWidget.zoomIn(0.25)
|
||||
settings = Settings()
|
||||
settings.beginGroup(u'advanced')
|
||||
settings.setValue(u'display size', QtCore.QVariant(display))
|
||||
settings.setValue(u'display size', display)
|
||||
settings.endGroup()
|
||||
|
||||
def copyText(self):
|
||||
|
@ -411,14 +383,10 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
# Save the settings for this dialog.
|
||||
settings = Settings()
|
||||
settings.beginGroup(u'advanced')
|
||||
settings.setValue(u'print slide text',
|
||||
QtCore.QVariant(self.slideTextCheckBox.isChecked()))
|
||||
settings.setValue(u'add page break',
|
||||
QtCore.QVariant(self.pageBreakAfterText.isChecked()))
|
||||
settings.setValue(u'print file meta data',
|
||||
QtCore.QVariant(self.metaDataCheckBox.isChecked()))
|
||||
settings.setValue(u'print notes',
|
||||
QtCore.QVariant(self.notesCheckBox.isChecked()))
|
||||
settings.setValue(u'print slide text', self.slideTextCheckBox.isChecked())
|
||||
settings.setValue(u'add page break', self.pageBreakAfterText.isChecked())
|
||||
settings.setValue(u'print file meta data', self.metaDataCheckBox.isChecked())
|
||||
settings.setValue(u'print notes', self.notesCheckBox.isChecked())
|
||||
settings.endGroup()
|
||||
|
||||
def update_song_usage(self):
|
||||
|
@ -427,5 +395,4 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
return
|
||||
for item in self.serviceManager.serviceItems:
|
||||
# Trigger Audit requests
|
||||
Receiver.send_message(u'print_service_started',
|
||||
[item[u'service_item']])
|
||||
Receiver.send_message(u'print_service_started', [item[u'service_item']])
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -35,8 +35,7 @@ import copy
|
|||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Receiver, translate
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import Receiver, translate, Settings
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -71,12 +70,8 @@ class ScreenList(object):
|
|||
screen_list.display_count = 0
|
||||
screen_list.screen_count_changed()
|
||||
screen_list._load_screen_settings()
|
||||
QtCore.QObject.connect(desktop,
|
||||
QtCore.SIGNAL(u'resized(int)'),
|
||||
screen_list.screen_resolution_changed)
|
||||
QtCore.QObject.connect(desktop,
|
||||
QtCore.SIGNAL(u'screenCountChanged(int)'),
|
||||
screen_list.screen_count_changed)
|
||||
QtCore.QObject.connect(desktop, QtCore.SIGNAL(u'resized(int)'), screen_list.screen_resolution_changed)
|
||||
QtCore.QObject.connect(desktop, QtCore.SIGNAL(u'screenCountChanged(int)'), screen_list.screen_count_changed)
|
||||
return screen_list
|
||||
|
||||
def screen_resolution_changed(self, number):
|
||||
|
@ -143,8 +138,7 @@ class ScreenList(object):
|
|||
screen_name = u'%s %d' % (translate('OpenLP.ScreenList', 'Screen'),
|
||||
screen[u'number'] + 1)
|
||||
if screen[u'primary']:
|
||||
screen_name = u'%s (%s)' % (screen_name,
|
||||
translate('OpenLP.ScreenList', 'primary'))
|
||||
screen_name = u'%s (%s)' % (screen_name, translate('OpenLP.ScreenList', 'primary'))
|
||||
screen_list.append(screen_name)
|
||||
return screen_list
|
||||
|
||||
|
@ -161,8 +155,7 @@ class ScreenList(object):
|
|||
u'size': PyQt4.QtCore.QRect(0, 0, 1024, 768)
|
||||
}
|
||||
"""
|
||||
log.info(u'Screen %d found with resolution %s',
|
||||
screen[u'number'], screen[u'size'])
|
||||
log.info(u'Screen %d found with resolution %s', screen[u'number'], screen[u'size'])
|
||||
if screen[u'primary']:
|
||||
self.current = screen
|
||||
self.override = copy.deepcopy(self.current)
|
||||
|
@ -250,20 +243,13 @@ class ScreenList(object):
|
|||
"""
|
||||
settings = Settings()
|
||||
settings.beginGroup(u'general')
|
||||
self.set_current_display(settings.value(u'monitor',
|
||||
QtCore.QVariant(self.display_count - 1)).toInt()[0])
|
||||
self.display = settings.value(
|
||||
u'display on monitor', QtCore.QVariant(True)).toBool()
|
||||
override_display = settings.value(
|
||||
u'override position', QtCore.QVariant(False)).toBool()
|
||||
x = settings.value(u'x position',
|
||||
QtCore.QVariant(self.current[u'size'].x())).toInt()[0]
|
||||
y = settings.value(u'y position',
|
||||
QtCore.QVariant(self.current[u'size'].y())).toInt()[0]
|
||||
width = settings.value(u'width',
|
||||
QtCore.QVariant(self.current[u'size'].width())).toInt()[0]
|
||||
height = settings.value(u'height',
|
||||
QtCore.QVariant(self.current[u'size'].height())).toInt()[0]
|
||||
self.set_current_display(settings.value(u'monitor', self.display_count - 1))
|
||||
self.display = settings.value(u'display on monitor', True)
|
||||
override_display = settings.value(u'override position', False)
|
||||
x = settings.value(u'x position', self.current[u'size'].x())
|
||||
y = settings.value(u'y position', self.current[u'size'].y())
|
||||
width = settings.value(u'width', self.current[u'size'].width())
|
||||
height = settings.value(u'height', self.current[u'size'].height())
|
||||
self.override[u'size'] = QtCore.QRect(x, y, width, height)
|
||||
self.override[u'primary'] = False
|
||||
settings.endGroup()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -45,23 +45,20 @@ class Ui_ServiceItemEditDialog(object):
|
|||
self.dialogLayout.addWidget(self.listWidget, 0, 0)
|
||||
self.buttonLayout = QtGui.QVBoxLayout()
|
||||
self.buttonLayout.setObjectName(u'buttonLayout')
|
||||
self.deleteButton = create_button(serviceItemEditDialog,
|
||||
u'deleteButton', role=u'delete',
|
||||
self.deleteButton = create_button(serviceItemEditDialog, u'deleteButton', role=u'delete',
|
||||
click=serviceItemEditDialog.onDeleteButtonClicked)
|
||||
self.buttonLayout.addWidget(self.deleteButton)
|
||||
self.buttonLayout.addStretch()
|
||||
self.upButton = create_button(serviceItemEditDialog, u'upButton',
|
||||
role=u'up', click=serviceItemEditDialog.onUpButtonClicked)
|
||||
self.downButton = create_button(serviceItemEditDialog, u'downButton',
|
||||
role=u'down', click=serviceItemEditDialog.onDownButtonClicked)
|
||||
self.upButton = create_button(serviceItemEditDialog, u'upButton', role=u'up',
|
||||
click=serviceItemEditDialog.onUpButtonClicked)
|
||||
self.downButton = create_button(serviceItemEditDialog, u'downButton', role=u'down',
|
||||
click=serviceItemEditDialog.onDownButtonClicked)
|
||||
self.buttonLayout.addWidget(self.upButton)
|
||||
self.buttonLayout.addWidget(self.downButton)
|
||||
self.dialogLayout.addLayout(self.buttonLayout, 0, 1)
|
||||
self.buttonBox = create_button_box(serviceItemEditDialog, u'buttonBox',
|
||||
[u'cancel', u'save'])
|
||||
self.buttonBox = create_button_box(serviceItemEditDialog, u'buttonBox', [u'cancel', u'save'])
|
||||
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
|
||||
self.retranslateUi(serviceItemEditDialog)
|
||||
|
||||
def retranslateUi(self, serviceItemEditDialog):
|
||||
serviceItemEditDialog.setWindowTitle(
|
||||
translate('OpenLP.ServiceItemEditForm', 'Reorder Service Item'))
|
||||
serviceItemEditDialog.setWindowTitle(translate('OpenLP.ServiceItemEditForm', 'Reorder Service Item'))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -42,8 +42,7 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
|
|||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.itemList = []
|
||||
QtCore.QObject.connect(self.listWidget,
|
||||
QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged)
|
||||
QtCore.QObject.connect(self.listWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged)
|
||||
|
||||
def setServiceItem(self, item):
|
||||
self.item = item
|
||||
|
|
|
@ -40,9 +40,8 @@ log = logging.getLogger(__name__)
|
|||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, ItemCapabilities, SettingsManager, \
|
||||
translate, str_to_bool, check_directory_exists
|
||||
translate, str_to_bool, check_directory_exists, Settings
|
||||
from openlp.core.lib.theme import ThemeLevel
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib.ui import UiStrings, 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
|
||||
|
@ -166,7 +165,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
self.orderToolbar = OpenLPToolbar(self)
|
||||
action_list = ActionList.get_instance()
|
||||
action_list.add_category(
|
||||
unicode(UiStrings().Service), CategoryOrder.standardToolbar)
|
||||
UiStrings().Service, CategoryOrder.standardToolbar)
|
||||
self.serviceManagerList.moveTop = self.orderToolbar.addToolbarAction(u'moveTop',
|
||||
text=translate('OpenLP.ServiceManager', 'Move to &top'), icon=u':/services/service_top.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Move item to the top of the service.'),
|
||||
|
@ -184,9 +183,9 @@ class ServiceManager(QtGui.QWidget):
|
|||
tooltip=translate('OpenLP.ServiceManager', 'Move item to the end of the service.'),
|
||||
shortcuts=[QtCore.Qt.Key_End], category=UiStrings().Service, triggers=self.onServiceEnd)
|
||||
self.serviceManagerList.down = self.orderToolbar.addToolbarAction(u'down',
|
||||
text=translate('OpenLP.ServiceManager', 'Move &down'), tooltip=translate('OpenLP.ServiceManager',
|
||||
'Moves the selection down the window.'), visible=False, shortcuts=[QtCore.Qt.Key_Down],
|
||||
triggers=self.onMoveSelectionDown)
|
||||
text=translate('OpenLP.ServiceManager', 'Move &down'),
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Moves the selection down the window.'), visible=False,
|
||||
shortcuts=[QtCore.Qt.Key_Down], triggers=self.onMoveSelectionDown)
|
||||
action_list.add_action(self.serviceManagerList.down)
|
||||
self.serviceManagerList.up = self.orderToolbar.addToolbarAction(u'up',
|
||||
text=translate('OpenLP.ServiceManager', 'Move up'), tooltip=translate('OpenLP.ServiceManager',
|
||||
|
@ -199,12 +198,10 @@ class ServiceManager(QtGui.QWidget):
|
|||
tooltip=translate('OpenLP.ServiceManager', 'Delete the selected item from the service.'),
|
||||
shortcuts=[QtCore.Qt.Key_Delete], triggers=self.onDeleteFromService)
|
||||
self.orderToolbar.addSeparator()
|
||||
self.serviceManagerList.expand = self.orderToolbar.addToolbarAction(
|
||||
u'expand', text=translate('OpenLP.ServiceManager', '&Expand all'),
|
||||
icon=u':/services/service_expand_all.png', tooltip=translate(
|
||||
'OpenLP.ServiceManager', 'Expand all the service items.'),
|
||||
shortcuts=[QtCore.Qt.Key_Plus], category=UiStrings().Service,
|
||||
triggers=self.onExpandAll)
|
||||
self.serviceManagerList.expand = self.orderToolbar.addToolbarAction(u'expand',
|
||||
text=translate('OpenLP.ServiceManager', '&Expand all'), icon=u':/services/service_expand_all.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Expand all the service items.'),
|
||||
shortcuts=[QtCore.Qt.Key_Plus], category=UiStrings().Service, triggers=self.onExpandAll)
|
||||
self.serviceManagerList.collapse = self.orderToolbar.addToolbarAction(u'collapse',
|
||||
text=translate('OpenLP.ServiceManager', '&Collapse all'), icon=u':/services/service_collapse_all.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Collapse all the service items.'),
|
||||
|
@ -233,16 +230,13 @@ class ServiceManager(QtGui.QWidget):
|
|||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_global'), self.themeChange)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'service_item_update'), self.serviceItemUpdate)
|
||||
# Last little bits of setting up
|
||||
self.service_theme = unicode(Settings().value(self.mainwindow.serviceManagerSettingsSection + u'/service theme',
|
||||
QtCore.QVariant(u'')).toString())
|
||||
self.service_theme = Settings().value(self.mainwindow.serviceManagerSettingsSection + u'/service theme', u'')
|
||||
self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
|
||||
# build the drag and drop context menu
|
||||
self.dndMenu = QtGui.QMenu()
|
||||
self.newAction = self.dndMenu.addAction(
|
||||
translate('OpenLP.ServiceManager', '&Add New Item'))
|
||||
self.newAction = self.dndMenu.addAction(translate('OpenLP.ServiceManager', '&Add New Item'))
|
||||
self.newAction.setIcon(build_icon(u':/general/general_edit.png'))
|
||||
self.addToAction = self.dndMenu.addAction(
|
||||
translate('OpenLP.ServiceManager', '&Add to Selected Item'))
|
||||
self.addToAction = self.dndMenu.addAction(translate('OpenLP.ServiceManager', '&Add to Selected Item'))
|
||||
self.addToAction.setIcon(build_icon(u':/general/general_edit.png'))
|
||||
# build the context menu
|
||||
self.menu = QtGui.QMenu()
|
||||
|
@ -303,8 +297,8 @@ class ServiceManager(QtGui.QWidget):
|
|||
self._fileName = unicode(fileName)
|
||||
self.mainwindow.setServiceModified(self.isModified(),
|
||||
self.shortFileName())
|
||||
Settings().setValue(u'servicemanager/last file',QtCore.QVariant(fileName))
|
||||
self._saveLite = True if self._fileName.endswith(u'.oszl') else False
|
||||
Settings().setValue(u'servicemanager/last file', fileName)
|
||||
self._saveLite = self._fileName.endswith(u'.oszl')
|
||||
|
||||
def fileName(self):
|
||||
"""
|
||||
|
@ -322,7 +316,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
"""
|
||||
Triggered when Config dialog is updated.
|
||||
"""
|
||||
self.expandTabs = Settings().value(u'advanced/expand service item', QtCore.QVariant(u'False')).toBool()
|
||||
self.expandTabs = Settings().value(u'advanced/expand service item', False)
|
||||
|
||||
def resetSupportedSuffixes(self):
|
||||
"""
|
||||
|
@ -370,10 +364,10 @@ class ServiceManager(QtGui.QWidget):
|
|||
elif result == QtGui.QMessageBox.Save:
|
||||
self.decideSaveMethod()
|
||||
if not loadFile:
|
||||
fileName = unicode(QtGui.QFileDialog.getOpenFileName(self.mainwindow,
|
||||
fileName = QtGui.QFileDialog.getOpenFileName(self.mainwindow,
|
||||
translate('OpenLP.ServiceManager', 'Open File'),
|
||||
SettingsManager.get_last_dir(self.mainwindow.serviceManagerSettingsSection),
|
||||
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz *.oszl)')))
|
||||
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz *.oszl)'))
|
||||
if not fileName:
|
||||
return False
|
||||
else:
|
||||
|
@ -390,7 +384,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
|
||||
def onRecentServiceClicked(self):
|
||||
sender = self.sender()
|
||||
self.loadFile(sender.data().toString())
|
||||
self.loadFile(sender.data())
|
||||
|
||||
def newFile(self):
|
||||
"""
|
||||
|
@ -401,7 +395,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
self.setFileName(u'')
|
||||
self.serviceId += 1
|
||||
self.setModified(False)
|
||||
Settings().setValue(u'servicemanager/last file',QtCore.QVariant(u''))
|
||||
Settings().setValue(u'servicemanager/last file', u'')
|
||||
Receiver.send_message(u'servicemanager_new_service')
|
||||
|
||||
def saveFile(self):
|
||||
|
@ -424,9 +418,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
basename = os.path.splitext(file_name)[0]
|
||||
service_file_name = '%s.osd' % basename
|
||||
log.debug(u'ServiceManager.saveFile - %s', path_file_name)
|
||||
SettingsManager.set_last_dir(
|
||||
self.mainwindow.serviceManagerSettingsSection,
|
||||
path)
|
||||
SettingsManager.set_last_dir(self.mainwindow.serviceManagerSettingsSection, path)
|
||||
service = []
|
||||
write_list = []
|
||||
missing_list = []
|
||||
|
@ -449,10 +441,10 @@ class ServiceManager(QtGui.QWidget):
|
|||
write_list.append(path_from)
|
||||
if missing_list:
|
||||
Receiver.send_message(u'cursor_normal')
|
||||
title = unicode(translate('OpenLP.ServiceManager', 'Service File(s) Missing'))
|
||||
message = unicode(translate('OpenLP.ServiceManager',
|
||||
title = translate('OpenLP.ServiceManager', 'Service File(s) Missing')
|
||||
message = translate('OpenLP.ServiceManager',
|
||||
'The following file(s) in the service are missing:\n\t%s\n\n'
|
||||
'These files will be removed if you continue to save.')) % "\n\t".join(missing_list)
|
||||
'These files will be removed if you continue to save.') % "\n\t".join(missing_list)
|
||||
answer = QtGui.QMessageBox.critical(self, title, message,
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel))
|
||||
if answer == QtGui.QMessageBox.Cancel:
|
||||
|
@ -599,39 +591,39 @@ class ServiceManager(QtGui.QWidget):
|
|||
Get a file name and then call :func:`ServiceManager.saveFile` to
|
||||
save the file.
|
||||
"""
|
||||
default_service_enabled = Settings().value(u'advanced/default service enabled', QtCore.QVariant(True)).toBool()
|
||||
default_service_enabled = Settings().value(u'advanced/default service enabled', True)
|
||||
if default_service_enabled:
|
||||
service_day = Settings().value(u'advanced/default service day', 7).toInt()[0]
|
||||
service_day = Settings().value(u'advanced/default service day', 7)
|
||||
if service_day == 7:
|
||||
local_time = datetime.now()
|
||||
else:
|
||||
service_hour = Settings().value(u'advanced/default service hour', 11).toInt()[0]
|
||||
service_minute = Settings().value(u'advanced/default service minute', 0).toInt()[0]
|
||||
service_hour = Settings().value(u'advanced/default service hour', 11)
|
||||
service_minute = Settings().value(u'advanced/default service minute', 0)
|
||||
now = datetime.now()
|
||||
day_delta = service_day - now.weekday()
|
||||
if day_delta < 0:
|
||||
day_delta += 7
|
||||
time = now + timedelta(days=day_delta)
|
||||
local_time = time.replace(hour=service_hour, minute=service_minute)
|
||||
default_pattern = unicode(Settings().value(u'advanced/default service name',
|
||||
default_pattern = Settings().value(u'advanced/default service name',
|
||||
translate('OpenLP.AdvancedTab', 'Service %Y-%m-%d %H-%M',
|
||||
'This may not contain any of the following characters: '
|
||||
'/\\?*|<>\[\]":+\nSee http://docs.python.org/library/'
|
||||
'datetime.html#strftime-strptime-behavior for more information.')).toString())
|
||||
'datetime.html#strftime-strptime-behavior for more information.'))
|
||||
default_filename = format_time(default_pattern, local_time)
|
||||
else:
|
||||
default_filename = u''
|
||||
directory = unicode(SettingsManager.get_last_dir(self.mainwindow.serviceManagerSettingsSection))
|
||||
directory = SettingsManager.get_last_dir(self.mainwindow.serviceManagerSettingsSection)
|
||||
path = os.path.join(directory, default_filename)
|
||||
# SaveAs from osz to oszl is not valid as the files will be deleted
|
||||
# on exit which is not sensible or usable in the long term.
|
||||
if self._fileName.endswith(u'oszl') or not self._fileName:
|
||||
fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow, UiStrings().SaveService, path,
|
||||
fileName = QtGui.QFileDialog.getSaveFileName(self.mainwindow, UiStrings().SaveService, path,
|
||||
translate('OpenLP.ServiceManager',
|
||||
'OpenLP Service Files (*.osz);; OpenLP Service Files - lite (*.oszl)')))
|
||||
'OpenLP Service Files (*.osz);; OpenLP Service Files - lite (*.oszl)'))
|
||||
else:
|
||||
fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow, UiStrings().SaveService, path,
|
||||
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz);;')))
|
||||
fileName = QtGui.QFileDialog.getSaveFileName(self.mainwindow, UiStrings().SaveService, path,
|
||||
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz);;'))
|
||||
if not fileName:
|
||||
return False
|
||||
if os.path.splitext(fileName)[1] == u'':
|
||||
|
@ -710,7 +702,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
delete_file(p_file)
|
||||
self.mainwindow.addRecentFile(fileName)
|
||||
self.setModified(False)
|
||||
Settings().setValue(u'servicemanager/last file', QtCore.QVariant(fileName))
|
||||
Settings().setValue('servicemanager/last file', fileName)
|
||||
else:
|
||||
critical_error_message_box(message=translate('OpenLP.ServiceManager', 'File is not a valid service.'))
|
||||
log.exception(u'File contains no service data')
|
||||
|
@ -745,7 +737,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
service was last closed. Can be blank if there was no service
|
||||
present.
|
||||
"""
|
||||
fileName = Settings().value(u'servicemanager/last file',QtCore.QVariant(u'')).toString()
|
||||
fileName = Settings().value(u'servicemanager/last file', u'')
|
||||
if fileName:
|
||||
self.loadFile(fileName)
|
||||
|
||||
|
@ -753,10 +745,10 @@ class ServiceManager(QtGui.QWidget):
|
|||
item = self.serviceManagerList.itemAt(point)
|
||||
if item is None:
|
||||
return
|
||||
if item.parent() is None:
|
||||
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||
if item.parent():
|
||||
pos = item.parent().data(0, QtCore.Qt.UserRole)
|
||||
else:
|
||||
pos = item.parent().data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||
pos = item.data(0, QtCore.Qt.UserRole)
|
||||
serviceItem = self.serviceItems[pos - 1]
|
||||
self.editAction.setVisible(False)
|
||||
self.maintainAction.setVisible(False)
|
||||
|
@ -873,7 +865,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
while serviceIterator.value():
|
||||
if serviceIterator.value() == selected:
|
||||
if message == u'last slide' and prevItemLastSlide:
|
||||
pos = prevItem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||
pos = prevItem.data(0, QtCore.Qt.UserRole)
|
||||
check_expanded = self.serviceItems[pos - 1][u'expanded']
|
||||
self.serviceManagerList.setCurrentItem(prevItemLastSlide)
|
||||
if not check_expanded:
|
||||
|
@ -940,7 +932,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
Record if an item is collapsed. Used when repainting the list to get the
|
||||
correct state.
|
||||
"""
|
||||
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||
pos = item.data(0, QtCore.Qt.UserRole)
|
||||
self.serviceItems[pos - 1][u'expanded'] = False
|
||||
|
||||
def onExpandAll(self):
|
||||
|
@ -956,7 +948,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
Record if an item is collapsed. Used when repainting the list to get the
|
||||
correct state.
|
||||
"""
|
||||
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||
pos = item.data(0, QtCore.Qt.UserRole)
|
||||
self.serviceItems[pos - 1][u'expanded'] = True
|
||||
|
||||
def onServiceTop(self):
|
||||
|
@ -1066,25 +1058,25 @@ class ServiceManager(QtGui.QWidget):
|
|||
tips = []
|
||||
if serviceitem.temporary_edit:
|
||||
tips.append(u'<strong>%s:</strong> <em>%s</em>' %
|
||||
(unicode(translate('OpenLP.ServiceManager', 'Edit')),
|
||||
(unicode(translate('OpenLP.ServiceManager', 'Service copy only')))))
|
||||
(translate('OpenLP.ServiceManager', 'Edit'),
|
||||
(translate('OpenLP.ServiceManager', 'Service copy only'))))
|
||||
if serviceitem.theme and serviceitem.theme != -1:
|
||||
tips.append(u'<strong>%s:</strong> <em>%s</em>' %
|
||||
(unicode(translate('OpenLP.ServiceManager', 'Slide theme')), serviceitem.theme))
|
||||
(translate('OpenLP.ServiceManager', 'Slide theme'), serviceitem.theme))
|
||||
if serviceitem.notes:
|
||||
tips.append(u'<strong>%s: </strong> %s' %
|
||||
(unicode(translate('OpenLP.ServiceManager', 'Notes')), cgi.escape(unicode(serviceitem.notes))))
|
||||
(translate('OpenLP.ServiceManager', 'Notes'), cgi.escape(serviceitem.notes)))
|
||||
if item[u'service_item'].is_capable(ItemCapabilities.HasVariableStartTime):
|
||||
tips.append(item[u'service_item'].get_media_time())
|
||||
treewidgetitem.setToolTip(0, u'<br>'.join(tips))
|
||||
treewidgetitem.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(item[u'order']))
|
||||
treewidgetitem.setData(0, QtCore.Qt.UserRole, item[u'order'])
|
||||
treewidgetitem.setSelected(item[u'selected'])
|
||||
# Add the children to their parent treewidgetitem.
|
||||
for count, frame in enumerate(serviceitem.get_frames()):
|
||||
child = QtGui.QTreeWidgetItem(treewidgetitem)
|
||||
text = frame[u'title'].replace(u'\n', u' ')
|
||||
child.setText(0, text[:40])
|
||||
child.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(count))
|
||||
child.setData(0, QtCore.Qt.UserRole, count)
|
||||
if serviceItem == itemcount:
|
||||
if item[u'expanded'] and serviceItemChild == count:
|
||||
self.serviceManagerList.setCurrentItem(child)
|
||||
|
@ -1120,10 +1112,9 @@ class ServiceManager(QtGui.QWidget):
|
|||
Set the theme for the current service.
|
||||
"""
|
||||
log.debug(u'onThemeComboBoxSelected')
|
||||
self.service_theme = unicode(self.themeComboBox.currentText())
|
||||
self.service_theme = self.themeComboBox.currentText()
|
||||
self.mainwindow.renderer.set_service_theme(self.service_theme)
|
||||
Settings().setValue(self.mainwindow.serviceManagerSettingsSection + u'/service theme',
|
||||
QtCore.QVariant(self.service_theme))
|
||||
Settings().setValue(self.mainwindow.serviceManagerSettingsSection + u'/service theme', self.service_theme)
|
||||
self.regenerateServiceItems(True)
|
||||
|
||||
def themeChange(self):
|
||||
|
@ -1156,9 +1147,9 @@ class ServiceManager(QtGui.QWidget):
|
|||
serviceIterator += 1
|
||||
if selectedItem is not None:
|
||||
if selectedItem.parent() is None:
|
||||
pos = selectedItem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||
pos = selectedItem.data(0, QtCore.Qt.UserRole)
|
||||
else:
|
||||
pos = selectedItem.parent().data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||
pos = selectedItem.parent().data(0, QtCore.Qt.UserRole)
|
||||
self.serviceItems[pos - 1][u'selected'] = True
|
||||
tempServiceItems = self.serviceItems
|
||||
self.serviceManagerList.clear()
|
||||
|
@ -1294,9 +1285,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
if self.serviceItems[item][u'service_item'].is_valid:
|
||||
self.mainwindow.liveController.addServiceManagerItem(
|
||||
self.serviceItems[item][u'service_item'], child)
|
||||
if Settings().value(
|
||||
self.mainwindow.generalSettingsSection + u'/auto preview',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
if Settings().value(self.mainwindow.generalSettingsSection + u'/auto preview', False):
|
||||
item += 1
|
||||
if self.serviceItems and item < len(self.serviceItems) and \
|
||||
self.serviceItems[item][u'service_item'].is_capable(ItemCapabilities.CanPreview):
|
||||
|
@ -1332,10 +1321,10 @@ class ServiceManager(QtGui.QWidget):
|
|||
for item in items:
|
||||
parentitem = item.parent()
|
||||
if parentitem is None:
|
||||
serviceItem = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||
serviceItem = item.data(0, QtCore.Qt.UserRole)
|
||||
else:
|
||||
serviceItem = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||
serviceItemChild = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||
serviceItem = parentitem.data(0, QtCore.Qt.UserRole)
|
||||
serviceItemChild = item.data(0, QtCore.Qt.UserRole)
|
||||
# Adjust for zero based arrays.
|
||||
serviceItem -= 1
|
||||
# Only process the first item on the list for this method.
|
||||
|
@ -1365,14 +1354,14 @@ class ServiceManager(QtGui.QWidget):
|
|||
event.setDropAction(QtCore.Qt.CopyAction)
|
||||
event.accept()
|
||||
for url in link.urls():
|
||||
filename = unicode(url.toLocalFile())
|
||||
filename = url.toLocalFile()
|
||||
if filename.endswith(u'.osz'):
|
||||
self.onLoadServiceClicked(filename)
|
||||
elif filename.endswith(u'.oszl'):
|
||||
# todo correct
|
||||
self.onLoadServiceClicked(filename)
|
||||
elif link.hasText():
|
||||
plugin = unicode(link.text())
|
||||
plugin = link.text()
|
||||
item = self.serviceManagerList.itemAt(event.pos())
|
||||
# ServiceManager started the drag and drop
|
||||
if plugin == u'ServiceManager':
|
||||
|
@ -1442,7 +1431,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
self.regenerateServiceItems()
|
||||
|
||||
def onThemeChangeAction(self):
|
||||
theme = unicode(self.sender().objectName())
|
||||
theme = self.sender().objectName()
|
||||
# No object name means that the "Default" theme is supposed to be used.
|
||||
if not theme:
|
||||
theme = None
|
||||
|
@ -1453,9 +1442,9 @@ class ServiceManager(QtGui.QWidget):
|
|||
def _getParentItemData(self, item):
|
||||
parentitem = item.parent()
|
||||
if parentitem is None:
|
||||
return item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||
return item.data(0, QtCore.Qt.UserRole)
|
||||
else:
|
||||
return parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||
return parentitem.data(0, QtCore.Qt.UserRole)
|
||||
|
||||
def printServiceOrder(self):
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -57,10 +57,8 @@ class ServiceNoteForm(QtGui.QDialog):
|
|||
self.textEdit = SpellTextEdit(self, False)
|
||||
self.textEdit.setObjectName(u'textEdit')
|
||||
self.dialogLayout.addWidget(self.textEdit)
|
||||
self.buttonBox = create_button_box(self, u'buttonBox',
|
||||
[u'cancel', u'save'])
|
||||
self.buttonBox = create_button_box(self, u'buttonBox', [u'cancel', u'save'])
|
||||
self.dialogLayout.addWidget(self.buttonBox)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.setWindowTitle(
|
||||
translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
|
||||
self.setWindowTitle(translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -36,29 +36,23 @@ class Ui_SettingsDialog(object):
|
|||
def setupUi(self, settingsDialog):
|
||||
settingsDialog.setObjectName(u'settingsDialog')
|
||||
settingsDialog.resize(800, 500)
|
||||
settingsDialog.setWindowIcon(
|
||||
build_icon(u':/system/system_settings.png'))
|
||||
settingsDialog.setWindowIcon(build_icon(u':/system/system_settings.png'))
|
||||
self.dialogLayout = QtGui.QGridLayout(settingsDialog)
|
||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
||||
self.dialogLayout.setMargin(8)
|
||||
self.settingListWidget = QtGui.QListWidget(settingsDialog)
|
||||
self.settingListWidget.setUniformItemSizes(True)
|
||||
self.settingListWidget.setMinimumSize(QtCore.QSize(150, 0))
|
||||
self.settingListWidget.setHorizontalScrollBarPolicy(
|
||||
QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.settingListWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.settingListWidget.setObjectName(u'settingListWidget')
|
||||
self.dialogLayout.addWidget(self.settingListWidget, 0, 0, 1, 1)
|
||||
self.stackedLayout = QtGui.QStackedLayout()
|
||||
self.stackedLayout.setObjectName(u'stackedLayout')
|
||||
self.dialogLayout.addLayout(self.stackedLayout, 0, 1, 1, 1)
|
||||
self.buttonBox = create_button_box(settingsDialog, u'buttonBox',
|
||||
[u'cancel', u'ok'])
|
||||
self.buttonBox = create_button_box(settingsDialog, u'buttonBox', [u'cancel', u'ok'])
|
||||
self.dialogLayout.addWidget(self.buttonBox, 1, 1, 1, 1)
|
||||
self.retranslateUi(settingsDialog)
|
||||
QtCore.QObject.connect(self.settingListWidget,
|
||||
QtCore.SIGNAL(u'currentRowChanged(int)'),
|
||||
self.tabChanged)
|
||||
QtCore.QObject.connect(self.settingListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.tabChanged)
|
||||
|
||||
def retranslateUi(self, settingsDialog):
|
||||
settingsDialog.setWindowTitle(translate('OpenLP.SettingsForm',
|
||||
'Configure OpenLP'))
|
||||
settingsDialog.setWindowTitle(translate('OpenLP.SettingsForm', 'Configure OpenLP'))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -81,27 +81,23 @@ class Ui_ShortcutListDialog(object):
|
|||
self.primaryPushButton = CaptureShortcutButton(shortcutListDialog)
|
||||
self.primaryPushButton.setObjectName(u'primaryPushButton')
|
||||
self.primaryPushButton.setMinimumSize(QtCore.QSize(84, 0))
|
||||
self.primaryPushButton.setIcon(
|
||||
build_icon(u':/system/system_configure_shortcuts.png'))
|
||||
self.primaryPushButton.setIcon(build_icon(u':/system/system_configure_shortcuts.png'))
|
||||
self.primaryLayout.addWidget(self.primaryPushButton)
|
||||
self.clearPrimaryButton = QtGui.QToolButton(shortcutListDialog)
|
||||
self.clearPrimaryButton.setObjectName(u'clearPrimaryButton')
|
||||
self.clearPrimaryButton.setMinimumSize(QtCore.QSize(0, 16))
|
||||
self.clearPrimaryButton.setIcon(
|
||||
build_icon(u':/system/clear_shortcut.png'))
|
||||
self.clearPrimaryButton.setIcon(build_icon(u':/system/clear_shortcut.png'))
|
||||
self.primaryLayout.addWidget(self.clearPrimaryButton)
|
||||
self.detailsLayout.addLayout(self.primaryLayout, 1, 1, 1, 1)
|
||||
self.alternateLayout = QtGui.QHBoxLayout()
|
||||
self.alternateLayout.setObjectName(u'alternateLayout')
|
||||
self.alternatePushButton = CaptureShortcutButton(shortcutListDialog)
|
||||
self.alternatePushButton.setObjectName(u'alternatePushButton')
|
||||
self.alternatePushButton.setIcon(
|
||||
build_icon(u':/system/system_configure_shortcuts.png'))
|
||||
self.alternatePushButton.setIcon(build_icon(u':/system/system_configure_shortcuts.png'))
|
||||
self.alternateLayout.addWidget(self.alternatePushButton)
|
||||
self.clearAlternateButton = QtGui.QToolButton(shortcutListDialog)
|
||||
self.clearAlternateButton.setObjectName(u'clearAlternateButton')
|
||||
self.clearAlternateButton.setIcon(
|
||||
build_icon(u':/system/clear_shortcut.png'))
|
||||
self.clearAlternateButton.setIcon(build_icon(u':/system/clear_shortcut.png'))
|
||||
self.alternateLayout.addWidget(self.clearAlternateButton)
|
||||
self.detailsLayout.addLayout(self.alternateLayout, 1, 2, 1, 1)
|
||||
self.primaryLabel = QtGui.QLabel(shortcutListDialog)
|
||||
|
@ -111,33 +107,24 @@ class Ui_ShortcutListDialog(object):
|
|||
self.alternateLabel.setObjectName(u'alternateLabel')
|
||||
self.detailsLayout.addWidget(self.alternateLabel, 0, 2, 1, 1)
|
||||
self.shortcutListLayout.addLayout(self.detailsLayout)
|
||||
self.buttonBox = create_button_box(shortcutListDialog, u'buttonBox',
|
||||
[u'cancel', u'ok', u'defaults'])
|
||||
self.buttonBox = create_button_box(shortcutListDialog, u'buttonBox', [u'cancel', u'ok', u'defaults'])
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.shortcutListLayout.addWidget(self.buttonBox)
|
||||
self.retranslateUi(shortcutListDialog)
|
||||
|
||||
def retranslateUi(self, shortcutListDialog):
|
||||
shortcutListDialog.setWindowTitle(
|
||||
translate('OpenLP.ShortcutListDialog', 'Configure Shortcuts'))
|
||||
self.descriptionLabel.setText(translate('OpenLP.ShortcutListDialog',
|
||||
'Select an action and click one of the buttons below to start '
|
||||
'capturing a new primary or alternate shortcut, respectively.'))
|
||||
self.treeWidget.setHeaderLabels([
|
||||
translate('OpenLP.ShortcutListDialog', 'Action'),
|
||||
shortcutListDialog.setWindowTitle(translate('OpenLP.ShortcutListDialog', 'Configure Shortcuts'))
|
||||
self.descriptionLabel.setText(
|
||||
translate('OpenLP.ShortcutListDialog', 'Select an action and click one of the buttons below to start '
|
||||
'capturing a new primary or alternate shortcut, respectively.'))
|
||||
self.treeWidget.setHeaderLabels([translate('OpenLP.ShortcutListDialog', 'Action'),
|
||||
translate('OpenLP.ShortcutListDialog', 'Shortcut'),
|
||||
translate('OpenLP.ShortcutListDialog', 'Alternate')])
|
||||
self.defaultRadioButton.setText(
|
||||
translate('OpenLP.ShortcutListDialog', 'Default'))
|
||||
self.customRadioButton.setText(
|
||||
translate('OpenLP.ShortcutListDialog', 'Custom'))
|
||||
self.primaryPushButton.setToolTip(
|
||||
translate('OpenLP.ShortcutListDialog', 'Capture shortcut.'))
|
||||
self.alternatePushButton.setToolTip(
|
||||
translate('OpenLP.ShortcutListDialog', 'Capture shortcut.'))
|
||||
self.clearPrimaryButton.setToolTip(
|
||||
translate('OpenLP.ShortcutListDialog',
|
||||
self.defaultRadioButton.setText(translate('OpenLP.ShortcutListDialog', 'Default'))
|
||||
self.customRadioButton.setText(translate('OpenLP.ShortcutListDialog', 'Custom'))
|
||||
self.primaryPushButton.setToolTip(translate('OpenLP.ShortcutListDialog', 'Capture shortcut.'))
|
||||
self.alternatePushButton.setToolTip(translate('OpenLP.ShortcutListDialog', 'Capture shortcut.'))
|
||||
self.clearPrimaryButton.setToolTip(translate('OpenLP.ShortcutListDialog',
|
||||
'Restore the default shortcut of this action.'))
|
||||
self.clearAlternateButton.setToolTip(
|
||||
translate('OpenLP.ShortcutListDialog',
|
||||
self.clearAlternateButton.setToolTip(translate('OpenLP.ShortcutListDialog',
|
||||
'Restore the default shortcut of this action.'))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -32,8 +32,7 @@ import re
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import Receiver, Settings
|
||||
from openlp.core.utils import translate
|
||||
from openlp.core.utils.actions import ActionList
|
||||
from shortcutlistdialog import Ui_ShortcutListDialog
|
||||
|
@ -52,57 +51,49 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
self.setupUi(self)
|
||||
self.changedActions = {}
|
||||
self.action_list = ActionList.get_instance()
|
||||
QtCore.QObject.connect(self.primaryPushButton,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.onPrimaryPushButtonClicked)
|
||||
QtCore.QObject.connect(self.alternatePushButton,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.onAlternatePushButtonClicked)
|
||||
QtCore.QObject.connect(self.treeWidget, QtCore.SIGNAL(
|
||||
u'currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)'),
|
||||
self.onCurrentItemChanged)
|
||||
QtCore.QObject.connect(self.primaryPushButton, QtCore.SIGNAL(u'toggled(bool)'),
|
||||
self.onPrimaryPushButtonClicked)
|
||||
QtCore.QObject.connect(self.alternatePushButton, QtCore.SIGNAL(u'toggled(bool)'),
|
||||
self.onAlternatePushButtonClicked)
|
||||
QtCore.QObject.connect(self.treeWidget,
|
||||
QtCore.SIGNAL(u'itemDoubleClicked(QTreeWidgetItem*, int)'),
|
||||
QtCore.SIGNAL(u'currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)'), self.onCurrentItemChanged)
|
||||
QtCore.QObject.connect(self.treeWidget, QtCore.SIGNAL(u'itemDoubleClicked(QTreeWidgetItem*, int)'),
|
||||
self.onItemDoubleClicked)
|
||||
QtCore.QObject.connect(self.clearPrimaryButton,
|
||||
QtCore.SIGNAL(u'clicked(bool)'), self.onClearPrimaryButtonClicked)
|
||||
QtCore.QObject.connect(self.clearAlternateButton,
|
||||
QtCore.SIGNAL(u'clicked(bool)'), self.onClearAlternateButtonClicked)
|
||||
QtCore.QObject.connect(self.buttonBox,
|
||||
QtCore.SIGNAL(u'clicked(QAbstractButton*)'),
|
||||
QtCore.QObject.connect(self.clearPrimaryButton, QtCore.SIGNAL(u'clicked(bool)'),
|
||||
self.onClearPrimaryButtonClicked)
|
||||
QtCore.QObject.connect(self.clearAlternateButton, QtCore.SIGNAL(u'clicked(bool)'),
|
||||
self.onClearAlternateButtonClicked)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'clicked(QAbstractButton*)'),
|
||||
self.onRestoreDefaultsClicked)
|
||||
QtCore.QObject.connect(self.defaultRadioButton,
|
||||
QtCore.SIGNAL(u'clicked(bool)'), self.onDefaultRadioButtonClicked)
|
||||
QtCore.QObject.connect(self.customRadioButton,
|
||||
QtCore.SIGNAL(u'clicked(bool)'), self.onCustomRadioButtonClicked)
|
||||
QtCore.QObject.connect(self.defaultRadioButton, QtCore.SIGNAL(u'clicked(bool)'),
|
||||
self.onDefaultRadioButtonClicked)
|
||||
QtCore.QObject.connect(self.customRadioButton, QtCore.SIGNAL(u'clicked(bool)'),
|
||||
self.onCustomRadioButtonClicked)
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
if event.key() == QtCore.Qt.Key_Space:
|
||||
self.keyReleaseEvent(event)
|
||||
elif self.primaryPushButton.isChecked() or \
|
||||
self.alternatePushButton.isChecked():
|
||||
elif self.primaryPushButton.isChecked() or self.alternatePushButton.isChecked():
|
||||
event.ignore()
|
||||
elif event.key() == QtCore.Qt.Key_Escape:
|
||||
event.accept()
|
||||
self.close()
|
||||
|
||||
def keyReleaseEvent(self, event):
|
||||
if not self.primaryPushButton.isChecked() and \
|
||||
not self.alternatePushButton.isChecked():
|
||||
if not self.primaryPushButton.isChecked() and not self.alternatePushButton.isChecked():
|
||||
return
|
||||
key = event.key()
|
||||
if key == QtCore.Qt.Key_Shift or key == QtCore.Qt.Key_Control or \
|
||||
key == QtCore.Qt.Key_Meta or key == QtCore.Qt.Key_Alt:
|
||||
return
|
||||
key_string = QtGui.QKeySequence(key).toString()
|
||||
if event.modifiers() & QtCore.Qt.ControlModifier == \
|
||||
QtCore.Qt.ControlModifier:
|
||||
if event.modifiers() & QtCore.Qt.ControlModifier == QtCore.Qt.ControlModifier:
|
||||
key_string = u'Ctrl+' + key_string
|
||||
if event.modifiers() & QtCore.Qt.AltModifier == QtCore.Qt.AltModifier:
|
||||
key_string = u'Alt+' + key_string
|
||||
if event.modifiers() & QtCore.Qt.ShiftModifier == \
|
||||
QtCore.Qt.ShiftModifier:
|
||||
if event.modifiers() & QtCore.Qt.ShiftModifier == QtCore.Qt.ShiftModifier:
|
||||
key_string = u'Shift+' + key_string
|
||||
if event.modifiers() & QtCore.Qt.MetaModifier == \
|
||||
QtCore.Qt.MetaModifier:
|
||||
if event.modifiers() & QtCore.Qt.MetaModifier == QtCore.Qt.MetaModifier:
|
||||
key_string = u'Meta+' + key_string
|
||||
key_sequence = QtGui.QKeySequence(key_string)
|
||||
if self._validiate_shortcut(self._currentItemAction(), key_sequence):
|
||||
|
@ -131,11 +122,10 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
continue
|
||||
item = QtGui.QTreeWidgetItem([category.name])
|
||||
for action in category.actions:
|
||||
actionText = REMOVE_AMPERSAND.sub('', unicode(action.text()))
|
||||
actionText = REMOVE_AMPERSAND.sub('', action.text())
|
||||
actionItem = QtGui.QTreeWidgetItem([actionText])
|
||||
actionItem.setIcon(0, action.icon())
|
||||
actionItem.setData(0,
|
||||
QtCore.Qt.UserRole, QtCore.QVariant(action))
|
||||
actionItem.setData(0, QtCore.Qt.UserRole, action)
|
||||
item.addChild(actionItem)
|
||||
self.treeWidget.addTopLevelItem(item)
|
||||
item.setExpanded(True)
|
||||
|
@ -274,8 +264,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
# been triggered by a signal.
|
||||
if item is None:
|
||||
return
|
||||
if primary_label_text == primary_text and \
|
||||
alternate_label_text == alternate_text:
|
||||
if primary_label_text == primary_text and alternate_label_text == alternate_text:
|
||||
self.defaultRadioButton.toggle()
|
||||
else:
|
||||
self.customRadioButton.toggle()
|
||||
|
@ -284,15 +273,12 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
"""
|
||||
Restores all default shortcuts.
|
||||
"""
|
||||
if self.buttonBox.buttonRole(button) != \
|
||||
QtGui.QDialogButtonBox.ResetRole:
|
||||
if self.buttonBox.buttonRole(button) != QtGui.QDialogButtonBox.ResetRole:
|
||||
return
|
||||
if QtGui.QMessageBox.question(self,
|
||||
translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),
|
||||
if QtGui.QMessageBox.question(self, translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),
|
||||
translate('OpenLP.ShortcutListDialog', 'Do you want to restore all '
|
||||
'shortcuts to their defaults?'), QtGui.QMessageBox.StandardButtons(
|
||||
QtGui.QMessageBox.Yes |
|
||||
QtGui.QMessageBox.No)) == QtGui.QMessageBox.No:
|
||||
'shortcuts to their defaults?'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == QtGui.QMessageBox.No:
|
||||
return
|
||||
self._adjustButton(self.primaryPushButton, False, text=u'')
|
||||
self._adjustButton(self.alternatePushButton, False, text=u'')
|
||||
|
@ -352,8 +338,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
map(QtGui.QKeySequence.toString, action.shortcuts()))
|
||||
action.setShortcuts(self.changedActions[action])
|
||||
self.action_list.update_shortcut_map(action, old_shortcuts)
|
||||
settings.setValue(
|
||||
action.objectName(), QtCore.QVariant(action.shortcuts()))
|
||||
settings.setValue(action.objectName(), action.shortcuts())
|
||||
settings.endGroup()
|
||||
|
||||
def onClearPrimaryButtonClicked(self, toggled):
|
||||
|
@ -375,8 +360,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
# shortcut (not the default one) will become primary shortcut, thus
|
||||
# the check will assume that an action were going to have the same
|
||||
# shortcut twice.
|
||||
if not self._validiate_shortcut(action, new_shortcuts[0]) and \
|
||||
new_shortcuts[0] != shortcuts[0]:
|
||||
if not self._validiate_shortcut(action, new_shortcuts[0]) and new_shortcuts[0] != shortcuts[0]:
|
||||
return
|
||||
if len(shortcuts) == 2:
|
||||
new_shortcuts.append(shortcuts[1])
|
||||
|
@ -424,11 +408,9 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
if key_sequence not in shortcuts:
|
||||
continue
|
||||
if action is changing_action:
|
||||
if self.primaryPushButton.isChecked() and \
|
||||
shortcuts.index(key_sequence) == 0:
|
||||
if self.primaryPushButton.isChecked() and shortcuts.index(key_sequence) == 0:
|
||||
continue
|
||||
if self.alternatePushButton.isChecked() and \
|
||||
shortcuts.index(key_sequence) == 1:
|
||||
if self.alternatePushButton.isChecked() and shortcuts.index(key_sequence) == 1:
|
||||
continue
|
||||
# Have the same parent, thus they cannot have the same shortcut.
|
||||
if action.parent() is changing_action.parent():
|
||||
|
@ -439,16 +421,14 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
if action.shortcutContext() in [QtCore.Qt.WindowShortcut,
|
||||
QtCore.Qt.ApplicationShortcut]:
|
||||
is_valid = False
|
||||
if changing_action.shortcutContext() in \
|
||||
[QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]:
|
||||
if changing_action.shortcutContext() in [QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]:
|
||||
is_valid = False
|
||||
if not is_valid:
|
||||
Receiver.send_message(u'openlp_warning_message', {
|
||||
u'title': translate('OpenLP.ShortcutListDialog',
|
||||
'Duplicate Shortcut'),
|
||||
u'message': unicode(translate('OpenLP.ShortcutListDialog',
|
||||
'The shortcut "%s" is already assigned to another action, '
|
||||
'please use a different shortcut.')) % key_sequence.toString()
|
||||
u'title': translate('OpenLP.ShortcutListDialog', 'Duplicate Shortcut'),
|
||||
u'message': translate('OpenLP.ShortcutListDialog',
|
||||
'The shortcut "%s" is already assigned to another action, '
|
||||
'please use a different shortcut.') % key_sequence.toString()
|
||||
})
|
||||
return is_valid
|
||||
|
||||
|
@ -471,7 +451,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
item = self.treeWidget.currentItem()
|
||||
if item is None:
|
||||
return
|
||||
return item.data(0, QtCore.Qt.UserRole).toPyObject()
|
||||
return item.data(0, QtCore.Qt.UserRole)
|
||||
|
||||
def _adjustButton(self, button, checked=None, enabled=None, text=None):
|
||||
"""
|
||||
|
|
|
@ -35,9 +35,10 @@ from collections import deque
|
|||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
|
||||
translate, build_icon, build_html, PluginManager, ServiceItem, ImageSource
|
||||
translate, build_icon, build_html, PluginManager, ServiceItem, \
|
||||
ImageSource, SlideLimits, ServiceItemAction, Settings
|
||||
from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList
|
||||
from openlp.core.lib.ui import UiStrings, create_action
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import SlideLimits, ServiceItemAction
|
||||
from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList, \
|
||||
DisplayControllerType
|
||||
|
@ -205,13 +206,12 @@ class SlideController(DisplayController):
|
|||
self.playSlidesMenu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Play Slides'), self.toolbar))
|
||||
self.toolbar.addToolbarWidget(self.playSlidesMenu)
|
||||
self.playSlidesLoop = create_action(self, u'playSlidesLoop', text=UiStrings().PlaySlidesInLoop,
|
||||
icon=u':/media/media_time.png', checked=False, shortcuts=[], category=self.category,
|
||||
triggers=self.onPlaySlidesLoop)
|
||||
icon=u':/media/media_time.png', checked=False, shortcuts=[],
|
||||
category=self.category, triggers=self.onPlaySlidesLoop)
|
||||
self.playSlidesOnce = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd,
|
||||
icon=u':/media/media_time.png', checked=False, shortcuts=[], category=self.category,
|
||||
triggers=self.onPlaySlidesOnce)
|
||||
if Settings().value(self.parent().generalSettingsSection + u'/enable slide loop',
|
||||
QtCore.QVariant(True)).toBool():
|
||||
icon=u':/media/media_time.png', checked=False, shortcuts=[],
|
||||
category=self.category, triggers=self.onPlaySlidesOnce)
|
||||
if Settings().value(self.parent().generalSettingsSection + u'/enable slide loop', True):
|
||||
self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
|
||||
else:
|
||||
self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
|
||||
|
@ -392,7 +392,7 @@ class SlideController(DisplayController):
|
|||
SONGS_PLUGIN_AVAILABLE = True
|
||||
except ImportError:
|
||||
SONGS_PLUGIN_AVAILABLE = False
|
||||
sender_name = unicode(self.sender().objectName())
|
||||
sender_name = self.sender().objectName()
|
||||
verse_type = sender_name[15:] if sender_name[:15] == u'shortcutAction_' else u''
|
||||
if SONGS_PLUGIN_AVAILABLE:
|
||||
if verse_type == u'V':
|
||||
|
@ -570,7 +570,7 @@ class SlideController(DisplayController):
|
|||
self.previewListWidget.setRowHeight(framenumber, width / self.ratio)
|
||||
|
||||
def onSongBarHandler(self):
|
||||
request = unicode(self.sender().text())
|
||||
request = self.sender().text()
|
||||
slide_no = self.slideList[request]
|
||||
self.__updatePreviewSelection(slide_no)
|
||||
self.slideSelected()
|
||||
|
@ -585,8 +585,7 @@ class SlideController(DisplayController):
|
|||
"""
|
||||
Updates the Slide Limits variable from the settings.
|
||||
"""
|
||||
self.slide_limits = Settings().value(self.parent().advancedSettingsSection + u'/slide limits',
|
||||
QtCore.QVariant(SlideLimits.End)).toInt()[0]
|
||||
self.slide_limits = Settings().value(self.parent().advancedSettingsSection + u'/slide limits', SlideLimits.End)
|
||||
|
||||
def enableToolBar(self, item):
|
||||
"""
|
||||
|
@ -614,8 +613,7 @@ class SlideController(DisplayController):
|
|||
self.playSlidesLoop.setChecked(False)
|
||||
self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
|
||||
if item.is_text():
|
||||
if Settings().value(self.parent().songsSettingsSection + u'/display songbar',
|
||||
QtCore.QVariant(True)).toBool() and self.slideList:
|
||||
if Settings().value(self.parent().songsSettingsSection + u'/display songbar', True) and self.slideList:
|
||||
self.songMenu.show()
|
||||
if item.is_capable(ItemCapabilities.CanLoop) and len(item.get_frames()) > 1:
|
||||
self.toolbar.setWidgetVisible(self.loopList)
|
||||
|
@ -729,9 +727,8 @@ class SlideController(DisplayController):
|
|||
action.setData(counter)
|
||||
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), self.onTrackTriggered)
|
||||
self.display.audioPlayer.repeat = Settings().value(
|
||||
self.parent().generalSettingsSection + u'/audio repeat list', QtCore.QVariant(False)).toBool()
|
||||
if Settings().value(
|
||||
self.parent().generalSettingsSection + u'/audio start paused', QtCore.QVariant(True)).toBool():
|
||||
self.parent().generalSettingsSection + u'/audio repeat list', False)
|
||||
if Settings().value(self.parent().generalSettingsSection + u'/audio start paused', True):
|
||||
self.audioPauseItem.setChecked(True)
|
||||
self.display.audioPlayer.pause()
|
||||
else:
|
||||
|
@ -841,7 +838,7 @@ class SlideController(DisplayController):
|
|||
"""
|
||||
log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
|
||||
display_type = Settings().value(self.parent().generalSettingsSection + u'/screen blank',
|
||||
QtCore.QVariant(u'')).toString()
|
||||
u'')
|
||||
if self.screens.which_screen(self.window()) != self.screens.which_screen(self.display):
|
||||
# Order done to handle initial conversion
|
||||
if display_type == u'themed':
|
||||
|
@ -879,7 +876,7 @@ class SlideController(DisplayController):
|
|||
self.themeScreen.setChecked(False)
|
||||
self.desktopScreen.setChecked(False)
|
||||
if checked:
|
||||
Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'blanked'))
|
||||
Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', u'blanked')
|
||||
else:
|
||||
Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
|
||||
self.blankPlugin()
|
||||
|
@ -897,7 +894,7 @@ class SlideController(DisplayController):
|
|||
self.themeScreen.setChecked(checked)
|
||||
self.desktopScreen.setChecked(False)
|
||||
if checked:
|
||||
Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'themed'))
|
||||
Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', u'themed')
|
||||
else:
|
||||
Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
|
||||
self.blankPlugin()
|
||||
|
@ -915,7 +912,7 @@ class SlideController(DisplayController):
|
|||
self.themeScreen.setChecked(False)
|
||||
self.desktopScreen.setChecked(checked)
|
||||
if checked:
|
||||
Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'hidden'))
|
||||
Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', u'hidden')
|
||||
else:
|
||||
Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
|
||||
self.hidePlugin(checked)
|
||||
|
@ -1195,7 +1192,7 @@ class SlideController(DisplayController):
|
|||
"""
|
||||
triggered by clicking the Preview slide items
|
||||
"""
|
||||
if Settings().value(u'advanced/double click live', QtCore.QVariant(False)).toBool():
|
||||
if Settings().value(u'advanced/double click live', False):
|
||||
# Live and Preview have issues if we have video or presentations
|
||||
# playing in both at the same time.
|
||||
if self.serviceItem.is_command():
|
||||
|
@ -1275,5 +1272,4 @@ class SlideController(DisplayController):
|
|||
|
||||
def onTrackTriggered(self):
|
||||
action = self.sender()
|
||||
index = action.data().toInt()[0]
|
||||
self.display.audioPlayer.goTo(index)
|
||||
self.display.audioPlayer.goTo(action.data())
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -34,8 +34,7 @@ class SplashScreen(QtGui.QSplashScreen):
|
|||
def __init__(self):
|
||||
QtGui.QSplashScreen.__init__(self)
|
||||
self.setupUi()
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'close_splash'), self.close)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'close_splash'), self.close)
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'splashScreen')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -101,15 +101,13 @@ class Ui_StartTimeDialog(object):
|
|||
self.secondFinishLabel.setAlignment(QtCore.Qt.AlignRight)
|
||||
self.dialogLayout.addWidget(self.secondFinishLabel, 3, 3, 1, 1)
|
||||
self.dialogLayout.addWidget(self.secondSpinBox, 3, 1, 1, 1)
|
||||
self.buttonBox = create_button_box(StartTimeDialog, u'buttonBox',
|
||||
[u'cancel', u'ok'])
|
||||
self.buttonBox = create_button_box(StartTimeDialog, u'buttonBox', [u'cancel', u'ok'])
|
||||
self.dialogLayout.addWidget(self.buttonBox, 5, 2, 1, 2)
|
||||
self.retranslateUi(StartTimeDialog)
|
||||
self.setMaximumHeight(self.sizeHint().height())
|
||||
|
||||
def retranslateUi(self, StartTimeDialog):
|
||||
self.setWindowTitle(translate('OpenLP.StartTimeForm',
|
||||
'Item Start and Finish Time'))
|
||||
self.setWindowTitle(translate('OpenLP.StartTimeForm', 'Item Start and Finish Time'))
|
||||
self.hourSpinBox.setSuffix(UiStrings().Hours)
|
||||
self.minuteSpinBox.setSuffix(UiStrings().Minutes)
|
||||
self.secondSpinBox.setSuffix(UiStrings().Seconds)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -46,22 +46,17 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
|
|||
"""
|
||||
Run the Dialog with correct heading.
|
||||
"""
|
||||
hour, minutes, seconds = self._time_split(
|
||||
self.item[u'service_item'].start_time)
|
||||
hour, minutes, seconds = self._time_split(self.item[u'service_item'].start_time)
|
||||
self.hourSpinBox.setValue(hour)
|
||||
self.minuteSpinBox.setValue(minutes)
|
||||
self.secondSpinBox.setValue(seconds)
|
||||
hours, minutes, seconds = self._time_split(
|
||||
self.item[u'service_item'].media_length)
|
||||
hours, minutes, seconds = self._time_split(self.item[u'service_item'].media_length)
|
||||
self.hourFinishSpinBox.setValue(hours)
|
||||
self.minuteFinishSpinBox.setValue(minutes)
|
||||
self.secondFinishSpinBox.setValue(seconds)
|
||||
self.hourFinishLabel.setText(u'%s%s' % (unicode(hour),
|
||||
UiStrings().Hours))
|
||||
self.minuteFinishLabel.setText(u'%s%s' %
|
||||
(unicode(minutes), UiStrings().Minutes))
|
||||
self.secondFinishLabel.setText(u'%s%s' %
|
||||
(unicode(seconds), UiStrings().Seconds))
|
||||
self.hourFinishLabel.setText(u'%s%s' % (unicode(hour), UiStrings().Hours))
|
||||
self.minuteFinishLabel.setText(u'%s%s' % (unicode(minutes), UiStrings().Minutes))
|
||||
self.secondFinishLabel.setText(u'%s%s' % (unicode(seconds), UiStrings().Seconds))
|
||||
return QtGui.QDialog.exec_(self)
|
||||
|
||||
def accept(self):
|
||||
|
@ -72,18 +67,12 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
|
|||
self.minuteFinishSpinBox.value() * 60 + \
|
||||
self.secondFinishSpinBox.value()
|
||||
if end > self.item[u'service_item'].media_length:
|
||||
critical_error_message_box(
|
||||
title=translate('OpenLP.StartTimeForm',
|
||||
'Time Validation Error'),
|
||||
message=translate('OpenLP.StartTimeForm',
|
||||
'Finish time is set after the end of the media item'))
|
||||
critical_error_message_box(title=translate('OpenLP.StartTimeForm', 'Time Validation Error'),
|
||||
message=translate('OpenLP.StartTimeForm', 'Finish time is set after the end of the media item'))
|
||||
return
|
||||
elif start > end:
|
||||
critical_error_message_box(
|
||||
title=translate('OpenLP.StartTimeForm',
|
||||
'Time Validation Error'),
|
||||
message=translate('OpenLP.StartTimeForm',
|
||||
'Start time is after the finish time of the media item'))
|
||||
critical_error_message_box(title=translate('OpenLP.StartTimeForm', 'Time Validation Error'),
|
||||
message=translate('OpenLP.StartTimeForm', 'Start time is after the finish time of the media item'))
|
||||
return
|
||||
self.item[u'service_item'].start_time = start
|
||||
self.item[u'service_item'].end_time = end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -62,63 +62,38 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
self.updateThemeAllowed = True
|
||||
self.temp_background_filename = u''
|
||||
self.themeLayoutForm = ThemeLayoutForm(self)
|
||||
QtCore.QObject.connect(self.backgroundComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
QtCore.QObject.connect(self.backgroundComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
self.onBackgroundComboBoxCurrentIndexChanged)
|
||||
QtCore.QObject.connect(self.gradientComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
QtCore.QObject.connect(self.gradientComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
self.onGradientComboBoxCurrentIndexChanged)
|
||||
QtCore.QObject.connect(self.colorButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onColorButtonClicked)
|
||||
QtCore.QObject.connect(self.imageColorButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onImageColorButtonClicked)
|
||||
QtCore.QObject.connect(self.gradientStartButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onGradientStartButtonClicked)
|
||||
QtCore.QObject.connect(self.gradientEndButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onGradientEndButtonClicked)
|
||||
QtCore.QObject.connect(self.imageBrowseButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onImageBrowseButtonClicked)
|
||||
QtCore.QObject.connect(self.mainColorButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onMainColorButtonClicked)
|
||||
QtCore.QObject.connect(self.outlineColorButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onOutlineColorButtonClicked)
|
||||
QtCore.QObject.connect(self.shadowColorButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onShadowColorButtonClicked)
|
||||
QtCore.QObject.connect(self.outlineCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
QtCore.QObject.connect(self.colorButton, QtCore.SIGNAL(u'clicked()'), self.onColorButtonClicked)
|
||||
QtCore.QObject.connect(self.imageColorButton, QtCore.SIGNAL(u'clicked()'), self.onImageColorButtonClicked)
|
||||
QtCore.QObject.connect(self.gradientStartButton, QtCore.SIGNAL(u'clicked()'),
|
||||
self.onGradientStartButtonClicked)
|
||||
QtCore.QObject.connect(self.gradientEndButton, QtCore.SIGNAL(u'clicked()'), self.onGradientEndButtonClicked)
|
||||
QtCore.QObject.connect(self.imageBrowseButton, QtCore.SIGNAL(u'clicked()'), self.onImageBrowseButtonClicked)
|
||||
QtCore.QObject.connect(self.mainColorButton, QtCore.SIGNAL(u'clicked()'), self.onMainColorButtonClicked)
|
||||
QtCore.QObject.connect(self.outlineColorButton, QtCore.SIGNAL(u'clicked()'), self.onOutlineColorButtonClicked)
|
||||
QtCore.QObject.connect(self.shadowColorButton, QtCore.SIGNAL(u'clicked()'), self.onShadowColorButtonClicked)
|
||||
QtCore.QObject.connect(self.outlineCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onOutlineCheckCheckBoxStateChanged)
|
||||
QtCore.QObject.connect(self.shadowCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
QtCore.QObject.connect(self.shadowCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onShadowCheckCheckBoxStateChanged)
|
||||
QtCore.QObject.connect(self.footerColorButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onFooterColorButtonClicked)
|
||||
QtCore.QObject.connect(self,
|
||||
QtCore.SIGNAL(u'customButtonClicked(int)'),
|
||||
self.onCustom1ButtonClicked)
|
||||
QtCore.QObject.connect(self.mainPositionCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
QtCore.QObject.connect(self.footerColorButton,QtCore.SIGNAL(u'clicked()'), self.onFooterColorButtonClicked)
|
||||
QtCore.QObject.connect(self, QtCore.SIGNAL(u'customButtonClicked(int)'), self.onCustom1ButtonClicked)
|
||||
QtCore.QObject.connect(self.mainPositionCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onMainPositionCheckBoxStateChanged)
|
||||
QtCore.QObject.connect(self.footerPositionCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
QtCore.QObject.connect(self.footerPositionCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onFooterPositionCheckBoxStateChanged)
|
||||
QtCore.QObject.connect(self,
|
||||
QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'theme_line_count'), self.updateLinesText)
|
||||
QtCore.QObject.connect(self.mainSizeSpinBox,
|
||||
QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
|
||||
QtCore.QObject.connect(self.lineSpacingSpinBox,
|
||||
QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
|
||||
QtCore.QObject.connect(self.outlineSizeSpinBox,
|
||||
QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
|
||||
QtCore.QObject.connect(self.shadowSizeSpinBox,
|
||||
QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
|
||||
QtCore.QObject.connect(self.mainFontComboBox,
|
||||
QtCore.SIGNAL(u'activated(int)'), self.calculateLines)
|
||||
QtCore.QObject.connect(self.footerFontComboBox,
|
||||
QtCore.SIGNAL(u'activated(int)'), self.updateTheme)
|
||||
QtCore.QObject.connect(self.footerSizeSpinBox,
|
||||
QtCore.SIGNAL(u'valueChanged(int)'), self.updateTheme)
|
||||
QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_line_count'), self.updateLinesText)
|
||||
QtCore.QObject.connect(self.mainSizeSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
|
||||
QtCore.QObject.connect(self.lineSpacingSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
|
||||
QtCore.QObject.connect(self.outlineSizeSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
|
||||
QtCore.QObject.connect(self.shadowSizeSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
|
||||
QtCore.QObject.connect(self.mainFontComboBox, QtCore.SIGNAL(u'activated(int)'), self.calculateLines)
|
||||
QtCore.QObject.connect(self.footerFontComboBox, QtCore.SIGNAL(u'activated(int)'), self.updateTheme)
|
||||
QtCore.QObject.connect(self.footerSizeSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.updateTheme)
|
||||
|
||||
def setDefaults(self):
|
||||
"""
|
||||
|
@ -136,61 +111,35 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
"""
|
||||
Map field names to screen names,
|
||||
"""
|
||||
self.backgroundPage.registerField(
|
||||
u'background_type', self.backgroundComboBox)
|
||||
self.backgroundPage.registerField(u'background_type', self.backgroundComboBox)
|
||||
self.backgroundPage.registerField(u'color', self.colorButton)
|
||||
self.backgroundPage.registerField(
|
||||
u'grandient_start', self.gradientStartButton)
|
||||
self.backgroundPage.registerField(
|
||||
u'grandient_end', self.gradientEndButton)
|
||||
self.backgroundPage.registerField(
|
||||
u'background_image', self.imageFileEdit)
|
||||
self.backgroundPage.registerField(u'grandient_start', self.gradientStartButton)
|
||||
self.backgroundPage.registerField(u'grandient_end', self.gradientEndButton)
|
||||
self.backgroundPage.registerField(u'background_image', self.imageFileEdit)
|
||||
self.backgroundPage.registerField(u'gradient', self.gradientComboBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'mainColorButton', self.mainColorButton)
|
||||
self.mainAreaPage.registerField(
|
||||
u'mainSizeSpinBox', self.mainSizeSpinBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'lineSpacingSpinBox', self.lineSpacingSpinBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'outlineCheckBox', self.outlineCheckBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'outlineColorButton', self.outlineColorButton)
|
||||
self.mainAreaPage.registerField(
|
||||
u'outlineSizeSpinBox', self.outlineSizeSpinBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'shadowCheckBox', self.shadowCheckBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'mainBoldCheckBox', self.mainBoldCheckBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'mainItalicsCheckBox', self.mainItalicsCheckBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'shadowColorButton', self.shadowColorButton)
|
||||
self.mainAreaPage.registerField(
|
||||
u'shadowSizeSpinBox', self.shadowSizeSpinBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'footerSizeSpinBox', self.footerSizeSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'mainPositionX', self.mainXSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'mainPositionY', self.mainYSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'mainPositionWidth', self.mainWidthSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'mainPositionHeight', self.mainHeightSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'footerPositionX', self.footerXSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'footerPositionY', self.footerYSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'footerPositionWidth', self.footerWidthSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'footerPositionHeight', self.footerHeightSpinBox)
|
||||
self.backgroundPage.registerField(
|
||||
u'horizontal', self.horizontalComboBox)
|
||||
self.mainAreaPage.registerField(u'mainColorButton', self.mainColorButton)
|
||||
self.mainAreaPage.registerField(u'mainSizeSpinBox', self.mainSizeSpinBox)
|
||||
self.mainAreaPage.registerField(u'lineSpacingSpinBox', self.lineSpacingSpinBox)
|
||||
self.mainAreaPage.registerField(u'outlineCheckBox', self.outlineCheckBox)
|
||||
self.mainAreaPage.registerField(u'outlineColorButton', self.outlineColorButton)
|
||||
self.mainAreaPage.registerField(u'outlineSizeSpinBox', self.outlineSizeSpinBox)
|
||||
self.mainAreaPage.registerField(u'shadowCheckBox', self.shadowCheckBox)
|
||||
self.mainAreaPage.registerField(u'mainBoldCheckBox', self.mainBoldCheckBox)
|
||||
self.mainAreaPage.registerField(u'mainItalicsCheckBox', self.mainItalicsCheckBox)
|
||||
self.mainAreaPage.registerField(u'shadowColorButton', self.shadowColorButton)
|
||||
self.mainAreaPage.registerField(u'shadowSizeSpinBox', self.shadowSizeSpinBox)
|
||||
self.mainAreaPage.registerField(u'footerSizeSpinBox', self.footerSizeSpinBox)
|
||||
self.areaPositionPage.registerField(u'mainPositionX', self.mainXSpinBox)
|
||||
self.areaPositionPage.registerField(u'mainPositionY', self.mainYSpinBox)
|
||||
self.areaPositionPage.registerField(u'mainPositionWidth', self.mainWidthSpinBox)
|
||||
self.areaPositionPage.registerField(u'mainPositionHeight', self.mainHeightSpinBox)
|
||||
self.areaPositionPage.registerField(u'footerPositionX', self.footerXSpinBox)
|
||||
self.areaPositionPage.registerField(u'footerPositionY', self.footerYSpinBox)
|
||||
self.areaPositionPage.registerField(u'footerPositionWidth', self.footerWidthSpinBox)
|
||||
self.areaPositionPage.registerField(u'footerPositionHeight', self.footerHeightSpinBox)
|
||||
self.backgroundPage.registerField(u'horizontal', self.horizontalComboBox)
|
||||
self.backgroundPage.registerField(u'vertical', self.verticalComboBox)
|
||||
self.backgroundPage.registerField(
|
||||
u'slideTransition', self.transitionsCheckBox)
|
||||
self.backgroundPage.registerField(u'slideTransition', self.transitionsCheckBox)
|
||||
self.backgroundPage.registerField(u'name', self.themeNameEdit)
|
||||
|
||||
def calculateLines(self):
|
||||
|
@ -206,9 +155,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
"""
|
||||
Updates the lines on a page on the wizard
|
||||
"""
|
||||
self.mainLineCountLabel.setText(unicode(translate(
|
||||
'OpenLP.ThemeWizard',
|
||||
'(approximately %d lines per slide)')) % int(lines))
|
||||
self.mainLineCountLabel.setText(
|
||||
translate('OpenLP.ThemeForm', '(approximately %d lines per slide)') % int(lines))
|
||||
|
||||
def resizeEvent(self, event=None):
|
||||
"""
|
||||
|
@ -232,10 +180,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
def validateCurrentPage(self):
|
||||
background_image = BackgroundType.to_string(BackgroundType.Image)
|
||||
if self.page(self.currentId()) == self.backgroundPage and \
|
||||
self.theme.background_type == background_image and \
|
||||
self.imageFileEdit.text().isEmpty():
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('OpenLP.ThemeWizard', 'Background Image Empty'),
|
||||
self.theme.background_type == background_image and not self.imageFileEdit.text():
|
||||
QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeWizard', 'Background Image Empty'),
|
||||
translate('OpenLP.ThemeWizard', 'You have not selected a '
|
||||
'background image. Please select one before continuing.'))
|
||||
return False
|
||||
|
@ -266,11 +212,9 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
pixmap.fill(QtCore.Qt.white)
|
||||
paint = QtGui.QPainter(pixmap)
|
||||
paint.setPen(QtGui.QPen(QtCore.Qt.blue, 2))
|
||||
paint.drawRect(self.thememanager.mainwindow.renderer.
|
||||
get_main_rectangle(self.theme))
|
||||
paint.drawRect(self.thememanager.mainwindow.renderer.get_main_rectangle(self.theme))
|
||||
paint.setPen(QtGui.QPen(QtCore.Qt.red, 2))
|
||||
paint.drawRect(self.thememanager.mainwindow.renderer.
|
||||
get_footer_rectangle(self.theme))
|
||||
paint.drawRect(self.thememanager.mainwindow.renderer.get_footer_rectangle(self.theme))
|
||||
paint.end()
|
||||
self.themeLayoutForm.exec_(pixmap)
|
||||
|
||||
|
@ -326,8 +270,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
self.themeNameEdit.setVisible(not edit)
|
||||
self.edit_mode = edit
|
||||
if edit:
|
||||
self.setWindowTitle(unicode(translate('OpenLP.ThemeWizard',
|
||||
'Edit Theme - %s')) % self.theme.theme_name)
|
||||
self.setWindowTitle(translate('OpenLP.ThemeWizard', 'Edit Theme - %s') % self.theme.theme_name)
|
||||
self.next()
|
||||
else:
|
||||
self.setWindowTitle(UiStrings().NewTheme)
|
||||
|
@ -356,79 +299,53 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
"""
|
||||
if self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Solid):
|
||||
self.colorButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.background_color)
|
||||
self.setField(u'background_type', QtCore.QVariant(0))
|
||||
elif self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Gradient):
|
||||
self.gradientStartButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.background_start_color)
|
||||
self.gradientEndButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.background_end_color)
|
||||
self.setField(u'background_type', QtCore.QVariant(1))
|
||||
elif self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Image):
|
||||
self.imageColorButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.background_border_color)
|
||||
self.colorButton.setStyleSheet(u'background-color: %s' % self.theme.background_color)
|
||||
self.setField(u'background_type', 0)
|
||||
elif self.theme.background_type == BackgroundType.to_string(BackgroundType.Gradient):
|
||||
self.gradientStartButton.setStyleSheet(u'background-color: %s' % self.theme.background_start_color)
|
||||
self.gradientEndButton.setStyleSheet(u'background-color: %s' % self.theme.background_end_color)
|
||||
self.setField(u'background_type', 1)
|
||||
elif self.theme.background_type == BackgroundType.to_string(BackgroundType.Image):
|
||||
self.imageColorButton.setStyleSheet(u'background-color: %s' % self.theme.background_border_color)
|
||||
self.imageFileEdit.setText(self.theme.background_filename)
|
||||
self.setField(u'background_type', QtCore.QVariant(2))
|
||||
elif self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Transparent):
|
||||
self.setField(u'background_type', QtCore.QVariant(3))
|
||||
if self.theme.background_direction == \
|
||||
BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):
|
||||
self.setField(u'gradient', QtCore.QVariant(0))
|
||||
elif self.theme.background_direction == \
|
||||
BackgroundGradientType.to_string(BackgroundGradientType.Vertical):
|
||||
self.setField(u'gradient', QtCore.QVariant(1))
|
||||
elif self.theme.background_direction == \
|
||||
BackgroundGradientType.to_string(BackgroundGradientType.Circular):
|
||||
self.setField(u'gradient', QtCore.QVariant(2))
|
||||
elif self.theme.background_direction == \
|
||||
BackgroundGradientType.to_string(BackgroundGradientType.LeftTop):
|
||||
self.setField(u'gradient', QtCore.QVariant(3))
|
||||
self.setField(u'background_type', 2)
|
||||
elif self.theme.background_type == BackgroundType.to_string(BackgroundType.Transparent):
|
||||
self.setField(u'background_type', 3)
|
||||
if self.theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):
|
||||
self.setField(u'gradient', 0)
|
||||
elif self.theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.Vertical):
|
||||
self.setField(u'gradient', 1)
|
||||
elif self.theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.Circular):
|
||||
self.setField(u'gradient', 2)
|
||||
elif self.theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.LeftTop):
|
||||
self.setField(u'gradient', 3)
|
||||
else:
|
||||
self.setField(u'gradient', QtCore.QVariant(4))
|
||||
self.setField(u'gradient', 4)
|
||||
|
||||
def setMainAreaPageValues(self):
|
||||
"""
|
||||
Handle the display and state of the Main Area page.
|
||||
"""
|
||||
self.mainFontComboBox.setCurrentFont(
|
||||
QtGui.QFont(self.theme.font_main_name))
|
||||
self.mainColorButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.font_main_color)
|
||||
self.setField(u'mainSizeSpinBox',
|
||||
QtCore.QVariant(self.theme.font_main_size))
|
||||
self.setField(u'lineSpacingSpinBox',
|
||||
QtCore.QVariant(self.theme.font_main_line_adjustment))
|
||||
self.setField(u'outlineCheckBox',
|
||||
QtCore.QVariant(self.theme.font_main_outline))
|
||||
self.outlineColorButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.font_main_outline_color)
|
||||
self.setField(u'outlineSizeSpinBox',
|
||||
QtCore.QVariant(self.theme.font_main_outline_size))
|
||||
self.setField(u'shadowCheckBox',
|
||||
QtCore.QVariant(self.theme.font_main_shadow))
|
||||
self.shadowColorButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.font_main_shadow_color)
|
||||
self.setField(u'shadowSizeSpinBox',
|
||||
QtCore.QVariant(self.theme.font_main_shadow_size))
|
||||
self.setField(u'mainBoldCheckBox',
|
||||
QtCore.QVariant(self.theme.font_main_bold))
|
||||
self.setField(u'mainItalicsCheckBox',
|
||||
QtCore.QVariant(self.theme.font_main_italics))
|
||||
self.mainFontComboBox.setCurrentFont(QtGui.QFont(self.theme.font_main_name))
|
||||
self.mainColorButton.setStyleSheet(u'background-color: %s' % self.theme.font_main_color)
|
||||
self.setField(u'mainSizeSpinBox', self.theme.font_main_size)
|
||||
self.setField(u'lineSpacingSpinBox', self.theme.font_main_line_adjustment)
|
||||
self.setField(u'outlineCheckBox', self.theme.font_main_outline)
|
||||
self.outlineColorButton.setStyleSheet(u'background-color: %s' % self.theme.font_main_outline_color)
|
||||
self.setField(u'outlineSizeSpinBox', self.theme.font_main_outline_size)
|
||||
self.setField(u'shadowCheckBox', self.theme.font_main_shadow)
|
||||
self.shadowColorButton.setStyleSheet(u'background-color: %s' % self.theme.font_main_shadow_color)
|
||||
self.setField(u'shadowSizeSpinBox', self.theme.font_main_shadow_size)
|
||||
self.setField(u'mainBoldCheckBox', self.theme.font_main_bold)
|
||||
self.setField(u'mainItalicsCheckBox', self.theme.font_main_italics)
|
||||
|
||||
def setFooterAreaPageValues(self):
|
||||
"""
|
||||
Handle the display and state of the Footer Area page.
|
||||
"""
|
||||
self.footerFontComboBox.setCurrentFont(
|
||||
QtGui.QFont(self.theme.font_footer_name))
|
||||
self.footerColorButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.font_footer_color)
|
||||
self.setField(u'footerSizeSpinBox',
|
||||
QtCore.QVariant(self.theme.font_footer_size))
|
||||
self.footerFontComboBox.setCurrentFont(QtGui.QFont(self.theme.font_footer_name))
|
||||
self.footerColorButton.setStyleSheet(u'background-color: %s' % self.theme.font_footer_color)
|
||||
self.setField(u'footerSizeSpinBox', self.theme.font_footer_size)
|
||||
|
||||
def setPositionPageValues(self):
|
||||
"""
|
||||
|
@ -436,40 +353,30 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
"""
|
||||
# Main Area
|
||||
self.mainPositionCheckBox.setChecked(not self.theme.font_main_override)
|
||||
self.setField(u'mainPositionX', QtCore.QVariant(self.theme.font_main_x))
|
||||
self.setField(u'mainPositionY', QtCore.QVariant(self.theme.font_main_y))
|
||||
self.setField(u'mainPositionHeight',
|
||||
QtCore.QVariant(self.theme.font_main_height))
|
||||
self.setField(u'mainPositionWidth',
|
||||
QtCore.QVariant(self.theme.font_main_width))
|
||||
self.setField(u'mainPositionX', self.theme.font_main_x)
|
||||
self.setField(u'mainPositionY', self.theme.font_main_y)
|
||||
self.setField(u'mainPositionHeight', self.theme.font_main_height)
|
||||
self.setField(u'mainPositionWidth', self.theme.font_main_width)
|
||||
# Footer
|
||||
self.footerPositionCheckBox.setChecked(
|
||||
not self.theme.font_footer_override)
|
||||
self.setField(u'footerPositionX',
|
||||
QtCore.QVariant(self.theme.font_footer_x))
|
||||
self.setField(u'footerPositionY',
|
||||
QtCore.QVariant(self.theme.font_footer_y))
|
||||
self.setField(u'footerPositionHeight',
|
||||
QtCore.QVariant(self.theme.font_footer_height))
|
||||
self.setField(u'footerPositionWidth',
|
||||
QtCore.QVariant(self.theme.font_footer_width))
|
||||
self.footerPositionCheckBox.setChecked(not self.theme.font_footer_override)
|
||||
self.setField(u'footerPositionX', self.theme.font_footer_x)
|
||||
self.setField(u'footerPositionY', self.theme.font_footer_y)
|
||||
self.setField(u'footerPositionHeight', self.theme.font_footer_height)
|
||||
self.setField(u'footerPositionWidth', self.theme.font_footer_width)
|
||||
|
||||
def setAlignmentPageValues(self):
|
||||
"""
|
||||
Handle the display and state of the Alignments page.
|
||||
"""
|
||||
self.setField(u'horizontal',
|
||||
QtCore.QVariant(self.theme.display_horizontal_align))
|
||||
self.setField(u'vertical',
|
||||
QtCore.QVariant(self.theme.display_vertical_align))
|
||||
self.setField(u'slideTransition',
|
||||
QtCore.QVariant(self.theme.display_slide_transition))
|
||||
self.setField(u'horizontal', self.theme.display_horizontal_align)
|
||||
self.setField(u'vertical', self.theme.display_vertical_align)
|
||||
self.setField(u'slideTransition', self.theme.display_slide_transition)
|
||||
|
||||
def setPreviewPageValues(self):
|
||||
"""
|
||||
Handle the display and state of the Preview page.
|
||||
"""
|
||||
self.setField(u'name', QtCore.QVariant(self.theme.theme_name))
|
||||
self.setField(u'name', self.theme.theme_name)
|
||||
|
||||
def onBackgroundComboBoxCurrentIndexChanged(self, index):
|
||||
"""
|
||||
|
@ -478,14 +385,12 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
# do not allow updates when screen is building for the first time.
|
||||
if self.updateThemeAllowed:
|
||||
self.theme.background_type = BackgroundType.to_string(index)
|
||||
if self.theme.background_type != \
|
||||
BackgroundType.to_string(BackgroundType.Image) and \
|
||||
self.temp_background_filename == u'':
|
||||
if self.theme.background_type != BackgroundType.to_string(BackgroundType.Image) and \
|
||||
self.temp_background_filename == u'':
|
||||
self.temp_background_filename = self.theme.background_filename
|
||||
self.theme.background_filename = u''
|
||||
if self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Image) and \
|
||||
self.temp_background_filename != u'':
|
||||
if self.theme.background_type == BackgroundType.to_string(BackgroundType.Image) and \
|
||||
self.temp_background_filename != u'':
|
||||
self.theme.background_filename = self.temp_background_filename
|
||||
self.temp_background_filename = u''
|
||||
self.setBackgroundPageValues()
|
||||
|
@ -495,40 +400,35 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
Background gradient Combo box has changed.
|
||||
"""
|
||||
if self.updateThemeAllowed:
|
||||
self.theme.background_direction = \
|
||||
BackgroundGradientType.to_string(index)
|
||||
self.theme.background_direction = BackgroundGradientType.to_string(index)
|
||||
self.setBackgroundPageValues()
|
||||
|
||||
def onColorButtonClicked(self):
|
||||
"""
|
||||
Background / Gradient 1 Color button pushed.
|
||||
"""
|
||||
self.theme.background_color = \
|
||||
self._colorButton(self.theme.background_color)
|
||||
self.theme.background_color = self._colorButton(self.theme.background_color)
|
||||
self.setBackgroundPageValues()
|
||||
|
||||
def onImageColorButtonClicked(self):
|
||||
"""
|
||||
Background / Gradient 1 Color button pushed.
|
||||
"""
|
||||
self.theme.background_border_color = \
|
||||
self._colorButton(self.theme.background_border_color)
|
||||
self.theme.background_border_color = self._colorButton(self.theme.background_border_color)
|
||||
self.setBackgroundPageValues()
|
||||
|
||||
def onGradientStartButtonClicked(self):
|
||||
"""
|
||||
Gradient 2 Color button pushed.
|
||||
"""
|
||||
self.theme.background_start_color = \
|
||||
self._colorButton(self.theme.background_start_color)
|
||||
self.theme.background_start_color = self._colorButton(self.theme.background_start_color)
|
||||
self.setBackgroundPageValues()
|
||||
|
||||
def onGradientEndButtonClicked(self):
|
||||
"""
|
||||
Gradient 2 Color button pushed.
|
||||
"""
|
||||
self.theme.background_end_color = \
|
||||
self._colorButton(self.theme.background_end_color)
|
||||
self.theme.background_end_color = self._colorButton(self.theme.background_end_color)
|
||||
self.setBackgroundPageValues()
|
||||
|
||||
def onImageBrowseButtonClicked(self):
|
||||
|
@ -536,33 +436,27 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
Background Image button pushed.
|
||||
"""
|
||||
images_filter = get_images_filter()
|
||||
images_filter = u'%s;;%s (*.*) (*)' % (
|
||||
images_filter, UiStrings().AllFiles)
|
||||
images_filter = u'%s;;%s (*.*) (*)' % (images_filter, UiStrings().AllFiles)
|
||||
filename = QtGui.QFileDialog.getOpenFileName(self,
|
||||
translate('OpenLP.ThemeWizard', 'Select Image'), u'',
|
||||
images_filter)
|
||||
translate('OpenLP.ThemeWizard', 'Select Image'), u'', images_filter)
|
||||
if filename:
|
||||
self.theme.background_filename = unicode(filename)
|
||||
self.setBackgroundPageValues()
|
||||
|
||||
def onMainColorButtonClicked(self):
|
||||
self.theme.font_main_color = \
|
||||
self._colorButton(self.theme.font_main_color)
|
||||
self.theme.font_main_color = self._colorButton(self.theme.font_main_color)
|
||||
self.setMainAreaPageValues()
|
||||
|
||||
def onOutlineColorButtonClicked(self):
|
||||
self.theme.font_main_outline_color = \
|
||||
self._colorButton(self.theme.font_main_outline_color)
|
||||
self.theme.font_main_outline_color = self._colorButton(self.theme.font_main_outline_color)
|
||||
self.setMainAreaPageValues()
|
||||
|
||||
def onShadowColorButtonClicked(self):
|
||||
self.theme.font_main_shadow_color = \
|
||||
self._colorButton(self.theme.font_main_shadow_color)
|
||||
self.theme.font_main_shadow_color = self._colorButton(self.theme.font_main_shadow_color)
|
||||
self.setMainAreaPageValues()
|
||||
|
||||
def onFooterColorButtonClicked(self):
|
||||
self.theme.font_footer_color = \
|
||||
self._colorButton(self.theme.font_footer_color)
|
||||
self.theme.font_footer_color = self._colorButton(self.theme.font_footer_color)
|
||||
self.setFooterAreaPageValues()
|
||||
|
||||
def updateTheme(self):
|
||||
|
@ -574,73 +468,53 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
return
|
||||
log.debug(u'updateTheme')
|
||||
# main page
|
||||
self.theme.font_main_name = \
|
||||
unicode(self.mainFontComboBox.currentFont().family())
|
||||
self.theme.font_main_size = \
|
||||
self.field(u'mainSizeSpinBox').toInt()[0]
|
||||
self.theme.font_main_line_adjustment = \
|
||||
self.field(u'lineSpacingSpinBox').toInt()[0]
|
||||
self.theme.font_main_outline_size = \
|
||||
self.field(u'outlineSizeSpinBox').toInt()[0]
|
||||
self.theme.font_main_shadow_size = \
|
||||
self.field(u'shadowSizeSpinBox').toInt()[0]
|
||||
self.theme.font_main_bold = \
|
||||
self.field(u'mainBoldCheckBox').toBool()
|
||||
self.theme.font_main_italics = \
|
||||
self.field(u'mainItalicsCheckBox').toBool()
|
||||
self.theme.font_main_name = self.mainFontComboBox.currentFont().family()
|
||||
self.theme.font_main_size = self.field(u'mainSizeSpinBox')
|
||||
self.theme.font_main_line_adjustment = self.field(u'lineSpacingSpinBox')
|
||||
self.theme.font_main_outline_size = self.field(u'outlineSizeSpinBox')
|
||||
self.theme.font_main_shadow_size = self.field(u'shadowSizeSpinBox')
|
||||
self.theme.font_main_bold = self.field(u'mainBoldCheckBox')
|
||||
self.theme.font_main_italics = self.field(u'mainItalicsCheckBox')
|
||||
# footer page
|
||||
self.theme.font_footer_name = \
|
||||
unicode(self.footerFontComboBox.currentFont().family())
|
||||
self.theme.font_footer_size = \
|
||||
self.field(u'footerSizeSpinBox').toInt()[0]
|
||||
self.theme.font_footer_name = self.footerFontComboBox.currentFont().family()
|
||||
self.theme.font_footer_size = self.field(u'footerSizeSpinBox')
|
||||
# position page
|
||||
self.theme.font_main_x = self.field(u'mainPositionX').toInt()[0]
|
||||
self.theme.font_main_y = self.field(u'mainPositionY').toInt()[0]
|
||||
self.theme.font_main_height = \
|
||||
self.field(u'mainPositionHeight').toInt()[0]
|
||||
self.theme.font_main_width = self.field(u'mainPositionWidth').toInt()[0]
|
||||
self.theme.font_footer_x = self.field(u'footerPositionX').toInt()[0]
|
||||
self.theme.font_footer_y = self.field(u'footerPositionY').toInt()[0]
|
||||
self.theme.font_footer_height = \
|
||||
self.field(u'footerPositionHeight').toInt()[0]
|
||||
self.theme.font_footer_width = \
|
||||
self.field(u'footerPositionWidth').toInt()[0]
|
||||
self.theme.font_main_x = self.field(u'mainPositionX')
|
||||
self.theme.font_main_y = self.field(u'mainPositionY')
|
||||
self.theme.font_main_height = self.field(u'mainPositionHeight')
|
||||
self.theme.font_main_width = self.field(u'mainPositionWidth')
|
||||
self.theme.font_footer_x = self.field(u'footerPositionX')
|
||||
self.theme.font_footer_y = self.field(u'footerPositionY')
|
||||
self.theme.font_footer_height = self.field(u'footerPositionHeight')
|
||||
self.theme.font_footer_width = self.field(u'footerPositionWidth')
|
||||
# position page
|
||||
self.theme.display_horizontal_align = \
|
||||
self.horizontalComboBox.currentIndex()
|
||||
self.theme.display_vertical_align = \
|
||||
self.verticalComboBox.currentIndex()
|
||||
self.theme.display_slide_transition = \
|
||||
self.field(u'slideTransition').toBool()
|
||||
self.theme.display_horizontal_align = self.horizontalComboBox.currentIndex()
|
||||
self.theme.display_vertical_align = self.verticalComboBox.currentIndex()
|
||||
self.theme.display_slide_transition = self.field(u'slideTransition')
|
||||
|
||||
def accept(self):
|
||||
"""
|
||||
Lets save the theme as Finish has been triggered
|
||||
"""
|
||||
# Save the theme name
|
||||
self.theme.theme_name = unicode(self.field(u'name').toString())
|
||||
self.theme.theme_name = self.field(u'name')
|
||||
if not self.theme.theme_name:
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.ThemeWizard', 'Theme Name Missing'),
|
||||
translate('OpenLP.ThemeWizard',
|
||||
'There is no name for this theme. Please enter one.'))
|
||||
translate('OpenLP.ThemeWizard', 'There is no name for this theme. Please enter one.'))
|
||||
return
|
||||
if self.theme.theme_name == u'-1' or self.theme.theme_name == u'None':
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.ThemeWizard', 'Theme Name Invalid'),
|
||||
translate('OpenLP.ThemeWizard',
|
||||
'Invalid theme name. Please enter one.'))
|
||||
translate('OpenLP.ThemeWizard', 'Invalid theme name. Please enter one.'))
|
||||
return
|
||||
saveFrom = None
|
||||
saveTo = None
|
||||
if self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Image):
|
||||
filename = \
|
||||
os.path.split(unicode(self.theme.background_filename))[1]
|
||||
if self.theme.background_type == BackgroundType.to_string(BackgroundType.Image):
|
||||
filename = os.path.split(unicode(self.theme.background_filename))[1]
|
||||
saveTo = os.path.join(self.path, self.theme.theme_name, filename)
|
||||
saveFrom = self.theme.background_filename
|
||||
if not self.edit_mode and \
|
||||
not self.thememanager.checkIfThemeExists(self.theme.theme_name):
|
||||
if not self.edit_mode and not self.thememanager.checkIfThemeExists(self.theme.theme_name):
|
||||
return
|
||||
self.thememanager.saveTheme(self.theme, saveFrom, saveTo)
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -58,16 +58,12 @@ class Ui_ThemeLayoutDialog(object):
|
|||
self.footerColourLabel = QtGui.QLabel(self.previewArea)
|
||||
self.footerColourLabel.setObjectName(u'footerColourLabel')
|
||||
self.previewLayout.addWidget(self.footerColourLabel)
|
||||
self.buttonBox = create_button_box(themeLayoutDialog, u'buttonBox',
|
||||
[u'ok'])
|
||||
self.buttonBox = create_button_box(themeLayoutDialog, u'buttonBox', [u'ok'])
|
||||
self.previewLayout.addWidget(self.buttonBox)
|
||||
self.retranslateUi(themeLayoutDialog)
|
||||
|
||||
def retranslateUi(self, themeLayoutDialog):
|
||||
themeLayoutDialog.setWindowTitle(
|
||||
translate('OpenLP.StartTimeForm', 'Theme Layout'))
|
||||
self.mainColourLabel.setText(translate('OpenLP.StartTimeForm',
|
||||
'The blue box shows the main area.'))
|
||||
self.footerColourLabel.setText(translate('OpenLP.StartTimeForm',
|
||||
'The red box shows the footer.'))
|
||||
themeLayoutDialog.setWindowTitle(translate('OpenLP.StartTimeForm', 'Theme Layout'))
|
||||
self.mainColourLabel.setText(translate('OpenLP.StartTimeForm', 'The blue box shows the main area.'))
|
||||
self.footerColourLabel.setText(translate('OpenLP.StartTimeForm', 'The red box shows the footer.'))
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -36,18 +36,13 @@ import re
|
|||
from xml.etree.ElementTree import ElementTree, XML
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, get_text_file_string, build_icon, \
|
||||
Receiver, SettingsManager, translate, check_item_selected, \
|
||||
check_directory_exists, create_thumb, validate_thumb, ImageSource
|
||||
from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, \
|
||||
BackgroundGradientType
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
|
||||
create_widget_action
|
||||
from openlp.core.lib import OpenLPToolbar, get_text_file_string, build_icon, Receiver, SettingsManager, translate, \
|
||||
check_item_selected, check_directory_exists, create_thumb, validate_thumb, ImageSource, Settings
|
||||
from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, BackgroundGradientType
|
||||
from openlp.core.lib.ui import UiStrings, 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, locale_compare, \
|
||||
get_filesystem_encoding
|
||||
from openlp.core.utils import AppLocation, delete_file, locale_compare, get_filesystem_encoding
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -103,8 +98,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
self.themeListWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||
self.themeListWidget.setObjectName(u'themeListWidget')
|
||||
self.layout.addWidget(self.themeListWidget)
|
||||
QtCore.QObject.connect(self.themeListWidget,
|
||||
QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
|
||||
QtCore.QObject.connect(self.themeListWidget, QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
|
||||
self.contextMenu)
|
||||
# build the context menu
|
||||
self.menu = QtGui.QMenu()
|
||||
|
@ -130,15 +124,12 @@ class ThemeManager(QtGui.QWidget):
|
|||
icon=u':/general/general_export.png', triggers=self.onExportTheme)
|
||||
# Signals
|
||||
QtCore.QObject.connect(self.themeListWidget,
|
||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||
self.changeGlobalFromScreen)
|
||||
QtCore.QObject.connect(self.themeListWidget, QtCore.SIGNAL(
|
||||
u'currentItemChanged(QListWidgetItem *, QListWidgetItem *)'),
|
||||
self.checkListState)
|
||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.changeGlobalFromScreen)
|
||||
QtCore.QObject.connect(self.themeListWidget,
|
||||
QtCore.SIGNAL(u'currentItemChanged(QListWidgetItem *, QListWidgetItem *)'), self.checkListState)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'theme_update_global'), self.changeGlobalFromTab)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'config_updated'), self.configUpdated)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configUpdated)
|
||||
# Variables
|
||||
self.themeList = []
|
||||
self.path = AppLocation.get_section_data_path(self.settingsSection)
|
||||
|
@ -167,9 +158,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
"""
|
||||
Triggered when Config dialog is updated.
|
||||
"""
|
||||
self.global_theme = unicode(Settings().value(
|
||||
self.settingsSection + u'/global theme',
|
||||
QtCore.QVariant(u'')).toString())
|
||||
self.global_theme = Settings().value(self.settingsSection + u'/global theme', u'')
|
||||
|
||||
def checkListState(self, item):
|
||||
"""
|
||||
|
@ -177,8 +166,8 @@ class ThemeManager(QtGui.QWidget):
|
|||
"""
|
||||
if item is None:
|
||||
return
|
||||
real_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
theme_name = unicode(item.text())
|
||||
real_theme_name = item.data(QtCore.Qt.UserRole)
|
||||
theme_name = item.text()
|
||||
# If default theme restrict actions
|
||||
if real_theme_name == theme_name:
|
||||
self.deleteToolbarAction.setVisible(True)
|
||||
|
@ -193,7 +182,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
item = self.themeListWidget.itemAt(point)
|
||||
if item is None:
|
||||
return
|
||||
real_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
real_theme_name = item.data(QtCore.Qt.UserRole)
|
||||
theme_name = unicode(item.text())
|
||||
visible = real_theme_name == theme_name
|
||||
self.deleteAction.setVisible(visible)
|
||||
|
@ -211,13 +200,12 @@ class ThemeManager(QtGui.QWidget):
|
|||
# reset the old name
|
||||
item = self.themeListWidget.item(count)
|
||||
old_name = item.text()
|
||||
new_name = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
new_name = item.data(QtCore.Qt.UserRole)
|
||||
if old_name != new_name:
|
||||
self.themeListWidget.item(count).setText(new_name)
|
||||
# Set the new name
|
||||
if theme_name == new_name:
|
||||
name = unicode(translate('OpenLP.ThemeManager',
|
||||
'%s (default)')) % new_name
|
||||
name = translate('OpenLP.ThemeManager', '%s (default)') % new_name
|
||||
self.themeListWidget.item(count).setText(name)
|
||||
self.deleteToolbarAction.setVisible(
|
||||
item not in self.themeListWidget.selectedItems())
|
||||
|
@ -233,19 +221,14 @@ class ThemeManager(QtGui.QWidget):
|
|||
item = self.themeListWidget.item(count)
|
||||
old_name = item.text()
|
||||
# reset the old name
|
||||
if old_name != unicode(item.data(QtCore.Qt.UserRole).toString()):
|
||||
self.themeListWidget.item(count).setText(
|
||||
unicode(item.data(QtCore.Qt.UserRole).toString()))
|
||||
if old_name != item.data(QtCore.Qt.UserRole):
|
||||
self.themeListWidget.item(count).setText(item.data(QtCore.Qt.UserRole))
|
||||
# Set the new name
|
||||
if count == selected_row:
|
||||
self.global_theme = unicode(
|
||||
self.themeListWidget.item(count).text())
|
||||
name = unicode(translate('OpenLP.ThemeManager',
|
||||
'%s (default)')) % self.global_theme
|
||||
self.global_theme = self.themeListWidget.item(count).text()
|
||||
name = translate('OpenLP.ThemeManager', '%s (default)') % self.global_theme
|
||||
self.themeListWidget.item(count).setText(name)
|
||||
Settings().setValue(
|
||||
self.settingsSection + u'/global theme',
|
||||
QtCore.QVariant(self.global_theme))
|
||||
Settings().setValue(self.settingsSection + u'/global theme', self.global_theme)
|
||||
Receiver.send_message(u'theme_update_global', self.global_theme)
|
||||
self._pushThemes()
|
||||
|
||||
|
@ -264,16 +247,14 @@ class ThemeManager(QtGui.QWidget):
|
|||
"""
|
||||
Renames an existing theme to a new name
|
||||
"""
|
||||
if self._validate_theme_action(unicode(translate('OpenLP.ThemeManager',
|
||||
'You must select a theme to rename.')),
|
||||
unicode(translate('OpenLP.ThemeManager', 'Rename Confirmation')),
|
||||
unicode(translate('OpenLP.ThemeManager', 'Rename %s theme?')),
|
||||
False, False):
|
||||
if self._validate_theme_action(translate('OpenLP.ThemeManager', 'You must select a theme to rename.'),
|
||||
translate('OpenLP.ThemeManager', 'Rename Confirmation'),
|
||||
translate('OpenLP.ThemeManager', 'Rename %s theme?'), False, False):
|
||||
item = self.themeListWidget.currentItem()
|
||||
old_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
old_theme_name = item.data(QtCore.Qt.UserRole)
|
||||
self.fileRenameForm.fileNameEdit.setText(old_theme_name)
|
||||
if self.fileRenameForm.exec_():
|
||||
new_theme_name = unicode(self.fileRenameForm.fileNameEdit.text())
|
||||
new_theme_name = self.fileRenameForm.fileNameEdit.text()
|
||||
if old_theme_name == new_theme_name:
|
||||
return
|
||||
if self.checkIfThemeExists(new_theme_name):
|
||||
|
@ -292,12 +273,11 @@ class ThemeManager(QtGui.QWidget):
|
|||
Copies an existing theme to a new name
|
||||
"""
|
||||
item = self.themeListWidget.currentItem()
|
||||
old_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
self.fileRenameForm.fileNameEdit.setText(
|
||||
unicode(translate('OpenLP.ThemeManager',
|
||||
'Copy of %s', 'Copy of <theme name>')) % old_theme_name)
|
||||
old_theme_name = item.data(QtCore.Qt.UserRole)
|
||||
self.fileRenameForm.fileNameEdit.setText(translate('OpenLP.ThemeManager',
|
||||
'Copy of %s', 'Copy of <theme name>') % old_theme_name)
|
||||
if self.fileRenameForm.exec_(True):
|
||||
new_theme_name = unicode(self.fileRenameForm.fileNameEdit.text())
|
||||
new_theme_name = self.fileRenameForm.fileNameEdit.text()
|
||||
if self.checkIfThemeExists(new_theme_name):
|
||||
theme_data = self.getThemeData(old_theme_name)
|
||||
self.cloneThemeData(theme_data, new_theme_name)
|
||||
|
@ -323,11 +303,10 @@ class ThemeManager(QtGui.QWidget):
|
|||
Loads the settings for the theme that is to be edited and launches the
|
||||
theme editing form so the user can make their changes.
|
||||
"""
|
||||
if check_item_selected(self.themeListWidget, translate(
|
||||
'OpenLP.ThemeManager', 'You must select a theme to edit.')):
|
||||
if check_item_selected(self.themeListWidget,
|
||||
translate('OpenLP.ThemeManager', 'You must select a theme to edit.')):
|
||||
item = self.themeListWidget.currentItem()
|
||||
theme = self.getThemeData(
|
||||
unicode(item.data(QtCore.Qt.UserRole).toString()))
|
||||
theme = self.getThemeData(item.data(QtCore.Qt.UserRole))
|
||||
if theme.background_type == u'image':
|
||||
self.oldBackgroundImage = theme.background_filename
|
||||
self.themeForm.theme = theme
|
||||
|
@ -340,12 +319,11 @@ class ThemeManager(QtGui.QWidget):
|
|||
"""
|
||||
Delete a theme
|
||||
"""
|
||||
if self._validate_theme_action(unicode(translate('OpenLP.ThemeManager',
|
||||
'You must select a theme to delete.')),
|
||||
unicode(translate('OpenLP.ThemeManager', 'Delete Confirmation')),
|
||||
unicode(translate('OpenLP.ThemeManager', 'Delete %s theme?'))):
|
||||
if self._validate_theme_action(translate('OpenLP.ThemeManager', 'You must select a theme to delete.'),
|
||||
translate('OpenLP.ThemeManager', 'Delete Confirmation'),
|
||||
translate('OpenLP.ThemeManager', 'Delete %s theme?')):
|
||||
item = self.themeListWidget.currentItem()
|
||||
theme = unicode(item.text())
|
||||
theme = item.text()
|
||||
row = self.themeListWidget.row(item)
|
||||
self.themeListWidget.takeItem(row)
|
||||
self.deleteTheme(theme)
|
||||
|
@ -377,13 +355,11 @@ class ThemeManager(QtGui.QWidget):
|
|||
"""
|
||||
item = self.themeListWidget.currentItem()
|
||||
if item is None:
|
||||
critical_error_message_box(message=translate('OpenLP.ThemeManager',
|
||||
'You have not selected a theme.'))
|
||||
critical_error_message_box(message=translate('OpenLP.ThemeManager', 'You have not selected a theme.'))
|
||||
return
|
||||
theme = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
theme = item.data(QtCore.Qt.UserRole)
|
||||
path = QtGui.QFileDialog.getExistingDirectory(self,
|
||||
unicode(translate('OpenLP.ThemeManager',
|
||||
'Save Theme - (%s)')) % theme,
|
||||
translate('OpenLP.ThemeManager', 'Save Theme - (%s)') % theme,
|
||||
SettingsManager.get_last_dir(self.settingsSection, 1))
|
||||
path = unicode(path)
|
||||
Receiver.send_message(u'cursor_busy')
|
||||
|
@ -401,14 +377,12 @@ class ThemeManager(QtGui.QWidget):
|
|||
os.path.join(theme, name).encode(u'utf-8'))
|
||||
QtGui.QMessageBox.information(self,
|
||||
translate('OpenLP.ThemeManager', 'Theme Exported'),
|
||||
translate('OpenLP.ThemeManager',
|
||||
'Your theme has been successfully exported.'))
|
||||
translate('OpenLP.ThemeManager', 'Your theme has been successfully exported.'))
|
||||
except (IOError, OSError):
|
||||
log.exception(u'Export Theme Failed')
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.ThemeManager', 'Theme Export Failed'),
|
||||
translate('OpenLP.ThemeManager',
|
||||
'Your theme could not be exported due to an error.'))
|
||||
translate('OpenLP.ThemeManager', 'Your theme could not be exported due to an error.'))
|
||||
finally:
|
||||
if zip:
|
||||
zip.close()
|
||||
|
@ -423,8 +397,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
files = QtGui.QFileDialog.getOpenFileNames(self,
|
||||
translate('OpenLP.ThemeManager', 'Select Theme Import File'),
|
||||
SettingsManager.get_last_dir(self.settingsSection),
|
||||
unicode(translate('OpenLP.ThemeManager',
|
||||
'OpenLP Themes (*.theme *.otz)')))
|
||||
translate('OpenLP.ThemeManager', 'OpenLP Themes (*.theme *.otz)'))
|
||||
log.info(u'New Themes %s', unicode(files))
|
||||
if not files:
|
||||
return
|
||||
|
@ -453,9 +426,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
theme = ThemeXML()
|
||||
theme.theme_name = UiStrings().Default
|
||||
self._writeTheme(theme, None, None)
|
||||
Settings().setValue(
|
||||
self.settingsSection + u'/global theme',
|
||||
QtCore.QVariant(theme.theme_name))
|
||||
Settings().setValue(self.settingsSection + u'/global theme', theme.theme_name)
|
||||
self.configUpdated()
|
||||
files = SettingsManager.get_files(self.settingsSection, u'.png')
|
||||
# Sort the themes by its name considering language specific
|
||||
|
@ -468,8 +439,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
if os.path.exists(theme):
|
||||
text_name = os.path.splitext(name)[0]
|
||||
if text_name == self.global_theme:
|
||||
name = unicode(translate('OpenLP.ThemeManager',
|
||||
'%s (default)')) % text_name
|
||||
name = translate('OpenLP.ThemeManager', '%s (default)') % text_name
|
||||
else:
|
||||
name = text_name
|
||||
thumb = os.path.join(self.thumbPath, u'%s.png' % text_name)
|
||||
|
@ -479,8 +449,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
else:
|
||||
icon = create_thumb(theme, thumb)
|
||||
item_name.setIcon(icon)
|
||||
item_name.setData(
|
||||
QtCore.Qt.UserRole, QtCore.QVariant(text_name))
|
||||
item_name.setData(QtCore.Qt.UserRole, text_name)
|
||||
self.themeListWidget.addItem(item_name)
|
||||
self.themeList.append(text_name)
|
||||
self._pushThemes()
|
||||
|
@ -518,10 +487,8 @@ class ThemeManager(QtGui.QWidget):
|
|||
ret = QtGui.QMessageBox.question(self,
|
||||
translate('OpenLP.ThemeManager', 'Theme Already Exists'),
|
||||
translate('OpenLP.ThemeManager',
|
||||
'Theme %s already exists. Do you want to replace it?'
|
||||
).replace('%s', theme_name),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||
QtGui.QMessageBox.No),
|
||||
'Theme %s already exists. Do you want to replace it?').replace('%s', theme_name),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
||||
QtGui.QMessageBox.No)
|
||||
return ret == QtGui.QMessageBox.Yes
|
||||
|
||||
|
@ -547,8 +514,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
xml_tree = ElementTree(element=XML(zip.read(xml_file[0]))).getroot()
|
||||
v1_background = xml_tree.find(u'BackgroundType')
|
||||
if v1_background is not None:
|
||||
theme_name, file_xml, out_file, abort_import = \
|
||||
self.unzipVersion122(
|
||||
theme_name, file_xml, out_file, abort_import = self.unzipVersion122(
|
||||
dir, zip, xml_file[0], xml_tree, v1_background, out_file)
|
||||
else:
|
||||
theme_name = xml_tree.find(u'name').text.strip()
|
||||
|
@ -563,8 +529,8 @@ class ThemeManager(QtGui.QWidget):
|
|||
try:
|
||||
uname = unicode(name, u'utf-8')
|
||||
except UnicodeDecodeError:
|
||||
log.exception(u'Theme file contains non utf-8 filename'
|
||||
u' "%s"' % name.decode(u'utf-8', u'replace'))
|
||||
log.exception(u'Theme file contains non utf-8 filename "%s"' %
|
||||
name.decode(u'utf-8', u'replace'))
|
||||
raise Exception(u'validation')
|
||||
uname = uname.replace(u'/', os.path.sep)
|
||||
split_name = uname.split(os.path.sep)
|
||||
|
@ -587,8 +553,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
except Exception as info:
|
||||
if unicode(info) == u'validation':
|
||||
critical_error_message_box(translate('OpenLP.ThemeManager',
|
||||
'Validation Error'), translate('OpenLP.ThemeManager',
|
||||
'File is not a valid theme.'))
|
||||
'Validation Error'), translate('OpenLP.ThemeManager', 'File is not a valid theme.'))
|
||||
else:
|
||||
raise
|
||||
finally:
|
||||
|
@ -607,10 +572,8 @@ class ThemeManager(QtGui.QWidget):
|
|||
elif zip is not None:
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.ThemeManager', 'Validation Error'),
|
||||
translate('OpenLP.ThemeManager',
|
||||
'File is not a valid theme.'))
|
||||
log.exception(u'Theme file does not contain XML data %s' %
|
||||
file_name)
|
||||
translate('OpenLP.ThemeManager', 'File is not a valid theme.'))
|
||||
log.exception(u'Theme file does not contain XML data %s' % file_name)
|
||||
|
||||
def unzipVersion122(self, dir, zip, xml_file, xml_tree, background,
|
||||
out_file):
|
||||
|
@ -642,8 +605,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
out_file.write(zip.read(image_file[0]))
|
||||
out_file.close()
|
||||
else:
|
||||
log.exception(u'Theme file does not contain image file "%s"' %
|
||||
image_name.decode(u'utf-8', u'replace'))
|
||||
log.exception(u'Theme file does not contain image file "%s"' % image_name.decode(u'utf-8', u'replace'))
|
||||
raise Exception(u'validation')
|
||||
return theme_name, file_xml, out_file, False
|
||||
|
||||
|
@ -658,8 +620,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
if os.path.exists(theme_dir):
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.ThemeManager', 'Validation Error'),
|
||||
translate('OpenLP.ThemeManager',
|
||||
'A theme with this name already exists.'))
|
||||
translate('OpenLP.ThemeManager', 'A theme with this name already exists.'))
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -669,10 +630,8 @@ class ThemeManager(QtGui.QWidget):
|
|||
and to trigger the reload of the theme list
|
||||
"""
|
||||
self._writeTheme(theme, image_from, image_to)
|
||||
if theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Image):
|
||||
self.mainwindow.imageManager.updateImageBorder(
|
||||
theme.background_filename,
|
||||
if theme.background_type == BackgroundType.to_string(BackgroundType.Image):
|
||||
self.mainwindow.imageManager.updateImageBorder(theme.background_filename,
|
||||
ImageSource.Theme, QtGui.QColor(theme.background_border_color))
|
||||
self.mainwindow.imageManager.processUpdates()
|
||||
|
||||
|
@ -701,9 +660,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
if image_from and image_from != image_to:
|
||||
try:
|
||||
encoding = get_filesystem_encoding()
|
||||
shutil.copyfile(
|
||||
unicode(image_from).encode(encoding),
|
||||
unicode(image_to).encode(encoding))
|
||||
shutil.copyfile(unicode(image_from).encode(encoding), unicode(image_to).encode(encoding))
|
||||
except IOError:
|
||||
log.exception(u'Failed to save theme image')
|
||||
self.generateAndSaveImage(self.path, name, theme)
|
||||
|
@ -726,8 +683,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
self.mainwindow.displayProgressBar(len(self.themeList))
|
||||
for theme in self.themeList:
|
||||
self.mainwindow.incrementProgressBar()
|
||||
self.generateAndSaveImage(
|
||||
self.path, theme, self.getThemeData(theme))
|
||||
self.generateAndSaveImage(self.path, theme, self.getThemeData(theme))
|
||||
self.mainwindow.finishedProgressBar()
|
||||
self.loadThemes()
|
||||
|
||||
|
@ -742,8 +698,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
Flag to tell message lines per page need to be generated.
|
||||
"""
|
||||
log.debug(u'generateImage \n%s ', theme_data)
|
||||
return self.mainwindow.renderer.generate_preview(
|
||||
theme_data, forcePage)
|
||||
return self.mainwindow.renderer.generate_preview(theme_data, forcePage)
|
||||
|
||||
def getPreviewImage(self, theme):
|
||||
"""
|
||||
|
@ -774,36 +729,30 @@ class ThemeManager(QtGui.QWidget):
|
|||
Check to see if theme has been selected and the destructive action
|
||||
is allowed.
|
||||
"""
|
||||
self.global_theme = unicode(Settings().value(
|
||||
self.settingsSection + u'/global theme',
|
||||
QtCore.QVariant(u'')).toString())
|
||||
self.global_theme = Settings().value(
|
||||
self.settingsSection + u'/global theme', u'')
|
||||
if check_item_selected(self.themeListWidget, select_text):
|
||||
item = self.themeListWidget.currentItem()
|
||||
theme = unicode(item.text())
|
||||
theme = item.text()
|
||||
# confirm deletion
|
||||
if confirm:
|
||||
answer = QtGui.QMessageBox.question(self, confirm_title,
|
||||
confirm_text % theme, QtGui.QMessageBox.StandardButtons(
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
||||
answer = QtGui.QMessageBox.question(self, confirm_title, confirm_text % theme,
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
||||
QtGui.QMessageBox.No)
|
||||
if answer == QtGui.QMessageBox.No:
|
||||
return False
|
||||
# should be the same unless default
|
||||
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
|
||||
if theme != item.data(QtCore.Qt.UserRole):
|
||||
critical_error_message_box(
|
||||
message=translate('OpenLP.ThemeManager',
|
||||
'You are unable to delete the default theme.'))
|
||||
message=translate('OpenLP.ThemeManager', 'You are unable to delete the default theme.'))
|
||||
return False
|
||||
# check for use in the system else where.
|
||||
if testPlugin:
|
||||
for plugin in self.mainwindow.pluginManager.plugins:
|
||||
if plugin.usesTheme(theme):
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.ThemeManager',
|
||||
'Validation Error'),
|
||||
unicode(translate('OpenLP.ThemeManager',
|
||||
'Theme %s is used in the %s plugin.')) % \
|
||||
(theme, plugin.name))
|
||||
critical_error_message_box(translate('OpenLP.ThemeManager', 'Validation Error'),
|
||||
translate('OpenLP.ThemeManager', 'Theme %s is used in the %s plugin.') %
|
||||
(theme, plugin.name))
|
||||
return False
|
||||
return True
|
||||
return False
|
||||
|
@ -822,31 +771,20 @@ class ThemeManager(QtGui.QWidget):
|
|||
new_theme = ThemeXML()
|
||||
new_theme.theme_name = self.badV1NameChars.sub(u'', theme.Name)
|
||||
if theme.BackgroundType == 0:
|
||||
new_theme.background_type = \
|
||||
BackgroundType.to_string(BackgroundType.Solid)
|
||||
new_theme.background_color = \
|
||||
unicode(theme.BackgroundParameter1.name())
|
||||
new_theme.background_type = BackgroundType.to_string(BackgroundType.Solid)
|
||||
new_theme.background_color = unicode(theme.BackgroundParameter1.name())
|
||||
elif theme.BackgroundType == 1:
|
||||
new_theme.background_type = \
|
||||
BackgroundType.to_string(BackgroundType.Gradient)
|
||||
new_theme.background_direction = \
|
||||
BackgroundGradientType. \
|
||||
to_string(BackgroundGradientType.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 = \
|
||||
unicode(theme.BackgroundParameter1.name())
|
||||
new_theme.background_end_color = \
|
||||
unicode(theme.BackgroundParameter2.name())
|
||||
new_theme.background_direction = BackgroundGradientType.to_string(BackgroundGradientType.Horizontal)
|
||||
new_theme.background_start_color = unicode(theme.BackgroundParameter1.name())
|
||||
new_theme.background_end_color = unicode(theme.BackgroundParameter2.name())
|
||||
elif theme.BackgroundType == 2:
|
||||
new_theme.background_type = \
|
||||
BackgroundType.to_string(BackgroundType.Image)
|
||||
new_theme.background_type = BackgroundType.to_string(BackgroundType.Image)
|
||||
new_theme.background_filename = unicode(theme.BackgroundParameter1)
|
||||
elif theme.BackgroundType == 3:
|
||||
new_theme.background_type = \
|
||||
BackgroundType.to_string(BackgroundType.Transparent)
|
||||
new_theme.background_type = BackgroundType.to_string(BackgroundType.Transparent)
|
||||
new_theme.font_main_name = theme.FontName
|
||||
new_theme.font_main_color = unicode(theme.FontColor.name())
|
||||
new_theme.font_main_size = theme.FontProportion * 3
|
||||
|
@ -858,8 +796,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
new_theme.font_main_shadow_color = unicode(theme.ShadowColor.name())
|
||||
if theme.Outline == 1:
|
||||
new_theme.font_main_outline = True
|
||||
new_theme.font_main_outline_color = \
|
||||
unicode(theme.OutlineColor.name())
|
||||
new_theme.font_main_outline_color = unicode(theme.OutlineColor.name())
|
||||
vAlignCorrection = VerticalType.Top
|
||||
if theme.VerticalAlign == 2:
|
||||
vAlignCorrection = VerticalType.Middle
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -29,10 +29,9 @@
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, Receiver, translate
|
||||
from openlp.core.lib import Receiver, Settings, SettingsTab, translate
|
||||
from openlp.core.lib.theme import ThemeLevel
|
||||
from openlp.core.lib.ui import UiStrings, find_and_set_in_combo_box
|
||||
from openlp.core.lib.settings import Settings
|
||||
|
||||
class ThemesTab(SettingsTab):
|
||||
"""
|
||||
|
@ -52,10 +51,8 @@ class ThemesTab(SettingsTab):
|
|||
self.GlobalGroupBoxLayout = QtGui.QVBoxLayout(self.GlobalGroupBox)
|
||||
self.GlobalGroupBoxLayout.setObjectName(u'GlobalGroupBoxLayout')
|
||||
self.DefaultComboBox = QtGui.QComboBox(self.GlobalGroupBox)
|
||||
self.DefaultComboBox.setSizeAdjustPolicy(
|
||||
QtGui.QComboBox.AdjustToMinimumContentsLength)
|
||||
self.DefaultComboBox.setSizePolicy(
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.DefaultComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
|
||||
self.DefaultComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.DefaultComboBox.setObjectName(u'DefaultComboBox')
|
||||
self.GlobalGroupBoxLayout.addWidget(self.DefaultComboBox)
|
||||
self.DefaultListView = QtGui.QLabel(self.GlobalGroupBox)
|
||||
|
@ -66,10 +63,8 @@ class ThemesTab(SettingsTab):
|
|||
self.LevelGroupBox = QtGui.QGroupBox(self.rightColumn)
|
||||
self.LevelGroupBox.setObjectName(u'LevelGroupBox')
|
||||
self.LevelLayout = QtGui.QFormLayout(self.LevelGroupBox)
|
||||
self.LevelLayout.setLabelAlignment(
|
||||
QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
|
||||
self.LevelLayout.setFormAlignment(
|
||||
QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
|
||||
self.LevelLayout.setLabelAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
|
||||
self.LevelLayout.setFormAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
|
||||
self.LevelLayout.setObjectName(u'LevelLayout')
|
||||
self.SongLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox)
|
||||
self.SongLevelRadioButton.setObjectName(u'SongLevelRadioButton')
|
||||
|
@ -80,66 +75,51 @@ class ThemesTab(SettingsTab):
|
|||
self.ServiceLevelRadioButton.setObjectName(u'ServiceLevelRadioButton')
|
||||
self.ServiceLevelLabel = QtGui.QLabel(self.LevelGroupBox)
|
||||
self.ServiceLevelLabel.setObjectName(u'ServiceLevelLabel')
|
||||
self.LevelLayout.addRow(self.ServiceLevelRadioButton,
|
||||
self.ServiceLevelLabel)
|
||||
self.LevelLayout.addRow(self.ServiceLevelRadioButton, self.ServiceLevelLabel)
|
||||
self.GlobalLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox)
|
||||
self.GlobalLevelRadioButton.setObjectName(u'GlobalLevelRadioButton')
|
||||
self.GlobalLevelLabel = QtGui.QLabel(self.LevelGroupBox)
|
||||
self.GlobalLevelLabel.setObjectName(u'GlobalLevelLabel')
|
||||
self.LevelLayout.addRow(self.GlobalLevelRadioButton,
|
||||
self.GlobalLevelLabel)
|
||||
self.LevelLayout.addRow(self.GlobalLevelRadioButton, self.GlobalLevelLabel)
|
||||
label_top_margin = (self.SongLevelRadioButton.sizeHint().height() -
|
||||
self.SongLevelLabel.sizeHint().height()) / 2
|
||||
for label in [self.SongLevelLabel, self.ServiceLevelLabel,
|
||||
self.GlobalLevelLabel]:
|
||||
for label in [self.SongLevelLabel, self.ServiceLevelLabel, self.GlobalLevelLabel]:
|
||||
rect = label.rect()
|
||||
rect.setTop(rect.top() + label_top_margin)
|
||||
label.setFrameRect(rect)
|
||||
label.setWordWrap(True)
|
||||
self.rightLayout.addWidget(self.LevelGroupBox)
|
||||
self.rightLayout.addStretch()
|
||||
QtCore.QObject.connect(self.SongLevelRadioButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onSongLevelButtonClicked)
|
||||
QtCore.QObject.connect(self.ServiceLevelRadioButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onServiceLevelButtonClicked)
|
||||
QtCore.QObject.connect(self.GlobalLevelRadioButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onGlobalLevelButtonClicked)
|
||||
QtCore.QObject.connect(self.DefaultComboBox,
|
||||
QtCore.SIGNAL(u'activated(int)'), self.onDefaultComboBoxChanged)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
|
||||
QtCore.QObject.connect(self.SongLevelRadioButton, QtCore.SIGNAL(u'clicked()'), self.onSongLevelButtonClicked)
|
||||
QtCore.QObject.connect(self.ServiceLevelRadioButton, QtCore.SIGNAL(u'clicked()'),
|
||||
self.onServiceLevelButtonClicked)
|
||||
QtCore.QObject.connect(self.GlobalLevelRadioButton, QtCore.SIGNAL(u'clicked()'),
|
||||
self.onGlobalLevelButtonClicked)
|
||||
QtCore.QObject.connect(self.DefaultComboBox, QtCore.SIGNAL(u'activated(int)'), self.onDefaultComboBoxChanged)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.tabTitleVisible = UiStrings().Themes
|
||||
self.GlobalGroupBox.setTitle(
|
||||
translate('OpenLP.ThemesTab', 'Global Theme'))
|
||||
self.LevelGroupBox.setTitle(
|
||||
translate('OpenLP.ThemesTab', 'Theme Level'))
|
||||
self.SongLevelRadioButton.setText(
|
||||
translate('OpenLP.ThemesTab', 'S&ong Level'))
|
||||
self.SongLevelLabel.setText(
|
||||
translate('OpenLP.ThemesTab', 'Use the theme from each song '
|
||||
self.GlobalGroupBox.setTitle(translate('OpenLP.ThemesTab', 'Global Theme'))
|
||||
self.LevelGroupBox.setTitle(translate('OpenLP.ThemesTab', 'Theme Level'))
|
||||
self.SongLevelRadioButton.setText(translate('OpenLP.ThemesTab', 'S&ong Level'))
|
||||
self.SongLevelLabel.setText(translate('OpenLP.ThemesTab', 'Use the theme from each song '
|
||||
'in the database. If a song doesn\'t have a theme associated with '
|
||||
'it, then use the service\'s theme. If the service doesn\'t have '
|
||||
'a theme, then use the global theme.'))
|
||||
self.ServiceLevelRadioButton.setText(
|
||||
translate('OpenLP.ThemesTab', '&Service Level'))
|
||||
self.ServiceLevelLabel.setText(
|
||||
translate('OpenLP.ThemesTab', 'Use the theme from the service, '
|
||||
self.ServiceLevelRadioButton.setText(translate('OpenLP.ThemesTab', '&Service Level'))
|
||||
self.ServiceLevelLabel.setText(translate('OpenLP.ThemesTab', 'Use the theme from the service, '
|
||||
'overriding any of the individual songs\' themes. If the '
|
||||
'service doesn\'t have a theme, then use the global theme.'))
|
||||
self.GlobalLevelRadioButton.setText(
|
||||
translate('OpenLP.ThemesTab', '&Global Level'))
|
||||
self.GlobalLevelLabel.setText(
|
||||
translate('OpenLP.ThemesTab', 'Use the global theme, overriding '
|
||||
self.GlobalLevelRadioButton.setText(translate('OpenLP.ThemesTab', '&Global Level'))
|
||||
self.GlobalLevelLabel.setText(translate('OpenLP.ThemesTab', 'Use the global theme, overriding '
|
||||
'any themes associated with either the service or the songs.'))
|
||||
|
||||
def load(self):
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
self.theme_level = settings.value(
|
||||
u'theme level', ThemeLevel.Song).toInt()[0]
|
||||
self.global_theme = unicode(settings.value(u'global theme').toString())
|
||||
self.theme_level = settings.value(u'theme level', ThemeLevel.Song)
|
||||
self.global_theme = settings.value(u'global theme', u'')
|
||||
settings.endGroup()
|
||||
if self.theme_level == ThemeLevel.Global:
|
||||
self.GlobalLevelRadioButton.setChecked(True)
|
||||
|
@ -151,8 +131,8 @@ class ThemesTab(SettingsTab):
|
|||
def save(self):
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
settings.setValue(u'theme level', QtCore.QVariant(self.theme_level))
|
||||
settings.setValue(u'global theme', QtCore.QVariant(self.global_theme))
|
||||
settings.setValue(u'theme level', self.theme_level)
|
||||
settings.setValue(u'global theme', self.global_theme)
|
||||
settings.endGroup()
|
||||
self.mainwindow.renderer.set_global_theme(self.global_theme)
|
||||
self.mainwindow.renderer.set_theme_level(self.theme_level)
|
||||
|
@ -171,9 +151,8 @@ class ThemesTab(SettingsTab):
|
|||
self.theme_level = ThemeLevel.Global
|
||||
|
||||
def onDefaultComboBoxChanged(self, value):
|
||||
self.global_theme = unicode(self.DefaultComboBox.currentText())
|
||||
self.global_theme = self.DefaultComboBox.currentText()
|
||||
self.mainwindow.renderer.set_global_theme(self.global_theme)
|
||||
self.mainwindow.renderer.set_theme_level(self.theme_level)
|
||||
self.__previewGlobalTheme()
|
||||
|
||||
def updateThemeList(self, theme_list):
|
||||
|
@ -186,9 +165,7 @@ class ThemesTab(SettingsTab):
|
|||
[u'Bible Theme', u'Song Theme']
|
||||
"""
|
||||
# Reload as may have been triggered by the ThemeManager.
|
||||
self.global_theme = unicode(Settings().value(
|
||||
self.settingsSection + u'/global theme',
|
||||
QtCore.QVariant(u'')).toString())
|
||||
self.global_theme = Settings().value(self.settingsSection + u'/global theme', u'')
|
||||
self.DefaultComboBox.clear()
|
||||
self.DefaultComboBox.addItems(theme_list)
|
||||
find_and_set_in_combo_box(self.DefaultComboBox, self.global_theme)
|
||||
|
@ -201,10 +178,8 @@ class ThemesTab(SettingsTab):
|
|||
"""
|
||||
Utility method to update the global theme preview image.
|
||||
"""
|
||||
image = self.mainwindow.themeManagerContents.getPreviewImage(
|
||||
self.global_theme)
|
||||
image = self.mainwindow.themeManagerContents.getPreviewImage(self.global_theme)
|
||||
preview = QtGui.QPixmap(unicode(image))
|
||||
if not preview.isNull():
|
||||
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
|
||||
QtCore.Qt.SmoothTransformation)
|
||||
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
|
||||
self.DefaultListView.setPixmap(preview)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -30,10 +30,8 @@
|
|||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, build_icon
|
||||
from openlp.core.lib.theme import HorizontalType, BackgroundType, \
|
||||
BackgroundGradientType
|
||||
from openlp.core.lib.ui import UiStrings, add_welcome_page, \
|
||||
create_valign_selection_widgets
|
||||
from openlp.core.lib.theme import HorizontalType, BackgroundType, BackgroundGradientType
|
||||
from openlp.core.lib.ui import UiStrings, add_welcome_page, create_valign_selection_widgets
|
||||
|
||||
class Ui_ThemeWizard(object):
|
||||
def setupUi(self, themeWizard):
|
||||
|
@ -43,8 +41,7 @@ class Ui_ThemeWizard(object):
|
|||
themeWizard.setOptions(QtGui.QWizard.IndependentPages |
|
||||
QtGui.QWizard.NoBackButtonOnStartPage |
|
||||
QtGui.QWizard.HaveCustomButton1)
|
||||
self.spacer = QtGui.QSpacerItem(10, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
|
||||
self.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
|
||||
# Welcome Page
|
||||
add_welcome_page(themeWizard, u':/wizards/wizard_createtheme.bmp')
|
||||
# Background Page
|
||||
|
@ -59,10 +56,8 @@ class Ui_ThemeWizard(object):
|
|||
self.backgroundComboBox = QtGui.QComboBox(self.backgroundPage)
|
||||
self.backgroundComboBox.addItems([u'', u'', u'', u''])
|
||||
self.backgroundComboBox.setObjectName(u'BackgroundComboBox')
|
||||
self.backgroundTypeLayout.addRow(self.backgroundLabel,
|
||||
self.backgroundComboBox)
|
||||
self.backgroundTypeLayout.setItem(1, QtGui.QFormLayout.LabelRole,
|
||||
self.spacer)
|
||||
self.backgroundTypeLayout.addRow(self.backgroundLabel, self.backgroundComboBox)
|
||||
self.backgroundTypeLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
|
||||
self.backgroundLayout.addLayout(self.backgroundTypeLayout)
|
||||
self.backgroundStack = QtGui.QStackedLayout()
|
||||
self.backgroundStack.setObjectName(u'BackgroundStack')
|
||||
|
@ -87,21 +82,18 @@ class Ui_ThemeWizard(object):
|
|||
self.gradientStartLabel.setObjectName(u'GradientStartLabel')
|
||||
self.gradientStartButton = QtGui.QPushButton(self.gradientWidget)
|
||||
self.gradientStartButton.setObjectName(u'GradientStartButton')
|
||||
self.gradientLayout.addRow(self.gradientStartLabel,
|
||||
self.gradientStartButton)
|
||||
self.gradientLayout.addRow(self.gradientStartLabel, self.gradientStartButton)
|
||||
self.gradientEndLabel = QtGui.QLabel(self.gradientWidget)
|
||||
self.gradientEndLabel.setObjectName(u'GradientEndLabel')
|
||||
self.gradientEndButton = QtGui.QPushButton(self.gradientWidget)
|
||||
self.gradientEndButton.setObjectName(u'GradientEndButton')
|
||||
self.gradientLayout.addRow(self.gradientEndLabel,
|
||||
self.gradientEndButton)
|
||||
self.gradientLayout.addRow(self.gradientEndLabel, self.gradientEndButton)
|
||||
self.gradientTypeLabel = QtGui.QLabel(self.gradientWidget)
|
||||
self.gradientTypeLabel.setObjectName(u'GradientTypeLabel')
|
||||
self.gradientComboBox = QtGui.QComboBox(self.gradientWidget)
|
||||
self.gradientComboBox.setObjectName(u'GradientComboBox')
|
||||
self.gradientComboBox.addItems([u'', u'', u'', u'', u''])
|
||||
self.gradientLayout.addRow(self.gradientTypeLabel,
|
||||
self.gradientComboBox)
|
||||
self.gradientLayout.addRow(self.gradientTypeLabel, self.gradientComboBox)
|
||||
self.gradientLayout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer)
|
||||
self.backgroundStack.addWidget(self.gradientWidget)
|
||||
self.imageWidget = QtGui.QWidget(self.backgroundPage)
|
||||
|
@ -123,8 +115,7 @@ class Ui_ThemeWizard(object):
|
|||
self.imageFileLayout.addWidget(self.imageFileEdit)
|
||||
self.imageBrowseButton = QtGui.QToolButton(self.imageWidget)
|
||||
self.imageBrowseButton.setObjectName(u'ImageBrowseButton')
|
||||
self.imageBrowseButton.setIcon(
|
||||
build_icon(u':/general/general_open.png'))
|
||||
self.imageBrowseButton.setIcon(build_icon(u':/general/general_open.png'))
|
||||
self.imageFileLayout.addWidget(self.imageBrowseButton)
|
||||
self.imageLayout.addRow(self.imageLabel, self.imageFileLayout)
|
||||
self.imageLayout.setItem(2, QtGui.QFormLayout.LabelRole, self.spacer)
|
||||
|
@ -162,8 +153,7 @@ class Ui_ThemeWizard(object):
|
|||
self.mainItalicsCheckBox = QtGui.QCheckBox(self.mainAreaPage)
|
||||
self.mainItalicsCheckBox.setObjectName(u'MainItalicsCheckBox')
|
||||
self.mainPropertiesLayout.addWidget(self.mainItalicsCheckBox)
|
||||
self.mainAreaLayout.addRow(self.mainColorLabel,
|
||||
self.mainPropertiesLayout)
|
||||
self.mainAreaLayout.addRow(self.mainColorLabel, self.mainPropertiesLayout)
|
||||
self.mainSizeLabel = QtGui.QLabel(self.mainAreaPage)
|
||||
self.mainSizeLabel.setObjectName(u'MainSizeLabel')
|
||||
self.mainSizeLayout = QtGui.QHBoxLayout()
|
||||
|
@ -183,8 +173,7 @@ class Ui_ThemeWizard(object):
|
|||
self.lineSpacingSpinBox.setMinimum(-50)
|
||||
self.lineSpacingSpinBox.setMaximum(50)
|
||||
self.lineSpacingSpinBox.setObjectName(u'LineSpacingSpinBox')
|
||||
self.mainAreaLayout.addRow(self.lineSpacingLabel,
|
||||
self.lineSpacingSpinBox)
|
||||
self.mainAreaLayout.addRow(self.lineSpacingLabel, self.lineSpacingSpinBox)
|
||||
self.outlineCheckBox = QtGui.QCheckBox(self.mainAreaPage)
|
||||
self.outlineCheckBox.setObjectName(u'OutlineCheckBox')
|
||||
self.outlineLayout = QtGui.QHBoxLayout()
|
||||
|
@ -229,24 +218,20 @@ class Ui_ThemeWizard(object):
|
|||
self.footerFontLabel.setObjectName(u'FooterFontLabel')
|
||||
self.footerFontComboBox = QtGui.QFontComboBox(self.footerAreaPage)
|
||||
self.footerFontComboBox.setObjectName(u'footerFontComboBox')
|
||||
self.footerAreaLayout.addRow(self.footerFontLabel,
|
||||
self.footerFontComboBox)
|
||||
self.footerAreaLayout.addRow(self.footerFontLabel, self.footerFontComboBox)
|
||||
self.footerColorLabel = QtGui.QLabel(self.footerAreaPage)
|
||||
self.footerColorLabel.setObjectName(u'FooterColorLabel')
|
||||
self.footerColorButton = QtGui.QPushButton(self.footerAreaPage)
|
||||
self.footerColorButton.setObjectName(u'footerColorButton')
|
||||
self.footerAreaLayout.addRow(self.footerColorLabel,
|
||||
self.footerColorButton)
|
||||
self.footerAreaLayout.addRow(self.footerColorLabel, self.footerColorButton)
|
||||
self.footerSizeLabel = QtGui.QLabel(self.footerAreaPage)
|
||||
self.footerSizeLabel.setObjectName(u'FooterSizeLabel')
|
||||
self.footerSizeSpinBox = QtGui.QSpinBox(self.footerAreaPage)
|
||||
self.footerSizeSpinBox.setMaximum(999)
|
||||
self.footerSizeSpinBox.setValue(10)
|
||||
self.footerSizeSpinBox.setObjectName(u'FooterSizeSpinBox')
|
||||
self.footerAreaLayout.addRow(self.footerSizeLabel,
|
||||
self.footerSizeSpinBox)
|
||||
self.footerAreaLayout.setItem(3, QtGui.QFormLayout.LabelRole,
|
||||
self.spacer)
|
||||
self.footerAreaLayout.addRow(self.footerSizeLabel, self.footerSizeSpinBox)
|
||||
self.footerAreaLayout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer)
|
||||
themeWizard.addPage(self.footerAreaPage)
|
||||
# Alignment Page
|
||||
self.alignmentPage = QtGui.QWizardPage()
|
||||
|
@ -258,10 +243,8 @@ class Ui_ThemeWizard(object):
|
|||
self.horizontalComboBox = QtGui.QComboBox(self.alignmentPage)
|
||||
self.horizontalComboBox.addItems([u'', u'', u'', u''])
|
||||
self.horizontalComboBox.setObjectName(u'HorizontalComboBox')
|
||||
self.alignmentLayout.addRow(self.horizontalLabel,
|
||||
self.horizontalComboBox)
|
||||
self.verticalLabel, self.verticalComboBox = \
|
||||
create_valign_selection_widgets(self.alignmentPage)
|
||||
self.alignmentLayout.addRow(self.horizontalLabel, self.horizontalComboBox)
|
||||
self.verticalLabel, self.verticalComboBox = create_valign_selection_widgets(self.alignmentPage)
|
||||
self.verticalLabel.setObjectName(u'verticalLabel')
|
||||
self.verticalComboBox.setObjectName(u'verticalComboBox')
|
||||
self.alignmentLayout.addRow(self.verticalLabel, self.verticalComboBox)
|
||||
|
@ -269,10 +252,8 @@ class Ui_ThemeWizard(object):
|
|||
self.transitionsLabel.setObjectName(u'TransitionsLabel')
|
||||
self.transitionsCheckBox = QtGui.QCheckBox(self.alignmentPage)
|
||||
self.transitionsCheckBox.setObjectName(u'TransitionsCheckBox')
|
||||
self.alignmentLayout.addRow(self.transitionsLabel,
|
||||
self.transitionsCheckBox)
|
||||
self.alignmentLayout.setItem(3, QtGui.QFormLayout.LabelRole,
|
||||
self.spacer)
|
||||
self.alignmentLayout.addRow(self.transitionsLabel, self.transitionsCheckBox)
|
||||
self.alignmentLayout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer)
|
||||
themeWizard.addPage(self.alignmentPage)
|
||||
# Area Position Page
|
||||
self.areaPositionPage = QtGui.QWizardPage()
|
||||
|
@ -303,23 +284,19 @@ class Ui_ThemeWizard(object):
|
|||
self.mainWidthSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox)
|
||||
self.mainWidthSpinBox.setMaximum(9999)
|
||||
self.mainWidthSpinBox.setObjectName(u'MainWidthSpinBox')
|
||||
self.mainPositionLayout.addRow(self.mainWidthLabel,
|
||||
self.mainWidthSpinBox)
|
||||
self.mainPositionLayout.addRow(self.mainWidthLabel, self.mainWidthSpinBox)
|
||||
self.mainHeightLabel = QtGui.QLabel(self.mainPositionGroupBox)
|
||||
self.mainHeightLabel.setObjectName(u'MainHeightLabel')
|
||||
self.mainHeightSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox)
|
||||
self.mainHeightSpinBox.setMaximum(9999)
|
||||
self.mainHeightSpinBox.setObjectName(u'MainHeightSpinBox')
|
||||
self.mainPositionLayout.addRow(self.mainHeightLabel,
|
||||
self.mainHeightSpinBox)
|
||||
self.mainPositionLayout.addRow(self.mainHeightLabel, self.mainHeightSpinBox)
|
||||
self.areaPositionLayout.addWidget(self.mainPositionGroupBox)
|
||||
self.footerPositionGroupBox = QtGui.QGroupBox(self.areaPositionPage)
|
||||
self.footerPositionGroupBox.setObjectName(u'FooterPositionGroupBox')
|
||||
self.footerPositionLayout = QtGui.QFormLayout(
|
||||
self.footerPositionGroupBox)
|
||||
self.footerPositionLayout = QtGui.QFormLayout(self.footerPositionGroupBox)
|
||||
self.footerPositionLayout.setObjectName(u'FooterPositionLayout')
|
||||
self.footerPositionCheckBox = QtGui.QCheckBox(
|
||||
self.footerPositionGroupBox)
|
||||
self.footerPositionCheckBox = QtGui.QCheckBox(self.footerPositionGroupBox)
|
||||
self.footerPositionCheckBox.setObjectName(u'FooterPositionCheckBox')
|
||||
self.footerPositionLayout.addRow(self.footerPositionCheckBox)
|
||||
self.footerXLabel = QtGui.QLabel(self.footerPositionGroupBox)
|
||||
|
@ -339,15 +316,13 @@ class Ui_ThemeWizard(object):
|
|||
self.footerWidthSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox)
|
||||
self.footerWidthSpinBox.setMaximum(9999)
|
||||
self.footerWidthSpinBox.setObjectName(u'FooterWidthSpinBox')
|
||||
self.footerPositionLayout.addRow(self.footerWidthLabel,
|
||||
self.footerWidthSpinBox)
|
||||
self.footerPositionLayout.addRow(self.footerWidthLabel, self.footerWidthSpinBox)
|
||||
self.footerHeightLabel = QtGui.QLabel(self.footerPositionGroupBox)
|
||||
self.footerHeightLabel.setObjectName(u'FooterHeightLabel')
|
||||
self.footerHeightSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox)
|
||||
self.footerHeightSpinBox.setMaximum(9999)
|
||||
self.footerHeightSpinBox.setObjectName(u'FooterHeightSpinBox')
|
||||
self.footerPositionLayout.addRow(self.footerHeightLabel,
|
||||
self.footerHeightSpinBox)
|
||||
self.footerPositionLayout.addRow(self.footerHeightLabel, self.footerHeightSpinBox)
|
||||
self.areaPositionLayout.addWidget(self.footerPositionGroupBox)
|
||||
themeWizard.addPage(self.areaPositionPage)
|
||||
# Preview Page
|
||||
|
@ -360,8 +335,7 @@ class Ui_ThemeWizard(object):
|
|||
self.themeNameLabel = QtGui.QLabel(self.previewPage)
|
||||
self.themeNameLabel.setObjectName(u'ThemeNameLabel')
|
||||
self.themeNameEdit = QtGui.QLineEdit(self.previewPage)
|
||||
self.themeNameEdit.setValidator(QtGui.QRegExpValidator(
|
||||
QtCore.QRegExp(r'[^/\\?*|<>\[\]":<>+%]+'), self))
|
||||
self.themeNameEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":<>+%]+'), self))
|
||||
self.themeNameEdit.setObjectName(u'ThemeNameEdit')
|
||||
self.themeNameLayout.addRow(self.themeNameLabel, self.themeNameEdit)
|
||||
self.previewLayout.addLayout(self.themeNameLayout)
|
||||
|
@ -380,78 +354,55 @@ class Ui_ThemeWizard(object):
|
|||
self.previewLayout.addWidget(self.previewArea)
|
||||
themeWizard.addPage(self.previewPage)
|
||||
self.retranslateUi(themeWizard)
|
||||
QtCore.QObject.connect(self.backgroundComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'), self.backgroundStack,
|
||||
QtCore.SLOT(u'setCurrentIndex(int)'))
|
||||
QtCore.QObject.connect(self.outlineCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.outlineColorButton,
|
||||
QtCore.QObject.connect(self.backgroundComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
self.backgroundStack, QtCore.SLOT(u'setCurrentIndex(int)'))
|
||||
QtCore.QObject.connect(self.outlineCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.outlineColorButton,
|
||||
QtCore.SLOT(u'setEnabled(bool)'))
|
||||
QtCore.QObject.connect(self.outlineCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.outlineSizeSpinBox,
|
||||
QtCore.QObject.connect(self.outlineCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.outlineSizeSpinBox,
|
||||
QtCore.SLOT(u'setEnabled(bool)'))
|
||||
QtCore.QObject.connect(self.shadowCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.shadowColorButton,
|
||||
QtCore.QObject.connect(self.shadowCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.shadowColorButton,
|
||||
QtCore.SLOT(u'setEnabled(bool)'))
|
||||
QtCore.QObject.connect(self.shadowCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.shadowSizeSpinBox,
|
||||
QtCore.QObject.connect(self.shadowCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.shadowSizeSpinBox,
|
||||
QtCore.SLOT(u'setEnabled(bool)'))
|
||||
QtCore.QObject.connect(self.mainPositionCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.mainXSpinBox,
|
||||
QtCore.QObject.connect(self.mainPositionCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.mainXSpinBox,
|
||||
QtCore.SLOT(u'setDisabled(bool)'))
|
||||
QtCore.QObject.connect(self.mainPositionCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.mainYSpinBox,
|
||||
QtCore.QObject.connect(self.mainPositionCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.mainYSpinBox,
|
||||
QtCore.SLOT(u'setDisabled(bool)'))
|
||||
QtCore.QObject.connect(self.mainPositionCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.mainWidthSpinBox,
|
||||
QtCore.QObject.connect(self.mainPositionCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.mainWidthSpinBox,
|
||||
QtCore.SLOT(u'setDisabled(bool)'))
|
||||
QtCore.QObject.connect(self.mainPositionCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.mainHeightSpinBox,
|
||||
QtCore.QObject.connect(self.mainPositionCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.mainHeightSpinBox,
|
||||
QtCore.SLOT(u'setDisabled(bool)'))
|
||||
QtCore.QObject.connect(self.footerPositionCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.footerXSpinBox,
|
||||
QtCore.QObject.connect(self.footerPositionCheckBox,QtCore.SIGNAL(u'toggled(bool)'), self.footerXSpinBox,
|
||||
QtCore.SLOT(u'setDisabled(bool)'))
|
||||
QtCore.QObject.connect(self.footerPositionCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.footerYSpinBox,
|
||||
QtCore.QObject.connect(self.footerPositionCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.footerYSpinBox,
|
||||
QtCore.SLOT(u'setDisabled(bool)'))
|
||||
QtCore.QObject.connect(self.footerPositionCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.footerWidthSpinBox,
|
||||
QtCore.QObject.connect(self.footerPositionCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.footerWidthSpinBox,
|
||||
QtCore.SLOT(u'setDisabled(bool)'))
|
||||
QtCore.QObject.connect(self.footerPositionCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.footerHeightSpinBox,
|
||||
QtCore.QObject.connect(self.footerPositionCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.footerHeightSpinBox,
|
||||
QtCore.SLOT(u'setDisabled(bool)'))
|
||||
|
||||
def retranslateUi(self, themeWizard):
|
||||
themeWizard.setWindowTitle(
|
||||
translate('OpenLP.ThemeWizard', 'Theme Wizard'))
|
||||
self.titleLabel.setText(
|
||||
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
|
||||
themeWizard.setWindowTitle(translate('OpenLP.ThemeWizard', 'Theme Wizard'))
|
||||
self.titleLabel.setText(u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
|
||||
translate('OpenLP.ThemeWizard', 'Welcome to the Theme Wizard'))
|
||||
self.informationLabel.setText(
|
||||
translate('OpenLP.ThemeWizard', 'This wizard will help you to '
|
||||
'create and edit your themes. Click the next button below to '
|
||||
'start the process by setting up your background.'))
|
||||
self.backgroundPage.setTitle(
|
||||
translate('OpenLP.ThemeWizard', 'Set Up Background'))
|
||||
self.backgroundPage.setSubTitle(
|
||||
translate('OpenLP.ThemeWizard', 'Set up your theme\'s background '
|
||||
self.backgroundPage.setTitle(translate('OpenLP.ThemeWizard', 'Set Up Background'))
|
||||
self.backgroundPage.setSubTitle(translate('OpenLP.ThemeWizard', 'Set up your theme\'s background '
|
||||
'according to the parameters below.'))
|
||||
self.backgroundLabel.setText(
|
||||
translate('OpenLP.ThemeWizard', 'Background type:'))
|
||||
self.backgroundLabel.setText(translate('OpenLP.ThemeWizard', 'Background type:'))
|
||||
self.backgroundComboBox.setItemText(BackgroundType.Solid,
|
||||
translate('OpenLP.ThemeWizard', 'Solid Color'))
|
||||
self.backgroundComboBox.setItemText(BackgroundType.Gradient,
|
||||
translate('OpenLP.ThemeWizard', 'Gradient'))
|
||||
self.backgroundComboBox.setItemText(
|
||||
BackgroundType.Image, UiStrings().Image)
|
||||
self.backgroundComboBox.setItemText(BackgroundType.Transparent,
|
||||
translate('OpenLP.ThemeWizard', 'Transparent'))
|
||||
self.backgroundComboBox.setItemText(BackgroundType.Image, UiStrings().Image)
|
||||
self.backgroundComboBox.setItemText(BackgroundType.Transparent, translate('OpenLP.ThemeWizard', 'Transparent'))
|
||||
self.colorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
|
||||
self.gradientStartLabel.setText(
|
||||
translate(u'OpenLP.ThemeWizard', 'Starting color:'))
|
||||
self.gradientEndLabel.setText(
|
||||
translate(u'OpenLP.ThemeWizard', 'Ending color:'))
|
||||
self.gradientTypeLabel.setText(
|
||||
translate('OpenLP.ThemeWizard', 'Gradient:'))
|
||||
self.gradientStartLabel.setText(translate(u'OpenLP.ThemeWizard', 'Starting color:'))
|
||||
self.gradientEndLabel.setText(translate(u'OpenLP.ThemeWizard', 'Ending color:'))
|
||||
self.gradientTypeLabel.setText(translate('OpenLP.ThemeWizard', 'Gradient:'))
|
||||
self.gradientComboBox.setItemText(BackgroundGradientType.Horizontal,
|
||||
translate('OpenLP.ThemeWizard', 'Horizontal'))
|
||||
self.gradientComboBox.setItemText(BackgroundGradientType.Vertical,
|
||||
|
@ -462,66 +413,46 @@ class Ui_ThemeWizard(object):
|
|||
translate('OpenLP.ThemeWizard', 'Top Left - Bottom Right'))
|
||||
self.gradientComboBox.setItemText(BackgroundGradientType.LeftBottom,
|
||||
translate('OpenLP.ThemeWizard', 'Bottom Left - Top Right'))
|
||||
self.imageColorLabel.setText(
|
||||
translate(u'OpenLP.ThemeWizard', 'Background color:'))
|
||||
self.imageColorLabel.setText(translate(u'OpenLP.ThemeWizard', 'Background color:'))
|
||||
self.imageLabel.setText(u'%s:' % UiStrings().Image)
|
||||
self.mainAreaPage.setTitle(
|
||||
translate('OpenLP.ThemeWizard', 'Main Area Font Details'))
|
||||
self.mainAreaPage.setSubTitle(
|
||||
translate('OpenLP.ThemeWizard', 'Define the font and display '
|
||||
self.mainAreaPage.setTitle(translate('OpenLP.ThemeWizard', 'Main Area Font Details'))
|
||||
self.mainAreaPage.setSubTitle(translate('OpenLP.ThemeWizard', 'Define the font and display '
|
||||
'characteristics for the Display text'))
|
||||
self.mainFontLabel.setText(translate('OpenLP.ThemeWizard', 'Font:'))
|
||||
self.mainColorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
|
||||
self.mainSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
|
||||
self.mainSizeSpinBox.setSuffix(UiStrings().FontSizePtUnit)
|
||||
self.lineSpacingLabel.setText(
|
||||
translate('OpenLP.ThemeWizard', 'Line Spacing:'))
|
||||
self.lineSpacingLabel.setText(translate('OpenLP.ThemeWizard', 'Line Spacing:'))
|
||||
self.lineSpacingSpinBox.setSuffix(UiStrings().FontSizePtUnit)
|
||||
self.outlineCheckBox.setText(
|
||||
translate('OpenLP.ThemeWizard', '&Outline:'))
|
||||
self.outlineCheckBox.setText(translate('OpenLP.ThemeWizard', '&Outline:'))
|
||||
self.outlineSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
|
||||
self.outlineSizeSpinBox.setSuffix(UiStrings().FontSizePtUnit)
|
||||
self.shadowCheckBox.setText(translate('OpenLP.ThemeWizard', '&Shadow:'))
|
||||
self.shadowSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
|
||||
self.shadowSizeSpinBox.setSuffix(UiStrings().FontSizePtUnit)
|
||||
self.mainBoldCheckBox.setText(translate('OpenLP.ThemeWizard', 'Bold'))
|
||||
self.mainItalicsCheckBox.setText(
|
||||
translate('OpenLP.ThemeWizard', 'Italic'))
|
||||
self.footerAreaPage.setTitle(
|
||||
translate('OpenLP.ThemeWizard', 'Footer Area Font Details'))
|
||||
self.footerAreaPage.setSubTitle(
|
||||
translate('OpenLP.ThemeWizard', 'Define the font and display '
|
||||
self.mainItalicsCheckBox.setText(translate('OpenLP.ThemeWizard', 'Italic'))
|
||||
self.footerAreaPage.setTitle(translate('OpenLP.ThemeWizard', 'Footer Area Font Details'))
|
||||
self.footerAreaPage.setSubTitle(translate('OpenLP.ThemeWizard', 'Define the font and display '
|
||||
'characteristics for the Footer text'))
|
||||
self.footerFontLabel.setText(translate('OpenLP.ThemeWizard', 'Font:'))
|
||||
self.footerColorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
|
||||
self.footerSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
|
||||
self.footerSizeSpinBox.setSuffix(UiStrings().FontSizePtUnit)
|
||||
self.alignmentPage.setTitle(
|
||||
translate('OpenLP.ThemeWizard', 'Text Formatting Details'))
|
||||
self.alignmentPage.setSubTitle(
|
||||
translate('OpenLP.ThemeWizard', 'Allows additional display '
|
||||
self.alignmentPage.setTitle(translate('OpenLP.ThemeWizard', 'Text Formatting Details'))
|
||||
self.alignmentPage.setSubTitle(translate('OpenLP.ThemeWizard', 'Allows additional display '
|
||||
'formatting information to be defined'))
|
||||
self.horizontalLabel.setText(
|
||||
translate('OpenLP.ThemeWizard', 'Horizontal Align:'))
|
||||
self.horizontalComboBox.setItemText(HorizontalType.Left,
|
||||
translate('OpenLP.ThemeWizard', 'Left'))
|
||||
self.horizontalComboBox.setItemText(HorizontalType.Right,
|
||||
translate('OpenLP.ThemeWizard', 'Right'))
|
||||
self.horizontalComboBox.setItemText(HorizontalType.Center,
|
||||
translate('OpenLP.ThemeWizard', 'Center'))
|
||||
self.horizontalComboBox.setItemText(HorizontalType.Justify,
|
||||
translate('OpenLP.ThemeWizard', 'Justify'))
|
||||
self.transitionsLabel.setText(
|
||||
translate('OpenLP.ThemeWizard', 'Transitions:'))
|
||||
self.areaPositionPage.setTitle(
|
||||
translate('OpenLP.ThemeWizard', 'Output Area Locations'))
|
||||
self.areaPositionPage.setSubTitle(
|
||||
translate('OpenLP.ThemeWizard', 'Allows you to change and move the'
|
||||
self.horizontalLabel.setText(translate('OpenLP.ThemeWizard', 'Horizontal Align:'))
|
||||
self.horizontalComboBox.setItemText(HorizontalType.Left, translate('OpenLP.ThemeWizard', 'Left'))
|
||||
self.horizontalComboBox.setItemText(HorizontalType.Right, translate('OpenLP.ThemeWizard', 'Right'))
|
||||
self.horizontalComboBox.setItemText(HorizontalType.Center, translate('OpenLP.ThemeWizard', 'Center'))
|
||||
self.horizontalComboBox.setItemText(HorizontalType.Justify, translate('OpenLP.ThemeWizard', 'Justify'))
|
||||
self.transitionsLabel.setText(translate('OpenLP.ThemeWizard', 'Transitions:'))
|
||||
self.areaPositionPage.setTitle(translate('OpenLP.ThemeWizard', 'Output Area Locations'))
|
||||
self.areaPositionPage.setSubTitle(translate('OpenLP.ThemeWizard', 'Allows you to change and move the'
|
||||
' main and footer areas.'))
|
||||
self.mainPositionGroupBox.setTitle(
|
||||
translate('OpenLP.ThemeWizard', '&Main Area'))
|
||||
self.mainPositionCheckBox.setText(
|
||||
translate('OpenLP.ThemeWizard', '&Use default location'))
|
||||
self.mainPositionGroupBox.setTitle(translate('OpenLP.ThemeWizard', '&Main Area'))
|
||||
self.mainPositionCheckBox.setText(translate('OpenLP.ThemeWizard', '&Use default location'))
|
||||
self.mainXLabel.setText(translate('OpenLP.ThemeWizard', 'X position:'))
|
||||
self.mainXSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
|
||||
self.mainYSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
|
||||
|
@ -529,37 +460,24 @@ class Ui_ThemeWizard(object):
|
|||
self.mainWidthSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
|
||||
self.mainWidthLabel.setText(translate('OpenLP.ThemeWizard', 'Width:'))
|
||||
self.mainHeightSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
|
||||
self.mainHeightLabel.setText(
|
||||
translate('OpenLP.ThemeWizard', 'Height:'))
|
||||
self.footerPositionGroupBox.setTitle(
|
||||
translate('OpenLP.ThemeWizard', '&Footer Area'))
|
||||
self.footerXLabel.setText(
|
||||
translate('OpenLP.ThemeWizard', 'X position:'))
|
||||
self.mainHeightLabel.setText(translate('OpenLP.ThemeWizard', 'Height:'))
|
||||
self.footerPositionGroupBox.setTitle(translate('OpenLP.ThemeWizard', '&Footer Area'))
|
||||
self.footerXLabel.setText(translate('OpenLP.ThemeWizard', 'X position:'))
|
||||
self.footerXSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
|
||||
self.footerYLabel.setText(
|
||||
translate('OpenLP.ThemeWizard', 'Y position:'))
|
||||
self.footerYLabel.setText(translate('OpenLP.ThemeWizard', 'Y position:'))
|
||||
self.footerYSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
|
||||
self.footerWidthLabel.setText(
|
||||
translate('OpenLP.ThemeWizard', 'Width:'))
|
||||
self.footerWidthSpinBox.setSuffix(
|
||||
translate('OpenLP.ThemeWizard', 'px'))
|
||||
self.footerHeightLabel.setText(
|
||||
translate('OpenLP.ThemeWizard', 'Height:'))
|
||||
self.footerHeightSpinBox.setSuffix(
|
||||
translate('OpenLP.ThemeWizard', 'px'))
|
||||
self.footerPositionCheckBox.setText(
|
||||
translate('OpenLP.ThemeWizard', 'Use default location'))
|
||||
self.footerWidthLabel.setText(translate('OpenLP.ThemeWizard', 'Width:'))
|
||||
self.footerWidthSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
|
||||
self.footerHeightLabel.setText(translate('OpenLP.ThemeWizard', 'Height:'))
|
||||
self.footerHeightSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
|
||||
self.footerPositionCheckBox.setText(translate('OpenLP.ThemeWizard', 'Use default location'))
|
||||
themeWizard.setOption(QtGui.QWizard.HaveCustomButton1, False)
|
||||
themeWizard.setButtonText(QtGui.QWizard.CustomButton1,
|
||||
translate('OpenLP.ThemeWizard', 'Layout Preview'))
|
||||
self.previewPage.setTitle(
|
||||
translate('OpenLP.ThemeWizard', 'Preview and Save'))
|
||||
self.previewPage.setSubTitle(
|
||||
translate('OpenLP.ThemeWizard', 'Preview the theme and save it.'))
|
||||
self.themeNameLabel.setText(
|
||||
translate('OpenLP.ThemeWizard', 'Theme name:'))
|
||||
self.previewPage.setTitle(translate('OpenLP.ThemeWizard', 'Preview and Save'))
|
||||
self.previewPage.setSubTitle(translate('OpenLP.ThemeWizard', 'Preview the theme and save it.'))
|
||||
self.themeNameLabel.setText(translate('OpenLP.ThemeWizard', 'Theme name:'))
|
||||
# Align all QFormLayouts towards each other.
|
||||
labelWidth = max(self.backgroundLabel.minimumSizeHint().width(),
|
||||
self.horizontalLabel.minimumSizeHint().width())
|
||||
self.spacer.changeSize(labelWidth, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.spacer.changeSize(labelWidth, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -54,25 +54,24 @@ class WizardStrings(object):
|
|||
FormatLabel = translate('OpenLP.Ui', 'Format:')
|
||||
HeaderStyle = u'<span style="font-size:14pt; font-weight:600;">%s</span>'
|
||||
Importing = translate('OpenLP.Ui', 'Importing')
|
||||
ImportingType = unicode(translate('OpenLP.Ui', 'Importing "%s"...'))
|
||||
ImportingType = translate('OpenLP.Ui', 'Importing "%s"...')
|
||||
ImportSelect = translate('OpenLP.Ui', 'Select Import Source')
|
||||
ImportSelectLong = unicode(translate('OpenLP.Ui',
|
||||
'Select the import format and the location to import from.'))
|
||||
ImportSelectLong = translate('OpenLP.Ui',
|
||||
'Select the import format and the location to import from.')
|
||||
NoSqlite = translate('OpenLP.Ui', 'The openlp.org 1.x importer has been '
|
||||
'disabled due to a missing Python module. If you want to use this '
|
||||
'importer, you will need to install the "python-sqlite" '
|
||||
'module.')
|
||||
OpenTypeFile = unicode(translate('OpenLP.Ui', 'Open %s File'))
|
||||
OpenTypeFolder = unicode(translate('OpenLP.Ui', 'Open %s Folder'))
|
||||
PercentSymbolFormat = unicode(translate('OpenLP.Ui', '%p%'))
|
||||
'importer, you will need to install the "python-sqlite" module.')
|
||||
OpenTypeFile = translate('OpenLP.Ui', 'Open %s File')
|
||||
OpenTypeFolder = translate('OpenLP.Ui', 'Open %s Folder')
|
||||
PercentSymbolFormat = translate('OpenLP.Ui', '%p%')
|
||||
Ready = translate('OpenLP.Ui', 'Ready.')
|
||||
StartingImport = translate('OpenLP.Ui', 'Starting import...')
|
||||
YouSpecifyFile = unicode(translate('OpenLP.Ui', 'You need to specify one '
|
||||
'%s file to import from.', 'A file type e.g. OpenSong'))
|
||||
YouSpecifyFiles = unicode(translate('OpenLP.Ui', 'You need to specify at '
|
||||
'least one %s file to import from.', 'A file type e.g. OpenSong'))
|
||||
YouSpecifyFolder = unicode(translate('OpenLP.Ui', 'You need to specify one '
|
||||
'%s folder to import from.', 'A song format e.g. PowerSong'))
|
||||
YouSpecifyFile = translate('OpenLP.Ui', 'You need to specify one '
|
||||
'%s file to import from.', 'A file type e.g. OpenSong')
|
||||
YouSpecifyFiles = translate('OpenLP.Ui', 'You need to specify at '
|
||||
'least one %s file to import from.', 'A file type e.g. OpenSong')
|
||||
YouSpecifyFolder = translate('OpenLP.Ui', 'You need to specify one '
|
||||
'%s folder to import from.', 'A song format e.g. PowerSong')
|
||||
|
||||
|
||||
class OpenLPWizard(QtGui.QWizard):
|
||||
|
@ -92,12 +91,9 @@ class OpenLPWizard(QtGui.QWizard):
|
|||
self.registerFields()
|
||||
self.customInit()
|
||||
self.customSignals()
|
||||
QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'),
|
||||
self.onCurrentIdChanged)
|
||||
QtCore.QObject.connect(self.errorCopyToButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onErrorCopyToButtonClicked)
|
||||
QtCore.QObject.connect(self.errorSaveToButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onErrorSaveToButtonClicked)
|
||||
QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged)
|
||||
QtCore.QObject.connect(self.errorCopyToButton, QtCore.SIGNAL(u'clicked()'), self.onErrorCopyToButtonClicked)
|
||||
QtCore.QObject.connect(self.errorSaveToButton, QtCore.SIGNAL(u'clicked()'), self.onErrorSaveToButtonClicked)
|
||||
|
||||
def setupUi(self, image):
|
||||
"""
|
||||
|
@ -145,20 +141,17 @@ class OpenLPWizard(QtGui.QWizard):
|
|||
self.progressLayout.addWidget(self.errorReportTextEdit)
|
||||
self.errorButtonLayout = QtGui.QHBoxLayout()
|
||||
self.errorButtonLayout.setObjectName(u'errorButtonLayout')
|
||||
spacer = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
spacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.errorButtonLayout.addItem(spacer)
|
||||
self.errorCopyToButton = QtGui.QPushButton(self.progressPage)
|
||||
self.errorCopyToButton.setObjectName(u'errorCopyToButton')
|
||||
self.errorCopyToButton.setHidden(True)
|
||||
self.errorCopyToButton.setIcon(
|
||||
build_icon(u':/system/system_edit_copy.png'))
|
||||
self.errorCopyToButton.setIcon(build_icon(u':/system/system_edit_copy.png'))
|
||||
self.errorButtonLayout.addWidget(self.errorCopyToButton)
|
||||
self.errorSaveToButton = QtGui.QPushButton(self.progressPage)
|
||||
self.errorSaveToButton.setObjectName(u'errorSaveToButton')
|
||||
self.errorSaveToButton.setHidden(True)
|
||||
self.errorSaveToButton.setIcon(
|
||||
build_icon(u':/general/general_save.png'))
|
||||
self.errorSaveToButton.setIcon(build_icon(u':/general/general_save.png'))
|
||||
self.errorButtonLayout.addWidget(self.errorSaveToButton)
|
||||
self.progressLayout.addLayout(self.errorButtonLayout)
|
||||
self.addPage(self.progressPage)
|
||||
|
@ -280,9 +273,8 @@ class OpenLPWizard(QtGui.QWizard):
|
|||
An editbox (QLineEdit).
|
||||
"""
|
||||
folder = unicode(QtGui.QFileDialog.getExistingDirectory(self, title,
|
||||
os.path.dirname(SettingsManager.get_last_dir(
|
||||
self.plugin.settingsSection, 1)), QtGui.QFileDialog.ShowDirsOnly))
|
||||
os.path.dirname(SettingsManager.get_last_dir(self.plugin.settingsSection, 1)),
|
||||
QtGui.QFileDialog.ShowDirsOnly))
|
||||
if folder:
|
||||
editbox.setText(folder)
|
||||
SettingsManager.set_last_dir(self.plugin.settingsSection,
|
||||
folder, 1)
|
||||
SettingsManager.set_last_dir(self.plugin.settingsSection, folder, 1)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -32,13 +32,14 @@ The :mod:`openlp.core.utils` module provides the utility libraries for OpenLP.
|
|||
from datetime import datetime
|
||||
from distutils.version import LooseVersion
|
||||
import logging
|
||||
import locale
|
||||
import os
|
||||
import re
|
||||
from subprocess import Popen, PIPE
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import Settings
|
||||
|
||||
from PyQt4 import QtGui, QtCore
|
||||
|
||||
|
@ -91,7 +92,7 @@ class AppLocation(object):
|
|||
VersionDir = 5
|
||||
CacheDir = 6
|
||||
LanguageDir = 7
|
||||
|
||||
|
||||
# Base path where data/config/cache dir is located
|
||||
BaseDir = None
|
||||
|
||||
|
@ -104,21 +105,15 @@ class AppLocation(object):
|
|||
The directory type you want, for instance the data directory.
|
||||
"""
|
||||
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, u'plugins'),
|
||||
os.path.join(os.path.split(openlp.__file__)[0], u'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, u'i18n')
|
||||
elif dir_type == AppLocation.DataDir and AppLocation.BaseDir:
|
||||
return os.path.join(AppLocation.BaseDir, 'data')
|
||||
|
@ -132,8 +127,7 @@ class AppLocation(object):
|
|||
"""
|
||||
# Check if we have a different data location.
|
||||
if Settings().contains(u'advanced/data path'):
|
||||
path = unicode(Settings().value(
|
||||
u'advanced/data path').toString())
|
||||
path = Settings().value(u'advanced/data path', u'')
|
||||
else:
|
||||
path = AppLocation.get_directory(AppLocation.DataDir)
|
||||
check_directory_exists(path)
|
||||
|
@ -157,8 +151,7 @@ def _get_os_dir_path(dir_type):
|
|||
encoding = sys.getfilesystemencoding()
|
||||
if sys.platform == u'win32':
|
||||
if dir_type == AppLocation.DataDir:
|
||||
return os.path.join(unicode(os.getenv(u'APPDATA'), encoding),
|
||||
u'openlp', u'data')
|
||||
return os.path.join(unicode(os.getenv(u'APPDATA'), encoding), u'openlp', u'data')
|
||||
elif dir_type == AppLocation.LanguageDir:
|
||||
return os.path.split(openlp.__file__)[0]
|
||||
return os.path.join(unicode(os.getenv(u'APPDATA'), encoding),
|
||||
|
@ -181,17 +174,13 @@ def _get_os_dir_path(dir_type):
|
|||
return os.path.join(u'/usr', u'share', u'openlp')
|
||||
if XDG_BASE_AVAILABLE:
|
||||
if dir_type == AppLocation.ConfigDir:
|
||||
return os.path.join(unicode(BaseDirectory.xdg_config_home,
|
||||
encoding), u'openlp')
|
||||
return os.path.join(unicode(BaseDirectory.xdg_config_home, encoding), u'openlp')
|
||||
elif dir_type == AppLocation.DataDir:
|
||||
return os.path.join(
|
||||
unicode(BaseDirectory.xdg_data_home, encoding), u'openlp')
|
||||
return os.path.join(unicode(BaseDirectory.xdg_data_home, encoding), u'openlp')
|
||||
elif dir_type == AppLocation.CacheDir:
|
||||
return os.path.join(unicode(BaseDirectory.xdg_cache_home,
|
||||
encoding), u'openlp')
|
||||
return os.path.join(unicode(BaseDirectory.xdg_cache_home, encoding), u'openlp')
|
||||
if dir_type == AppLocation.DataDir:
|
||||
return os.path.join(unicode(os.getenv(u'HOME'), encoding),
|
||||
u'.openlp', u'data')
|
||||
return os.path.join(unicode(os.getenv(u'HOME'), encoding), u'.openlp', u'data')
|
||||
return os.path.join(unicode(os.getenv(u'HOME'), encoding), u'.openlp')
|
||||
|
||||
|
||||
|
@ -231,8 +220,7 @@ def get_application_version():
|
|||
if revision_id in tags:
|
||||
full_version = u'%s' % tags[revision_id][0]
|
||||
else:
|
||||
full_version = '%s-bzr%s' % \
|
||||
(sorted(b.tags.get_tag_dict().keys())[-1], revno)
|
||||
full_version = '%s-bzr%s' % (sorted(b.tags.get_tag_dict().keys())[-1], revno)
|
||||
finally:
|
||||
b.unlock()
|
||||
except:
|
||||
|
@ -254,8 +242,7 @@ def get_application_version():
|
|||
if code != 0:
|
||||
raise Exception(u'Error running bzr log')
|
||||
latest = output.split(u':')[0]
|
||||
full_version = latest == revision and tag or \
|
||||
u'%s-bzr%s' % (tag, latest)
|
||||
full_version = latest == revision and tag or u'%s-bzr%s' % (tag, latest)
|
||||
else:
|
||||
# We're not running the development version, let's use the file.
|
||||
filepath = AppLocation.get_directory(AppLocation.VersionDir)
|
||||
|
@ -277,8 +264,7 @@ def get_application_version():
|
|||
u'build': bits[1] if len(bits) > 1 else None
|
||||
}
|
||||
if APPLICATION_VERSION[u'build']:
|
||||
log.info(u'Openlp version %s build %s',
|
||||
APPLICATION_VERSION[u'version'], APPLICATION_VERSION[u'build'])
|
||||
log.info(u'Openlp version %s build %s', APPLICATION_VERSION[u'version'], APPLICATION_VERSION[u'build'])
|
||||
else:
|
||||
log.info(u'Openlp version %s' % APPLICATION_VERSION[u'version'])
|
||||
return APPLICATION_VERSION
|
||||
|
@ -296,15 +282,13 @@ def check_latest_version(current_version):
|
|||
# set to prod in the distribution config file.
|
||||
settings = Settings()
|
||||
settings.beginGroup(u'general')
|
||||
last_test = unicode(settings.value(u'last version test',
|
||||
QtCore.QVariant(datetime.now().date())).toString())
|
||||
this_test = unicode(datetime.now().date())
|
||||
settings.setValue(u'last version test', QtCore.QVariant(this_test))
|
||||
last_test = settings.value(u'last version test', datetime.now().date())
|
||||
this_test = datetime.now().date()
|
||||
settings.setValue(u'last version test', this_test)
|
||||
settings.endGroup()
|
||||
if last_test != this_test:
|
||||
if current_version[u'build']:
|
||||
req = urllib2.Request(
|
||||
u'http://www.openlp.org/files/dev_version.txt')
|
||||
req = urllib2.Request(u'http://www.openlp.org/files/dev_version.txt')
|
||||
else:
|
||||
req = urllib2.Request(u'http://www.openlp.org/files/version.txt')
|
||||
req.add_header(u'User-Agent', u'OpenLP/%s' % current_version[u'full'])
|
||||
|
@ -359,8 +343,7 @@ def get_images_filter():
|
|||
for fmt in QtGui.QImageReader.supportedImageFormats()]
|
||||
visible_formats = u'(*.%s)' % u'; *.'.join(formats)
|
||||
actual_formats = u'(*.%s)' % u' *.'.join(formats)
|
||||
IMAGES_FILTER = u'%s %s %s' % (translate('OpenLP', 'Image Files'),
|
||||
visible_formats, actual_formats)
|
||||
IMAGES_FILTER = u'%s %s %s' % (translate('OpenLP', 'Image Files'), visible_formats, actual_formats)
|
||||
return IMAGES_FILTER
|
||||
|
||||
|
||||
|
@ -464,11 +447,9 @@ def get_uno_instance(resolver):
|
|||
"""
|
||||
log.debug(u'get UNO Desktop Openoffice - resolve')
|
||||
if UNO_CONNECTION_TYPE == u'pipe':
|
||||
return resolver.resolve(u'uno:pipe,name=openlp_pipe;' \
|
||||
+ u'urp;StarOffice.ComponentContext')
|
||||
return resolver.resolve(u'uno:pipe,name=openlp_pipe; urp;StarOffice.ComponentContext')
|
||||
else:
|
||||
return resolver.resolve(u'uno:socket,host=localhost,port=2002;' \
|
||||
+ u'urp;StarOffice.ComponentContext')
|
||||
return resolver.resolve(u'uno:socket,host=localhost,port=2002; urp;StarOffice.ComponentContext')
|
||||
|
||||
|
||||
def format_time(text, local_time):
|
||||
|
@ -497,15 +478,15 @@ def locale_compare(string1, string2):
|
|||
or 0, depending on whether string1 collates before or after string2 or
|
||||
is equal to it. Comparison is case insensitive.
|
||||
"""
|
||||
# Function locale.strcol() from standard Python library does not work
|
||||
# properly on Windows and probably somewhere else.
|
||||
return QtCore.QString.localeAwareCompare(string1.lower(), string2.lower())
|
||||
# Function locale.strcoll() from standard Python library does not work
|
||||
# properly on Windows.
|
||||
return locale.strcoll(string1.lower(), string2.lower())
|
||||
|
||||
|
||||
# For performance reasons provide direct reference to compare function
|
||||
# without wrapping it in another function making te string lowercase.
|
||||
# This is needed for sorting songs.
|
||||
locale_direct_compare = QtCore.QString.localeAwareCompare
|
||||
locale_direct_compare = locale.strcoll
|
||||
|
||||
|
||||
from languagemanager import LanguageManager
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -32,7 +32,8 @@ by the shortcuts system.
|
|||
"""
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import Settings
|
||||
|
||||
|
||||
class ActionCategory(object):
|
||||
"""
|
||||
|
@ -212,11 +213,11 @@ class ActionList(object):
|
|||
empty ``objectName``.
|
||||
|
||||
``category``
|
||||
The category this action belongs to. The category can be a QString
|
||||
or python unicode string. **Note**, if the category is ``None``, the
|
||||
category and its actions are being hidden in the shortcut dialog.
|
||||
However, if they are added, it is possible to avoid assigning
|
||||
shortcuts twice, which is important.
|
||||
The category this action belongs to. The category has to be a python
|
||||
string. . **Note**, if the category is ``None``, the category and
|
||||
its actions are being hidden in the shortcut dialog. However, if
|
||||
they are added, it is possible to avoid assigning shortcuts twice,
|
||||
which is important.
|
||||
|
||||
``weight``
|
||||
The weight specifies how important a category is. However, this only
|
||||
|
@ -232,8 +233,7 @@ class ActionList(object):
|
|||
# Load the shortcut from the config.
|
||||
settings = Settings()
|
||||
settings.beginGroup(u'shortcuts')
|
||||
shortcuts = settings.value(action.objectName(),
|
||||
QtCore.QVariant(action.shortcuts())).toStringList()
|
||||
shortcuts = settings.value(action.objectName(), action.shortcuts())
|
||||
settings.endGroup()
|
||||
if not shortcuts:
|
||||
action.setShortcuts([])
|
||||
|
@ -287,8 +287,7 @@ class ActionList(object):
|
|||
# Remove empty categories.
|
||||
if not self.categories[category].actions:
|
||||
self.categories.remove(category)
|
||||
shortcuts = map(unicode,
|
||||
map(QtGui.QKeySequence.toString, action.shortcuts()))
|
||||
shortcuts = map(unicode, map(QtGui.QKeySequence.toString, action.shortcuts()))
|
||||
for shortcut in shortcuts:
|
||||
# Remove action from the list of actions which are using this
|
||||
# shortcut.
|
||||
|
@ -339,8 +338,7 @@ class ActionList(object):
|
|||
# Remove empty entries.
|
||||
if not ActionList.shortcut_map[old_shortcut]:
|
||||
del ActionList.shortcut_map[old_shortcut]
|
||||
new_shortcuts = map(unicode,
|
||||
map(QtGui.QKeySequence.toString, action.shortcuts()))
|
||||
new_shortcuts = map(unicode, map(QtGui.QKeySequence.toString, action.shortcuts()))
|
||||
# Add the new shortcuts to the map.
|
||||
for new_shortcut in new_shortcuts:
|
||||
existing_actions = ActionList.shortcut_map.get(new_shortcut, [])
|
||||
|
@ -358,8 +356,7 @@ class ActionList(object):
|
|||
``action``
|
||||
The action which wants to use a particular shortcut.
|
||||
"""
|
||||
local = action.shortcutContext() in \
|
||||
[QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]
|
||||
local = action.shortcutContext() in [QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]
|
||||
affected_actions = filter(lambda a: isinstance(a, QtGui.QAction),
|
||||
self.getAllChildObjects(action.parent())) if local else []
|
||||
for existing_action in existing_actions:
|
||||
|
@ -367,8 +364,7 @@ class ActionList(object):
|
|||
continue
|
||||
if not local or existing_action in affected_actions:
|
||||
return False
|
||||
if existing_action.shortcutContext() \
|
||||
in [QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]:
|
||||
if existing_action.shortcutContext() in [QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]:
|
||||
return False
|
||||
elif action in self.getAllChildObjects(existing_action.parent()):
|
||||
return False
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
|
@ -31,13 +31,13 @@ The :mod:`languagemanager` module provides all the translation settings and
|
|||
language file loading for OpenLP.
|
||||
"""
|
||||
import logging
|
||||
import re
|
||||
import sys
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import translate, Settings
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -63,8 +63,7 @@ class LanguageManager(object):
|
|||
app_translator.load(language, lang_path)
|
||||
# A translator for buttons and other default strings provided by Qt.
|
||||
if sys.platform != u'win32' and sys.platform != u'darwin':
|
||||
lang_path = QtCore.QLibraryInfo.location(
|
||||
QtCore.QLibraryInfo.TranslationsPath)
|
||||
lang_path = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)
|
||||
default_translator = QtCore.QTranslator()
|
||||
default_translator.load(u'qt_%s' % language, lang_path)
|
||||
return app_translator, default_translator
|
||||
|
@ -76,15 +75,11 @@ class LanguageManager(object):
|
|||
"""
|
||||
log.debug(u'Translation files: %s', AppLocation.get_directory(
|
||||
AppLocation.LanguageDir))
|
||||
trans_dir = QtCore.QDir(AppLocation.get_directory(
|
||||
AppLocation.LanguageDir))
|
||||
file_names = trans_dir.entryList(QtCore.QStringList(u'*.qm'),
|
||||
QtCore.QDir.Files, QtCore.QDir.Name)
|
||||
trans_dir = QtCore.QDir(AppLocation.get_directory(AppLocation.LanguageDir))
|
||||
file_names = trans_dir.entryList(u'*.qm', QtCore.QDir.Files, QtCore.QDir.Name)
|
||||
# Remove qm files from the list which start with "qt_".
|
||||
file_names = file_names.filter(QtCore.QRegExp("^(?!qt_)"))
|
||||
for name in file_names:
|
||||
file_names.replaceInStrings(name, trans_dir.filePath(name))
|
||||
return file_names
|
||||
file_names = filter(lambda file_: not file_.startswith(u'qt_'), file_names)
|
||||
return map(trans_dir.filePath, file_names)
|
||||
|
||||
@staticmethod
|
||||
def language_name(qm_file):
|
||||
|
@ -96,22 +91,19 @@ class LanguageManager(object):
|
|||
"""
|
||||
translator = QtCore.QTranslator()
|
||||
translator.load(qm_file)
|
||||
return translator.translate('OpenLP.MainWindow', 'English',
|
||||
'Please add the name of your language here')
|
||||
return translator.translate('OpenLP.MainWindow', 'English', 'Please add the name of your language here')
|
||||
|
||||
@staticmethod
|
||||
def get_language():
|
||||
"""
|
||||
Retrieve a saved language to use from settings
|
||||
"""
|
||||
settings = Settings()
|
||||
language = unicode(settings.value(
|
||||
u'general/language', QtCore.QVariant(u'[en]')).toString())
|
||||
language = Settings().value(u'general/language', u'[en]')
|
||||
language = str(language)
|
||||
log.info(u'Language file: \'%s\' Loaded from conf file' % language)
|
||||
reg_ex = QtCore.QRegExp("^\[(.*)\]")
|
||||
if reg_ex.exactMatch(language):
|
||||
if re.match(r'[[].*[]]', language):
|
||||
LanguageManager.auto_language = True
|
||||
language = reg_ex.cap(1)
|
||||
language = re.sub(r'[\[\]]', '', language)
|
||||
return language
|
||||
|
||||
@staticmethod
|
||||
|
@ -136,14 +128,12 @@ class LanguageManager(object):
|
|||
language = unicode(qm_list[action_name])
|
||||
if LanguageManager.auto_language:
|
||||
language = u'[%s]' % language
|
||||
Settings().setValue(
|
||||
u'general/language', QtCore.QVariant(language))
|
||||
Settings().setValue(u'general/language', language)
|
||||
log.info(u'Language file: \'%s\' written to conf file' % language)
|
||||
if message:
|
||||
QtGui.QMessageBox.information(None,
|
||||
translate('OpenLP.LanguageManager', 'Language'),
|
||||
translate('OpenLP.LanguageManager',
|
||||
'Please restart OpenLP to use your new language setting.'))
|
||||
translate('OpenLP.LanguageManager', 'Please restart OpenLP to use your new language setting.'))
|
||||
|
||||
@staticmethod
|
||||
def init_qm_list():
|
||||
|
@ -156,8 +146,7 @@ class LanguageManager(object):
|
|||
reg_ex = QtCore.QRegExp("^.*i18n/(.*).qm")
|
||||
if reg_ex.exactMatch(qmf):
|
||||
name = u'%s' % reg_ex.cap(1)
|
||||
LanguageManager.__qm_list__[u'%#2i %s' % (counter + 1,
|
||||
LanguageManager.language_name(qmf))] = name
|
||||
LanguageManager.__qm_list__[u'%#2i %s' % (counter + 1, LanguageManager.language_name(qmf))] = name
|
||||
|
||||
@staticmethod
|
||||
def get_qm_list():
|
||||
|
|
|
@ -31,10 +31,10 @@ import logging
|
|||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
|
||||
Settings
|
||||
from openlp.core.lib.db import Manager
|
||||
from openlp.core.lib.ui import create_action, UiStrings
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib.theme import VerticalType
|
||||
from openlp.core.utils.actions import ActionList
|
||||
from openlp.plugins.alerts.lib import AlertsManager, AlertsTab
|
||||
|
@ -149,7 +149,7 @@ class AlertsPlugin(Plugin):
|
|||
Plugin.initialise(self)
|
||||
self.toolsAlertItem.setVisible(True)
|
||||
action_list = ActionList.get_instance()
|
||||
action_list.add_action(self.toolsAlertItem, unicode(UiStrings().Tools))
|
||||
action_list.add_action(self.toolsAlertItem, UiStrings().Tools)
|
||||
|
||||
def finalise(self):
|
||||
"""
|
||||
|
@ -165,7 +165,7 @@ class AlertsPlugin(Plugin):
|
|||
def toggleAlertsState(self):
|
||||
self.alertsActive = not self.alertsActive
|
||||
Settings().setValue(self.settingsSection + u'/active',
|
||||
QtCore.QVariant(self.alertsActive))
|
||||
self.alertsActive)
|
||||
|
||||
def onAlertsTrigger(self):
|
||||
self.alertForm.loadList()
|
||||
|
|
|
@ -79,7 +79,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||
order_by_ref=AlertItem.text)
|
||||
for alert in alerts:
|
||||
item_name = QtGui.QListWidgetItem(alert.text)
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(alert.id))
|
||||
item_name.setData(QtCore.Qt.UserRole, alert.id)
|
||||
self.alertListWidget.addItem(item_name)
|
||||
if alert.text == unicode(self.alertTextEdit.text()):
|
||||
self.item_id = alert.id
|
||||
|
@ -87,10 +87,10 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||
self.alertListWidget.row(item_name))
|
||||
|
||||
def onDisplayClicked(self):
|
||||
self.triggerAlert(unicode(self.alertTextEdit.text()))
|
||||
self.triggerAlert(self.alertTextEdit.text())
|
||||
|
||||
def onDisplayCloseClicked(self):
|
||||
if self.triggerAlert(unicode(self.alertTextEdit.text())):
|
||||
if self.triggerAlert(self.alertTextEdit.text()):
|
||||
self.close()
|
||||
|
||||
def onDeleteButtonClicked(self):
|
||||
|
@ -99,7 +99,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||
"""
|
||||
item = self.alertListWidget.currentItem()
|
||||
if item:
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
item_id = item.data(QtCore.Qt.UserRole)
|
||||
self.manager.delete_object(AlertItem, item_id)
|
||||
row = self.alertListWidget.row(item)
|
||||
self.alertListWidget.takeItem(row)
|
||||
|
@ -115,7 +115,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||
'clicking New.'))
|
||||
else:
|
||||
alert = AlertItem()
|
||||
alert.text = unicode(self.alertTextEdit.text())
|
||||
alert.text = self.alertTextEdit.text()
|
||||
self.manager.save_object(alert)
|
||||
self.loadList()
|
||||
|
||||
|
@ -125,7 +125,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||
"""
|
||||
if self.item_id:
|
||||
alert = self.manager.get_object(AlertItem, self.item_id)
|
||||
alert.text = unicode(self.alertTextEdit.text())
|
||||
alert.text = self.alertTextEdit.text()
|
||||
self.manager.save_object(alert)
|
||||
self.item_id = None
|
||||
self.loadList()
|
||||
|
@ -133,7 +133,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||
|
||||
def onTextChanged(self):
|
||||
"""
|
||||
Enable save button when data has been changed by editing the form
|
||||
Enable save button when data has been changed by editing the form.
|
||||
"""
|
||||
# Only enable the button, if we are editing an item.
|
||||
if self.item_id:
|
||||
|
@ -147,26 +147,26 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||
|
||||
def onDoubleClick(self):
|
||||
"""
|
||||
List item has been double clicked to display it
|
||||
List item has been double clicked to display it.
|
||||
"""
|
||||
item = self.alertListWidget.selectedIndexes()[0]
|
||||
bitem = self.alertListWidget.item(item.row())
|
||||
self.triggerAlert(unicode(bitem.text()))
|
||||
self.alertTextEdit.setText(unicode(bitem.text()))
|
||||
self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
self.triggerAlert(bitem.text())
|
||||
self.alertTextEdit.setText(bitem.text())
|
||||
self.item_id = bitem.data(QtCore.Qt.UserRole)
|
||||
self.saveButton.setEnabled(False)
|
||||
|
||||
def onSingleClick(self):
|
||||
"""
|
||||
List item has been single clicked to add it to
|
||||
the edit field so it can be changed.
|
||||
List item has been single clicked to add it to the edit field so it can
|
||||
be changed.
|
||||
"""
|
||||
item = self.alertListWidget.selectedIndexes()[0]
|
||||
bitem = self.alertListWidget.item(item.row())
|
||||
self.alertTextEdit.setText(unicode(bitem.text()))
|
||||
self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
self.alertTextEdit.setText(bitem.text())
|
||||
self.item_id = bitem.data(QtCore.Qt.UserRole)
|
||||
# If the alert does not contain '<>' we clear the ParameterEdit field.
|
||||
if unicode(self.alertTextEdit.text()).find(u'<>') == -1:
|
||||
if self.alertTextEdit.text().find(u'<>') == -1:
|
||||
self.parameterEdit.setText(u'')
|
||||
self.saveButton.setEnabled(False)
|
||||
|
||||
|
@ -200,7 +200,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
|
||||
self.parameterEdit.setFocus()
|
||||
return False
|
||||
text = text.replace(u'<>', unicode(self.parameterEdit.text()))
|
||||
text = text.replace(u'<>', self.parameterEdit.text())
|
||||
self.plugin.alertsmanager.displayAlert(text)
|
||||
return True
|
||||
|
||||
|
|
|
@ -29,10 +29,9 @@
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver, Settings
|
||||
from openlp.core.ui import AlertLocation
|
||||
from openlp.core.lib.ui import UiStrings, create_valign_selection_widgets
|
||||
from openlp.core.lib.settings import Settings
|
||||
|
||||
class AlertsTab(SettingsTab):
|
||||
"""
|
||||
|
@ -157,17 +156,12 @@ class AlertsTab(SettingsTab):
|
|||
def load(self):
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
self.timeout = settings.value(u'timeout', QtCore.QVariant(5)).toInt()[0]
|
||||
self.font_color = unicode(settings.value(
|
||||
u'font color', QtCore.QVariant(u'#ffffff')).toString())
|
||||
self.font_size = settings.value(
|
||||
u'font size', QtCore.QVariant(40)).toInt()[0]
|
||||
self.bg_color = unicode(settings.value(
|
||||
u'background color', QtCore.QVariant(u'#660000')).toString())
|
||||
self.font_face = unicode(settings.value(
|
||||
u'font face', QtCore.QVariant(QtGui.QFont().family())).toString())
|
||||
self.location = settings.value(
|
||||
u'location', QtCore.QVariant(AlertLocation.Bottom)).toInt()[0]
|
||||
self.timeout = settings.value(u'timeout', 5)
|
||||
self.font_color = settings.value(u'font color', u'#ffffff')
|
||||
self.font_size = settings.value(u'font size', 40)
|
||||
self.bg_color = settings.value(u'background color', u'#660000')
|
||||
self.font_face = settings.value(u'font face', QtGui.QFont().family())
|
||||
self.location = settings.value(u'location', AlertLocation.Bottom)
|
||||
settings.endGroup()
|
||||
self.fontSizeSpinBox.setValue(self.font_size)
|
||||
self.timeoutSpinBox.setValue(self.timeout)
|
||||
|
@ -186,17 +180,17 @@ class AlertsTab(SettingsTab):
|
|||
settings = Settings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
# Check value has changed as no event handles this field
|
||||
if settings.value(u'location', QtCore.QVariant(1)).toInt()[0] != \
|
||||
if settings.value(u'location', 1) != \
|
||||
self.verticalComboBox.currentIndex():
|
||||
self.changed = True
|
||||
settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
|
||||
settings.setValue(u'font color', QtCore.QVariant(self.font_color))
|
||||
settings.setValue(u'font size', QtCore.QVariant(self.font_size))
|
||||
settings.setValue(u'background color', self.bg_color)
|
||||
settings.setValue(u'font color', self.font_color)
|
||||
settings.setValue(u'font size', self.font_size)
|
||||
self.font_face = self.fontComboBox.currentFont().family()
|
||||
settings.setValue(u'font face', QtCore.QVariant(self.font_face))
|
||||
settings.setValue(u'timeout', QtCore.QVariant(self.timeout))
|
||||
settings.setValue(u'font face', self.font_face)
|
||||
settings.setValue(u'timeout', self.timeout)
|
||||
self.location = self.verticalComboBox.currentIndex()
|
||||
settings.setValue(u'location', QtCore.QVariant(self.location))
|
||||
settings.setValue(u'location', self.location)
|
||||
settings.endGroup()
|
||||
if self.changed:
|
||||
Receiver.send_message(u'update_display_css')
|
||||
|
|
|
@ -31,9 +31,9 @@ import logging
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
|
||||
Settings
|
||||
from openlp.core.lib.ui import create_action, UiStrings
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.utils.actions import ActionList
|
||||
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
|
||||
from openlp.plugins.bibles.forms import BibleUpgradeForm
|
||||
|
@ -58,11 +58,9 @@ class BiblePlugin(Plugin):
|
|||
Plugin.initialise(self)
|
||||
self.importBibleItem.setVisible(True)
|
||||
action_list = ActionList.get_instance()
|
||||
action_list.add_action(self.importBibleItem,
|
||||
unicode(UiStrings().Import))
|
||||
action_list.add_action(self.importBibleItem, UiStrings().Import)
|
||||
# Do not add the action to the list yet.
|
||||
#action_list.add_action(self.exportBibleItem,
|
||||
# unicode(UiStrings().Export))
|
||||
#action_list.add_action(self.exportBibleItem, UiStrings().Export)
|
||||
# Set to invisible until we can export bibles
|
||||
self.exportBibleItem.setVisible(False)
|
||||
self.toolsUpgradeItem.setVisible(bool(self.manager.old_bible_databases))
|
||||
|
@ -75,8 +73,7 @@ class BiblePlugin(Plugin):
|
|||
self.manager.finalise()
|
||||
Plugin.finalise(self)
|
||||
action_list = ActionList.get_instance()
|
||||
action_list.remove_action(self.importBibleItem,
|
||||
unicode(UiStrings().Import))
|
||||
action_list.remove_action(self.importBibleItem, UiStrings().Import)
|
||||
self.importBibleItem.setVisible(False)
|
||||
#action_list.remove_action(self.exportBibleItem, UiStrings().Export)
|
||||
self.exportBibleItem.setVisible(False)
|
||||
|
@ -97,7 +94,7 @@ class BiblePlugin(Plugin):
|
|||
settings.beginGroup(self.settingsSection)
|
||||
if settings.contains(u'bookname language'):
|
||||
settings.setValue(u'book name language', settings.value(
|
||||
u'bookname language', QtCore.QVariant(0)).toInt()[0])
|
||||
u'bookname language', 0))
|
||||
settings.remove(u'bookname language')
|
||||
settings.endGroup()
|
||||
|
||||
|
|
|
@ -34,10 +34,9 @@ import os
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver, translate
|
||||
from openlp.core.lib import Receiver, translate, Settings
|
||||
from openlp.core.lib.db import delete_database
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||
from openlp.core.utils import AppLocation, locale_compare
|
||||
from openlp.plugins.bibles.lib.manager import BibleFormat
|
||||
|
@ -434,50 +433,49 @@ class BibleImportForm(OpenLPWizard):
|
|||
if self.currentPage() == self.welcomePage:
|
||||
return True
|
||||
elif self.currentPage() == self.selectPage:
|
||||
if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
|
||||
if not self.field(u'osis_location').toString():
|
||||
if self.field(u'source_format') == BibleFormat.OSIS:
|
||||
if not self.field(u'osis_location'):
|
||||
critical_error_message_box(UiStrings().NFSs,
|
||||
WizardStrings.YouSpecifyFile % WizardStrings.OSIS)
|
||||
self.osisFileEdit.setFocus()
|
||||
return False
|
||||
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
|
||||
if not self.field(u'csv_booksfile').toString():
|
||||
elif self.field(u'source_format') == BibleFormat.CSV:
|
||||
if not self.field(u'csv_booksfile'):
|
||||
critical_error_message_box(UiStrings().NFSs,
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'You need to specify a file with books of '
|
||||
'the Bible to use in the import.'))
|
||||
self.csvBooksEdit.setFocus()
|
||||
return False
|
||||
elif not self.field(u'csv_versefile').toString():
|
||||
elif not self.field(u'csv_versefile'):
|
||||
critical_error_message_box(UiStrings().NFSs,
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'You need to specify a file of Bible '
|
||||
'verses to import.'))
|
||||
self.csvVersesEdit.setFocus()
|
||||
return False
|
||||
elif self.field(u'source_format').toInt()[0] == \
|
||||
elif self.field(u'source_format') == \
|
||||
BibleFormat.OpenSong:
|
||||
if not self.field(u'opensong_file').toString():
|
||||
if not self.field(u'opensong_file'):
|
||||
critical_error_message_box(UiStrings().NFSs,
|
||||
WizardStrings.YouSpecifyFile % WizardStrings.OS)
|
||||
self.openSongFileEdit.setFocus()
|
||||
return False
|
||||
elif self.field(u'source_format').toInt()[0] == \
|
||||
elif self.field(u'source_format') == \
|
||||
BibleFormat.WebDownload:
|
||||
self.versionNameEdit.setText(
|
||||
self.webTranslationComboBox.currentText())
|
||||
return True
|
||||
elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1:
|
||||
if not self.field(u'openlp1_location').toString():
|
||||
elif self.field(u'source_format') == BibleFormat.OpenLP1:
|
||||
if not self.field(u'openlp1_location'):
|
||||
critical_error_message_box(UiStrings().NFSs,
|
||||
WizardStrings.YouSpecifyFile % UiStrings().OLPV1)
|
||||
self.openlp1FileEdit.setFocus()
|
||||
return False
|
||||
return True
|
||||
elif self.currentPage() == self.licenseDetailsPage:
|
||||
license_version = unicode(self.field(u'license_version').toString())
|
||||
license_copyright = \
|
||||
unicode(self.field(u'license_copyright').toString())
|
||||
license_version = self.field(u'license_version')
|
||||
license_copyright = self.field(u'license_copyright')
|
||||
path = AppLocation.get_section_data_path(u'bibles')
|
||||
if not license_version:
|
||||
critical_error_message_box(UiStrings().EmptyField,
|
||||
|
@ -597,27 +595,21 @@ class BibleImportForm(OpenLPWizard):
|
|||
self.restart()
|
||||
self.finishButton.setVisible(False)
|
||||
self.cancelButton.setVisible(True)
|
||||
self.setField(u'source_format', QtCore.QVariant(0))
|
||||
self.setField(u'osis_location', QtCore.QVariant(''))
|
||||
self.setField(u'csv_booksfile', QtCore.QVariant(''))
|
||||
self.setField(u'csv_versefile', QtCore.QVariant(''))
|
||||
self.setField(u'opensong_file', QtCore.QVariant(''))
|
||||
self.setField(u'web_location', QtCore.QVariant(WebDownload.Crosswalk))
|
||||
self.setField(u'source_format', 0)
|
||||
self.setField(u'osis_location', '')
|
||||
self.setField(u'csv_booksfile', '')
|
||||
self.setField(u'csv_versefile', '')
|
||||
self.setField(u'opensong_file', '')
|
||||
self.setField(u'web_location', WebDownload.Crosswalk)
|
||||
self.setField(u'web_biblename',
|
||||
QtCore.QVariant(self.webTranslationComboBox.currentIndex()))
|
||||
self.setField(u'proxy_server',
|
||||
settings.value(u'proxy address', QtCore.QVariant(u'')))
|
||||
self.setField(u'proxy_username',
|
||||
settings.value(u'proxy username', QtCore.QVariant(u'')))
|
||||
self.setField(u'proxy_password',
|
||||
settings.value(u'proxy password', QtCore.QVariant(u'')))
|
||||
self.setField(u'openlp1_location', QtCore.QVariant(''))
|
||||
self.setField(u'license_version',
|
||||
QtCore.QVariant(self.versionNameEdit.text()))
|
||||
self.setField(u'license_copyright',
|
||||
QtCore.QVariant(self.copyrightEdit.text()))
|
||||
self.setField(u'license_permissions',
|
||||
QtCore.QVariant(self.permissionsEdit.text()))
|
||||
self.webTranslationComboBox.currentIndex())
|
||||
self.setField(u'proxy_server', settings.value(u'proxy address', u''))
|
||||
self.setField(u'proxy_username', settings.value(u'proxy username', u''))
|
||||
self.setField(u'proxy_password', settings.value(u'proxy password', u''))
|
||||
self.setField(u'openlp1_location', '')
|
||||
self.setField(u'license_version', self.versionNameEdit.text())
|
||||
self.setField(u'license_copyright', self.copyrightEdit.text())
|
||||
self.setField(u'license_permissions', self.permissionsEdit.text())
|
||||
self.onWebSourceComboBoxIndexChanged(WebDownload.Crosswalk)
|
||||
settings.endGroup()
|
||||
|
||||
|
@ -652,7 +644,7 @@ class BibleImportForm(OpenLPWizard):
|
|||
Prepare the UI for the import.
|
||||
"""
|
||||
OpenLPWizard.preWizard(self)
|
||||
bible_type = self.field(u'source_format').toInt()[0]
|
||||
bible_type = self.field(u'source_format')
|
||||
if bible_type == BibleFormat.WebDownload:
|
||||
self.progressLabel.setText(translate(
|
||||
'BiblesPlugin.ImportWizardForm',
|
||||
|
@ -665,51 +657,49 @@ class BibleImportForm(OpenLPWizard):
|
|||
"""
|
||||
Perform the actual import.
|
||||
"""
|
||||
bible_type = self.field(u'source_format').toInt()[0]
|
||||
license_version = unicode(self.field(u'license_version').toString())
|
||||
license_copyright = unicode(self.field(u'license_copyright').toString())
|
||||
license_permissions = \
|
||||
unicode(self.field(u'license_permissions').toString())
|
||||
bible_type = self.field(u'source_format')
|
||||
license_version = self.field(u'license_version')
|
||||
license_copyright = self.field(u'license_copyright')
|
||||
license_permissions = self.field(u'license_permissions')
|
||||
importer = None
|
||||
if bible_type == BibleFormat.OSIS:
|
||||
# Import an OSIS bible.
|
||||
importer = self.manager.import_bible(BibleFormat.OSIS,
|
||||
name=license_version,
|
||||
filename=unicode(self.field(u'osis_location').toString())
|
||||
filename=self.field(u'osis_location')
|
||||
)
|
||||
elif bible_type == BibleFormat.CSV:
|
||||
# Import a CSV bible.
|
||||
importer = self.manager.import_bible(BibleFormat.CSV,
|
||||
name=license_version,
|
||||
booksfile=unicode(self.field(u'csv_booksfile').toString()),
|
||||
versefile=unicode(self.field(u'csv_versefile').toString())
|
||||
booksfile=self.field(u'csv_booksfile'),
|
||||
versefile=self.field(u'csv_versefile')
|
||||
)
|
||||
elif bible_type == BibleFormat.OpenSong:
|
||||
# Import an OpenSong bible.
|
||||
importer = self.manager.import_bible(BibleFormat.OpenSong,
|
||||
name=license_version,
|
||||
filename=unicode(self.field(u'opensong_file').toString())
|
||||
filename=self.field(u'opensong_file')
|
||||
)
|
||||
elif bible_type == BibleFormat.WebDownload:
|
||||
# Import a bible from the web.
|
||||
self.progressBar.setMaximum(1)
|
||||
download_location = self.field(u'web_location').toInt()[0]
|
||||
bible_version = unicode(self.webTranslationComboBox.currentText())
|
||||
download_location = self.field(u'web_location')
|
||||
bible_version = self.webTranslationComboBox.currentText()
|
||||
bible = self.web_bible_list[download_location][bible_version]
|
||||
importer = self.manager.import_bible(
|
||||
BibleFormat.WebDownload, name=license_version,
|
||||
download_source=WebDownload.Names[download_location],
|
||||
download_name=bible,
|
||||
proxy_server=unicode(self.field(u'proxy_server').toString()),
|
||||
proxy_username=\
|
||||
unicode(self.field(u'proxy_username').toString()),
|
||||
proxy_password=unicode(self.field(u'proxy_password').toString())
|
||||
proxy_server=self.field(u'proxy_server'),
|
||||
proxy_username=self.field(u'proxy_username'),
|
||||
proxy_password=self.field(u'proxy_password')
|
||||
)
|
||||
elif bible_type == BibleFormat.OpenLP1:
|
||||
# Import an openlp.org 1.x bible.
|
||||
importer = self.manager.import_bible(BibleFormat.OpenLP1,
|
||||
name=license_version,
|
||||
filename=unicode(self.field(u'openlp1_location').toString())
|
||||
filename=self.field(u'openlp1_location')
|
||||
)
|
||||
if importer.do_import(license_version):
|
||||
self.manager.save_meta_data(license_version, license_version,
|
||||
|
|
|
@ -37,9 +37,8 @@ from tempfile import gettempdir
|
|||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver, SettingsManager, translate, \
|
||||
check_directory_exists
|
||||
check_directory_exists, Settings
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||
from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding
|
||||
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, \
|
||||
|
@ -309,7 +308,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
return True
|
||||
elif self.currentPage() == self.backupPage:
|
||||
if not self.noBackupCheckBox.checkState() == QtCore.Qt.Checked:
|
||||
backup_path = unicode(self.backupDirectoryEdit.text())
|
||||
backup_path = self.backupDirectoryEdit.text()
|
||||
if not backup_path:
|
||||
critical_error_message_box(UiStrings().EmptyField,
|
||||
translate('BiblesPlugin.UpgradeWizardForm',
|
||||
|
@ -406,9 +405,9 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
old_bible = OldBibleDB(self.mediaItem, path=self.temp_dir,
|
||||
file=filename[0])
|
||||
name = filename[1]
|
||||
self.progressLabel.setText(unicode(translate(
|
||||
self.progressLabel.setText(translate(
|
||||
'BiblesPlugin.UpgradeWizardForm',
|
||||
'Upgrading Bible %s of %s: "%s"\nUpgrading ...')) %
|
||||
'Upgrading Bible %s of %s: "%s"\nUpgrading ...') %
|
||||
(number + 1, max_bibles, name))
|
||||
self.newbibles[number] = BibleDB(self.mediaItem, path=self.path,
|
||||
name=name, file=filename[0])
|
||||
|
@ -453,9 +452,9 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
translate('BiblesPlugin.UpgradeWizardForm',
|
||||
'To upgrade your Web Bibles an Internet connection is '
|
||||
'required.'))
|
||||
self.incrementProgressBar(unicode(translate(
|
||||
self.incrementProgressBar(translate(
|
||||
'BiblesPlugin.UpgradeWizardForm',
|
||||
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
||||
'Upgrading Bible %s of %s: "%s"\nFailed') %
|
||||
(number + 1, max_bibles, name),
|
||||
self.progressBar.maximum() - self.progressBar.value())
|
||||
self.success[number] = False
|
||||
|
@ -473,9 +472,9 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
log.warn(u'Upgrading from "%s" failed' % filename[0])
|
||||
self.newbibles[number].session.close()
|
||||
del self.newbibles[number]
|
||||
self.incrementProgressBar(unicode(translate(
|
||||
self.incrementProgressBar(translate(
|
||||
'BiblesPlugin.UpgradeWizardForm',
|
||||
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
||||
'Upgrading Bible %s of %s: "%s"\nFailed') %
|
||||
(number + 1, max_bibles, name),
|
||||
self.progressBar.maximum() - self.progressBar.value())
|
||||
self.success[number] = False
|
||||
|
@ -485,10 +484,10 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
if self.stop_import_flag:
|
||||
self.success[number] = False
|
||||
break
|
||||
self.incrementProgressBar(unicode(translate(
|
||||
self.incrementProgressBar(translate(
|
||||
'BiblesPlugin.UpgradeWizardForm',
|
||||
'Upgrading Bible %s of %s: "%s"\n'
|
||||
'Upgrading %s ...')) %
|
||||
'Upgrading %s ...') %
|
||||
(number + 1, max_bibles, name, book))
|
||||
book_ref_id = self.newbibles[number].\
|
||||
get_book_ref_id_by_name(book, len(books), language_id)
|
||||
|
@ -530,9 +529,9 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
log.warn(u'Upgrading books from "%s" failed' % name)
|
||||
self.newbibles[number].session.close()
|
||||
del self.newbibles[number]
|
||||
self.incrementProgressBar(unicode(translate(
|
||||
self.incrementProgressBar(translate(
|
||||
'BiblesPlugin.UpgradeWizardForm',
|
||||
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
||||
'Upgrading Bible %s of %s: "%s"\nFailed') %
|
||||
(number + 1, max_bibles, name),
|
||||
self.progressBar.maximum() - self.progressBar.value())
|
||||
self.success[number] = False
|
||||
|
@ -543,10 +542,10 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
if self.stop_import_flag:
|
||||
self.success[number] = False
|
||||
break
|
||||
self.incrementProgressBar(unicode(translate(
|
||||
self.incrementProgressBar(translate(
|
||||
'BiblesPlugin.UpgradeWizardForm',
|
||||
'Upgrading Bible %s of %s: "%s"\n'
|
||||
'Upgrading %s ...')) %
|
||||
'Upgrading %s ...') %
|
||||
(number + 1, max_bibles, name, book[u'name']))
|
||||
book_ref_id = self.newbibles[number].\
|
||||
get_book_ref_id_by_name(book[u'name'], len(books),
|
||||
|
@ -577,18 +576,18 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
Receiver.send_message(u'openlp_process_events')
|
||||
self.newbibles[number].session.commit()
|
||||
if not self.success.get(number, True):
|
||||
self.incrementProgressBar(unicode(translate(
|
||||
self.incrementProgressBar(translate(
|
||||
'BiblesPlugin.UpgradeWizardForm',
|
||||
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
||||
'Upgrading Bible %s of %s: "%s"\nFailed') %
|
||||
(number + 1, max_bibles, name),
|
||||
self.progressBar.maximum() - self.progressBar.value())
|
||||
else:
|
||||
self.success[number] = True
|
||||
self.newbibles[number].save_meta(u'name', name)
|
||||
self.incrementProgressBar(unicode(translate(
|
||||
self.incrementProgressBar(translate(
|
||||
'BiblesPlugin.UpgradeWizardForm',
|
||||
'Upgrading Bible %s of %s: "%s"\n'
|
||||
'Complete')) %
|
||||
'Complete') %
|
||||
(number + 1, max_bibles, name))
|
||||
if number in self.newbibles:
|
||||
self.newbibles[number].session.close()
|
||||
|
@ -612,23 +611,22 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
# Copy not upgraded bible back.
|
||||
shutil.move(os.path.join(self.temp_dir, filename[0]), self.path)
|
||||
if failed_import > 0:
|
||||
failed_import_text = unicode(translate(
|
||||
'BiblesPlugin.UpgradeWizardForm',
|
||||
', %s failed')) % failed_import
|
||||
failed_import_text = translate('BiblesPlugin.UpgradeWizardForm',
|
||||
', %s failed') % failed_import
|
||||
else:
|
||||
failed_import_text = u''
|
||||
if successful_import > 0:
|
||||
if self.includeWebBible:
|
||||
self.progressLabel.setText(unicode(
|
||||
self.progressLabel.setText(
|
||||
translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading '
|
||||
'Bible(s): %s successful%s\nPlease note that verses from '
|
||||
'Web Bibles will be downloaded on demand and so an '
|
||||
'Internet connection is required.')) %
|
||||
'Internet connection is required.') %
|
||||
(successful_import, failed_import_text))
|
||||
else:
|
||||
self.progressLabel.setText(unicode(
|
||||
self.progressLabel.setText(
|
||||
translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading '
|
||||
'Bible(s): %s successful%s')) % (successful_import,
|
||||
'Bible(s): %s successful%s') % (successful_import,
|
||||
failed_import_text))
|
||||
else:
|
||||
self.progressLabel.setText(translate(
|
||||
|
|
|
@ -128,7 +128,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
|
|||
self.correspondingComboBox.setFocus()
|
||||
return False
|
||||
else:
|
||||
cor_book = unicode(self.correspondingComboBox.currentText())
|
||||
cor_book = self.correspondingComboBox.currentText()
|
||||
for character in u'\\.^$*+?{}[]()':
|
||||
cor_book = cor_book.replace(character, u'\\' + character)
|
||||
books = filter(lambda key:
|
||||
|
|
|
@ -118,9 +118,9 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
|
|||
Exit Dialog and save data
|
||||
"""
|
||||
log.debug(u'BibleEditForm.accept')
|
||||
version = unicode(self.versionNameEdit.text())
|
||||
copyright = unicode(self.copyrightEdit.text())
|
||||
permissions = unicode(self.permissionsEdit.text())
|
||||
version = self.versionNameEdit.text()
|
||||
copyright = self.copyrightEdit.text()
|
||||
permissions = self.permissionsEdit.text()
|
||||
book_name_language = self.languageSelectionComboBox.currentIndex() - 1
|
||||
if book_name_language == -1:
|
||||
book_name_language = None
|
||||
|
@ -130,7 +130,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
|
|||
custom_names = {}
|
||||
for abbr, book in self.books.iteritems():
|
||||
if book:
|
||||
custom_names[abbr] = unicode(self.bookNameEdit[abbr].text())
|
||||
custom_names[abbr] = self.bookNameEdit[abbr].text()
|
||||
if book.name != custom_names[abbr]:
|
||||
if not self.validateBook(custom_names[abbr], abbr):
|
||||
return
|
||||
|
@ -185,29 +185,29 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
|
|||
if not new_book_name:
|
||||
self.bookNameEdit[abbreviation].setFocus()
|
||||
critical_error_message_box(UiStrings().EmptyField,
|
||||
unicode(translate('BiblesPlugin.BibleEditForm',
|
||||
'You need to specify a book name for "%s".')) %
|
||||
translate('BiblesPlugin.BibleEditForm',
|
||||
'You need to specify a book name for "%s".') %
|
||||
self.book_names[abbreviation])
|
||||
return False
|
||||
elif not book_regex.match(new_book_name):
|
||||
self.bookNameEdit[abbreviation].setFocus()
|
||||
critical_error_message_box(UiStrings().EmptyField,
|
||||
unicode(translate('BiblesPlugin.BibleEditForm',
|
||||
translate('BiblesPlugin.BibleEditForm',
|
||||
'The book name "%s" is not correct.\nNumbers can only be used '
|
||||
'at the beginning and must\nbe followed by one or more '
|
||||
'non-numeric characters.')) % new_book_name)
|
||||
'non-numeric characters.') % new_book_name)
|
||||
return False
|
||||
for abbr, book in self.books.iteritems():
|
||||
if book:
|
||||
if abbr == abbreviation:
|
||||
continue
|
||||
if unicode(self.bookNameEdit[abbr].text()) == new_book_name:
|
||||
if self.bookNameEdit[abbr].text() == new_book_name:
|
||||
self.bookNameEdit[abbreviation].setFocus()
|
||||
critical_error_message_box(
|
||||
translate('BiblesPlugin.BibleEditForm',
|
||||
'Duplicate Book Name'),
|
||||
unicode(translate('BiblesPlugin.BibleEditForm',
|
||||
'The Book Name "%s" has been entered more than once.'))
|
||||
translate('BiblesPlugin.BibleEditForm',
|
||||
'The Book Name "%s" has been entered more than once.')
|
||||
% new_book_name)
|
||||
return False
|
||||
return True
|
||||
|
|
|
@ -33,8 +33,7 @@ plugin.
|
|||
import logging
|
||||
import re
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import translate, Settings
|
||||
from openlp.plugins.bibles.lib.db import BiblesResourcesDB
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -182,17 +181,17 @@ def update_reference_separators():
|
|||
Updates separators and matches for parsing and formating scripture
|
||||
references.
|
||||
"""
|
||||
default_separators = unicode(translate('BiblesPlugin',
|
||||
default_separators = translate('BiblesPlugin',
|
||||
':|v|V|verse|verses;;-|to;;,|and;;end',
|
||||
'Double-semicolon delimited separators for parsing references. '
|
||||
'Consult the developers for further information.')).split(u';;')
|
||||
'Consult the developers for further information.').split(u';;')
|
||||
settings = Settings()
|
||||
settings.beginGroup(u'bibles')
|
||||
custom_separators = [
|
||||
unicode(settings.value(u'verse separator').toString()),
|
||||
unicode(settings.value(u'range separator').toString()),
|
||||
unicode(settings.value(u'list separator').toString()),
|
||||
unicode(settings.value(u'end separator').toString())]
|
||||
settings.value(u'verse separator', u''),
|
||||
settings.value(u'range separator', u''),
|
||||
settings.value(u'list separator', u''),
|
||||
settings.value(u'end separator', u'')]
|
||||
settings.endGroup()
|
||||
for index, role in enumerate([u'v', u'r', u'l', u'e']):
|
||||
if custom_separators[index].strip(u'|') == u'':
|
||||
|
|
|
@ -31,9 +31,8 @@ import logging
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver, SettingsTab, translate
|
||||
from openlp.core.lib import Receiver, SettingsTab, translate, Settings
|
||||
from openlp.core.lib.ui import UiStrings, find_and_set_in_combo_box
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
|
||||
update_reference_separators, get_reference_separator, LanguageSelection
|
||||
|
||||
|
@ -334,7 +333,7 @@ class BiblesTab(SettingsTab):
|
|||
if self.verseSeparatorLineEdit.isModified():
|
||||
text = self.verseSeparatorLineEdit.text()
|
||||
if text == get_reference_separator(u'sep_v_default') or \
|
||||
text.remove(u'|').isEmpty():
|
||||
not text.replace(u'|', u''):
|
||||
self.verseSeparatorCheckBox.setChecked(False)
|
||||
self.verseSeparatorLineEdit.setText(
|
||||
get_reference_separator(u'sep_v_default'))
|
||||
|
@ -359,7 +358,7 @@ class BiblesTab(SettingsTab):
|
|||
if self.rangeSeparatorLineEdit.isModified():
|
||||
text = self.rangeSeparatorLineEdit.text()
|
||||
if text == get_reference_separator(u'sep_r_default') or \
|
||||
text.remove(u'|').isEmpty():
|
||||
not text.replace(u'|', u''):
|
||||
self.rangeSeparatorCheckBox.setChecked(False)
|
||||
self.rangeSeparatorLineEdit.setText(
|
||||
get_reference_separator(u'sep_r_default'))
|
||||
|
@ -384,7 +383,7 @@ class BiblesTab(SettingsTab):
|
|||
if self.listSeparatorLineEdit.isModified():
|
||||
text = self.listSeparatorLineEdit.text()
|
||||
if text == get_reference_separator(u'sep_l_default') or \
|
||||
text.remove(u'|').isEmpty():
|
||||
not text.replace(u'|', u''):
|
||||
self.listSeparatorCheckBox.setChecked(False)
|
||||
self.listSeparatorLineEdit.setText(
|
||||
get_reference_separator(u'sep_l_default'))
|
||||
|
@ -409,7 +408,7 @@ class BiblesTab(SettingsTab):
|
|||
if self.endSeparatorLineEdit.isModified():
|
||||
text = self.endSeparatorLineEdit.text()
|
||||
if text == get_reference_separator(u'sep_e_default') or \
|
||||
text.remove(u'|').isEmpty():
|
||||
not text.replace(u'|', u''):
|
||||
self.endSeparatorCheckBox.setChecked(False)
|
||||
self.endSeparatorLineEdit.setText(
|
||||
get_reference_separator(u'sep_e_default'))
|
||||
|
@ -419,21 +418,16 @@ class BiblesTab(SettingsTab):
|
|||
def load(self):
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
self.show_new_chapters = settings.value(
|
||||
u'display new chapter', QtCore.QVariant(False)).toBool()
|
||||
self.display_style = settings.value(
|
||||
u'display brackets', QtCore.QVariant(0)).toInt()[0]
|
||||
self.layout_style = settings.value(
|
||||
u'verse layout style', QtCore.QVariant(0)).toInt()[0]
|
||||
self.bible_theme = unicode(
|
||||
settings.value(u'bible theme', QtCore.QVariant(u'')).toString())
|
||||
self.second_bibles = settings.value(
|
||||
u'second bibles', QtCore.QVariant(True)).toBool()
|
||||
self.show_new_chapters = settings.value(u'display new chapter', False)
|
||||
self.display_style = settings.value(u'display brackets', 0)
|
||||
self.layout_style = settings.value(u'verse layout style', 0)
|
||||
self.bible_theme = settings.value(u'bible theme', u'')
|
||||
self.second_bibles = settings.value(u'second bibles', True)
|
||||
self.newChaptersCheckBox.setChecked(self.show_new_chapters)
|
||||
self.displayStyleComboBox.setCurrentIndex(self.display_style)
|
||||
self.layoutStyleComboBox.setCurrentIndex(self.layout_style)
|
||||
self.bibleSecondCheckBox.setChecked(self.second_bibles)
|
||||
verse_separator = unicode(settings.value(u'verse separator').toString())
|
||||
verse_separator = settings.value(u'verse separator', u'')
|
||||
if (verse_separator.strip(u'|') == u'') or \
|
||||
(verse_separator == get_reference_separator(u'sep_v_default')):
|
||||
self.verseSeparatorLineEdit.setText(
|
||||
|
@ -446,7 +440,7 @@ class BiblesTab(SettingsTab):
|
|||
self.verseSeparatorLineEdit.setPalette(
|
||||
self.getGreyTextPalette(False))
|
||||
self.verseSeparatorCheckBox.setChecked(True)
|
||||
range_separator = unicode(settings.value(u'range separator').toString())
|
||||
range_separator = settings.value(u'range separator', u'')
|
||||
if (range_separator.strip(u'|') == u'') or \
|
||||
(range_separator == get_reference_separator(u'sep_r_default')):
|
||||
self.rangeSeparatorLineEdit.setText(
|
||||
|
@ -459,50 +453,42 @@ class BiblesTab(SettingsTab):
|
|||
self.rangeSeparatorLineEdit.setPalette(
|
||||
self.getGreyTextPalette(False))
|
||||
self.rangeSeparatorCheckBox.setChecked(True)
|
||||
list_separator = unicode(settings.value(u'list separator').toString())
|
||||
list_separator = settings.value(u'list separator', u'')
|
||||
if (list_separator.strip(u'|') == u'') or \
|
||||
(list_separator == get_reference_separator(u'sep_l_default')):
|
||||
self.listSeparatorLineEdit.setText(
|
||||
get_reference_separator(u'sep_l_default'))
|
||||
self.listSeparatorLineEdit.setPalette(
|
||||
self.getGreyTextPalette(True))
|
||||
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
|
||||
self.listSeparatorCheckBox.setChecked(False)
|
||||
else:
|
||||
self.listSeparatorLineEdit.setText(list_separator)
|
||||
self.listSeparatorLineEdit.setPalette(
|
||||
self.getGreyTextPalette(False))
|
||||
self.listSeparatorCheckBox.setChecked(True)
|
||||
end_separator = unicode(settings.value(u'end separator').toString())
|
||||
end_separator = settings.value(u'end separator', u'')
|
||||
if (end_separator.strip(u'|') == u'') or \
|
||||
(end_separator == get_reference_separator(u'sep_e_default')):
|
||||
self.endSeparatorLineEdit.setText(
|
||||
get_reference_separator(u'sep_e_default'))
|
||||
self.endSeparatorLineEdit.setPalette(
|
||||
self.getGreyTextPalette(True))
|
||||
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
|
||||
self.endSeparatorCheckBox.setChecked(False)
|
||||
else:
|
||||
self.endSeparatorLineEdit.setText(end_separator)
|
||||
self.endSeparatorLineEdit.setPalette(
|
||||
self.getGreyTextPalette(False))
|
||||
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
|
||||
self.endSeparatorCheckBox.setChecked(True)
|
||||
self.language_selection = settings.value(
|
||||
u'book name language', QtCore.QVariant(0)).toInt()[0]
|
||||
self.language_selection = settings.value(u'book name language', 0)
|
||||
self.languageSelectionComboBox.setCurrentIndex(self.language_selection)
|
||||
settings.endGroup()
|
||||
|
||||
def save(self):
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
settings.setValue(u'display new chapter',
|
||||
QtCore.QVariant(self.show_new_chapters))
|
||||
settings.setValue(u'display brackets',
|
||||
QtCore.QVariant(self.display_style))
|
||||
settings.setValue(u'verse layout style',
|
||||
QtCore.QVariant(self.layout_style))
|
||||
settings.setValue(u'book name language',
|
||||
QtCore.QVariant(self.language_selection))
|
||||
settings.setValue(u'second bibles', QtCore.QVariant(self.second_bibles))
|
||||
settings.setValue(u'bible theme', QtCore.QVariant(self.bible_theme))
|
||||
settings.setValue(u'display new chapter', self.show_new_chapters)
|
||||
settings.setValue(u'display brackets', self.display_style)
|
||||
settings.setValue(u'verse layout style', self.layout_style)
|
||||
settings.setValue(u'book name language', self.language_selection)
|
||||
settings.setValue(u'second bibles', self.second_bibles)
|
||||
settings.setValue(u'bible theme', self.bible_theme)
|
||||
if self.verseSeparatorCheckBox.isChecked():
|
||||
settings.setValue(u'verse separator',
|
||||
self.verseSeparatorLineEdit.text())
|
||||
|
|
|
@ -109,9 +109,9 @@ class CSVBible(BibleDB):
|
|||
for line in books_reader:
|
||||
if self.stop_import_flag:
|
||||
break
|
||||
self.wizard.incrementProgressBar(unicode(
|
||||
self.wizard.incrementProgressBar(
|
||||
translate('BiblesPlugin.CSVBible',
|
||||
'Importing books... %s')) %
|
||||
'Importing books... %s') %
|
||||
unicode(line[2], details['encoding']))
|
||||
book_ref_id = self.get_book_ref_id_by_name(
|
||||
unicode(line[2], details['encoding']), 67, language_id)
|
||||
|
@ -153,9 +153,9 @@ class CSVBible(BibleDB):
|
|||
if book_ptr != line_book:
|
||||
book = self.get_book(line_book)
|
||||
book_ptr = book.name
|
||||
self.wizard.incrementProgressBar(unicode(translate(
|
||||
self.wizard.incrementProgressBar(translate(
|
||||
'BiblesPlugin.CSVBible', 'Importing verses from %s...',
|
||||
'Importing verses from <book name>...')) % book.name)
|
||||
'Importing verses from <book name>...') % book.name)
|
||||
self.session.commit()
|
||||
try:
|
||||
verse_text = unicode(line[3], details['encoding'])
|
||||
|
|
|
@ -512,9 +512,9 @@ class HTTPBible(BibleDB):
|
|||
``True`` on success, ``False`` on failure.
|
||||
"""
|
||||
self.wizard.progressBar.setMaximum(68)
|
||||
self.wizard.incrementProgressBar(unicode(translate(
|
||||
self.wizard.incrementProgressBar(translate(
|
||||
'BiblesPlugin.HTTPBible',
|
||||
'Registering Bible and loading books...')))
|
||||
'Registering Bible and loading books...'))
|
||||
self.save_meta(u'download_source', self.download_source)
|
||||
self.save_meta(u'download_name', self.download_name)
|
||||
if self.proxy_server:
|
||||
|
@ -537,8 +537,8 @@ class HTTPBible(BibleDB):
|
|||
'failed' % (self.download_source, self.download_name))
|
||||
return False
|
||||
self.wizard.progressBar.setMaximum(len(books)+2)
|
||||
self.wizard.incrementProgressBar(unicode(translate(
|
||||
'BiblesPlugin.HTTPBible', 'Registering Language...')))
|
||||
self.wizard.incrementProgressBar(translate(
|
||||
'BiblesPlugin.HTTPBible', 'Registering Language...'))
|
||||
bible = BiblesResourcesDB.get_webbible(self.download_name,
|
||||
self.download_source.lower())
|
||||
if bible[u'language_id']:
|
||||
|
@ -553,9 +553,9 @@ class HTTPBible(BibleDB):
|
|||
for book in books:
|
||||
if self.stop_import_flag:
|
||||
break
|
||||
self.wizard.incrementProgressBar(unicode(translate(
|
||||
self.wizard.incrementProgressBar(translate(
|
||||
'BiblesPlugin.HTTPBible', 'Importing %s...',
|
||||
'Importing <book name>...')) % book)
|
||||
'Importing <book name>...') % book)
|
||||
book_ref_id = self.get_book_ref_id_by_name(book, len(books),
|
||||
language_id)
|
||||
if not book_ref_id:
|
||||
|
|
|
@ -32,9 +32,8 @@ import os
|
|||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Receiver, SettingsManager, translate
|
||||
from openlp.core.lib import Receiver, SettingsManager, translate, Settings
|
||||
from openlp.core.utils import AppLocation, delete_file
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.plugins.bibles.lib import parse_reference, \
|
||||
get_reference_separator, LanguageSelection
|
||||
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
|
||||
|
@ -128,9 +127,8 @@ class BibleManager(object):
|
|||
self.web = u'Web'
|
||||
self.db_cache = None
|
||||
self.path = AppLocation.get_section_data_path(self.settingsSection)
|
||||
self.proxy_name = unicode(
|
||||
Settings().value(self.settingsSection + u'/proxy name',
|
||||
QtCore.QVariant(u'')).toString())
|
||||
self.proxy_name = Settings().value(
|
||||
self.settingsSection + u'/proxy name', u'')
|
||||
self.suffix = u'.sqlite'
|
||||
self.import_wizard = None
|
||||
self.reload_bibles()
|
||||
|
@ -340,7 +338,7 @@ class BibleManager(object):
|
|||
Receiver.send_message(u'openlp_information_message', {
|
||||
u'title': translate('BiblesPlugin.BibleManager',
|
||||
'Scripture Reference Error'),
|
||||
u'message': unicode(translate('BiblesPlugin.BibleManager',
|
||||
u'message': translate('BiblesPlugin.BibleManager',
|
||||
'Your scripture reference is either not supported by '
|
||||
'OpenLP or is invalid. Please make sure your reference '
|
||||
'conforms to one of the following patterns or consult the '
|
||||
|
@ -355,7 +353,7 @@ class BibleManager(object):
|
|||
'Book Chapter%(verse)sVerse%(range)sChapter%(verse)sVerse',
|
||||
'Please pay attention to the appended "s" of the wildcards '
|
||||
'and refrain from translating the words inside the '
|
||||
'names in the brackets.')) % reference_seperators
|
||||
'names in the brackets.') % reference_seperators
|
||||
})
|
||||
return None
|
||||
|
||||
|
@ -374,8 +372,7 @@ class BibleManager(object):
|
|||
# If None is returned, it's not the singleton object but a
|
||||
# BibleMeta object with the value "None"
|
||||
language_selection = Settings().value(
|
||||
self.settingsSection + u'/book name language',
|
||||
QtCore.QVariant(0)).toInt()[0]
|
||||
self.settingsSection + u'/book name language', 0)
|
||||
else:
|
||||
language_selection = language_selection.value
|
||||
try:
|
||||
|
@ -436,7 +433,7 @@ class BibleManager(object):
|
|||
})
|
||||
return None
|
||||
|
||||
def save_meta_data(self, bible, version, copyright, permissions,
|
||||
def save_meta_data(self, bible, version, copyright, permissions,
|
||||
book_name_language=None):
|
||||
"""
|
||||
Saves the bibles meta data.
|
||||
|
@ -455,7 +452,7 @@ class BibleManager(object):
|
|||
"""
|
||||
log.debug(u'get_meta %s,%s', bible, key)
|
||||
return self.db_cache[bible].get_object(BibleMeta, key)
|
||||
|
||||
|
||||
def update_book(self, bible, book):
|
||||
"""
|
||||
Update a book of the bible.
|
||||
|
|
|
@ -32,9 +32,8 @@ import logging
|
|||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||
translate, create_separated_list, ServiceItemContext
|
||||
translate, create_separated_list, ServiceItemContext, Settings
|
||||
from openlp.core.lib.searchedit import SearchEdit
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib.ui import UiStrings, set_case_insensitive_completer, \
|
||||
create_horizontal_adjusting_combo_box, critical_error_message_box, \
|
||||
find_and_set_in_combo_box, build_icon
|
||||
|
@ -102,11 +101,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
|
||||
def _decodeQtObject(self, bitem, key):
|
||||
reference = bitem.data(QtCore.Qt.UserRole)
|
||||
if isinstance(reference, QtCore.QVariant):
|
||||
reference = reference.toPyObject()
|
||||
obj = reference[QtCore.QString(key)]
|
||||
if isinstance(obj, QtCore.QVariant):
|
||||
obj = obj.toPyObject()
|
||||
obj = reference[unicode(key)]
|
||||
return unicode(obj).strip()
|
||||
|
||||
def requiredIcons(self):
|
||||
|
@ -297,8 +292,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
|
||||
def configUpdated(self):
|
||||
log.debug(u'configUpdated')
|
||||
if Settings().value(self.settingsSection + u'/second bibles',
|
||||
QtCore.QVariant(True)).toBool():
|
||||
if Settings().value(self.settingsSection + u'/second bibles', True):
|
||||
self.advancedSecondLabel.setVisible(True)
|
||||
self.advancedSecondComboBox.setVisible(True)
|
||||
self.quickSecondLabel.setVisible(True)
|
||||
|
@ -367,7 +361,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
])
|
||||
self.quickSearchEdit.setCurrentSearchType(Settings().value(
|
||||
u'%s/last search type' % self.settingsSection,
|
||||
QtCore.QVariant(BibleSearch.Reference)).toInt()[0])
|
||||
BibleSearch.Reference))
|
||||
self.configUpdated()
|
||||
log.debug(u'bible manager initialise complete')
|
||||
|
||||
|
@ -389,17 +383,15 @@ class BibleMediaItem(MediaManagerItem):
|
|||
self.advancedVersionComboBox.addItems(bibles)
|
||||
self.advancedSecondComboBox.addItems(bibles)
|
||||
# set the default value
|
||||
bible = Settings().value(
|
||||
self.settingsSection + u'/advanced bible',
|
||||
QtCore.QVariant(u'')).toString()
|
||||
bible = Settings().value(self.settingsSection + u'/advanced bible', u'')
|
||||
if bible in bibles:
|
||||
find_and_set_in_combo_box(self.advancedVersionComboBox, bible)
|
||||
self.initialiseAdvancedBible(unicode(bible))
|
||||
elif bibles:
|
||||
self.initialiseAdvancedBible(bibles[0])
|
||||
bible = Settings().value(
|
||||
self.settingsSection + u'/quick bible', QtCore.QVariant(
|
||||
self.quickVersionComboBox.currentText())).toString()
|
||||
self.settingsSection + u'/quick bible',
|
||||
self.quickVersionComboBox.currentText())
|
||||
find_and_set_in_combo_box(self.quickVersionComboBox, bible)
|
||||
|
||||
def reloadBibles(self, process=False):
|
||||
|
@ -427,7 +419,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
"""
|
||||
log.debug(u'initialiseAdvancedBible %s, %s', bible, last_book_id)
|
||||
book_data = self.plugin.manager.get_books(bible)
|
||||
secondbible = unicode(self.advancedSecondComboBox.currentText())
|
||||
secondbible = self.advancedSecondComboBox.currentText()
|
||||
if secondbible != u'':
|
||||
secondbook_data = self.plugin.manager.get_books(secondbible)
|
||||
book_data_temp = []
|
||||
|
@ -456,14 +448,14 @@ class BibleMediaItem(MediaManagerItem):
|
|||
book[u'book_reference_id'])
|
||||
self.advancedBookComboBox.addItem(data[u'name'])
|
||||
self.advancedBookComboBox.setItemData(
|
||||
row, QtCore.QVariant(book[u'book_reference_id']))
|
||||
row, book[u'book_reference_id'])
|
||||
if first:
|
||||
first = False
|
||||
first_book = book
|
||||
initialise_chapter_verse = True
|
||||
if last_book_id and last_book_id == int(book[u'book_reference_id']):
|
||||
index = self.advancedBookComboBox.findData(
|
||||
QtCore.QVariant(book[u'book_reference_id']))
|
||||
book[u'book_reference_id'])
|
||||
if index == -1:
|
||||
# Not Found.
|
||||
index = 0
|
||||
|
@ -501,19 +493,18 @@ class BibleMediaItem(MediaManagerItem):
|
|||
log.debug(u'updateAutoCompleter')
|
||||
# Save the current search type to the configuration.
|
||||
Settings().setValue(u'%s/last search type' %
|
||||
self.settingsSection,
|
||||
QtCore.QVariant(self.quickSearchEdit.currentSearchType()))
|
||||
self.settingsSection, self.quickSearchEdit.currentSearchType())
|
||||
# Save the current bible to the configuration.
|
||||
Settings().setValue(self.settingsSection + u'/quick bible',
|
||||
QtCore.QVariant(self.quickVersionComboBox.currentText()))
|
||||
self.quickVersionComboBox.currentText())
|
||||
books = []
|
||||
# We have to do a 'Reference Search'.
|
||||
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
|
||||
bibles = self.plugin.manager.get_bibles()
|
||||
bible = unicode(self.quickVersionComboBox.currentText())
|
||||
bible = self.quickVersionComboBox.currentText()
|
||||
if bible:
|
||||
book_data = bibles[bible].get_books()
|
||||
secondbible = unicode(self.quickSecondComboBox.currentText())
|
||||
secondbible = self.quickSecondComboBox.currentText()
|
||||
if secondbible != u'':
|
||||
secondbook_data = bibles[secondbible].get_books()
|
||||
book_data_temp = []
|
||||
|
@ -552,9 +543,9 @@ class BibleMediaItem(MediaManagerItem):
|
|||
|
||||
def onEditClick(self):
|
||||
if self.quickTab.isVisible():
|
||||
bible = unicode(self.quickVersionComboBox.currentText())
|
||||
bible = self.quickVersionComboBox.currentText()
|
||||
elif self.advancedTab.isVisible():
|
||||
bible = unicode(self.advancedVersionComboBox.currentText())
|
||||
bible = self.advancedVersionComboBox.currentText()
|
||||
if bible:
|
||||
self.editBibleForm = EditBibleForm(self, self.plugin.formParent,
|
||||
self.plugin.manager)
|
||||
|
@ -564,15 +555,15 @@ class BibleMediaItem(MediaManagerItem):
|
|||
|
||||
def onDeleteClick(self):
|
||||
if self.quickTab.isVisible():
|
||||
bible = unicode(self.quickVersionComboBox.currentText())
|
||||
bible = self.quickVersionComboBox.currentText()
|
||||
elif self.advancedTab.isVisible():
|
||||
bible = unicode(self.advancedVersionComboBox.currentText())
|
||||
bible = self.advancedVersionComboBox.currentText()
|
||||
if bible:
|
||||
if QtGui.QMessageBox.question(self, UiStrings().ConfirmDelete,
|
||||
unicode(translate('BiblesPlugin.MediaItem',
|
||||
translate('BiblesPlugin.MediaItem',
|
||||
'Are you sure you want to completely delete "%s" Bible from '
|
||||
'OpenLP?\n\nYou will need to re-import this Bible to use it '
|
||||
'again.'))% bible,
|
||||
'again.') % bible,
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||
QtGui.QMessageBox.No),
|
||||
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
|
||||
|
@ -603,7 +594,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
self.settings.layout_style)
|
||||
Settings().setValue(
|
||||
self.settingsSection + u'/verse layout style',
|
||||
QtCore.QVariant(self.settings.layout_style))
|
||||
self.settings.layout_style)
|
||||
|
||||
def onAdvancedStyleComboBoxChanged(self):
|
||||
self.settings.layout_style = self.advancedStyleComboBox.currentIndex()
|
||||
|
@ -612,36 +603,35 @@ class BibleMediaItem(MediaManagerItem):
|
|||
self.settings.layout_style)
|
||||
Settings().setValue(
|
||||
self.settingsSection + u'/verse layout style',
|
||||
QtCore.QVariant(self.settings.layout_style))
|
||||
self.settings.layout_style)
|
||||
|
||||
def onAdvancedVersionComboBox(self):
|
||||
Settings().setValue(self.settingsSection + u'/advanced bible',
|
||||
QtCore.QVariant(self.advancedVersionComboBox.currentText()))
|
||||
self.initialiseAdvancedBible(
|
||||
unicode(self.advancedVersionComboBox.currentText()),
|
||||
self.advancedVersionComboBox.currentText())
|
||||
self.initialiseAdvancedBible(self.advancedVersionComboBox.currentText(),
|
||||
self.advancedBookComboBox.itemData(
|
||||
int(self.advancedBookComboBox.currentIndex())))
|
||||
|
||||
def onAdvancedSecondComboBox(self):
|
||||
self.initialiseAdvancedBible(
|
||||
unicode(self.advancedVersionComboBox.currentText()),
|
||||
self.advancedVersionComboBox.currentText(),
|
||||
self.advancedBookComboBox.itemData(
|
||||
int(self.advancedBookComboBox.currentIndex())))
|
||||
|
||||
def onAdvancedBookComboBox(self):
|
||||
item = int(self.advancedBookComboBox.currentIndex())
|
||||
self.initialiseChapterVerse(
|
||||
unicode(self.advancedVersionComboBox.currentText()),
|
||||
unicode(self.advancedBookComboBox.currentText()),
|
||||
unicode(self.advancedBookComboBox.itemData(item).toString()))
|
||||
self.advancedVersionComboBox.currentText(),
|
||||
self.advancedBookComboBox.currentText(),
|
||||
self.advancedBookComboBox.itemData(item))
|
||||
|
||||
def onAdvancedFromVerse(self):
|
||||
chapter_from = int(self.advancedFromChapter.currentText())
|
||||
chapter_to = int(self.advancedToChapter.currentText())
|
||||
if chapter_from == chapter_to:
|
||||
bible = unicode(self.advancedVersionComboBox.currentText())
|
||||
book_ref_id = unicode(self.advancedBookComboBox.itemData(
|
||||
int(self.advancedBookComboBox.currentIndex())).toString())
|
||||
bible = self.advancedVersionComboBox.currentText()
|
||||
book_ref_id = self.advancedBookComboBox.itemData(
|
||||
int(self.advancedBookComboBox.currentIndex()))
|
||||
verse_from = int(self.advancedFromVerse.currentText())
|
||||
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(
|
||||
bible, book_ref_id, chapter_to)
|
||||
|
@ -649,9 +639,9 @@ class BibleMediaItem(MediaManagerItem):
|
|||
self.advancedToVerse, True)
|
||||
|
||||
def onAdvancedToChapter(self):
|
||||
bible = unicode(self.advancedVersionComboBox.currentText())
|
||||
book_ref_id = unicode(self.advancedBookComboBox.itemData(
|
||||
int(self.advancedBookComboBox.currentIndex())).toString())
|
||||
bible = self.advancedVersionComboBox.currentText()
|
||||
book_ref_id = self.advancedBookComboBox.itemData(
|
||||
int(self.advancedBookComboBox.currentIndex()))
|
||||
chapter_from = int(self.advancedFromChapter.currentText())
|
||||
chapter_to = int(self.advancedToChapter.currentText())
|
||||
verse_from = int(self.advancedFromVerse.currentText())
|
||||
|
@ -664,9 +654,9 @@ class BibleMediaItem(MediaManagerItem):
|
|||
self.adjustComboBox(1, verse_count, self.advancedToVerse)
|
||||
|
||||
def onAdvancedFromChapter(self):
|
||||
bible = unicode(self.advancedVersionComboBox.currentText())
|
||||
book_ref_id = unicode(self.advancedBookComboBox.itemData(
|
||||
int(self.advancedBookComboBox.currentIndex())).toString())
|
||||
bible = self.advancedVersionComboBox.currentText()
|
||||
book_ref_id = self.advancedBookComboBox.itemData(
|
||||
int(self.advancedBookComboBox.currentIndex()))
|
||||
chapter_from = int(self.advancedFromChapter.currentText())
|
||||
chapter_to = int(self.advancedToChapter.currentText())
|
||||
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible,
|
||||
|
@ -703,7 +693,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
"""
|
||||
log.debug(u'adjustComboBox %s, %s, %s', combo, range_from, range_to)
|
||||
if restore:
|
||||
old_text = unicode(combo.currentText())
|
||||
old_text = combo.currentText()
|
||||
combo.clear()
|
||||
combo.addItems(map(unicode, range(range_from, range_to + 1)))
|
||||
if restore and combo.findText(old_text) != -1:
|
||||
|
@ -716,11 +706,11 @@ class BibleMediaItem(MediaManagerItem):
|
|||
log.debug(u'Advanced Search Button clicked')
|
||||
self.advancedSearchButton.setEnabled(False)
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
bible = unicode(self.advancedVersionComboBox.currentText())
|
||||
second_bible = unicode(self.advancedSecondComboBox.currentText())
|
||||
book = unicode(self.advancedBookComboBox.currentText())
|
||||
book_ref_id = unicode(self.advancedBookComboBox.itemData(
|
||||
int(self.advancedBookComboBox.currentIndex())).toString())
|
||||
bible = self.advancedVersionComboBox.currentText()
|
||||
second_bible = self.advancedSecondComboBox.currentText()
|
||||
book = self.advancedBookComboBox.currentText()
|
||||
book_ref_id = self.advancedBookComboBox.itemData(
|
||||
int(self.advancedBookComboBox.currentIndex()))
|
||||
chapter_from = self.advancedFromChapter.currentText()
|
||||
chapter_to = self.advancedToChapter.currentText()
|
||||
verse_from = self.advancedFromVerse.currentText()
|
||||
|
@ -755,9 +745,9 @@ class BibleMediaItem(MediaManagerItem):
|
|||
log.debug(u'Quick Search Button clicked')
|
||||
self.quickSearchButton.setEnabled(False)
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
bible = unicode(self.quickVersionComboBox.currentText())
|
||||
second_bible = unicode(self.quickSecondComboBox.currentText())
|
||||
text = unicode(self.quickSearchEdit.text())
|
||||
bible = self.quickVersionComboBox.currentText()
|
||||
second_bible = self.quickSecondComboBox.currentText()
|
||||
text = self.quickSearchEdit.text()
|
||||
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
|
||||
# We are doing a 'Reference Search'.
|
||||
self.search_results = self.plugin.manager.get_verses(bible, text)
|
||||
|
@ -792,11 +782,11 @@ class BibleMediaItem(MediaManagerItem):
|
|||
if passage_not_found:
|
||||
QtGui.QMessageBox.information(self,
|
||||
translate('BiblesPlugin.MediaItem', 'Information'),
|
||||
unicode(translate('BiblesPlugin.MediaItem',
|
||||
translate('BiblesPlugin.MediaItem',
|
||||
'The second Bible does not contain all the verses '
|
||||
'that are in the main Bible. Only verses found in both '
|
||||
'Bibles will be shown. %d verses have not been '
|
||||
'included in the results.')) % count,
|
||||
'included in the results.') % count,
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
self.search_results = new_search_results
|
||||
self.second_search_results = \
|
||||
|
@ -861,24 +851,24 @@ class BibleMediaItem(MediaManagerItem):
|
|||
verse.book.book_reference_id)
|
||||
book = data[u'name']
|
||||
data = {
|
||||
'book': QtCore.QVariant(book),
|
||||
'chapter': QtCore.QVariant(verse.chapter),
|
||||
'verse': QtCore.QVariant(verse.verse),
|
||||
'bible': QtCore.QVariant(bible),
|
||||
'version': QtCore.QVariant(version),
|
||||
'copyright': QtCore.QVariant(copyright),
|
||||
'permissions': QtCore.QVariant(permissions),
|
||||
'text': QtCore.QVariant(verse.text),
|
||||
'second_bible': QtCore.QVariant(second_bible),
|
||||
'second_version': QtCore.QVariant(second_version),
|
||||
'second_copyright': QtCore.QVariant(second_copyright),
|
||||
'second_permissions': QtCore.QVariant(second_permissions),
|
||||
'second_text': QtCore.QVariant(u'')
|
||||
'book': book,
|
||||
'chapter': verse.chapter,
|
||||
'verse': verse.verse,
|
||||
'bible': bible,
|
||||
'version': version,
|
||||
'copyright': copyright,
|
||||
'permissions': permissions,
|
||||
'text': verse.text,
|
||||
'second_bible': second_bible,
|
||||
'second_version': second_version,
|
||||
'second_copyright': second_copyright,
|
||||
'second_permissions': second_permissions,
|
||||
'second_text': u''
|
||||
}
|
||||
if second_bible:
|
||||
try:
|
||||
data[u'second_text'] = QtCore.QVariant(
|
||||
self.second_search_results[count].text)
|
||||
data[u'second_text'] = \
|
||||
self.second_search_results[count].text
|
||||
except IndexError:
|
||||
log.exception(u'The second_search_results does not have as '
|
||||
'many verses as the search_results.')
|
||||
|
@ -889,7 +879,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
bible_text = u'%s %d%s%d (%s)' % (book, verse.chapter,
|
||||
verse_separator, verse.verse, version)
|
||||
bible_verse = QtGui.QListWidgetItem(bible_text)
|
||||
bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
|
||||
bible_verse.setData(QtCore.Qt.UserRole, data)
|
||||
items.append(bible_verse)
|
||||
return items
|
||||
|
||||
|
@ -1092,7 +1082,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
"""
|
||||
Search for some Bible verses (by reference).
|
||||
"""
|
||||
bible = unicode(self.quickVersionComboBox.currentText())
|
||||
bible = self.quickVersionComboBox.currentText()
|
||||
search_results = self.plugin.manager.get_verses(bible, string, False,
|
||||
showError)
|
||||
if search_results:
|
||||
|
@ -1102,7 +1092,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
|
||||
def createItemFromId(self, item_id):
|
||||
item = QtGui.QListWidgetItem()
|
||||
bible = unicode(self.quickVersionComboBox.currentText())
|
||||
bible = self.quickVersionComboBox.currentText()
|
||||
search_results = self.plugin.manager.get_verses(bible, item_id, False)
|
||||
items = self.buildDisplayResults(bible, u'', search_results)
|
||||
return items
|
||||
|
|
|
@ -63,7 +63,7 @@ class OpenSongBible(BibleDB):
|
|||
verse_text += self.get_text(sub_element)
|
||||
if element.tail:
|
||||
verse_text += element.tail
|
||||
return verse_text
|
||||
return verse_text
|
||||
|
||||
def do_import(self, bible_name=None):
|
||||
"""
|
||||
|
@ -129,11 +129,11 @@ class OpenSongBible(BibleDB):
|
|||
db_book.id,
|
||||
chapter_number,
|
||||
verse_number,
|
||||
unicode(self.get_text(verse)))
|
||||
self.wizard.incrementProgressBar(unicode(translate(
|
||||
self.get_text(verse))
|
||||
self.wizard.incrementProgressBar(translate(
|
||||
'BiblesPlugin.Opensong', 'Importing %s %s...',
|
||||
'Importing <book name> <chapter>...')) %
|
||||
(db_book.name, chapter_number))
|
||||
'Importing <book name> <chapter>...')) % \
|
||||
(db_book.name, chapter_number)
|
||||
self.session.commit()
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
except etree.XMLSyntaxError as inst:
|
||||
|
|
|
@ -103,7 +103,7 @@ class OSISBible(BibleDB):
|
|||
osis = codecs.open(self.filename, u'r', details['encoding'])
|
||||
repl = replacement
|
||||
language_id = False
|
||||
# Decide if the bible propably contains only NT or AT and NT or
|
||||
# Decide if the bible propably contains only NT or AT and NT or
|
||||
# AT, NT and Apocrypha
|
||||
if lines_in_file < 11500:
|
||||
book_count = 27
|
||||
|
@ -159,9 +159,9 @@ class OSISBible(BibleDB):
|
|||
if last_chapter != chapter:
|
||||
if last_chapter != 0:
|
||||
self.session.commit()
|
||||
self.wizard.incrementProgressBar(unicode(translate(
|
||||
self.wizard.incrementProgressBar(translate(
|
||||
'BiblesPlugin.OsisImport', 'Importing %s %s...',
|
||||
'Importing <book name> <chapter>...')) %
|
||||
'Importing <book name> <chapter>...') %
|
||||
(book_details[u'name'], chapter))
|
||||
last_chapter = chapter
|
||||
# All of this rigmarol below is because the mod2osis
|
||||
|
|
|
@ -74,9 +74,9 @@ class Ui_CustomEditDialog(object):
|
|||
self.buttonLayout.addWidget(self.deleteButton)
|
||||
self.buttonLayout.addStretch()
|
||||
self.upButton = create_button(customEditDialog, u'upButton', role=u'up',
|
||||
enable=False, click=customEditDialog.onUpButtonClicked)
|
||||
enabled=False, click=customEditDialog.onUpButtonClicked)
|
||||
self.downButton = create_button(customEditDialog, u'downButton',
|
||||
role=u'down', enable=False,
|
||||
role=u'down', enabled=False,
|
||||
click=customEditDialog.onDownButtonClicked)
|
||||
self.buttonLayout.addWidget(self.upButton)
|
||||
self.buttonLayout.addWidget(self.downButton)
|
||||
|
|
|
@ -129,11 +129,11 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||
sxml.add_lyrics_to_song()
|
||||
for count in range(self.slideListView.count()):
|
||||
sxml.add_verse_to_lyrics(u'custom', unicode(count + 1),
|
||||
unicode(self.slideListView.item(count).text()))
|
||||
self.customSlide.title = unicode(self.titleEdit.text())
|
||||
self.slideListView.item(count).text())
|
||||
self.customSlide.title = self.titleEdit.text()
|
||||
self.customSlide.text = unicode(sxml.extract_xml(), u'utf-8')
|
||||
self.customSlide.credits = unicode(self.creditEdit.text())
|
||||
self.customSlide.theme_name = unicode(self.themeComboBox.currentText())
|
||||
self.customSlide.credits = self.creditEdit.text()
|
||||
self.customSlide.theme_name = self.themeComboBox.currentText()
|
||||
success = self.manager.save_object(self.customSlide)
|
||||
self.mediaitem.autoSelectId = self.customSlide.id
|
||||
return success
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import SettingsTab, translate, Settings
|
||||
|
||||
class CustomTab(SettingsTab):
|
||||
"""
|
||||
|
@ -70,10 +69,9 @@ class CustomTab(SettingsTab):
|
|||
|
||||
def load(self):
|
||||
self.displayFooter = Settings().value(
|
||||
self.settingsSection + u'/display footer',
|
||||
QtCore.QVariant(True)).toBool()
|
||||
self.settingsSection + u'/display footer', True)
|
||||
self.displayFooterCheckBox.setChecked(self.displayFooter)
|
||||
|
||||
def save(self):
|
||||
Settings().setValue(self.settingsSection + u'/display footer',
|
||||
QtCore.QVariant(self.displayFooter))
|
||||
self.displayFooter)
|
||||
|
|
|
@ -33,9 +33,8 @@ from PyQt4 import QtCore, QtGui
|
|||
from sqlalchemy.sql import or_, func
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||
check_item_selected, translate, ServiceItemContext
|
||||
check_item_selected, translate, ServiceItemContext, Settings
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.plugins.custom.forms import EditCustomForm
|
||||
from openlp.plugins.custom.lib import CustomXMLParser
|
||||
from openlp.plugins.custom.lib.db import CustomSlide
|
||||
|
@ -102,8 +101,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||
self.loadList(self.manager.get_all_objects(
|
||||
CustomSlide, order_by_ref=CustomSlide.title))
|
||||
self.searchTextEdit.setCurrentSearchType(Settings().value(
|
||||
u'%s/last search type' % self.settingsSection,
|
||||
QtCore.QVariant(CustomSearch.Titles)).toInt()[0])
|
||||
u'%s/last search type' % self.settingsSection, CustomSearch.Titles))
|
||||
|
||||
def loadList(self, custom_slides):
|
||||
# Sort out what custom we want to select after loading the list.
|
||||
|
@ -112,8 +110,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||
custom_slides.sort()
|
||||
for custom_slide in custom_slides:
|
||||
custom_name = QtGui.QListWidgetItem(custom_slide.title)
|
||||
custom_name.setData(
|
||||
QtCore.Qt.UserRole, QtCore.QVariant(custom_slide.id))
|
||||
custom_name.setData(QtCore.Qt.UserRole, custom_slide.id)
|
||||
self.listView.addItem(custom_name)
|
||||
# Auto-select the custom.
|
||||
if custom_slide.id == self.autoSelectId:
|
||||
|
@ -161,7 +158,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||
"""
|
||||
if check_item_selected(self.listView, UiStrings().SelectEdit):
|
||||
item = self.listView.currentItem()
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
item_id = item.data(QtCore.Qt.UserRole)
|
||||
self.edit_custom_form.loadCustom(item_id, False)
|
||||
self.edit_custom_form.exec_()
|
||||
self.autoSelectId = -1
|
||||
|
@ -185,7 +182,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||
return
|
||||
row_list = [item.row() for item in self.listView.selectedIndexes()]
|
||||
row_list.sort(reverse=True)
|
||||
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
id_list = [(item.data(QtCore.Qt.UserRole))
|
||||
for item in self.listView.selectedIndexes()]
|
||||
for id in id_list:
|
||||
self.plugin.manager.delete_object(CustomSlide, id)
|
||||
|
@ -215,7 +212,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||
for slide in raw_slides:
|
||||
service_item.add_from_text(slide)
|
||||
if Settings().value(self.settingsSection + u'/display footer',
|
||||
QtCore.QVariant(True)).toBool() or credit:
|
||||
True) or credit:
|
||||
service_item.raw_footer.append(u' '.join([title, credit]))
|
||||
else:
|
||||
service_item.raw_footer.append(u'')
|
||||
|
@ -224,10 +221,9 @@ class CustomMediaItem(MediaManagerItem):
|
|||
def onSearchTextButtonClicked(self):
|
||||
# Save the current search type to the configuration.
|
||||
Settings().setValue(u'%s/last search type' %
|
||||
self.settingsSection,
|
||||
QtCore.QVariant(self.searchTextEdit.currentSearchType()))
|
||||
self.settingsSection, self.searchTextEdit.currentSearchType())
|
||||
# Reload the list considering the new search type.
|
||||
search_keywords = unicode(self.searchTextEdit.displayText())
|
||||
search_keywords = self.searchTextEdit.displayText()
|
||||
search_results = []
|
||||
search_type = self.searchTextEdit.currentSearchType()
|
||||
if search_type == CustomSearch.Titles:
|
||||
|
|
|
@ -32,8 +32,7 @@ from PyQt4 import QtCore, QtGui
|
|||
import logging
|
||||
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
|
||||
Receiver, ImageSource
|
||||
from openlp.core.lib.settings import Settings
|
||||
Receiver, ImageSource, Settings
|
||||
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -98,6 +97,6 @@ class ImagePlugin(Plugin):
|
|||
last part of saving the config.
|
||||
"""
|
||||
background = QtGui.QColor(Settings().value(self.settingsSection
|
||||
+ u'/background color', QtCore.QVariant(u'#000000')))
|
||||
+ u'/background color', u'#000000'))
|
||||
self.liveController.imageManager.updateImagesBorder(
|
||||
ImageSource.ImagePlugin, background)
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver, Settings
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
|
||||
class ImageTab(SettingsTab):
|
||||
|
@ -86,8 +85,7 @@ class ImageTab(SettingsTab):
|
|||
def load(self):
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
self.bg_color = unicode(settings.value(
|
||||
u'background color', QtCore.QVariant(u'#000000')).toString())
|
||||
self.bg_color = settings.value(u'background color', u'#000000')
|
||||
self.initial_color = self.bg_color
|
||||
settings.endGroup()
|
||||
self.backgroundColorButton.setStyleSheet(
|
||||
|
@ -96,7 +94,7 @@ class ImageTab(SettingsTab):
|
|||
def save(self):
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
|
||||
settings.setValue(u'background color', self.bg_color)
|
||||
settings.endGroup()
|
||||
if self.initial_color != self.bg_color:
|
||||
Receiver.send_message(u'image_updated')
|
||||
|
|
|
@ -34,9 +34,8 @@ from PyQt4 import QtCore, QtGui
|
|||
|
||||
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
|
||||
SettingsManager, translate, check_item_selected, check_directory_exists, \
|
||||
Receiver, create_thumb, validate_thumb, ServiceItemContext
|
||||
Receiver, create_thumb, validate_thumb, ServiceItemContext, Settings
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.utils import AppLocation, delete_file, locale_compare, \
|
||||
get_images_filter
|
||||
|
||||
|
@ -113,8 +112,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||
for row in row_list:
|
||||
text = self.listView.item(row)
|
||||
if text:
|
||||
delete_file(os.path.join(self.servicePath,
|
||||
unicode(text.text())))
|
||||
delete_file(os.path.join(self.servicePath, text.text()))
|
||||
self.listView.takeItem(row)
|
||||
self.plugin.formParent.incrementProgressBar()
|
||||
SettingsManager.set_list(self.settingsSection,
|
||||
|
@ -144,7 +142,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||
item_name = QtGui.QListWidgetItem(filename)
|
||||
item_name.setIcon(icon)
|
||||
item_name.setToolTip(imageFile)
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(imageFile))
|
||||
item_name.setData(QtCore.Qt.UserRole, imageFile)
|
||||
self.listView.addItem(item_name)
|
||||
if not initialLoad:
|
||||
self.plugin.formParent.incrementProgressBar()
|
||||
|
@ -155,7 +153,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||
def generateSlideData(self, service_item, item=None, xmlVersion=False,
|
||||
remote=False, context=ServiceItemContext.Service):
|
||||
background = QtGui.QColor(Settings().value(self.settingsSection
|
||||
+ u'/background color', QtCore.QVariant(u'#000000')))
|
||||
+ u'/background color', u'#000000'))
|
||||
if item:
|
||||
items = [item]
|
||||
else:
|
||||
|
@ -172,7 +170,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||
missing_items = []
|
||||
missing_items_filenames = []
|
||||
for bitem in items:
|
||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||
filename = bitem.data(QtCore.Qt.UserRole)
|
||||
if not os.path.exists(filename):
|
||||
missing_items.append(bitem)
|
||||
missing_items_filenames.append(filename)
|
||||
|
@ -183,22 +181,22 @@ class ImageMediaItem(MediaManagerItem):
|
|||
if not remote:
|
||||
critical_error_message_box(
|
||||
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
|
||||
unicode(translate('ImagePlugin.MediaItem',
|
||||
'The following image(s) no longer exist: %s')) %
|
||||
translate('ImagePlugin.MediaItem',
|
||||
'The following image(s) no longer exist: %s') %
|
||||
u'\n'.join(missing_items_filenames))
|
||||
return False
|
||||
# We have missing as well as existing images. We ask what to do.
|
||||
elif missing_items and QtGui.QMessageBox.question(self,
|
||||
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
|
||||
unicode(translate('ImagePlugin.MediaItem', 'The following '
|
||||
translate('ImagePlugin.MediaItem', 'The following '
|
||||
'image(s) no longer exist: %s\nDo you want to add the other '
|
||||
'images anyway?')) % u'\n'.join(missing_items_filenames),
|
||||
'images anyway?') % u'\n'.join(missing_items_filenames),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
|
||||
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
|
||||
return False
|
||||
# Continue with the existing images.
|
||||
for bitem in items:
|
||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||
filename = bitem.data(QtCore.Qt.UserRole)
|
||||
name = os.path.split(filename)[1]
|
||||
service_item.add_from_image(filename, name, background)
|
||||
return True
|
||||
|
@ -224,11 +222,10 @@ class ImageMediaItem(MediaManagerItem):
|
|||
translate('ImagePlugin.MediaItem',
|
||||
'You must select an image to replace the background with.')):
|
||||
background = QtGui.QColor(Settings().value(
|
||||
self.settingsSection + u'/background color',
|
||||
QtCore.QVariant(u'#000000')))
|
||||
self.settingsSection + u'/background color', u'#000000'))
|
||||
item = self.listView.selectedIndexes()[0]
|
||||
bitem = self.listView.item(item.row())
|
||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||
filename = bitem.data(QtCore.Qt.UserRole)
|
||||
if os.path.exists(filename):
|
||||
if self.plugin.liveController.display.directImage(
|
||||
filename, background):
|
||||
|
@ -239,9 +236,9 @@ class ImageMediaItem(MediaManagerItem):
|
|||
'There was no display item to amend.'))
|
||||
else:
|
||||
critical_error_message_box(UiStrings().LiveBGError,
|
||||
unicode(translate('ImagePlugin.MediaItem',
|
||||
translate('ImagePlugin.MediaItem',
|
||||
'There was a problem replacing your background, '
|
||||
'the image file "%s" no longer exists.')) % filename)
|
||||
'the image file "%s" no longer exists.') % filename)
|
||||
|
||||
def search(self, string, showError):
|
||||
files = SettingsManager.load_list(self.settingsSection, u'images')
|
||||
|
|
|
@ -33,8 +33,7 @@ import os
|
|||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, SettingsManager, translate, \
|
||||
check_item_selected, Receiver, MediaType, ServiceItem, build_html, ServiceItemContext
|
||||
from openlp.core.lib.settings import Settings
|
||||
check_item_selected, Receiver, MediaType, ServiceItem, build_html, ServiceItemContext, Settings
|
||||
from openlp.core.lib.ui import UiStrings, 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
|
||||
|
@ -72,8 +71,8 @@ class MediaMediaItem(MediaManagerItem):
|
|||
self.displayController.previewDisplay.screen = {u'size':self.displayController.previewDisplay.geometry()}
|
||||
self.displayController.previewDisplay.setup()
|
||||
self.plugin.mediaController.setup_display(self.displayController.previewDisplay, False)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'video_background_replaced'), self.videobackgroundReplaced)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'video_background_replaced'),
|
||||
self.videobackgroundReplaced)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'mediaitem_media_rebuild'), self.rebuild_players)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'), self.displaySetup)
|
||||
# Allow DnD from the desktop
|
||||
|
@ -149,7 +148,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||
translate('MediaPlugin.MediaItem',
|
||||
'You must select a media file to replace the background with.')):
|
||||
item = self.listView.currentItem()
|
||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
filename = item.data(QtCore.Qt.UserRole)
|
||||
if os.path.exists(filename):
|
||||
service_item = ServiceItem()
|
||||
service_item.title = u'webkit'
|
||||
|
@ -164,8 +163,8 @@ class MediaMediaItem(MediaManagerItem):
|
|||
translate('MediaPlugin.MediaItem', 'There was no display item to amend.'))
|
||||
else:
|
||||
critical_error_message_box(UiStrings().LiveBGError,
|
||||
unicode(translate('MediaPlugin.MediaItem',
|
||||
'There was a problem replacing your background, the media file "%s" no longer exists.')) % filename)
|
||||
translate('MediaPlugin.MediaItem',
|
||||
'There was a problem replacing your background, the media file "%s" no longer exists.') % filename)
|
||||
|
||||
def generateSlideData(self, service_item, item=None, xmlVersion=False,
|
||||
remote=False, context=ServiceItemContext.Live):
|
||||
|
@ -173,15 +172,15 @@ class MediaMediaItem(MediaManagerItem):
|
|||
item = self.listView.currentItem()
|
||||
if item is None:
|
||||
return False
|
||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
filename = item.data(QtCore.Qt.UserRole)
|
||||
if not os.path.exists(filename):
|
||||
if not remote:
|
||||
# File is no longer present
|
||||
critical_error_message_box(
|
||||
translate('MediaPlugin.MediaItem', 'Missing Media File'),
|
||||
unicode(translate('MediaPlugin.MediaItem', 'The file %s no longer exists.')) % filename)
|
||||
translate('MediaPlugin.MediaItem', 'The file %s no longer exists.') % filename)
|
||||
return False
|
||||
service_item.title = unicode(self.displayTypeComboBox.currentText())
|
||||
service_item.title = self.displayTypeComboBox.currentText()
|
||||
service_item.shortname = service_item.title
|
||||
(path, name) = os.path.split(filename)
|
||||
service_item.add_from_command(path, name, CLAPPERBOARD)
|
||||
|
@ -193,8 +192,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||
service_item.add_capability(ItemCapabilities.CanAutoStartForLive)
|
||||
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
||||
service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay)
|
||||
if Settings().value(self.settingsSection + u'/media auto start',
|
||||
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == QtCore.Qt.Checked:
|
||||
if Settings().value(self.settingsSection + u'/media auto start', QtCore.Qt.Unchecked) == QtCore.Qt.Checked:
|
||||
service_item.will_auto_start = True
|
||||
# force a non-existent theme
|
||||
service_item.theme = -1
|
||||
|
@ -212,7 +210,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||
the settings
|
||||
"""
|
||||
self.populateDisplayTypes()
|
||||
self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem', 'Videos (%s);;Audio (%s);;%s (*)')) % (
|
||||
self.onNewFileMasks = translate('MediaPlugin.MediaItem', 'Videos (%s);;Audio (%s);;%s (*)') % (
|
||||
u' '.join(self.plugin.mediaController.video_extensions_list),
|
||||
u' '.join(self.plugin.mediaController.audio_extensions_list), UiStrings().AllFiles)
|
||||
|
||||
|
@ -268,7 +266,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||
filename = os.path.split(unicode(track))[1]
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
item_name.setIcon(ERROR)
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
|
||||
item_name.setData(QtCore.Qt.UserRole, track)
|
||||
elif track_info.isFile():
|
||||
filename = os.path.split(unicode(track))[1]
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
|
@ -276,12 +274,12 @@ class MediaMediaItem(MediaManagerItem):
|
|||
item_name.setIcon(AUDIO)
|
||||
else:
|
||||
item_name.setIcon(VIDEO)
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
|
||||
item_name.setData(QtCore.Qt.UserRole, track)
|
||||
else:
|
||||
filename = os.path.split(unicode(track))[1]
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
item_name.setIcon(build_icon(DVDICON))
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
|
||||
item_name.setData(QtCore.Qt.UserRole, track)
|
||||
item_name.setToolTip(track)
|
||||
self.listView.addItem(item_name)
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue