openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #21614
[Merge] lp:~openlp-core/openlp/python3-productive into lp:openlp
Andreas Preikschat has proposed merging lp:~openlp-core/openlp/python3-productive into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~openlp-core/openlp/python3-productive/+merge/183337
run 2to3 and updated resources.py
--
The attached diff has been truncated due to its size.
https://code.launchpad.net/~openlp-core/openlp/python3-productive/+merge/183337
Your team OpenLP Core is requested to review the proposed merge of lp:~openlp-core/openlp/python3-productive into lp:openlp.
=== modified file 'openlp.py'
--- openlp.py 2013-07-20 09:38:24 +0000
+++ openlp.py 2013-08-31 18:18:25 +0000
@@ -32,7 +32,7 @@
from openlp.core import main
-if __name__ == u'__main__':
+if __name__ == '__main__':
"""
Instantiate and run the application.
"""
@@ -41,5 +41,5 @@
# conflict with other OpenLP arguments. Since we do not use this
# argument we can delete it to avoid any potential conflicts.
if sys.platform.startswith('darwin'):
- sys.argv = filter(lambda x: not x.startswith('-psn'), sys.argv)
+ sys.argv = [x for x in sys.argv if not x.startswith('-psn')]
main()
=== modified file 'openlp/__init__.py'
--- openlp/__init__.py 2013-07-20 09:38:24 +0000
+++ openlp/__init__.py 2013-08-31 18:18:25 +0000
@@ -33,4 +33,4 @@
import openlp.core
import openlp.plugins
-__all__ = [u'core', u'plugins']
+__all__ = ['core', 'plugins']
=== modified file 'openlp/core/__init__.py'
--- openlp/core/__init__.py 2013-07-19 20:56:31 +0000
+++ openlp/core/__init__.py 2013-08-31 18:18:25 +0000
@@ -53,11 +53,11 @@
from openlp.core.utils import AppLocation, LanguageManager, VersionThread, get_application_version
-__all__ = [u'OpenLP', u'main']
+__all__ = ['OpenLP', 'main']
log = logging.getLogger()
-NT_REPAIR_STYLESHEET = u"""
+NT_REPAIR_STYLESHEET = """
QMainWindow::separator
{
border: none;
@@ -111,22 +111,22 @@
# 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'core/has run wizard')
+ has_run_wizard = Settings().value('core/has run wizard')
if not has_run_wizard:
if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
- Settings().setValue(u'core/has run wizard', True)
+ Settings().setValue('core/has run wizard', True)
# Correct stylesheet bugs
- application_stylesheet = u''
- if not Settings().value(u'advanced/alternate rows'):
+ application_stylesheet = ''
+ if not Settings().value('advanced/alternate rows'):
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'
+ 'QTableWidget, QListWidget, QTreeWidget {alternate-background-color: ' + base_color.name() + ';}\n'
application_stylesheet += alternate_rows_repair_stylesheet
- if os.name == u'nt':
+ if os.name == 'nt':
application_stylesheet += NT_REPAIR_STYLESHEET
if application_stylesheet:
self.setStyleSheet(application_stylesheet)
- show_splash = Settings().value(u'core/show splash')
+ show_splash = Settings().value('core/show splash')
if show_splash:
self.splash = SplashScreen()
self.splash.show()
@@ -134,20 +134,20 @@
self.processEvents()
# start the main app window
self.main_window = MainWindow()
- Registry().execute(u'bootstrap_initialise')
- Registry().execute(u'bootstrap_post_set_up')
+ Registry().execute('bootstrap_initialise')
+ Registry().execute('bootstrap_post_set_up')
self.main_window.show()
if show_splash:
# now kill the splashscreen
self.splash.finish(self.main_window)
- log.debug(u'Splashscreen closed')
+ log.debug('Splashscreen closed')
# make sure Qt really display the splash screen
self.processEvents()
self.main_window.repaint()
self.processEvents()
if not has_run_wizard:
self.main_window.first_time()
- update_check = Settings().value(u'core/update check')
+ update_check = Settings().value('core/update check')
if update_check:
VersionThread(self.main_window).start()
self.main_window.is_display_blank()
@@ -184,7 +184,7 @@
A traceback object with the details of where the exception occurred.
"""
log.exception(''.join(format_exception(exctype, value, traceback)))
- if not hasattr(self, u'exception_form'):
+ if not hasattr(self, 'exception_form'):
self.exception_form = ExceptionForm()
self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exctype, value, traceback)))
self.set_normal_cursor()
@@ -194,7 +194,7 @@
"""
Wrapper to make ProcessEvents visible and named correctly
"""
- log.debug(u'processing event flush')
+ log.debug('processing event flush')
self.processEvents()
def set_busy_cursor(self):
@@ -217,7 +217,7 @@
"""
if event.type() == QtCore.QEvent.FileOpen:
file_name = event.file()
- log.debug(u'Got open file event for %s!', file_name)
+ log.debug('Got open file event for %s!', file_name)
self.args.insert(0, file_name)
return True
else:
@@ -229,9 +229,9 @@
Setup our logging using log_path
"""
check_directory_exists(log_path, True)
- filename = os.path.join(log_path, u'openlp.log')
- logfile = logging.FileHandler(filename, u'w')
- logfile.setFormatter(logging.Formatter(u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s'))
+ filename = os.path.join(log_path, 'openlp.log')
+ logfile = logging.FileHandler(filename, 'w')
+ logfile.setFormatter(logging.Formatter('%(asctime)s %(name)-55s %(levelname)-8s %(message)s'))
log.addHandler(logfile)
if log.isEnabledFor(logging.DEBUG):
print('Logging to: %s' % filename)
@@ -275,40 +275,40 @@
qInitResources()
# Now create and actually run the application.
application = OpenLP(qt_args)
- application.setOrganizationName(u'OpenLP')
- application.setOrganizationDomain(u'openlp.org')
+ application.setOrganizationName('OpenLP')
+ application.setOrganizationDomain('openlp.org')
if options.portable:
- application.setApplicationName(u'OpenLPPortable')
+ application.setApplicationName('OpenLPPortable')
Settings.setDefaultFormat(Settings.IniFormat)
# Get location OpenLPPortable.ini
application_path = AppLocation.get_directory(AppLocation.AppDir)
- set_up_logging(os.path.abspath(os.path.join(application_path, u'..', u'..', u'Other')))
- log.info(u'Running portable')
- portable_settings_file = os.path.abspath(os.path.join(application_path, u'..', u'..', u'Data', u'OpenLP.ini'))
+ set_up_logging(os.path.abspath(os.path.join(application_path, '..', '..', 'Other')))
+ log.info('Running portable')
+ portable_settings_file = os.path.abspath(os.path.join(application_path, '..', '..', 'Data', 'OpenLP.ini'))
# Make this our settings file
- log.info(u'INI file: %s', portable_settings_file)
+ log.info('INI file: %s', portable_settings_file)
Settings.set_filename(portable_settings_file)
portable_settings = Settings()
# Set our data path
- data_path = os.path.abspath(os.path.join(application_path, u'..', u'..', u'Data',))
- log.info(u'Data path: %s', data_path)
+ data_path = os.path.abspath(os.path.join(application_path, '..', '..', 'Data',))
+ log.info('Data path: %s', data_path)
# Point to our data path
- portable_settings.setValue(u'advanced/data path', data_path)
- portable_settings.setValue(u'advanced/is portable', True)
+ portable_settings.setValue('advanced/data path', data_path)
+ portable_settings.setValue('advanced/is portable', True)
portable_settings.sync()
else:
- application.setApplicationName(u'OpenLP')
+ application.setApplicationName('OpenLP')
set_up_logging(AppLocation.get_directory(AppLocation.CacheDir))
Registry.create()
- Registry().register(u'application', application)
- application.setApplicationVersion(get_application_version()[u'version'])
+ Registry().register('application', application)
+ application.setApplicationVersion(get_application_version()['version'])
# Instance check
if application.is_already_running():
sys.exit()
# Remove/convert obsolete settings.
Settings().remove_obsolete_settings()
# First time checks in settings
- if not Settings().value(u'core/has run wizard'):
+ if not Settings().value('core/has run wizard'):
if not FirstTimeLanguageForm().exec_():
# if cancel then stop processing
sys.exit()
@@ -320,7 +320,7 @@
if not default_translator.isEmpty():
application.installTranslator(default_translator)
else:
- log.debug(u'Could not find default_translator.')
+ log.debug('Could not find default_translator.')
if not options.no_error_form:
sys.excepthook = application.hook_exception
sys.exit(application.run(qt_args))
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2013-06-13 10:52:47 +0000
+++ openlp/core/lib/__init__.py 2013-08-31 18:18:25 +0000
@@ -30,7 +30,7 @@
The :mod:`lib` module contains most of the components and libraries that make
OpenLP work.
"""
-from __future__ import division
+
from distutils.version import LooseVersion
import logging
import os
@@ -123,13 +123,13 @@
file_handle = None
content = None
try:
- file_handle = open(text_file, u'r')
+ file_handle = open(text_file, 'r')
if not file_handle.read(3) == '\xEF\xBB\xBF':
# no BOM was found
file_handle.seek(0)
content = file_handle.read()
except (IOError, UnicodeError):
- log.exception(u'Failed to open text file %s' % text_file)
+ log.exception('Failed to open text file %s' % text_file)
finally:
if file_handle:
file_handle.close()
@@ -145,7 +145,7 @@
"""
if isinstance(string_value, bool):
return string_value
- return unicode(string_value).strip().lower() in (u'true', u'yes', u'y')
+ return str(string_value).strip().lower() in ('true', 'yes', 'y')
def build_icon(icon):
@@ -160,8 +160,8 @@
button_icon = QtGui.QIcon()
if isinstance(icon, QtGui.QIcon):
button_icon = icon
- elif isinstance(icon, basestring):
- if icon.startswith(u':/'):
+ elif isinstance(icon, str):
+ if icon.startswith(':/'):
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)
@@ -177,13 +177,13 @@
``image``
The image to converted.
"""
- log.debug(u'image_to_byte - start')
+ log.debug('image_to_byte - start')
byte_array = QtCore.QByteArray()
# use buffer to store pixmap into byteArray
buffie = QtCore.QBuffer(byte_array)
buffie.open(QtCore.QIODevice.WriteOnly)
image.save(buffie, "PNG")
- log.debug(u'image_to_byte - end')
+ log.debug('image_to_byte - end')
# convert to base64 encoding so does not get missed!
return bytes(byte_array.toBase64()).decode('utf-8')
@@ -217,9 +217,9 @@
if not return_icon:
return
if os.path.exists(thumb_path):
- return build_icon(unicode(thumb_path))
+ return build_icon(str(thumb_path))
# Fallback for files with animation support.
- return build_icon(unicode(image_path))
+ return build_icon(str(image_path))
def validate_thumb(file_path, thumb_path):
@@ -240,7 +240,7 @@
return image_date <= thumb_date
-def resize_image(image_path, width, height, background=u'#000000'):
+def resize_image(image_path, width, height, background='#000000'):
"""
Resize an image to fit on the current screen.
@@ -258,7 +258,7 @@
DO NOT REMOVE THE DEFAULT BACKGROUND VALUE!
"""
- log.debug(u'resize_image - start')
+ log.debug('resize_image - start')
reader = QtGui.QImageReader(image_path)
# The image's ratio.
image_ratio = reader.size().width() / reader.size().height()
@@ -308,12 +308,12 @@
"""
Remove Tags from text for display
"""
- text = text.replace(u'<br>', u'\n')
- text = text.replace(u'{br}', u'\n')
- text = text.replace(u' ', u' ')
+ text = text.replace('<br>', '\n')
+ text = text.replace('{br}', '\n')
+ text = text.replace(' ', ' ')
for tag in FormattingTags.get_html_tags():
- text = text.replace(tag[u'start tag'], u'')
- text = text.replace(tag[u'end tag'], u'')
+ text = text.replace(tag['start tag'], '')
+ text = text.replace(tag['end tag'], '')
return text
@@ -322,8 +322,8 @@
Expand tags HTML for display
"""
for tag in FormattingTags.get_html_tags():
- text = text.replace(tag[u'start tag'], tag[u'start html'])
- text = text.replace(tag[u'end tag'], tag[u'end html'])
+ text = text.replace(tag['start tag'], tag['start html'])
+ text = text.replace(tag['end tag'], tag['end html'])
return text
@@ -338,7 +338,7 @@
To not log anything. This is need for the start up, when the log isn't ready.
"""
if not do_not_log:
- log.debug(u'check_directory_exists %s' % directory)
+ log.debug('check_directory_exists %s' % directory)
try:
if not os.path.exists(directory):
os.makedirs(directory)
@@ -355,11 +355,11 @@
``stringlist``
List of unicode strings
"""
- if LooseVersion(Qt.PYQT_VERSION_STR) >= LooseVersion(u'4.9') and \
- LooseVersion(Qt.qVersion()) >= LooseVersion(u'4.8'):
+ if LooseVersion(Qt.PYQT_VERSION_STR) >= LooseVersion('4.9') and \
+ LooseVersion(Qt.qVersion()) >= LooseVersion('4.8'):
return QtCore.QLocale().createSeparatedList(stringlist)
if not stringlist:
- return u''
+ return ''
elif len(stringlist) == 1:
return stringlist[0]
elif len(stringlist) == 2:
@@ -367,29 +367,29 @@
'Locale list separator: 2 items') % (stringlist[0], stringlist[1])
else:
merged = translate('OpenLP.core.lib', '%s, and %s',
- u'Locale list separator: end') % (stringlist[-2], stringlist[-1])
- for index in reversed(range(1, len(stringlist) - 2)):
+ 'Locale list separator: end') % (stringlist[-2], stringlist[-1])
+ for index in reversed(list(range(1, len(stringlist) - 2))):
merged = translate('OpenLP.core.lib', '%s, %s',
- u'Locale list separator: middle') % (stringlist[index], merged)
- return translate('OpenLP.core.lib', '%s, %s', u'Locale list separator: start') % (stringlist[0], merged)
-
-
-from registry import Registry
-from uistrings import UiStrings
-from screen import ScreenList
-from settings import Settings
-from listwidgetwithdnd import ListWidgetWithDnD
-from treewidgetwithdnd import TreeWidgetWithDnD
-from formattingtags import FormattingTags
-from spelltextedit import SpellTextEdit
-from plugin import PluginStatus, StringContent, Plugin
-from pluginmanager import PluginManager
-from settingstab import SettingsTab
-from serviceitem import ServiceItem, ServiceItemType, ItemCapabilities
-from htmlbuilder import build_html, build_lyrics_format_css, build_lyrics_outline_css
-from toolbar import OpenLPToolbar
-from dockwidget import OpenLPDockWidget
-from imagemanager import ImageManager
-from renderer import Renderer
-from mediamanageritem import MediaManagerItem
+ 'Locale list separator: middle') % (stringlist[index], merged)
+ return translate('OpenLP.core.lib', '%s, %s', 'Locale list separator: start') % (stringlist[0], merged)
+
+
+from .registry import Registry
+from .uistrings import UiStrings
+from .screen import ScreenList
+from .settings import Settings
+from .listwidgetwithdnd import ListWidgetWithDnD
+from .treewidgetwithdnd import TreeWidgetWithDnD
+from .formattingtags import FormattingTags
+from .spelltextedit import SpellTextEdit
+from .plugin import PluginStatus, StringContent, Plugin
+from .pluginmanager import PluginManager
+from .settingstab import SettingsTab
+from .serviceitem import ServiceItem, ServiceItemType, ItemCapabilities
+from .htmlbuilder import build_html, build_lyrics_format_css, build_lyrics_outline_css
+from .toolbar import OpenLPToolbar
+from .dockwidget import OpenLPDockWidget
+from .imagemanager import ImageManager
+from .renderer import Renderer
+from .mediamanageritem import MediaManagerItem
=== modified file 'openlp/core/lib/db.py'
--- openlp/core/lib/db.py 2013-07-05 18:47:32 +0000
+++ openlp/core/lib/db.py 2013-08-31 18:18:25 +0000
@@ -32,7 +32,7 @@
"""
import logging
import os
-from urllib import quote_plus as urlquote
+from urllib.parse import quote_plus as urlquote
from sqlalchemy import Table, MetaData, Column, types, create_engine
from sqlalchemy.exc import SQLAlchemyError, InvalidRequestError, DBAPIError, OperationalError
@@ -96,15 +96,15 @@
"""
pass
- metadata_table = Table(u'metadata', metadata,
- Column(u'key', types.Unicode(64), primary_key=True),
- Column(u'value', types.UnicodeText(), default=None)
+ metadata_table = Table('metadata', metadata,
+ Column('key', types.Unicode(64), primary_key=True),
+ Column('value', types.UnicodeText(), default=None)
)
metadata_table.create(checkfirst=True)
mapper(Metadata, metadata_table)
- version_meta = session.query(Metadata).get(u'version')
+ version_meta = session.query(Metadata).get('version')
if version_meta is None:
- version_meta = Metadata.populate(key=u'version', value=u'0')
+ version_meta = Metadata.populate(key='version', value='0')
session.add(version_meta)
version = 0
else:
@@ -113,22 +113,22 @@
return version, upgrade.__version__
version += 1
try:
- while hasattr(upgrade, u'upgrade_%d' % version):
- log.debug(u'Running upgrade_%d', version)
+ while hasattr(upgrade, 'upgrade_%d' % version):
+ log.debug('Running upgrade_%d', version)
try:
- upgrade_func = getattr(upgrade, u'upgrade_%d' % version)
+ upgrade_func = getattr(upgrade, 'upgrade_%d' % version)
upgrade_func(session, metadata)
session.commit()
# Update the version number AFTER a commit so that we are sure the previous transaction happened
- version_meta.value = unicode(version)
+ version_meta.value = str(version)
session.commit()
version += 1
except (SQLAlchemyError, DBAPIError):
- log.exception(u'Could not run database upgrade script "upgrade_%s", upgrade process has been halted.',
+ log.exception('Could not run database upgrade script "upgrade_%s", upgrade process has been halted.',
version)
break
except (SQLAlchemyError, DBAPIError):
- version_meta = Metadata.populate(key=u'version', value=int(upgrade.__version__))
+ version_meta = Metadata.populate(key='version', value=int(upgrade.__version__))
session.commit()
return int(version_meta.value), upgrade.__version__
@@ -161,7 +161,7 @@
Creates an instance of a class and populates it, returning the instance
"""
instance = cls()
- for key, value in kwargs.iteritems():
+ for key, value in kwargs.items():
instance.__setattr__(key, value)
return instance
@@ -189,24 +189,24 @@
"""
settings = Settings()
settings.beginGroup(plugin_name)
- self.db_url = u''
+ self.db_url = ''
self.is_dirty = False
self.session = None
- db_type = settings.value(u'db type')
- if db_type == u'sqlite':
+ db_type = settings.value('db type')
+ if db_type == '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 = '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 = 'sqlite:///%s/%s.sqlite' % (AppLocation.get_section_data_path(plugin_name), plugin_name)
else:
- self.db_url = u'%s://%s:%s@%s/%s' % (db_type,
- urlquote(settings.value(u'db username')),
- urlquote(settings.value(u'db password')),
- urlquote(settings.value(u'db hostname')),
- urlquote(settings.value(u'db database')))
- if db_type == u'mysql':
- db_encoding = settings.value(u'db encoding')
- self.db_url += u'?charset=%s' % urlquote(db_encoding)
+ self.db_url = '%s://%s:%s@%s/%s' % (db_type,
+ urlquote(settings.value('db username')),
+ urlquote(settings.value('db password')),
+ urlquote(settings.value('db hostname')),
+ urlquote(settings.value('db database')))
+ if db_type == 'mysql':
+ db_encoding = settings.value('db encoding')
+ self.db_url += '?charset=%s' % urlquote(db_encoding)
settings.endGroup()
if upgrade_mod:
db_ver, up_ver = upgrade_db(self.db_url, upgrade_mod)
@@ -221,7 +221,7 @@
try:
self.session = init_schema(self.db_url)
except (SQLAlchemyError, DBAPIError):
- log.exception(u'Error loading database: %s', self.db_url)
+ log.exception('Error loading database: %s', self.db_url)
critical_error_message_box(
translate('OpenLP.Manager', 'Database Error'),
translate('OpenLP.Manager', 'OpenLP cannot load your database.\n\nDatabase: %s') % self.db_url
@@ -248,13 +248,13 @@
# This exception clause is for users running MySQL which likes to terminate connections on its own
# without telling anyone. See bug #927473. However, other dbms can raise it, usually in a
# non-recoverable way. So we only retry 3 times.
- log.exception(u'Probably a MySQL issue - "MySQL has gone away"')
+ log.exception('Probably a MySQL issue - "MySQL has gone away"')
self.session.rollback()
if try_count >= 2:
raise
except InvalidRequestError:
self.session.rollback()
- log.exception(u'Object list save failed')
+ log.exception('Object list save failed')
return False
except:
self.session.rollback()
@@ -281,13 +281,13 @@
# This exception clause is for users running MySQL which likes to terminate connections on its own
# without telling anyone. See bug #927473. However, other dbms can raise it, usually in a
# non-recoverable way. So we only retry 3 times.
- log.exception(u'Probably a MySQL issue, "MySQL has gone away"')
+ log.exception('Probably a MySQL issue, "MySQL has gone away"')
self.session.rollback()
if try_count >= 2:
raise
except InvalidRequestError:
self.session.rollback()
- log.exception(u'Object list save failed')
+ log.exception('Object list save failed')
return False
except:
self.session.rollback()
@@ -313,7 +313,7 @@
# This exception clause is for users running MySQL which likes to terminate connections on its own
# without telling anyone. See bug #927473. However, other dbms can raise it, usually in a
# non-recoverable way. So we only retry 3 times.
- log.exception(u'Probably a MySQL issue, "MySQL has gone away"')
+ log.exception('Probably a MySQL issue, "MySQL has gone away"')
if try_count >= 2:
raise
@@ -334,7 +334,7 @@
# This exception clause is for users running MySQL which likes to terminate connections on its own
# without telling anyone. See bug #927473. However, other dbms can raise it, usually in a
# non-recoverable way. So we only retry 3 times.
- log.exception(u'Probably a MySQL issue, "MySQL has gone away"')
+ log.exception('Probably a MySQL issue, "MySQL has gone away"')
if try_count >= 2:
raise
@@ -365,7 +365,7 @@
# This exception clause is for users running MySQL which likes to terminate connections on its own
# without telling anyone. See bug #927473. However, other dbms can raise it, usually in a
# non-recoverable way. So we only retry 3 times.
- log.exception(u'Probably a MySQL issue, "MySQL has gone away"')
+ log.exception('Probably a MySQL issue, "MySQL has gone away"')
if try_count >= 2:
raise
@@ -389,7 +389,7 @@
# This exception clause is for users running MySQL which likes to terminate connections on its own
# without telling anyone. See bug #927473. However, other dbms can raise it, usually in a
# non-recoverable way. So we only retry 3 times.
- log.exception(u'Probably a MySQL issue, "MySQL has gone away"')
+ log.exception('Probably a MySQL issue, "MySQL has gone away"')
if try_count >= 2:
raise
@@ -415,13 +415,13 @@
# This exception clause is for users running MySQL which likes to terminate connections on its own
# without telling anyone. See bug #927473. However, other dbms can raise it, usually in a
# non-recoverable way. So we only retry 3 times.
- log.exception(u'Probably a MySQL issue, "MySQL has gone away"')
+ log.exception('Probably a MySQL issue, "MySQL has gone away"')
self.session.rollback()
if try_count >= 2:
raise
except InvalidRequestError:
self.session.rollback()
- log.exception(u'Failed to delete object')
+ log.exception('Failed to delete object')
return False
except:
self.session.rollback()
@@ -453,13 +453,13 @@
# This exception clause is for users running MySQL which likes to terminate connections on its own
# without telling anyone. See bug #927473. However, other dbms can raise it, usually in a
# non-recoverable way. So we only retry 3 times.
- log.exception(u'Probably a MySQL issue, "MySQL has gone away"')
+ log.exception('Probably a MySQL issue, "MySQL has gone away"')
self.session.rollback()
if try_count >= 2:
raise
except InvalidRequestError:
self.session.rollback()
- log.exception(u'Failed to delete %s records', object_class.__name__)
+ log.exception('Failed to delete %s records', object_class.__name__)
return False
except:
self.session.rollback()
@@ -471,5 +471,5 @@
"""
if self.is_dirty:
engine = create_engine(self.db_url)
- if self.db_url.startswith(u'sqlite'):
+ if self.db_url.startswith('sqlite'):
engine.execute("vacuum")
=== modified file 'openlp/core/lib/dockwidget.py'
--- openlp/core/lib/dockwidget.py 2013-07-18 11:17:40 +0000
+++ openlp/core/lib/dockwidget.py 2013-08-31 18:18:25 +0000
@@ -30,7 +30,7 @@
"""
Provide additional functionality required by OpenLP from the inherited QDockWidget.
"""
-from __future__ import division
+
import logging
from PyQt4 import QtGui
@@ -48,7 +48,7 @@
"""
Initialise the DockWidget
"""
- log.debug(u'Initialise the %s widget' % name)
+ log.debug('Initialise the %s widget' % name)
super(OpenLPDockWidget, self).__init__(parent)
if name:
self.setObjectName(name)
@@ -56,7 +56,7 @@
self.setWindowIcon(build_icon(icon))
# Sort out the minimum width.
screens = ScreenList()
- main_window_docbars = screens.current[u'size'].width() // 5
+ main_window_docbars = screens.current['size'].width() // 5
if main_window_docbars > 300:
self.setMinimumWidth(300)
else:
=== modified file 'openlp/core/lib/formattingtags.py'
--- openlp/core/lib/formattingtags.py 2013-08-01 12:57:59 +0000
+++ openlp/core/lib/formattingtags.py 2013-08-31 18:18:25 +0000
@@ -54,106 +54,106 @@
"""
tags = []
for tag in FormattingTags.html_expands:
- if not tag[u'protected'] and not tag.get(u'temporary'):
+ if not tag['protected'] and not tag.get('temporary'):
# Using dict ensures that copy is made and encoding of values a little later does not affect tags in
# the original list
tags.append(dict(tag))
tag = tags[-1]
# Remove key 'temporary' from tags. It is not needed to be saved.
- if u'temporary' in tag:
- del tag[u'temporary']
+ if 'temporary' in tag:
+ del tag['temporary']
# Formatting Tags were also known as display tags.
- Settings().setValue(u'formattingTags/html_tags', json.dumps(tags) if tags else u'')
+ Settings().setValue('formattingTags/html_tags', json.dumps(tags) if tags else '')
@staticmethod
def load_tags():
"""
Load the Tags from store so can be used in the system or used to update the display.
"""
- temporary_tags = [tag for tag in FormattingTags.html_expands if tag.get(u'temporary')]
+ temporary_tags = [tag for tag in FormattingTags.html_expands if tag.get('temporary')]
FormattingTags.html_expands = []
base_tags = []
# Append the base tags.
- base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Red'),
- u'start tag': u'{r}',
- u'start html': u'<span style="-webkit-text-fill-color:red">',
- u'end tag': u'{/r}', u'end html': u'</span>', u'protected': True,
- u'temporary': False})
- base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Black'),
- u'start tag': u'{b}',
- u'start html': u'<span style="-webkit-text-fill-color:black">',
- u'end tag': u'{/b}', u'end html': u'</span>', u'protected': True,
- u'temporary': False})
- base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Blue'),
- u'start tag': u'{bl}',
- u'start html': u'<span style="-webkit-text-fill-color:blue">',
- u'end tag': u'{/bl}', u'end html': u'</span>', u'protected': True,
- u'temporary': False})
- base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Yellow'),
- u'start tag': u'{y}',
- u'start html': u'<span style="-webkit-text-fill-color:yellow">',
- u'end tag': u'{/y}', u'end html': u'</span>', u'protected': True,
- u'temporary': False})
- base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Green'),
- u'start tag': u'{g}',
- u'start html': u'<span style="-webkit-text-fill-color:green">',
- u'end tag': u'{/g}', u'end html': u'</span>', u'protected': True,
- u'temporary': False})
- base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Pink'),
- u'start tag': u'{pk}',
- u'start html': u'<span style="-webkit-text-fill-color:#FFC0CB">',
- u'end tag': u'{/pk}', u'end html': u'</span>', u'protected': True,
- u'temporary': False})
- base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Orange'),
- u'start tag': u'{o}',
- u'start html': u'<span style="-webkit-text-fill-color:#FFA500">',
- u'end tag': u'{/o}', u'end html': u'</span>', u'protected': True,
- u'temporary': False})
- base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Purple'),
- u'start tag': u'{pp}',
- u'start html': u'<span style="-webkit-text-fill-color:#800080">',
- u'end tag': u'{/pp}', u'end html': u'</span>', u'protected': True,
- u'temporary': False})
- base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'White'),
- u'start tag': u'{w}',
- u'start html': u'<span style="-webkit-text-fill-color:white">',
- u'end tag': u'{/w}', u'end html': u'</span>', u'protected': True,
- u'temporary': False})
- base_tags.append({
- u'desc': translate('OpenLP.FormattingTags', 'Superscript'),
- u'start tag': u'{su}', u'start html': u'<sup>',
- u'end tag': u'{/su}', u'end html': u'</sup>', u'protected': True,
- u'temporary': False})
- base_tags.append({
- u'desc': translate('OpenLP.FormattingTags', 'Subscript'),
- u'start tag': u'{sb}', u'start html': u'<sub>',
- u'end tag': u'{/sb}', u'end html': u'</sub>', u'protected': True,
- u'temporary': False})
- base_tags.append({
- u'desc': translate('OpenLP.FormattingTags', 'Paragraph'),
- u'start tag': u'{p}', u'start html': u'<p>', u'end tag': u'{/p}',
- u'end html': u'</p>', u'protected': True,
- u'temporary': False})
- base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Bold'),
- u'start tag': u'{st}', u'start html': u'<strong>',
- u'end tag': u'{/st}', u'end html': u'</strong>',
- u'protected': True, u'temporary': False})
- base_tags.append({
- u'desc': translate('OpenLP.FormattingTags', 'Italics'),
- u'start tag': u'{it}', u'start html': u'<em>', u'end tag': u'{/it}',
- u'end html': u'</em>', u'protected': True, u'temporary': False})
- base_tags.append({
- u'desc': translate('OpenLP.FormattingTags', 'Underline'),
- u'start tag': u'{u}',
- u'start html': u'<span style="text-decoration: underline;">',
- u'end tag': u'{/u}', u'end html': u'</span>', u'protected': True,
- u'temporary': False})
- base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Break'),
- u'start tag': u'{br}', u'start html': u'<br>', u'end tag': u'',
- u'end html': u'', u'protected': True, u'temporary': False})
+ base_tags.append({'desc': translate('OpenLP.FormattingTags', 'Red'),
+ 'start tag': '{r}',
+ 'start html': '<span style="-webkit-text-fill-color:red">',
+ 'end tag': '{/r}', 'end html': '</span>', 'protected': True,
+ 'temporary': False})
+ base_tags.append({'desc': translate('OpenLP.FormattingTags', 'Black'),
+ 'start tag': '{b}',
+ 'start html': '<span style="-webkit-text-fill-color:black">',
+ 'end tag': '{/b}', 'end html': '</span>', 'protected': True,
+ 'temporary': False})
+ base_tags.append({'desc': translate('OpenLP.FormattingTags', 'Blue'),
+ 'start tag': '{bl}',
+ 'start html': '<span style="-webkit-text-fill-color:blue">',
+ 'end tag': '{/bl}', 'end html': '</span>', 'protected': True,
+ 'temporary': False})
+ base_tags.append({'desc': translate('OpenLP.FormattingTags', 'Yellow'),
+ 'start tag': '{y}',
+ 'start html': '<span style="-webkit-text-fill-color:yellow">',
+ 'end tag': '{/y}', 'end html': '</span>', 'protected': True,
+ 'temporary': False})
+ base_tags.append({'desc': translate('OpenLP.FormattingTags', 'Green'),
+ 'start tag': '{g}',
+ 'start html': '<span style="-webkit-text-fill-color:green">',
+ 'end tag': '{/g}', 'end html': '</span>', 'protected': True,
+ 'temporary': False})
+ base_tags.append({'desc': translate('OpenLP.FormattingTags', 'Pink'),
+ 'start tag': '{pk}',
+ 'start html': '<span style="-webkit-text-fill-color:#FFC0CB">',
+ 'end tag': '{/pk}', 'end html': '</span>', 'protected': True,
+ 'temporary': False})
+ base_tags.append({'desc': translate('OpenLP.FormattingTags', 'Orange'),
+ 'start tag': '{o}',
+ 'start html': '<span style="-webkit-text-fill-color:#FFA500">',
+ 'end tag': '{/o}', 'end html': '</span>', 'protected': True,
+ 'temporary': False})
+ base_tags.append({'desc': translate('OpenLP.FormattingTags', 'Purple'),
+ 'start tag': '{pp}',
+ 'start html': '<span style="-webkit-text-fill-color:#800080">',
+ 'end tag': '{/pp}', 'end html': '</span>', 'protected': True,
+ 'temporary': False})
+ base_tags.append({'desc': translate('OpenLP.FormattingTags', 'White'),
+ 'start tag': '{w}',
+ 'start html': '<span style="-webkit-text-fill-color:white">',
+ 'end tag': '{/w}', 'end html': '</span>', 'protected': True,
+ 'temporary': False})
+ base_tags.append({
+ 'desc': translate('OpenLP.FormattingTags', 'Superscript'),
+ 'start tag': '{su}', 'start html': '<sup>',
+ 'end tag': '{/su}', 'end html': '</sup>', 'protected': True,
+ 'temporary': False})
+ base_tags.append({
+ 'desc': translate('OpenLP.FormattingTags', 'Subscript'),
+ 'start tag': '{sb}', 'start html': '<sub>',
+ 'end tag': '{/sb}', 'end html': '</sub>', 'protected': True,
+ 'temporary': False})
+ base_tags.append({
+ 'desc': translate('OpenLP.FormattingTags', 'Paragraph'),
+ 'start tag': '{p}', 'start html': '<p>', 'end tag': '{/p}',
+ 'end html': '</p>', 'protected': True,
+ 'temporary': False})
+ base_tags.append({'desc': translate('OpenLP.FormattingTags', 'Bold'),
+ 'start tag': '{st}', 'start html': '<strong>',
+ 'end tag': '{/st}', 'end html': '</strong>',
+ 'protected': True, 'temporary': False})
+ base_tags.append({
+ 'desc': translate('OpenLP.FormattingTags', 'Italics'),
+ 'start tag': '{it}', 'start html': '<em>', 'end tag': '{/it}',
+ 'end html': '</em>', 'protected': True, 'temporary': False})
+ base_tags.append({
+ 'desc': translate('OpenLP.FormattingTags', 'Underline'),
+ 'start tag': '{u}',
+ 'start html': '<span style="text-decoration: underline;">',
+ 'end tag': '{/u}', 'end html': '</span>', 'protected': True,
+ 'temporary': False})
+ base_tags.append({'desc': translate('OpenLP.FormattingTags', 'Break'),
+ 'start tag': '{br}', 'start html': '<br>', 'end tag': '',
+ 'end html': '', 'protected': True, 'temporary': False})
FormattingTags.add_html_tags(base_tags)
FormattingTags.add_html_tags(temporary_tags)
- user_expands_string = str(Settings().value(u'formattingTags/html_tags'))
+ user_expands_string = str(Settings().value('formattingTags/html_tags'))
# If we have some user ones added them as well
if user_expands_string:
user_tags = json.loads(user_expands_string)
=== modified file 'openlp/core/lib/htmlbuilder.py'
--- openlp/core/lib/htmlbuilder.py 2013-06-20 18:42:45 +0000
+++ openlp/core/lib/htmlbuilder.py 2013-08-31 18:18:25 +0000
@@ -26,7 +26,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from __future__ import division
+
import logging
from PyQt4 import QtWebKit
@@ -35,7 +35,7 @@
log = logging.getLogger(__name__)
-HTMLSRC = u"""
+HTMLSRC = """
<!DOCTYPE html>
<html>
<head>
@@ -220,24 +220,24 @@
``plugins``
The List of available plugins
"""
- width = screen[u'size'].width()
- height = screen[u'size'].height()
+ width = screen['size'].width()
+ height = screen['size'].height()
theme = item.themedata
webkit_ver = webkit_version()
# Image generated and poked in
if background:
- bgimage_src = u'src="data:image/png;base64,%s"' % background
+ bgimage_src = 'src="data:image/png;base64,%s"' % background
elif item.bg_image_bytes:
- bgimage_src = u'src="data:image/png;base64,%s"' % item.bg_image_bytes
+ bgimage_src = 'src="data:image/png;base64,%s"' % item.bg_image_bytes
else:
- bgimage_src = u'style="display:none;"'
+ bgimage_src = 'style="display:none;"'
if image:
- image_src = u'src="data:image/png;base64,%s"' % image
+ image_src = 'src="data:image/png;base64,%s"' % image
else:
- image_src = u'style="display:none;"'
- css_additions = u''
- js_additions = u''
- html_additions = u''
+ image_src = 'style="display:none;"'
+ css_additions = ''
+ js_additions = ''
+ html_additions = ''
if plugins:
for plugin in plugins:
css_additions += plugin.get_display_css()
@@ -248,7 +248,7 @@
css_additions,
build_footer_css(item, height),
build_lyrics_css(item, webkit_ver),
- u'true' if theme and theme.display_slide_transition and is_live else u'false',
+ 'true' if theme and theme.display_slide_transition and is_live else 'false',
js_additions,
bgimage_src, image_src,
html_additions,
@@ -263,7 +263,7 @@
"""
try:
webkit_ver = float(QtWebKit.qWebKitVersion())
- log.debug(u'Webkit version = %s' % webkit_ver)
+ log.debug('Webkit version = %s' % webkit_ver)
except AttributeError:
webkit_ver = 0
return webkit_ver
@@ -278,27 +278,27 @@
"""
width = int(width) // 2
theme = item.themedata
- background = u'background-color: black'
+ background = 'background-color: black'
if theme:
if theme.background_type == BackgroundType.to_string(BackgroundType.Transparent):
- background = u''
+ background = ''
elif theme.background_type == BackgroundType.to_string(BackgroundType.Solid):
- background = u'background-color: %s' % theme.background_color
+ background = 'background-color: %s' % theme.background_color
else:
if theme.background_direction == BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):
- background = u'background: -webkit-gradient(linear, left top, left bottom, from(%s), to(%s)) fixed' \
+ background = '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' \
+ background = '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' \
+ background = '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' % \
+ background = '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 50%%, %s, from(%s), to(%s)) fixed'\
+ background = '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
@@ -314,7 +314,7 @@
The version of qtwebkit we're using
"""
- style = u"""
+ style = """
.lyricstable {
z-index: 5;
position: absolute;
@@ -338,13 +338,13 @@
}
"""
theme = item.themedata
- lyricstable = u''
- lyrics = u''
- lyricsmain = u''
- outline = u''
- shadow = u''
+ lyricstable = ''
+ lyrics = ''
+ lyricsmain = ''
+ outline = ''
+ shadow = ''
if theme and item.main:
- lyricstable = u'left: %spx; top: %spx;' % (item.main.x(), item.main.y())
+ lyricstable = 'left: %spx; top: %spx;' % (item.main.x(), item.main.y())
lyrics = build_lyrics_format_css(theme, item.main.width(), item.main.height())
# For performance reasons we want to show as few DIV's as possible, especially when animating/transitions.
# However some bugs in older versions of qtwebkit mean we need to perform workarounds and add extra divs. Only
@@ -364,12 +364,12 @@
outline = build_lyrics_outline_css(theme)
if theme.font_main_shadow:
if theme.font_main_outline and webkit_ver <= 534.3:
- shadow = u'padding-left: %spx; padding-top: %spx;' % \
+ shadow = 'padding-left: %spx; padding-top: %spx;' % \
(int(theme.font_main_shadow_size) + (int(theme.font_main_outline_size) * 2),
theme.font_main_shadow_size)
shadow += build_lyrics_outline_css(theme, True)
else:
- lyricsmain += u' text-shadow: %s %spx %spx;' % \
+ lyricsmain += ' text-shadow: %s %spx %spx;' % \
(theme.font_main_shadow_color, theme.font_main_shadow_size, theme.font_main_shadow_size)
lyrics_css = style % (lyricstable, lyrics, lyricsmain, outline, shadow)
return lyrics_css
@@ -393,9 +393,9 @@
else:
fill_color = theme.font_main_color
outline_color = theme.font_main_outline_color
- return u' -webkit-text-stroke: %sem %s; -webkit-text-fill-color: %s; ' % (size, outline_color, fill_color)
+ return ' -webkit-text-stroke: %sem %s; -webkit-text-fill-color: %s; ' % (size, outline_color, fill_color)
else:
- return u''
+ return ''
def build_lyrics_format_css(theme, width, height):
@@ -417,15 +417,15 @@
left_margin = int(theme.font_main_outline_size) * 2
else:
left_margin = 0
- justify = u'white-space:pre-wrap;'
+ justify = 'white-space:pre-wrap;'
# fix tag incompatibilities
if theme.display_horizontal_align == HorizontalType.Justify:
- justify = u''
+ justify = ''
if theme.display_vertical_align == VerticalType.Bottom:
- padding_bottom = u'0.5em'
+ padding_bottom = '0.5em'
else:
- padding_bottom = u'0'
- lyrics = u'%s word-wrap: break-word; ' \
+ padding_bottom = '0'
+ lyrics = '%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; ' % \
@@ -433,11 +433,11 @@
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;'
+ lyrics += ' letter-spacing: 1px;'
if theme.font_main_italics:
- lyrics += u' font-style:italic; '
+ lyrics += ' font-style:italic; '
if theme.font_main_bold:
- lyrics += u' font-weight:bold; '
+ lyrics += ' font-weight:bold; '
return lyrics
@@ -454,16 +454,16 @@
# Bugs in some versions of QtWebKit mean we sometimes need additional divs for outline and shadow, since the CSS
# doesn't work. To support vertical alignment middle and bottom, nested div's using display:table/display:table-cell
# are required for each lyric block.
- lyrics = u''
+ lyrics = ''
theme = item.themedata
if webkitvers <= 534.3 and theme and theme.font_main_outline:
- lyrics += u'<div class="lyricstable"><div id="lyricsshadow" style="opacity:1" ' \
- u'class="lyricscell lyricsshadow"></div></div>'
+ lyrics += '<div class="lyricstable"><div id="lyricsshadow" style="opacity:1" ' \
+ 'class="lyricscell lyricsshadow"></div></div>'
if webkitvers < 533.3:
- lyrics += u'<div class="lyricstable"><div id="lyricsoutline" style="opacity:1" ' \
- u'class="lyricscell lyricsoutline"></div></div>'
- lyrics += u'<div class="lyricstable"><div id="lyricsmain" style="opacity:1" ' \
- u'class="lyricscell lyricsmain"></div></div>'
+ lyrics += '<div class="lyricstable"><div id="lyricsoutline" style="opacity:1" ' \
+ 'class="lyricscell lyricsoutline"></div></div>'
+ lyrics += '<div class="lyricstable"><div id="lyricsmain" style="opacity:1" ' \
+ 'class="lyricscell lyricsmain"></div></div>'
return lyrics
@@ -474,7 +474,7 @@
``item``
Service Item to be processed.
"""
- style = u"""
+ style = """
left: %spx;
bottom: %spx;
width: %spx;
@@ -486,7 +486,7 @@
"""
theme = item.themedata
if not theme or not item.footer:
- return u''
+ return ''
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)
=== modified file 'openlp/core/lib/imagemanager.py'
--- openlp/core/lib/imagemanager.py 2013-07-18 11:15:17 +0000
+++ openlp/core/lib/imagemanager.py 2013-08-31 18:18:25 +0000
@@ -35,7 +35,7 @@
import logging
import os
import time
-import Queue
+import queue
from PyQt4 import QtCore
@@ -134,7 +134,7 @@
Image.secondary_priority += 1
-class PriorityQueue(Queue.PriorityQueue):
+class PriorityQueue(queue.PriorityQueue):
"""
Customised ``Queue.PriorityQueue``.
@@ -177,42 +177,42 @@
"""
Image Manager handles the conversion and sizing of images.
"""
- log.info(u'Image Manager loaded')
+ log.info('Image Manager loaded')
def __init__(self):
"""
Constructor for the image manager.
"""
super(ImageManager, self).__init__()
- Registry().register(u'image_manager', self)
+ Registry().register('image_manager', self)
current_screen = ScreenList().current
- self.width = current_screen[u'size'].width()
- self.height = current_screen[u'size'].height()
+ self.width = current_screen['size'].width()
+ self.height = current_screen['size'].height()
self._cache = {}
self.image_thread = ImageThread(self)
self._conversion_queue = PriorityQueue()
self.stop_manager = False
- Registry().register_function(u'images_regenerate', self.process_updates)
+ Registry().register_function('images_regenerate', self.process_updates)
def update_display(self):
"""
Screen has changed size so rebuild the cache to new size.
"""
- log.debug(u'update_display')
+ log.debug('update_display')
current_screen = ScreenList().current
- self.width = current_screen[u'size'].width()
- self.height = current_screen[u'size'].height()
+ self.width = current_screen['size'].width()
+ self.height = current_screen['size'].height()
# Mark the images as dirty for a rebuild by setting the image and byte stream to None.
- for image in self._cache.values():
+ for image in list(self._cache.values()):
self._reset_image(image)
def update_images_border(self, source, background):
"""
Border has changed so update all the images affected.
"""
- log.debug(u'update_images_border')
+ log.debug('update_images_border')
# Mark the images as dirty for a rebuild by setting the image and byte stream to None.
- for image in self._cache.values():
+ for image in list(self._cache.values()):
if image.source == source:
image.background = background
self._reset_image(image)
@@ -221,7 +221,7 @@
"""
Border has changed so update the image affected.
"""
- log.debug(u'update_image_border')
+ log.debug('update_image_border')
# Mark the image as dirty for a rebuild by setting the image and byte stream to None.
image = self._cache[(path, source)]
if image.source == source:
@@ -248,14 +248,14 @@
"""
Return the ``QImage`` from the cache. If not present wait for the background thread to process it.
"""
- log.debug(u'getImage %s' % path)
+ log.debug('getImage %s' % path)
image = self._cache[(path, source)]
if image.image is None:
self._conversion_queue.modify_priority(image, Priority.High)
# make sure we are running and if not give it a kick
self.process_updates()
while image.image is None:
- log.debug(u'getImage - waiting')
+ log.debug('getImage - waiting')
time.sleep(0.1)
elif image.image_bytes is None:
# Set the priority to Low, because the image was requested but the byte stream was not generated yet.
@@ -268,14 +268,14 @@
"""
Returns the byte string for an image. If not present wait for the background thread to process it.
"""
- log.debug(u'get_image_bytes %s' % path)
+ log.debug('get_image_bytes %s' % path)
image = self._cache[(path, source)]
if image.image_bytes is None:
self._conversion_queue.modify_priority(image, Priority.Urgent)
# make sure we are running and if not give it a kick
self.process_updates()
while image.image_bytes is None:
- log.debug(u'getImageBytes - waiting')
+ log.debug('getImageBytes - waiting')
time.sleep(0.1)
return image.image_bytes
@@ -283,13 +283,13 @@
"""
Add image to cache if it is not already there.
"""
- log.debug(u'add_image %s' % path)
+ log.debug('add_image %s' % path)
if not (path, source) in self._cache:
image = Image(path, source, background)
self._cache[(path, source)] = image
self._conversion_queue.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():
+ for image in list(self._cache.values()):
if os.path.exists(path):
if image.path == path and image.timestamp != os.stat(path).st_mtime:
image.timestamp = os.stat(path).st_mtime
@@ -302,16 +302,16 @@
"""
Controls the processing called from a ``QtCore.QThread``.
"""
- log.debug(u'_process - started')
+ log.debug('_process - started')
while not self._conversion_queue.empty() and not self.stop_manager:
self._process_cache()
- log.debug(u'_process - ended')
+ log.debug('_process - ended')
def _process_cache(self):
"""
Actually does the work.
"""
- log.debug(u'_processCache')
+ log.debug('_processCache')
image = self._conversion_queue.get()[2]
# Generate the QImage for the image.
if image.image is None:
=== modified file 'openlp/core/lib/listwidgetwithdnd.py'
--- openlp/core/lib/listwidgetwithdnd.py 2013-07-18 11:17:40 +0000
+++ openlp/core/lib/listwidgetwithdnd.py 2013-08-31 18:18:25 +0000
@@ -40,7 +40,7 @@
"""
Provide a list widget to store objects and handle drag and drop events
"""
- def __init__(self, parent=None, name=u''):
+ def __init__(self, parent=None, name=''):
"""
Initialise the list widget
"""
@@ -54,7 +54,7 @@
"""
self.setAcceptDrops(True)
self.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
- Registry().register_function((u'%s_dnd' % self.mimeDataText), self.parent().load_file)
+ Registry().register_function(('%s_dnd' % self.mimeDataText), self.parent().load_file)
def mouseMoveEvent(self, event):
"""
@@ -111,6 +111,6 @@
listing = os.listdir(localFile)
for file in listing:
files.append(os.path.join(localFile, file))
- Registry().execute(u'%s_dnd' % self.mimeDataText, files)
+ Registry().execute('%s_dnd' % self.mimeDataText, files)
else:
event.ignore()
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2013-07-18 11:19:20 +0000
+++ openlp/core/lib/mediamanageritem.py 2013-08-31 18:18:25 +0000
@@ -76,7 +76,7 @@
that is performed automatically by OpenLP when necessary. If this method is not defined, a default will be used
(treat the filename as an image).
"""
- log.info(u'Media Item loaded')
+ log.info('Media Item loaded')
def __init__(self, parent=None, plugin=None):
"""
@@ -87,7 +87,7 @@
self.whitespace = re.compile(r'[\W_]+', re.UNICODE)
self.plugin = plugin
visible_title = self.plugin.get_string(StringContent.VisibleName)
- self.title = unicode(visible_title[u'title'])
+ self.title = str(visible_title['title'])
Registry().register(self.plugin.name, self)
self.settings_section = self.plugin.name
self.toolbar = None
@@ -103,8 +103,8 @@
self.retranslateUi()
self.auto_select_id = -1
# Need to use event as called across threads and UI is updated
- QtCore.QObject.connect(self, QtCore.SIGNAL(u'%s_go_live' % self.plugin.name), self.go_live_remote)
- QtCore.QObject.connect(self, QtCore.SIGNAL(u'%s_add_to_service' % self.plugin.name), self.add_to_service_remote)
+ QtCore.QObject.connect(self, QtCore.SIGNAL('%s_go_live' % self.plugin.name), self.go_live_remote)
+ QtCore.QObject.connect(self, QtCore.SIGNAL('%s_add_to_service' % self.plugin.name), self.add_to_service_remote)
def required_icons(self):
"""
@@ -156,34 +156,34 @@
toolbar_actions = []
## Import Button ##
if self.has_import_icon:
- toolbar_actions.append([u'Import', StringContent.Import,
- u':/general/general_import.png', self.on_import_click])
+ toolbar_actions.append(['Import', StringContent.Import,
+ ':/general/general_import.png', self.on_import_click])
## Load Button ##
if self.has_file_icon:
- toolbar_actions.append([u'Load', StringContent.Load, u':/general/general_open.png', self.on_file_click])
+ toolbar_actions.append(['Load', StringContent.Load, ':/general/general_open.png', self.on_file_click])
## New Button ##
if self.has_new_icon:
- toolbar_actions.append([u'New', StringContent.New, u':/general/general_new.png', self.on_new_click])
+ toolbar_actions.append(['New', StringContent.New, ':/general/general_new.png', self.on_new_click])
## Edit Button ##
if self.has_edit_icon:
- toolbar_actions.append([u'Edit', StringContent.Edit, u':/general/general_edit.png', self.on_edit_click])
+ toolbar_actions.append(['Edit', StringContent.Edit, ':/general/general_edit.png', self.on_edit_click])
## Delete Button ##
if self.has_delete_icon:
- toolbar_actions.append([u'Delete', StringContent.Delete,
- u':/general/general_delete.png', self.on_delete_click])
+ toolbar_actions.append(['Delete', StringContent.Delete,
+ ':/general/general_delete.png', self.on_delete_click])
## Preview ##
- toolbar_actions.append([u'Preview', StringContent.Preview,
- u':/general/general_preview.png', self.on_preview_click])
+ toolbar_actions.append(['Preview', StringContent.Preview,
+ ':/general/general_preview.png', self.on_preview_click])
## Live Button ##
- toolbar_actions.append([u'Live', StringContent.Live, u':/general/general_live.png', self.on_live_click])
+ toolbar_actions.append(['Live', StringContent.Live, ':/general/general_live.png', self.on_live_click])
## Add to service Button ##
- toolbar_actions.append([u'Service', StringContent.Service, u':/general/general_add.png', self.on_add_click])
+ toolbar_actions.append(['Service', StringContent.Service, ':/general/general_add.png', self.on_add_click])
for action in toolbar_actions:
if action[0] == StringContent.Preview:
self.toolbar.addSeparator()
- self.toolbar.add_toolbar_action(u'%s%sAction' % (self.plugin.name, action[0]),
- text=self.plugin.get_string(action[1])[u'title'], icon=action[2],
- tooltip=self.plugin.get_string(action[1])[u'tooltip'],
+ self.toolbar.add_toolbar_action('%s%sAction' % (self.plugin.name, action[0]),
+ text=self.plugin.get_string(action[1])['title'], icon=action[2],
+ tooltip=self.plugin.get_string(action[1])['tooltip'],
triggers=action[3])
def add_list_view_to_toolbar(self):
@@ -195,47 +195,47 @@
self.list_view.setSpacing(1)
self.list_view.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.list_view.setAlternatingRowColors(True)
- self.list_view.setObjectName(u'%sListView' % self.plugin.name)
+ self.list_view.setObjectName('%sListView' % self.plugin.name)
# Add to page_layout
self.page_layout.addWidget(self.list_view)
# define and add the context menu
self.list_view.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
if self.has_edit_icon:
create_widget_action(self.list_view,
- text=self.plugin.get_string(StringContent.Edit)[u'title'],
- icon=u':/general/general_edit.png',
+ text=self.plugin.get_string(StringContent.Edit)['title'],
+ icon=':/general/general_edit.png',
triggers=self.on_edit_click)
create_widget_action(self.list_view, separator=True)
if self.has_delete_icon:
create_widget_action(self.list_view,
- u'listView%s%sItem' % (self.plugin.name.title(), StringContent.Delete.title()),
- text=self.plugin.get_string(StringContent.Delete)[u'title'],
- icon=u':/general/general_delete.png',
+ 'listView%s%sItem' % (self.plugin.name.title(), StringContent.Delete.title()),
+ text=self.plugin.get_string(StringContent.Delete)['title'],
+ icon=':/general/general_delete.png',
can_shortcuts=True, triggers=self.on_delete_click)
create_widget_action(self.list_view, separator=True)
create_widget_action(self.list_view,
- u'listView%s%sItem' % (self.plugin.name.title(), StringContent.Preview.title()),
- text=self.plugin.get_string(StringContent.Preview)[u'title'],
- icon=u':/general/general_preview.png',
+ 'listView%s%sItem' % (self.plugin.name.title(), StringContent.Preview.title()),
+ text=self.plugin.get_string(StringContent.Preview)['title'],
+ icon=':/general/general_preview.png',
can_shortcuts=True,
triggers=self.on_preview_click)
create_widget_action(self.list_view,
- u'listView%s%sItem' % (self.plugin.name.title(), StringContent.Live.title()),
- text=self.plugin.get_string(StringContent.Live)[u'title'],
- icon=u':/general/general_live.png',
+ 'listView%s%sItem' % (self.plugin.name.title(), StringContent.Live.title()),
+ text=self.plugin.get_string(StringContent.Live)['title'],
+ icon=':/general/general_live.png',
can_shortcuts=True,
triggers=self.on_live_click)
create_widget_action(self.list_view,
- u'listView%s%sItem' % (self.plugin.name.title(), StringContent.Service.title()),
+ 'listView%s%sItem' % (self.plugin.name.title(), StringContent.Service.title()),
can_shortcuts=True,
- text=self.plugin.get_string(StringContent.Service)[u'title'],
- icon=u':/general/general_add.png',
+ text=self.plugin.get_string(StringContent.Service)['title'],
+ icon=':/general/general_add.png',
triggers=self.on_add_click)
if self.add_to_service_item:
create_widget_action(self.list_view, separator=True)
create_widget_action(self.list_view,
text=translate('OpenLP.MediaManagerItem', '&Add to selected Service Item'),
- icon=u':/general/general_add.png',
+ icon=':/general/general_add.png',
triggers=self.on_add_edit_click)
self.add_custom_context_actions()
# Create the context menu and add all actions from the list_view.
@@ -250,23 +250,23 @@
Creates a search field with button and related signal handling.
"""
self.search_widget = QtGui.QWidget(self)
- self.search_widget.setObjectName(u'search_widget')
+ self.search_widget.setObjectName('search_widget')
self.search_layout = QtGui.QVBoxLayout(self.search_widget)
- self.search_layout.setObjectName(u'search_layout')
+ self.search_layout.setObjectName('search_layout')
self.search_text_layout = QtGui.QFormLayout()
- self.search_text_layout.setObjectName(u'search_text_layout')
+ self.search_text_layout.setObjectName('search_text_layout')
self.search_text_label = QtGui.QLabel(self.search_widget)
- self.search_text_label.setObjectName(u'search_text_label')
+ self.search_text_label.setObjectName('search_text_label')
self.search_text_edit = SearchEdit(self.search_widget)
- self.search_text_edit.setObjectName(u'search_text_edit')
+ self.search_text_edit.setObjectName('search_text_edit')
self.search_text_label.setBuddy(self.search_text_edit)
self.search_text_layout.addRow(self.search_text_label, self.search_text_edit)
self.search_layout.addLayout(self.search_text_layout)
self.search_button_layout = QtGui.QHBoxLayout()
- self.search_button_layout.setObjectName(u'search_button_layout')
+ self.search_button_layout.setObjectName('search_button_layout')
self.search_button_layout.addStretch()
self.search_text_button = QtGui.QPushButton(self.search_widget)
- self.search_text_button.setObjectName(u'search_text_button')
+ self.search_text_button.setObjectName('search_text_button')
self.search_button_layout.addWidget(self.search_text_button)
self.search_layout.addLayout(self.search_button_layout)
self.page_layout.addWidget(self.search_widget)
@@ -306,8 +306,8 @@
Add a file to the list widget to make it available for showing
"""
files = QtGui.QFileDialog.getOpenFileNames(self, self.on_new_prompt,
- Settings().value(self.settings_section + u'/last directory'), self.on_new_file_masks)
- log.info(u'New files(s) %s', files)
+ Settings().value(self.settings_section + '/last directory'), self.on_new_file_masks)
+ log.info('New files(s) %s', files)
if files:
self.application.set_busy_cursor()
self.validate_and_load(files)
@@ -323,7 +323,7 @@
new_files = []
error_shown = False
for file_name in data['files']:
- file_type = file_name.split(u'.')[-1]
+ file_type = file_name.split('.')[-1]
if file_type.lower() not in self.on_new_file_masks:
if not error_shown:
critical_error_message_box(translate('OpenLP.MediaManagerItem', 'Invalid File Type'),
@@ -362,7 +362,7 @@
duplicates_found = False
files_added = False
for file_path in files:
- filename = os.path.split(unicode(file_path))[1]
+ filename = os.path.split(str(file_path))[1]
if filename in names:
duplicates_found = True
else:
@@ -372,9 +372,9 @@
if target_group is None:
self.list_view.clear()
self.load_list(full_list, target_group)
- last_dir = os.path.split(unicode(files[0]))[0]
- Settings().setValue(self.settings_section + u'/last directory', last_dir)
- Settings().setValue(u'%s/%s files' % (self.settings_section, self.settings_section), self.get_file_list())
+ last_dir = os.path.split(str(files[0]))[0]
+ Settings().setValue(self.settings_section + '/last directory', last_dir)
+ Settings().setValue('%s/%s files' % (self.settings_section, self.settings_section), self.get_file_list())
if duplicates_found:
critical_error_message_box(UiStrings().Duplicate,
translate('OpenLP.MediaManagerItem', 'Duplicate files were found on import and were ignored.'))
@@ -396,7 +396,7 @@
Return the current list of files
"""
file_list = []
- for index in xrange(self.list_view.count()):
+ for index in range(self.list_view.count()):
bitem = self.list_view.item(index)
filename = bitem.data(QtCore.Qt.UserRole)
file_list.append(filename)
@@ -406,7 +406,7 @@
"""
Load a list. Needs to be implemented by the plugin.
"""
- raise NotImplementedError(u'MediaManagerItem.loadList needs to be defined by the plugin')
+ raise NotImplementedError('MediaManagerItem.loadList needs to be defined by the plugin')
def on_new_click(self):
"""
@@ -424,7 +424,7 @@
"""
Delete an item. Needs to be implemented by the plugin.
"""
- raise NotImplementedError(u'MediaManagerItem.on_delete_click needs to be defined by the plugin')
+ raise NotImplementedError('MediaManagerItem.on_delete_click needs to be defined by the plugin')
def on_focus(self):
"""
@@ -438,13 +438,13 @@
"""
Generate the slide data. Needs to be implemented by the plugin.
"""
- raise NotImplementedError(u'MediaManagerItem.generate_slide_data needs to be defined by the plugin')
+ raise NotImplementedError('MediaManagerItem.generate_slide_data needs to be defined by the plugin')
def on_double_clicked(self):
"""
Allows the list click action to be determined dynamically
"""
- if Settings().value(u'advanced/double click live'):
+ if Settings().value('advanced/double click live'):
self.on_live_click()
else:
self.on_preview_click()
@@ -453,7 +453,7 @@
"""
Allows the change of current item in the list to be actioned
"""
- if Settings().value(u'advanced/single click preview') and self.quick_preview_allowed \
+ if Settings().value('advanced/single click preview') and self.quick_preview_allowed \
and self.list_view.selectedIndexes() and self.auto_select_id == -1:
self.on_preview_click(True)
@@ -465,7 +465,7 @@
QtGui.QMessageBox.information(self, UiStrings().NISp,
translate('OpenLP.MediaManagerItem', 'You must select one or more items to preview.'))
else:
- log.debug(u'%s Preview requested', self.plugin.name)
+ log.debug('%s Preview requested', self.plugin.name)
service_item = self.build_service_item()
if service_item:
service_item.from_plugin = True
@@ -496,7 +496,7 @@
"""
Make the currently selected item go live.
"""
- log.debug(u'%s Live requested', self.plugin.name)
+ log.debug('%s Live requested', self.plugin.name)
item = None
if item_id:
item = self.create_item_from_id(item_id)
@@ -527,7 +527,7 @@
# Is it possible to process multiple list items to generate
# multiple service items?
if self.single_service_item:
- log.debug(u'%s Add requested', self.plugin.name)
+ log.debug('%s Add requested', self.plugin.name)
self.add_to_service(replace=self.remote_triggered)
else:
items = self.list_view.selectedIndexes()
@@ -560,7 +560,7 @@
QtGui.QMessageBox.information(self, UiStrings().NISp,
translate('OpenLP.MediaManagerItem', 'You must select one or more items.'))
else:
- log.debug(u'%s Add requested', self.plugin.name)
+ log.debug('%s Add requested', self.plugin.name)
service_item = self.service_manager.get_service_item()
if not service_item:
QtGui.QMessageBox.information(self, UiStrings().NISs,
@@ -644,14 +644,14 @@
"""
Performs a plugin specific search for items containing ``string``
"""
- raise NotImplementedError(u'Plugin.search needs to be defined by the plugin')
+ raise NotImplementedError('Plugin.search needs to be defined by the plugin')
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
- if not hasattr(self, u'_main_window'):
- self._main_window = Registry().get(u'main_window')
+ if not hasattr(self, '_main_window'):
+ self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
@@ -660,8 +660,8 @@
"""
Adds the Renderer to the class dynamically
"""
- if not hasattr(self, u'_renderer'):
- self._renderer = Registry().get(u'renderer')
+ if not hasattr(self, '_renderer'):
+ self._renderer = Registry().get('renderer')
return self._renderer
renderer = property(_get_renderer)
@@ -670,8 +670,8 @@
"""
Adds the live controller to the class dynamically
"""
- if not hasattr(self, u'_live_controller'):
- self._live_controller = Registry().get(u'live_controller')
+ if not hasattr(self, '_live_controller'):
+ self._live_controller = Registry().get('live_controller')
return self._live_controller
live_controller = property(_get_live_controller)
@@ -680,8 +680,8 @@
"""
Adds the preview controller to the class dynamically
"""
- if not hasattr(self, u'_preview_controller'):
- self._preview_controller = Registry().get(u'preview_controller')
+ if not hasattr(self, '_preview_controller'):
+ self._preview_controller = Registry().get('preview_controller')
return self._preview_controller
preview_controller = property(_get_preview_controller)
@@ -690,8 +690,8 @@
"""
Adds the plugin manager to the class dynamically
"""
- if not hasattr(self, u'_plugin_manager'):
- self._plugin_manager = Registry().get(u'plugin_manager')
+ if not hasattr(self, '_plugin_manager'):
+ self._plugin_manager = Registry().get('plugin_manager')
return self._plugin_manager
plugin_manager = property(_get_plugin_manager)
@@ -700,8 +700,8 @@
"""
Adds the media controller to the class dynamically
"""
- if not hasattr(self, u'_media_controller'):
- self._media_controller = Registry().get(u'media_controller')
+ if not hasattr(self, '_media_controller'):
+ self._media_controller = Registry().get('media_controller')
return self._media_controller
media_controller = property(_get_media_controller)
@@ -710,8 +710,8 @@
"""
Adds the service manager to the class dynamically
"""
- if not hasattr(self, u'_service_manager'):
- self._service_manager = Registry().get(u'service_manager')
+ if not hasattr(self, '_service_manager'):
+ self._service_manager = Registry().get('service_manager')
return self._service_manager
service_manager = property(_get_service_manager)
@@ -720,8 +720,8 @@
"""
Adds the theme manager to the class dynamically
"""
- if not hasattr(self, u'_theme_manager'):
- self._theme_manager = Registry().get(u'theme_manager')
+ if not hasattr(self, '_theme_manager'):
+ self._theme_manager = Registry().get('theme_manager')
return self._theme_manager
theme_manager = property(_get_theme_manager)
@@ -731,11 +731,11 @@
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
- if os.name == u'nt':
- return Registry().get(u'application')
+ if os.name == 'nt':
+ return Registry().get('application')
else:
- if not hasattr(self, u'_application'):
- self._application = Registry().get(u'application')
+ if not hasattr(self, '_application'):
+ self._application = Registry().get('application')
return self._application
application = property(_get_application)
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2013-08-01 13:04:42 +0000
+++ openlp/core/lib/plugin.py 2013-08-31 18:18:25 +0000
@@ -53,16 +53,16 @@
"""
Provide standard strings for objects to use.
"""
- Name = u'name'
- Import = u'import'
- Load = u'load'
- New = u'new'
- Edit = u'edit'
- Delete = u'delete'
- Preview = u'preview'
- Live = u'live'
- Service = u'service'
- VisibleName = u'visible_name'
+ Name = 'name'
+ Import = 'import'
+ Load = 'load'
+ New = 'new'
+ Edit = 'edit'
+ Delete = 'delete'
+ Preview = 'preview'
+ Live = 'live'
+ Service = 'service'
+ VisibleName = 'visible_name'
class Plugin(QtCore.QObject):
@@ -118,7 +118,7 @@
Used in the plugin manager, when a person clicks on the 'About' button.
"""
- log.info(u'loaded')
+ log.info('loaded')
def __init__(self, name, default_settings, media_item_class=None, settings_tab_class=None, version=None):
"""
@@ -145,7 +145,7 @@
``version``
Defaults to *None*, which means that the same version number is used as OpenLP's version number.
"""
- log.debug(u'Plugin %s initialised' % name)
+ log.debug('Plugin %s initialised' % name)
super(Plugin, self).__init__()
self.name = name
self.text_strings = {}
@@ -154,7 +154,7 @@
if version:
self.version = version
else:
- self.version = get_application_version()[u'version']
+ self.version = get_application_version()['version']
self.settings_section = self.name
self.icon = None
self.media_item_class = media_item_class
@@ -164,16 +164,16 @@
self.weight = 0
self.status = PluginStatus.Inactive
# Add the default status to the default settings.
- default_settings[name + u'/status'] = PluginStatus.Inactive
- default_settings[name + u'/last directory'] = u''
+ default_settings[name + '/status'] = PluginStatus.Inactive
+ default_settings[name + '/last directory'] = ''
# Append a setting for files in the mediamanager (note not all plugins
# which have a mediamanager need this).
if media_item_class is not None:
- default_settings[u'%s/%s files' % (name, name)] = []
+ default_settings['%s/%s files' % (name, name)] = []
# Add settings to the dict of all settings.
Settings.extend_default_settings(default_settings)
- Registry().register_function(u'%s_add_service_item' % self.name, self.process_add_service_event)
- Registry().register_function(u'%s_config_updated' % self.name, self.config_update)
+ Registry().register_function('%s_add_service_item' % self.name, self.process_add_service_event)
+ Registry().register_function('%s_config_updated' % self.name, self.config_update)
def check_pre_conditions(self):
"""
@@ -188,14 +188,14 @@
"""
Sets the status of the plugin
"""
- self.status = Settings().value(self.settings_section + u'/status')
+ self.status = Settings().value(self.settings_section + '/status')
def toggle_status(self, new_status):
"""
Changes the status of the plugin and remembers it
"""
self.status = new_status
- Settings().setValue(self.settings_section + u'/status', self.status)
+ Settings().setValue(self.settings_section + '/status', self.status)
if new_status == PluginStatus.Active:
self.initialise()
elif new_status == PluginStatus.Inactive:
@@ -260,7 +260,7 @@
"""
if self.settings_tab_class:
self.settings_tab = self.settings_tab_class(parent, self.name,
- self.get_string(StringContent.VisibleName)[u'title'], self.icon_path)
+ self.get_string(StringContent.VisibleName)['title'], self.icon_path)
def add_to_menu(self, menubar):
"""
@@ -275,7 +275,7 @@
"""
Generic Drag and drop handler triggered from service_manager.
"""
- log.debug(u'process_add_service_event event called for plugin %s' % self.name)
+ log.debug('process_add_service_event event called for plugin %s' % self.name)
if replace:
self.media_item.on_add_edit_click()
else:
@@ -286,7 +286,7 @@
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('Plugin.about needs to be defined by the plugin')
def initialise(self):
"""
@@ -309,11 +309,11 @@
"""
# FIXME: Remove after 2.2 release.
# This is needed to load the list of media/presentation from the config saved before the settings rewrite.
- if self.media_item_class is not None and self.name != u'images':
+ if self.media_item_class is not None and self.name != 'images':
loaded_list = Settings().get_files_from_config(self)
# Now save the list to the config using our Settings class.
if loaded_list:
- Settings().setValue(u'%s/%s files' % (self.settings_section, self.name), loaded_list)
+ Settings().setValue('%s/%s files' % (self.settings_section, self.name), loaded_list)
def uses_theme(self, theme):
"""
@@ -346,21 +346,21 @@
Called to define all translatable texts of the plugin
"""
## Load Action ##
- self.__set_name_text_string(StringContent.Load, UiStrings().Load, tooltips[u'load'])
+ self.__set_name_text_string(StringContent.Load, UiStrings().Load, tooltips['load'])
## Import Action ##
- self.__set_name_text_string(StringContent.Import, UiStrings().Import, tooltips[u'import'])
+ self.__set_name_text_string(StringContent.Import, UiStrings().Import, tooltips['import'])
## New Action ##
- self.__set_name_text_string(StringContent.New, UiStrings().Add, tooltips[u'new'])
+ self.__set_name_text_string(StringContent.New, UiStrings().Add, tooltips['new'])
## Edit Action ##
- self.__set_name_text_string(StringContent.Edit, UiStrings().Edit, tooltips[u'edit'])
+ self.__set_name_text_string(StringContent.Edit, UiStrings().Edit, tooltips['edit'])
## Delete Action ##
- self.__set_name_text_string(StringContent.Delete, UiStrings().Delete, tooltips[u'delete'])
+ self.__set_name_text_string(StringContent.Delete, UiStrings().Delete, tooltips['delete'])
## Preview Action ##
- self.__set_name_text_string(StringContent.Preview, UiStrings().Preview, tooltips[u'preview'])
+ self.__set_name_text_string(StringContent.Preview, UiStrings().Preview, tooltips['preview'])
## Send Live Action ##
- self.__set_name_text_string(StringContent.Live, UiStrings().Live, tooltips[u'live'])
+ self.__set_name_text_string(StringContent.Live, UiStrings().Live, tooltips['live'])
## Add to Service Action ##
- self.__set_name_text_string(StringContent.Service, UiStrings().Service, tooltips[u'service'])
+ self.__set_name_text_string(StringContent.Service, UiStrings().Service, tooltips['service'])
def __set_name_text_string(self, name, title, tooltip):
"""
@@ -368,19 +368,19 @@
use of the singular name of the plugin object so must only be called
after this has been set.
"""
- self.text_strings[name] = {u'title': title, u'tooltip': tooltip}
+ self.text_strings[name] = {'title': title, 'tooltip': tooltip}
def get_display_css(self):
"""
Add css style sheets to htmlbuilder.
"""
- return u''
+ return ''
def get_display_javascript(self):
"""
Add javascript functions to htmlbuilder.
"""
- return u''
+ return ''
def refresh_css(self, frame):
"""
@@ -389,19 +389,19 @@
``frame``
The Web frame holding the page.
"""
- return u''
+ return ''
def get_display_html(self):
"""
Add html code to htmlbuilder.
"""
- return u''
+ return ''
def config_update(self):
"""
Called when Config is changed to restart values dependent on configuration.
"""
- log.info(u'config update processed')
+ log.info('config update processed')
if self.media_item:
self.media_item.config_update()
@@ -415,8 +415,8 @@
"""
Adds the main window to the class dynamically
"""
- if not hasattr(self, u'_main_window'):
- self._main_window = Registry().get(u'main_window')
+ if not hasattr(self, '_main_window'):
+ self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
@@ -425,11 +425,11 @@
"""
Adds the openlp to the class dynamically
"""
- if os.name == u'nt':
- return Registry().get(u'application')
+ if os.name == 'nt':
+ return Registry().get('application')
else:
- if not hasattr(self, u'_application'):
- self._application = Registry().get(u'application')
+ if not hasattr(self, '_application'):
+ self._application = Registry().get('application')
return self._application
application = property(_get_application)
=== modified file 'openlp/core/lib/pluginmanager.py'
--- openlp/core/lib/pluginmanager.py 2013-04-05 19:37:15 +0000
+++ openlp/core/lib/pluginmanager.py 2013-08-31 18:18:25 +0000
@@ -45,54 +45,54 @@
This is the Plugin manager, which loads all the plugins,
and executes all the hooks, as and when necessary.
"""
- log.info(u'Plugin manager loaded')
+ log.info('Plugin manager loaded')
def __init__(self):
"""
The constructor for the plugin manager. Passes the controllers on to
the plugins for them to interact with via their ServiceItems.
"""
- log.info(u'Plugin manager Initialising')
- Registry().register(u'plugin_manager', self)
- Registry().register_function(u'bootstrap_initialise', self.bootstrap_initialise)
+ log.info('Plugin manager Initialising')
+ Registry().register('plugin_manager', self)
+ Registry().register_function('bootstrap_initialise', self.bootstrap_initialise)
self.base_path = os.path.abspath(AppLocation.get_directory(AppLocation.PluginsDir))
- log.debug(u'Base path %s ', self.base_path)
+ log.debug('Base path %s ', self.base_path)
self.plugins = []
- log.info(u'Plugin manager Initialised')
+ log.info('Plugin manager Initialised')
def bootstrap_initialise(self):
"""
Bootstrap all the plugin manager functions
"""
- log.info(u'bootstrap_initialise')
+ log.info('bootstrap_initialise')
self.find_plugins()
# hook methods have to happen after find_plugins. Find plugins needs
# the controllers hence the hooks have moved from setupUI() to here
# Find and insert settings tabs
- log.info(u'hook settings')
+ log.info('hook settings')
self.hook_settings_tabs()
# Find and insert media manager items
- log.info(u'hook media')
+ log.info('hook media')
self.hook_media_manager()
# Call the hook method to pull in import menus.
- log.info(u'hook menus')
+ log.info('hook menus')
self.hook_import_menu()
# Call the hook method to pull in export menus.
self.hook_export_menu()
# Call the hook method to pull in tools menus.
self.hook_tools_menu()
# Call the initialise method to setup plugins.
- log.info(u'initialise plugins')
+ log.info('initialise plugins')
self.initialise_plugins()
def find_plugins(self):
"""
Scan a directory for objects inheriting from the ``Plugin`` class.
"""
- log.info(u'Finding plugins')
+ log.info('Finding plugins')
start_depth = len(os.path.abspath(self.base_path).split(os.sep))
present_plugin_dir = os.path.join(self.base_path, 'presentations')
- log.debug(u'finding plugins in %s at depth %d', unicode(self.base_path), start_depth)
+ log.debug('finding plugins in %s at depth %d', str(self.base_path), start_depth)
for root, dirs, files in os.walk(self.base_path):
if sys.platform == 'darwin' and root.startswith(present_plugin_dir):
# TODO Presentation plugin is not yet working on Mac OS X.
@@ -100,7 +100,7 @@
# and thereby never import the plugin.
continue
for name in files:
- if name.endswith(u'.py') and not name.startswith(u'__'):
+ if name.endswith('.py') and not name.startswith('__'):
path = os.path.abspath(os.path.join(root, name))
this_depth = len(path.split(os.sep))
if this_depth - start_depth > 2:
@@ -108,7 +108,7 @@
break
module_name = name[:-3]
# import the modules
- log.debug(u'Importing %s from %s. Depth %d', module_name, root, this_depth)
+ log.debug('Importing %s from %s. Depth %d', module_name, root, this_depth)
try:
# Use the "imp" library to try to get around a problem with the PyUNO library which
# monkey-patches the __import__ function to do some magic. This causes issues with our tests.
@@ -116,21 +116,21 @@
fp, path_name, description = imp.find_module(module_name, [root])
# Then load the module (do the actual import) using the details from find_module()
imp.load_module(module_name, fp, path_name, description)
- except ImportError, e:
- log.exception(u'Failed to import module %s on path %s: %s', module_name, path, e.args[0])
+ except ImportError as e:
+ log.exception('Failed to import module %s on path %s: %s', module_name, path, e.args[0])
plugin_classes = Plugin.__subclasses__()
plugin_objects = []
for p in plugin_classes:
try:
plugin = p()
- log.debug(u'Loaded plugin %s', unicode(p))
+ log.debug('Loaded plugin %s', str(p))
plugin_objects.append(plugin)
except TypeError:
- log.exception(u'Failed to load plugin %s', unicode(p))
+ log.exception('Failed to load plugin %s', str(p))
plugins_list = sorted(plugin_objects, key=lambda plugin: plugin.weight)
for plugin in plugins_list:
if plugin.check_pre_conditions():
- log.debug(u'Plugin %s active', unicode(plugin.name))
+ log.debug('Plugin %s active', str(plugin.name))
plugin.set_status()
else:
plugin.status = PluginStatus.Disabled
@@ -199,24 +199,24 @@
Loop through all the plugins and give them an opportunity to
initialise themselves.
"""
- log.info(u'Initialise Plugins - Started')
+ log.info('Initialise Plugins - Started')
for plugin in self.plugins:
- log.info(u'initialising plugins %s in a %s state' % (plugin.name, plugin.is_active()))
+ log.info('initialising plugins %s in a %s state' % (plugin.name, plugin.is_active()))
if plugin.is_active():
plugin.initialise()
- log.info(u'Initialisation Complete for %s ' % plugin.name)
- log.info(u'Initialise Plugins - Finished')
+ log.info('Initialisation Complete for %s ' % plugin.name)
+ log.info('Initialise Plugins - Finished')
def finalise_plugins(self):
"""
Loop through all the plugins and give them an opportunity to
clean themselves up
"""
- log.info(u'finalising plugins')
+ log.info('finalising plugins')
for plugin in self.plugins:
if plugin.is_active():
plugin.finalise()
- log.info(u'Finalisation Complete for %s ' % plugin.name)
+ log.info('Finalisation Complete for %s ' % plugin.name)
def get_plugin_by_name(self, name):
"""
@@ -231,7 +231,7 @@
"""
Loop through all the plugins and give them an opportunity to handle a new service
"""
- log.info(u'plugins - new service created')
+ log.info('plugins - new service created')
for plugin in self.plugins:
if plugin.is_active():
plugin.new_service_created()
@@ -240,8 +240,8 @@
"""
Adds the plugin manager to the class dynamically
"""
- if not hasattr(self, u'_settings_form'):
- self._settings_form = Registry().get(u'settings_form')
+ if not hasattr(self, '_settings_form'):
+ self._settings_form = Registry().get('settings_form')
return self._settings_form
settings_form = property(_get_settings_form)
@@ -250,8 +250,8 @@
"""
Adds the main window to the class dynamically
"""
- if not hasattr(self, u'_main_window'):
- self._main_window = Registry().get(u'main_window')
+ if not hasattr(self, '_main_window'):
+ self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
=== modified file 'openlp/core/lib/registry.py'
--- openlp/core/lib/registry.py 2013-06-21 05:16:35 +0000
+++ openlp/core/lib/registry.py 2013-08-31 18:18:25 +0000
@@ -40,7 +40,7 @@
This is the Component Registry. It is a singleton object and is used to provide a look up service for common
objects.
"""
- log.info(u'Registry loaded')
+ log.info('Registry loaded')
__instance__ = None
def __new__(cls):
@@ -56,13 +56,13 @@
"""
The constructor for the component registry providing a single registry of objects.
"""
- log.info(u'Registry Initialising')
+ log.info('Registry Initialising')
registry = cls()
registry.service_list = {}
registry.functions_list = {}
registry.running_under_test = False
# Allow the tests to remove Registry entries but not the live system
- if u'nose' in sys.argv[0]:
+ if 'nose' in sys.argv[0]:
registry.running_under_test = True
return registry
@@ -76,8 +76,8 @@
if key in self.service_list:
return self.service_list[key]
else:
- log.error(u'Service %s not found in list' % key)
- raise KeyError(u'Service %s not found in list' % key)
+ log.error('Service %s not found in list' % key)
+ raise KeyError('Service %s not found in list' % key)
def register(self, key, reference):
"""
@@ -90,8 +90,8 @@
The service address to be saved.
"""
if key in self.service_list:
- log.error(u'Duplicate service exception %s' % key)
- raise KeyError(u'Duplicate service exception %s' % key)
+ log.error('Duplicate service exception %s' % key)
+ raise KeyError('Duplicate service exception %s' % key)
else:
self.service_list[key] = reference
@@ -134,8 +134,8 @@
The function to be called when the event happens.
"""
if self.running_under_test is False:
- log.error(u'Invalid Method call for key %s' % event)
- raise KeyError(u'Invalid Method call for key %s' % event)
+ log.error('Invalid Method call for key %s' % event)
+ raise KeyError('Invalid Method call for key %s' % event)
if event in self.functions_list:
self.functions_list[event].remove(function)
@@ -163,5 +163,5 @@
# Who has called me can help in debugging
import inspect
log.debug(inspect.currentframe().f_back.f_locals)
- log.exception(u'Exception for function %s', function)
+ log.exception('Exception for function %s', function)
return results
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2013-07-06 18:33:45 +0000
+++ openlp/core/lib/renderer.py 2013-08-31 18:18:25 +0000
@@ -26,7 +26,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from __future__ import division
+
import logging
from PyQt4 import QtGui, QtCore, QtWebKit
@@ -38,15 +38,15 @@
log = logging.getLogger(__name__)
-VERSE = u'The Lord said to {r}Noah{/r}: \n' \
+VERSE = 'The Lord said to {r}Noah{/r}: \n' \
'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n' \
'The Lord said to {g}Noah{/g}:\n' \
'There\'s gonna be a {st}floody{/st}, {it}floody{/it}\n' \
'Get those children out of the muddy, muddy \n' \
'{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \
'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n'
-VERSE_FOR_LINE_COUNT = u'\n'.join(map(unicode, xrange(100)))
-FOOTER = [u'Arky Arky (Unknown)', u'Public Domain', u'CCLI 123456']
+VERSE_FOR_LINE_COUNT = '\n'.join(map(str, range(100)))
+FOOTER = ['Arky Arky (Unknown)', 'Public Domain', 'CCLI 123456']
class Renderer(object):
@@ -54,25 +54,25 @@
Class to pull all Renderer interactions into one place. The plugins will call helper methods to do the rendering but
this class will provide display defense code.
"""
- log.info(u'Renderer Loaded')
+ log.info('Renderer Loaded')
def __init__(self):
"""
Initialise the renderer.
"""
- log.debug(u'Initialisation started')
+ log.debug('Initialisation started')
self.screens = ScreenList()
- Registry().register(u'renderer', self)
+ Registry().register('renderer', self)
self.theme_level = ThemeLevel.Global
- self.global_theme_name = u''
- self.service_theme_name = u''
- self.item_theme_name = u''
+ self.global_theme_name = ''
+ self.service_theme_name = ''
+ self.item_theme_name = ''
self.force_page = False
self.display = MainDisplay(None, False, self)
self.display.setup()
self._theme_dimensions = {}
self._calculate_default()
- Registry().register_function(u'theme_update_global', self.set_global_theme)
+ Registry().register_function('theme_update_global', self.set_global_theme)
self.web = QtWebKit.QWebView()
self.web.setVisible(False)
self.web_frame = self.web.page().mainFrame()
@@ -81,7 +81,7 @@
"""
Updates the renderer's information about the current screen.
"""
- log.debug(u'Update Display')
+ log.debug('Update Display')
self._calculate_default()
if self.display:
self.display.close()
@@ -178,7 +178,7 @@
``global_theme_name``
The global-level theme's name.
"""
- global_theme_name = Settings().value(u'themes/global theme')
+ global_theme_name = Settings().value('themes/global theme')
self._set_theme(global_theme_name)
self.global_theme_name = global_theme_name
@@ -212,7 +212,7 @@
``force_page``
Flag to tell message lines per page need to be generated.
"""
- log.debug(u'generate preview')
+ log.debug('generate preview')
# save value for use in format_slide
self.force_page = force_page
# build a service item to generate preview
@@ -250,72 +250,72 @@
``item``
The :class:`~openlp.core.lib.serviceitem.ServiceItem` item object.
"""
- log.debug(u'format slide')
+ log.debug('format slide')
# Add line endings after each line of text used for bibles.
- line_end = u'<br>'
+ line_end = '<br>'
if item.is_capable(ItemCapabilities.NoLineBreaks):
- line_end = u' '
+ line_end = ' '
# Bibles
if item.is_capable(ItemCapabilities.CanWordSplit):
- pages = self._paginate_slide_words(text.split(u'\n'), line_end)
+ pages = self._paginate_slide_words(text.split('\n'), line_end)
# Songs and Custom
elif item.is_capable(ItemCapabilities.CanSoftBreak):
pages = []
- if u'[---]' in text:
+ if '[---]' in text:
while True:
- slides = text.split(u'\n[---]\n', 2)
+ slides = text.split('\n[---]\n', 2)
# If there are (at least) two occurrences of [---] we use the first two slides (and neglect the last
# for now).
if len(slides) == 3:
- html_text = expand_tags(u'\n'.join(slides[:2]))
+ html_text = expand_tags('\n'.join(slides[:2]))
# We check both slides to determine if the optional split is needed (there is only one optional
# split).
else:
- html_text = expand_tags(u'\n'.join(slides))
- html_text = html_text.replace(u'\n', u'<br>')
+ html_text = expand_tags('\n'.join(slides))
+ html_text = html_text.replace('\n', '<br>')
if self._text_fits_on_slide(html_text):
# The first two optional slides fit (as a whole) on one slide. Replace the first occurrence
# of [---].
- text = text.replace(u'\n[---]', u'', 1)
+ text = text.replace('\n[---]', '', 1)
else:
# The first optional slide fits, which means we have to render the first optional slide.
- text_contains_split = u'[---]' in text
+ text_contains_split = '[---]' in text
if text_contains_split:
try:
- text_to_render, text = text.split(u'\n[---]\n', 1)
+ text_to_render, text = text.split('\n[---]\n', 1)
except ValueError:
- text_to_render = text.split(u'\n[---]\n')[0]
- text = u''
+ text_to_render = text.split('\n[---]\n')[0]
+ text = ''
text_to_render, raw_tags, html_tags = self._get_start_tags(text_to_render)
if text:
text = raw_tags + text
else:
text_to_render = text
- text = u''
- lines = text_to_render.strip(u'\n').split(u'\n')
+ text = ''
+ lines = text_to_render.strip('\n').split('\n')
slides = self._paginate_slide(lines, line_end)
if len(slides) > 1 and text:
# Add all slides apart from the last one the list.
pages.extend(slides[:-1])
if text_contains_split:
- text = slides[-1] + u'\n[---]\n' + text
+ text = slides[-1] + '\n[---]\n' + text
else:
- text = slides[-1] + u'\n' + text
- text = text.replace(u'<br>', u'\n')
+ text = slides[-1] + '\n' + text
+ text = text.replace('<br>', '\n')
else:
pages.extend(slides)
- if u'[---]' not in text:
- lines = text.strip(u'\n').split(u'\n')
+ if '[---]' not in text:
+ lines = text.strip('\n').split('\n')
pages.extend(self._paginate_slide(lines, line_end))
break
else:
# Clean up line endings.
- pages = self._paginate_slide(text.split(u'\n'), line_end)
+ pages = self._paginate_slide(text.split('\n'), line_end)
else:
- pages = self._paginate_slide(text.split(u'\n'), line_end)
+ pages = self._paginate_slide(text.split('\n'), line_end)
new_pages = []
for page in pages:
- while page.endswith(u'<br>'):
+ while page.endswith('<br>'):
page = page[:-4]
new_pages.append(page)
return new_pages
@@ -324,11 +324,11 @@
"""
Calculate the default dimensions of the screen.
"""
- screen_size = self.screens.current[u'size']
+ screen_size = self.screens.current['size']
self.width = screen_size.width()
self.height = screen_size.height()
self.screen_ratio = self.height / self.width
- log.debug(u'_calculate default %s, %f' % (screen_size, self.screen_ratio))
+ log.debug('_calculate default %s, %f' % (screen_size, self.screen_ratio))
# 90% is start of footer
self.footer_start = int(self.height * 0.90)
@@ -371,7 +371,7 @@
``rect_footer``
The footer text block.
"""
- log.debug(u'_set_text_rectangle %s , %s' % (rect_main, rect_footer))
+ log.debug('_set_text_rectangle %s , %s' % (rect_main, rect_footer))
self._rect = rect_main
self._rect_footer = rect_footer
self.page_width = self._rect.width()
@@ -387,7 +387,7 @@
self.web.resize(self.page_width, self.page_height)
self.web_frame = self.web.page().mainFrame()
# Adjust width and height to account for shadow. outline done in css.
- html = u"""<!DOCTYPE html><html><head><script>
+ html = """<!DOCTYPE html><html><head><script>
function show_text(newtext) {
var main = document.getElementById('main');
main.innerHTML = newtext;
@@ -416,20 +416,20 @@
``line_end``
The text added after each line. Either ``u' '`` or ``u'<br>``.
"""
- log.debug(u'_paginate_slide - Start')
+ log.debug('_paginate_slide - Start')
formatted = []
- previous_html = u''
- previous_raw = u''
- separator = u'<br>'
- html_lines = map(expand_tags, lines)
+ previous_html = ''
+ previous_raw = ''
+ separator = '<br>'
+ html_lines = list(map(expand_tags, lines))
# Text too long so go to next page.
if not self._text_fits_on_slide(separator.join(html_lines)):
html_text, previous_raw = self._binary_chop(
- formatted, previous_html, previous_raw, html_lines, lines, separator, u'')
+ formatted, previous_html, previous_raw, html_lines, lines, separator, '')
else:
previous_raw = separator.join(lines)
formatted.append(previous_raw)
- log.debug(u'_paginate_slide - End')
+ log.debug('_paginate_slide - End')
return formatted
def _paginate_slide_words(self, lines, line_end):
@@ -444,10 +444,10 @@
``line_end``
The text added after each line. Either ``u' '`` or ``u'<br>``. This is needed for **bibles**.
"""
- log.debug(u'_paginate_slide_words - Start')
+ log.debug('_paginate_slide_words - Start')
formatted = []
- previous_html = u''
- previous_raw = u''
+ previous_html = ''
+ previous_raw = ''
for line in lines:
line = line.strip()
html_line = expand_tags(line)
@@ -457,8 +457,8 @@
if previous_html:
if self._text_fits_on_slide(previous_html):
formatted.append(previous_raw)
- previous_html = u''
- previous_raw = u''
+ previous_html = ''
+ previous_raw = ''
# Now check if the current verse will fit, if it does not we have to start to process the verse
# word by word.
if self._text_fits_on_slide(html_line):
@@ -467,14 +467,14 @@
continue
# Figure out how many words of the line will fit on screen as the line will not fit as a whole.
raw_words = self._words_split(line)
- html_words = map(expand_tags, raw_words)
+ html_words = list(map(expand_tags, raw_words))
previous_html, previous_raw = \
- self._binary_chop(formatted, previous_html, previous_raw, html_words, raw_words, u' ', line_end)
+ self._binary_chop(formatted, previous_html, previous_raw, html_words, raw_words, ' ', line_end)
else:
previous_html += html_line + line_end
previous_raw += line + line_end
formatted.append(previous_raw)
- log.debug(u'_paginate_slide_words - End')
+ log.debug('_paginate_slide_words - End')
return formatted
def _get_start_tags(self, raw_text):
@@ -494,11 +494,11 @@
raw_tags = []
html_tags = []
for tag in FormattingTags.get_html_tags():
- if tag[u'start tag'] == u'{br}':
+ if tag['start tag'] == '{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['start tag']) != raw_text.count(tag['end tag']):
+ raw_tags.append((raw_text.find(tag['start tag']), tag['start tag'], tag['end tag']))
+ html_tags.append((raw_text.find(tag['start tag']), tag['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.
raw_tags.sort(key=lambda tag: tag[0])
@@ -512,7 +512,7 @@
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 + ''.join(end_tags), ''.join(start_tags), ''.join(html_tags)
def _binary_chop(self, formatted, previous_html, previous_raw, html_list, raw_list, separator, line_end):
"""
@@ -558,14 +558,14 @@
# 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('<br>') + separator.join(raw_list[:index + 1])
text, raw_tags, html_tags = self._get_start_tags(text)
formatted.append(text)
- previous_html = u''
- previous_raw = u''
+ previous_html = ''
+ previous_raw = ''
# Stop here as the theme line count was requested.
if self.force_page:
- Registry().execute(u'theme_line_count', index + 1)
+ Registry().execute('theme_line_count', index + 1)
break
else:
continue
@@ -592,7 +592,7 @@
``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('show_text("%s")' % text.replace('\\', '\\\\').replace('\"', '\\\"'))
return self.web_frame.contentsSize().height() <= self.empty_height
def _words_split(self, line):
@@ -600,15 +600,15 @@
Split the slide up by word so can wrap better
"""
# this parse we are to be wordy
- line = line.replace(u'\n', u' ')
- return line.split(u' ')
+ line = line.replace('\n', ' ')
+ return line.split(' ')
def _get_image_manager(self):
"""
Adds the image manager to the class dynamically
"""
- if not hasattr(self, u'_image_manager'):
- self._image_manager = Registry().get(u'image_manager')
+ if not hasattr(self, '_image_manager'):
+ self._image_manager = Registry().get('image_manager')
return self._image_manager
image_manager = property(_get_image_manager)
@@ -617,8 +617,8 @@
"""
Adds the theme manager to the class dynamically
"""
- if not hasattr(self, u'_theme_manager'):
- self._theme_manager = Registry().get(u'theme_manager')
+ if not hasattr(self, '_theme_manager'):
+ self._theme_manager = Registry().get('theme_manager')
return self._theme_manager
theme_manager = property(_get_theme_manager)
=== modified file 'openlp/core/lib/screen.py'
--- openlp/core/lib/screen.py 2013-04-24 19:05:34 +0000
+++ openlp/core/lib/screen.py 2013-08-31 18:18:25 +0000
@@ -30,7 +30,7 @@
The :mod:`screen` module provides management functionality for a machines'
displays.
"""
-from __future__ import division
+
import logging
import copy
@@ -47,7 +47,7 @@
To get access to the screen list call ``ScreenList()``.
"""
- log.info(u'Screen loaded')
+ log.info('Screen loaded')
__instance__ = None
def __new__(cls):
@@ -86,13 +86,13 @@
``number``
The number of the screen, which size has changed.
"""
- log.info(u'screen_resolution_changed %d' % number)
+ log.info('screen_resolution_changed %d' % number)
for screen in self.screen_list:
- if number == screen[u'number']:
+ if number == screen['number']:
newScreen = {
- u'number': number,
- u'size': self.desktop.screenGeometry(number),
- u'primary': self.desktop.primaryScreen() == number
+ 'number': number,
+ 'size': self.desktop.screenGeometry(number),
+ 'primary': self.desktop.primaryScreen() == number
}
self.remove_screen(number)
self.add_screen(newScreen)
@@ -101,7 +101,7 @@
if screen == self.override:
self.override = copy.deepcopy(newScreen)
self.set_override_display()
- Registry().execute(u'config_screen_changed')
+ Registry().execute('config_screen_changed')
break
def screen_count_changed(self, changed_screen=-1):
@@ -113,23 +113,23 @@
"""
# Do not log at start up.
if changed_screen != -1:
- log.info(u'screen_count_changed %d' % self.desktop.screenCount())
+ log.info('screen_count_changed %d' % self.desktop.screenCount())
# Remove unplugged screens.
for screen in copy.deepcopy(self.screen_list):
- if screen[u'number'] == self.desktop.screenCount():
- self.remove_screen(screen[u'number'])
+ if screen['number'] == self.desktop.screenCount():
+ self.remove_screen(screen['number'])
# Add new screens.
- for number in xrange(self.desktop.screenCount()):
+ for number in range(self.desktop.screenCount()):
if not self.screen_exists(number):
self.add_screen({
- u'number': number,
- u'size': self.desktop.screenGeometry(number),
- u'primary': (self.desktop.primaryScreen() == number)
+ 'number': number,
+ 'size': self.desktop.screenGeometry(number),
+ 'primary': (self.desktop.primaryScreen() == number)
})
# We do not want to send this message at start up.
if changed_screen != -1:
# Reload setting tabs to apply possible changes.
- Registry().execute(u'config_screen_changed')
+ Registry().execute('config_screen_changed')
def get_screen_list(self):
"""
@@ -140,9 +140,9 @@
"""
screen_list = []
for screen in self.screen_list:
- 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 = '%s %d' % (translate('OpenLP.ScreenList', 'Screen'), screen['number'] + 1)
+ if screen['primary']:
+ screen_name = '%s (%s)' % (screen_name, translate('OpenLP.ScreenList', 'primary'))
screen_list.append(screen_name)
return screen_list
@@ -159,8 +159,8 @@
u'size': PyQt4.QtCore.QRect(0, 0, 1024, 768)
}
"""
- log.info(u'Screen %d found with resolution %s', screen[u'number'], screen[u'size'])
- if screen[u'primary']:
+ log.info('Screen %d found with resolution %s', screen['number'], screen['size'])
+ if screen['primary']:
self.current = screen
self.override = copy.deepcopy(self.current)
self.screen_list.append(screen)
@@ -173,9 +173,9 @@
``number``
The screen number (int).
"""
- log.info(u'remove_screen %d' % number)
+ log.info('remove_screen %d' % number)
for screen in self.screen_list:
- if screen[u'number'] == number:
+ if screen['number'] == number:
self.screen_list.remove(screen)
self.display_count -= 1
break
@@ -188,7 +188,7 @@
The screen number (int).
"""
for screen in self.screen_list:
- if screen[u'number'] == number:
+ if screen['number'] == number:
return True
return False
@@ -199,7 +199,7 @@
``number``
The screen number (int).
"""
- log.debug(u'set_current_display %s', number)
+ log.debug('set_current_display %s', number)
if number + 1 > self.display_count:
self.current = self.screen_list[0]
else:
@@ -214,7 +214,7 @@
Replace the current size with the override values, as the user wants to
have their own screen attributes.
"""
- log.debug(u'set_override_display')
+ log.debug('set_override_display')
self.current = copy.deepcopy(self.override)
self.preview = copy.deepcopy(self.current)
@@ -223,8 +223,8 @@
Replace the current values with the correct values, as the user wants to
use the correct screen attributes.
"""
- log.debug(u'reset_current_display')
- self.set_current_display(self.current[u'number'])
+ log.debug('reset_current_display')
+ self.set_current_display(self.current['number'])
def which_screen(self, window):
"""
@@ -236,9 +236,9 @@
x = window.x() + (window.width() // 2)
y = window.y() + (window.height() // 2)
for screen in self.screen_list:
- size = screen[u'size']
+ size = screen['size']
if x >= size.x() and x <= (size.x() + size.width()) and y >= size.y() and y <= (size.y() + size.height()):
- return screen[u'number']
+ return screen['number']
def load_screen_settings(self):
"""
@@ -248,25 +248,25 @@
# Add the screen settings to the settings dict. This has to be done here due to cyclic dependency.
# Do not do this anywhere else.
screen_settings = {
- u'core/x position': self.current[u'size'].x(),
- u'core/y position': self.current[u'size'].y(),
- u'core/monitor': self.display_count - 1,
- u'core/height': self.current[u'size'].height(),
- u'core/width': self.current[u'size'].width()
+ 'core/x position': self.current['size'].x(),
+ 'core/y position': self.current['size'].y(),
+ 'core/monitor': self.display_count - 1,
+ 'core/height': self.current['size'].height(),
+ 'core/width': self.current['size'].width()
}
Settings.extend_default_settings(screen_settings)
settings = Settings()
- settings.beginGroup(u'core')
- monitor = settings.value(u'monitor')
+ settings.beginGroup('core')
+ monitor = settings.value('monitor')
self.set_current_display(monitor)
- self.display = settings.value(u'display on monitor')
- override_display = settings.value(u'override position')
- x = settings.value(u'x position')
- y = settings.value(u'y position')
- width = settings.value(u'width')
- height = settings.value(u'height')
- self.override[u'size'] = QtCore.QRect(x, y, width, height)
- self.override[u'primary'] = False
+ self.display = settings.value('display on monitor')
+ override_display = settings.value('override position')
+ x = settings.value('x position')
+ y = settings.value('y position')
+ width = settings.value('width')
+ height = settings.value('height')
+ self.override['size'] = QtCore.QRect(x, y, width, height)
+ self.override['primary'] = False
settings.endGroup()
if override_display:
self.set_override_display()
=== modified file 'openlp/core/lib/searchedit.py'
--- openlp/core/lib/searchedit.py 2013-07-18 11:19:20 +0000
+++ openlp/core/lib/searchedit.py 2013-08-31 18:18:25 +0000
@@ -26,7 +26,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from __future__ import division
+
import logging
from PyQt4 import QtCore, QtGui
@@ -49,9 +49,9 @@
super(SearchEdit, self).__init__(parent)
self._current_search_type = -1
self.clear_button = QtGui.QToolButton(self)
- self.clear_button.setIcon(build_icon(u':/system/clear_shortcut.png'))
+ self.clear_button.setIcon(build_icon(':/system/clear_shortcut.png'))
self.clear_button.setCursor(QtCore.Qt.ArrowCursor)
- self.clear_button.setStyleSheet(u'QToolButton { border: none; padding: 0px; }')
+ self.clear_button.setStyleSheet('QToolButton { border: none; padding: 0px; }')
self.clear_button.resize(18, 18)
self.clear_button.hide()
self.clear_button.clicked.connect(self._on_clear_button_clicked)
@@ -65,11 +65,11 @@
"""
frame_width = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
right_padding = self.clear_button.width() + frame_width
- if hasattr(self, u'menu_button'):
+ if hasattr(self, 'menu_button'):
left_padding = self.menu_button.width()
- stylesheet = u'QLineEdit { padding-left: %spx; padding-right: %spx; } ' % (left_padding, right_padding)
+ stylesheet = 'QLineEdit { padding-left: %spx; padding-right: %spx; } ' % (left_padding, right_padding)
else:
- stylesheet = u'QLineEdit { padding-right: %spx; } ' % right_padding
+ stylesheet = 'QLineEdit { padding-right: %spx; } ' % right_padding
self.setStyleSheet(stylesheet)
msz = self.minimumSizeHint()
self.setMinimumSize(max(msz.width(), self.clear_button.width() + (frame_width * 2) + 2),
@@ -86,7 +86,7 @@
frame_width = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
self.clear_button.move(self.rect().right() - frame_width - size.width(),
(self.rect().bottom() + 1 - size.height()) // 2)
- if hasattr(self, u'menu_button'):
+ if hasattr(self, 'menu_button'):
size = self.menu_button.size()
self.menu_button.move(self.rect().left() + frame_width + 2, (self.rect().bottom() + 1 - size.height()) // 2)
@@ -114,7 +114,7 @@
pass
self.menu_button.setDefaultAction(action)
self._current_search_type = identifier
- self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'), identifier)
+ self.emit(QtCore.SIGNAL('searchTypeChanged(int)'), identifier)
return True
def set_search_types(self, items):
@@ -145,12 +145,12 @@
if first is None:
first = action
self._current_search_type = identifier
- if not hasattr(self, u'menu_button'):
+ if not hasattr(self, 'menu_button'):
self.menu_button = QtGui.QToolButton(self)
- self.menu_button.setIcon(build_icon(u':/system/clear_shortcut.png'))
+ self.menu_button.setIcon(build_icon(':/system/clear_shortcut.png'))
self.menu_button.setCursor(QtCore.Qt.ArrowCursor)
self.menu_button.setPopupMode(QtGui.QToolButton.InstantPopup)
- self.menu_button.setStyleSheet(u'QToolButton { border: none; padding: 0px 10px 0px 0px; }')
+ self.menu_button.setStyleSheet('QToolButton { border: none; padding: 0px 10px 0px 0px; }')
self.menu_button.resize(QtCore.QSize(28, 18))
self.menu_button.setMenu(menu)
self.menu_button.setDefaultAction(first)
@@ -174,7 +174,7 @@
line edit.
"""
self.clear()
- self.emit(QtCore.SIGNAL(u'cleared()'))
+ self.emit(QtCore.SIGNAL('cleared()'))
def _on_menu_action_triggered(self):
"""
@@ -193,4 +193,4 @@
self.setPlaceholderText(self.menu_button.defaultAction().placeholder_text)
except AttributeError:
pass
- self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'), self._current_search_type)
+ self.emit(QtCore.SIGNAL('searchTypeChanged(int)'), self._current_search_type)
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2013-06-30 18:33:41 +0000
+++ openlp/core/lib/serviceitem.py 2013-08-31 18:18:25 +0000
@@ -132,7 +132,7 @@
the service manager, the slide controller, and the projection screen
compositor.
"""
- log.info(u'Service Item created')
+ log.info('Service Item created')
def __init__(self, plugin=None):
"""
@@ -143,19 +143,19 @@
"""
if plugin:
self.name = plugin.name
- self.title = u''
+ self.title = ''
self.processor = None
- self.audit = u''
+ self.audit = ''
self.items = []
self.iconic_representation = None
self.raw_footer = []
- self.foot_text = u''
+ self.foot_text = ''
self.theme = None
self.service_item_type = None
self._raw_frames = []
self._display_frames = []
self.unique_identifier = 0
- self.notes = u''
+ self.notes = ''
self.from_plugin = False
self.capabilities = []
self.is_valid = True
@@ -164,15 +164,15 @@
self.main = None
self.footer = None
self.bg_image_bytes = None
- self.search_string = u''
- self.data_string = u''
+ self.search_string = ''
+ self.data_string = ''
self.edit_id = None
self.xml_version = None
self.start_time = 0
self.end_time = 0
self.media_length = 0
self.from_service = False
- self.image_border = u'#000000'
+ self.image_border = '#000000'
self.background_audio = []
self.theme_overwritten = False
self.temporary_edit = False
@@ -188,7 +188,7 @@
Method to set the internal id of the item. This is used to compare
service items to see if they are the same.
"""
- self.unique_identifier = unicode(uuid.uuid1())
+ self.unique_identifier = str(uuid.uuid1())
self.validate_item()
def add_capability(self, capability):
@@ -232,45 +232,45 @@
the renderer knows the correct theme data. However, this is needed
for the theme manager.
"""
- log.debug(u'Render called')
+ log.debug('Render called')
self._display_frames = []
self.bg_image_bytes = None
if not provides_own_theme_data:
self.renderer.set_item_theme(self.theme)
self.themedata, self.main, self.footer = self.renderer.pre_render()
if self.service_item_type == ServiceItemType.Text:
- log.debug(u'Formatting slides: %s' % self.title)
+ log.debug('Formatting slides: %s' % self.title)
# Save rendered pages to this dict. In the case that a slide is used
# twice we can use the pages saved to the dict instead of rendering
# them again.
previous_pages = {}
for slide in self._raw_frames:
- verse_tag = slide[u'verseTag']
- if verse_tag in previous_pages and previous_pages[verse_tag][0] == slide[u'raw_slide']:
+ verse_tag = slide['verseTag']
+ if verse_tag in previous_pages and previous_pages[verse_tag][0] == slide['raw_slide']:
pages = previous_pages[verse_tag][1]
else:
- pages = self.renderer.format_slide(slide[u'raw_slide'], self)
- previous_pages[verse_tag] = (slide[u'raw_slide'], pages)
+ pages = self.renderer.format_slide(slide['raw_slide'], self)
+ previous_pages[verse_tag] = (slide['raw_slide'], pages)
for page in pages:
- page = page.replace(u'<br>', u'{br}')
+ page = page.replace('<br>', '{br}')
html = expand_tags(cgi.escape(page.rstrip()))
self._display_frames.append({
- u'title': clean_tags(page),
- u'text': clean_tags(page.rstrip()),
- u'html': html.replace(u'&nbsp;', u' '),
- u'verseTag': verse_tag
+ 'title': clean_tags(page),
+ 'text': clean_tags(page.rstrip()),
+ 'html': html.replace('&nbsp;', ' '),
+ 'verseTag': verse_tag
})
elif self.service_item_type == ServiceItemType.Image or self.service_item_type == ServiceItemType.Command:
pass
else:
- log.error(u'Invalid value renderer: %s' % self.service_item_type)
+ log.error('Invalid value renderer: %s' % self.service_item_type)
self.title = clean_tags(self.title)
# The footer should never be None, but to be compatible with a few
# nightly builds between 1.9.4 and 1.9.5, we have to correct this to
# avoid tracebacks.
if self.raw_footer is None:
self.raw_footer = []
- self.foot_text = u'<br>'.join(filter(None, self.raw_footer))
+ self.foot_text = '<br>'.join([_f for _f in self.raw_footer if _f])
def add_from_image(self, path, title, background=None):
"""
@@ -285,7 +285,7 @@
if background:
self.image_border = background
self.service_item_type = ServiceItemType.Image
- self._raw_frames.append({u'title': title, u'path': path})
+ self._raw_frames.append({'title': title, 'path': path})
self.image_manager.add_image(path, ImageSource.ImagePlugin, self.image_border)
self._new_item()
@@ -299,8 +299,8 @@
if verse_tag:
verse_tag = verse_tag.upper()
self.service_item_type = ServiceItemType.Text
- title = raw_slide[:30].split(u'\n')[0]
- self._raw_frames.append({u'title': title, u'raw_slide': raw_slide, u'verseTag': verse_tag})
+ title = raw_slide[:30].split('\n')[0]
+ self._raw_frames.append({'title': title, 'raw_slide': raw_slide, 'verseTag': verse_tag})
self._new_item()
def add_from_command(self, path, file_name, image):
@@ -317,7 +317,7 @@
The command of/for the slide.
"""
self.service_item_type = ServiceItemType.Command
- self._raw_frames.append({u'title': file_name, u'image': image, u'path': path})
+ self._raw_frames.append({'title': file_name, 'image': image, 'path': path})
self._new_item()
def get_service_repr(self, lite_save):
@@ -326,30 +326,30 @@
file to represent this item.
"""
service_header = {
- u'name': self.name,
- u'plugin': self.name,
- u'theme': self.theme,
- u'title': self.title,
- u'icon': self.icon,
- u'footer': self.raw_footer,
- u'type': self.service_item_type,
- u'audit': self.audit,
- u'notes': self.notes,
- u'from_plugin': self.from_plugin,
- u'capabilities': self.capabilities,
- u'search': self.search_string,
- u'data': self.data_string,
- u'xml_version': self.xml_version,
- u'auto_play_slides_once': self.auto_play_slides_once,
- u'auto_play_slides_loop': self.auto_play_slides_loop,
- u'timed_slide_interval': self.timed_slide_interval,
- u'start_time': self.start_time,
- u'end_time': self.end_time,
- u'media_length': self.media_length,
- u'background_audio': self.background_audio,
- u'theme_overwritten': self.theme_overwritten,
- u'will_auto_start': self.will_auto_start,
- u'processor': self.processor
+ 'name': self.name,
+ 'plugin': self.name,
+ 'theme': self.theme,
+ 'title': self.title,
+ 'icon': self.icon,
+ 'footer': self.raw_footer,
+ 'type': self.service_item_type,
+ 'audit': self.audit,
+ 'notes': self.notes,
+ 'from_plugin': self.from_plugin,
+ 'capabilities': self.capabilities,
+ 'search': self.search_string,
+ 'data': self.data_string,
+ 'xml_version': self.xml_version,
+ 'auto_play_slides_once': self.auto_play_slides_once,
+ 'auto_play_slides_loop': self.auto_play_slides_loop,
+ 'timed_slide_interval': self.timed_slide_interval,
+ 'start_time': self.start_time,
+ 'end_time': self.end_time,
+ 'media_length': self.media_length,
+ 'background_audio': self.background_audio,
+ 'theme_overwritten': self.theme_overwritten,
+ 'will_auto_start': self.will_auto_start,
+ 'processor': self.processor
}
service_data = []
if self.service_item_type == ServiceItemType.Text:
@@ -357,13 +357,13 @@
elif self.service_item_type == ServiceItemType.Image:
if lite_save:
for slide in self._raw_frames:
- service_data.append({u'title': slide[u'title'], u'path': slide[u'path']})
+ service_data.append({'title': slide['title'], 'path': slide['path']})
else:
- service_data = [slide[u'title'] for slide in self._raw_frames]
+ service_data = [slide['title'] for slide in self._raw_frames]
elif self.service_item_type == ServiceItemType.Command:
for slide in self._raw_frames:
- service_data.append({u'title': slide[u'title'], u'image': slide[u'image'], u'path': slide[u'path']})
- return {u'header': service_header, u'data': service_data}
+ service_data.append({'title': slide['title'], 'image': slide['image'], 'path': slide['path']})
+ return {'header': service_header, 'data': service_data}
def set_from_service(self, serviceitem, path=None):
"""
@@ -378,65 +378,65 @@
which have their files saved with them or None when the saved
service is lite and the original file paths need to be preserved..
"""
- log.debug(u'set_from_service called with path %s' % path)
- header = serviceitem[u'serviceitem'][u'header']
- self.title = header[u'title']
- self.name = header[u'name']
- self.service_item_type = header[u'type']
- self.theme = header[u'theme']
- self.add_icon(header[u'icon'])
- self.raw_footer = header[u'footer']
- self.audit = header[u'audit']
- self.notes = header[u'notes']
- self.from_plugin = header[u'from_plugin']
- self.capabilities = header[u'capabilities']
+ log.debug('set_from_service called with path %s' % path)
+ header = serviceitem['serviceitem']['header']
+ self.title = header['title']
+ self.name = header['name']
+ self.service_item_type = header['type']
+ self.theme = header['theme']
+ self.add_icon(header['icon'])
+ self.raw_footer = header['footer']
+ self.audit = header['audit']
+ self.notes = header['notes']
+ self.from_plugin = header['from_plugin']
+ self.capabilities = header['capabilities']
# Added later so may not be present in older services.
- self.search_string = header.get(u'search', u'')
- self.data_string = header.get(u'data', u'')
- self.xml_version = header.get(u'xml_version')
- self.start_time = header.get(u'start_time', 0)
- self.end_time = header.get(u'end_time', 0)
- self.media_length = header.get(u'media_length', 0)
- self.auto_play_slides_once = header.get(u'auto_play_slides_once', False)
- self.auto_play_slides_loop = header.get(u'auto_play_slides_loop', False)
- self.timed_slide_interval = header.get(u'timed_slide_interval', 0)
- self.will_auto_start = header.get(u'will_auto_start', False)
- self.processor = header.get(u'processor', None)
+ self.search_string = header.get('search', '')
+ self.data_string = header.get('data', '')
+ self.xml_version = header.get('xml_version')
+ self.start_time = header.get('start_time', 0)
+ self.end_time = header.get('end_time', 0)
+ self.media_length = header.get('media_length', 0)
+ self.auto_play_slides_once = header.get('auto_play_slides_once', False)
+ self.auto_play_slides_loop = header.get('auto_play_slides_loop', False)
+ self.timed_slide_interval = header.get('timed_slide_interval', 0)
+ self.will_auto_start = header.get('will_auto_start', False)
+ self.processor = header.get('processor', None)
self.has_original_files = True
#TODO Remove me in 2,3 build phase
if self.is_capable(ItemCapabilities.HasDetailedTitleDisplay):
self.capabilities.remove(ItemCapabilities.HasDetailedTitleDisplay)
self.processor = self.title
self.title = None
- if u'background_audio' in header:
+ if 'background_audio' in header:
self.background_audio = []
- for filename in header[u'background_audio']:
+ for filename in header['background_audio']:
# Give them real file paths
self.background_audio.append(os.path.join(path, filename))
- self.theme_overwritten = header.get(u'theme_overwritten', False)
+ self.theme_overwritten = header.get('theme_overwritten', False)
if self.service_item_type == ServiceItemType.Text:
- for slide in serviceitem[u'serviceitem'][u'data']:
+ for slide in serviceitem['serviceitem']['data']:
self._raw_frames.append(slide)
elif self.service_item_type == ServiceItemType.Image:
- settings_section = serviceitem[u'serviceitem'][u'header'][u'name']
- background = QtGui.QColor(Settings().value(settings_section + u'/background color'))
+ settings_section = serviceitem['serviceitem']['header']['name']
+ background = QtGui.QColor(Settings().value(settings_section + '/background color'))
if path:
self.has_original_files = False
- for text_image in serviceitem[u'serviceitem'][u'data']:
+ for text_image in serviceitem['serviceitem']['data']:
filename = os.path.join(path, text_image)
self.add_from_image(filename, text_image, background)
else:
- for text_image in serviceitem[u'serviceitem'][u'data']:
- self.add_from_image(text_image[u'path'], text_image[u'title'], background)
+ for text_image in serviceitem['serviceitem']['data']:
+ self.add_from_image(text_image['path'], text_image['title'], background)
elif self.service_item_type == ServiceItemType.Command:
- for text_image in serviceitem[u'serviceitem'][u'data']:
+ for text_image in serviceitem['serviceitem']['data']:
if not self.title:
- self.title = text_image[u'title']
+ self.title = text_image['title']
if path:
self.has_original_files = False
- self.add_from_command(path, text_image[u'title'], text_image[u'image'])
+ self.add_from_command(path, text_image['title'], text_image['image'])
else:
- self.add_from_command(text_image[u'path'], text_image[u'title'], text_image[u'image'])
+ self.add_from_command(text_image['path'], text_image['title'], text_image['image'])
self._new_item()
def get_display_title(self):
@@ -449,7 +449,7 @@
if len(self._raw_frames) > 1:
return self.title
else:
- return self._raw_frames[0][u'title']
+ return self._raw_frames[0]['title']
def merge(self, other):
"""
@@ -548,20 +548,20 @@
The service item slide to be returned
"""
if self.service_item_type == ServiceItemType.Text:
- return self._display_frames[row][u'html'].split(u'\n')[0]
+ return self._display_frames[row]['html'].split('\n')[0]
elif self.service_item_type == ServiceItemType.Image:
- return self._raw_frames[row][u'path']
+ return self._raw_frames[row]['path']
else:
- return self._raw_frames[row][u'image']
+ return self._raw_frames[row]['image']
def get_frame_title(self, row=0):
"""
Returns the title of the raw frame
"""
try:
- return self._raw_frames[row][u'title']
+ return self._raw_frames[row]['title']
except IndexError:
- return u''
+ return ''
def get_frame_path(self, row=0, frame=None):
"""
@@ -571,11 +571,11 @@
try:
frame = self._raw_frames[row]
except IndexError:
- return u''
+ return ''
if self.is_image():
- path_from = frame[u'path']
+ path_from = frame['path']
else:
- path_from = os.path.join(frame[u'path'], frame[u'title'])
+ path_from = os.path.join(frame['path'], frame['title'])
return path_from
def remove_frame(self, frame):
@@ -593,18 +593,18 @@
end = None
if self.start_time != 0:
start = translate('OpenLP.ServiceItem', '<strong>Start</strong>: %s') % \
- unicode(datetime.timedelta(seconds=self.start_time))
+ str(datetime.timedelta(seconds=self.start_time))
if self.media_length != 0:
end = translate('OpenLP.ServiceItem', '<strong>Length</strong>: %s') % \
- unicode(datetime.timedelta(seconds=self.media_length))
+ str(datetime.timedelta(seconds=self.media_length))
if not start and not end:
- return u''
+ return ''
elif start and not end:
return start
elif not start and end:
return end
else:
- return u'%s <br>%s' % (start, end)
+ return '%s <br>%s' % (start, end)
def update_theme(self, theme):
"""
@@ -639,16 +639,16 @@
"""
self.is_valid = True
for frame in self._raw_frames:
- if self.is_image() and not os.path.exists(frame[u'path']):
+ if self.is_image() and not os.path.exists(frame['path']):
self.is_valid = False
break
elif self.is_command():
- file_name = os.path.join(frame[u'path'], frame[u'title'])
+ file_name = os.path.join(frame['path'], frame['title'])
if not os.path.exists(file_name):
self.is_valid = False
break
if suffix_list and not self.is_text():
- file_suffix = frame[u'title'].split(u'.')[-1]
+ file_suffix = frame['title'].split('.')[-1]
if file_suffix.lower() not in suffix_list:
self.is_valid = False
break
@@ -657,8 +657,8 @@
"""
Adds the Renderer to the class dynamically
"""
- if not hasattr(self, u'_renderer'):
- self._renderer = Registry().get(u'renderer')
+ if not hasattr(self, '_renderer'):
+ self._renderer = Registry().get('renderer')
return self._renderer
renderer = property(_get_renderer)
@@ -667,8 +667,8 @@
"""
Adds the image manager to the class dynamically
"""
- if not hasattr(self, u'_image_manager'):
- self._image_manager = Registry().get(u'image_manager')
+ if not hasattr(self, '_image_manager'):
+ self._image_manager = Registry().get('image_manager')
return self._image_manager
image_manager = property(_get_image_manager)
=== modified file 'openlp/core/lib/settings.py'
--- openlp/core/lib/settings.py 2013-07-03 20:20:12 +0000
+++ openlp/core/lib/settings.py 2013-08-31 18:18:25 +0000
@@ -45,11 +45,11 @@
# Fix for bug #1014422.
X11_BYPASS_DEFAULT = True
-if sys.platform.startswith(u'linux'):
+if sys.platform.startswith('linux'):
# Default to False on Gnome.
- X11_BYPASS_DEFAULT = bool(not os.environ.get(u'GNOME_DESKTOP_SESSION_ID'))
+ X11_BYPASS_DEFAULT = bool(not os.environ.get('GNOME_DESKTOP_SESSION_ID'))
# Default to False on Xfce.
- if os.environ.get(u'DESKTOP_SESSION') == u'xfce':
+ if os.environ.get('DESKTOP_SESSION') == 'xfce':
X11_BYPASS_DEFAULT = False
@@ -87,263 +87,263 @@
So, if the type of the old value is bool, then there must be two rules.
"""
__default_settings__ = {
- u'advanced/add page break': False,
- u'advanced/alternate rows': not sys.platform.startswith(u'win'),
- u'advanced/current media plugin': -1,
- u'advanced/data path': u'',
- u'advanced/default color': u'#ffffff',
- u'advanced/default image': u':/graphics/openlp-splash-screen.png',
+ 'advanced/add page break': False,
+ 'advanced/alternate rows': not sys.platform.startswith('win'),
+ 'advanced/current media plugin': -1,
+ 'advanced/data path': '',
+ 'advanced/default color': '#ffffff',
+ 'advanced/default image': ':/graphics/openlp-splash-screen.png',
# 7 stands for now, 0 to 6 is Monday to Sunday.
- u'advanced/default service day': 7,
- u'advanced/default service enabled': True,
- u'advanced/default service hour': 11,
- u'advanced/default service minute': 0,
- u'advanced/default service name': UiStrings().DefaultServiceName,
- u'advanced/display size': 0,
- u'advanced/double click live': False,
- u'advanced/enable exit confirmation': True,
- u'advanced/expand service item': False,
- u'advanced/hide mouse': True,
- u'advanced/is portable': False,
- u'advanced/max recent files': 20,
- u'advanced/print file meta data': False,
- u'advanced/print notes': False,
- u'advanced/print slide text': False,
- u'advanced/recent file count': 4,
- u'advanced/save current plugin': False,
- u'advanced/slide limits': SlideLimits.End,
- u'advanced/single click preview': False,
- u'advanced/x11 bypass wm': X11_BYPASS_DEFAULT,
- u'crashreport/last directory': u'',
- u'formattingTags/html_tags': u'',
- u'core/audio repeat list': False,
- u'core/auto open': False,
- u'core/auto preview': False,
- u'core/audio start paused': True,
- u'core/auto unblank': False,
- u'core/blank warning': False,
- u'core/ccli number': u'',
- u'core/has run wizard': False,
- u'core/language': u'[en]',
- u'core/last version test': u'',
- u'core/loop delay': 5,
- u'core/recent files': [],
- u'core/save prompt': False,
- u'core/screen blank': False,
- u'core/show splash': True,
- u'core/songselect password': u'',
- u'core/songselect username': u'',
- u'core/update check': True,
- u'core/view mode': u'default',
+ 'advanced/default service day': 7,
+ 'advanced/default service enabled': True,
+ 'advanced/default service hour': 11,
+ 'advanced/default service minute': 0,
+ 'advanced/default service name': UiStrings().DefaultServiceName,
+ 'advanced/display size': 0,
+ 'advanced/double click live': False,
+ 'advanced/enable exit confirmation': True,
+ 'advanced/expand service item': False,
+ 'advanced/hide mouse': True,
+ 'advanced/is portable': False,
+ 'advanced/max recent files': 20,
+ 'advanced/print file meta data': False,
+ 'advanced/print notes': False,
+ 'advanced/print slide text': False,
+ 'advanced/recent file count': 4,
+ 'advanced/save current plugin': False,
+ 'advanced/slide limits': SlideLimits.End,
+ 'advanced/single click preview': False,
+ 'advanced/x11 bypass wm': X11_BYPASS_DEFAULT,
+ 'crashreport/last directory': '',
+ 'formattingTags/html_tags': '',
+ 'core/audio repeat list': False,
+ 'core/auto open': False,
+ 'core/auto preview': False,
+ 'core/audio start paused': True,
+ 'core/auto unblank': False,
+ 'core/blank warning': False,
+ 'core/ccli number': '',
+ 'core/has run wizard': False,
+ 'core/language': '[en]',
+ 'core/last version test': '',
+ 'core/loop delay': 5,
+ 'core/recent files': [],
+ 'core/save prompt': False,
+ 'core/screen blank': False,
+ 'core/show splash': True,
+ 'core/songselect password': '',
+ 'core/songselect username': '',
+ 'core/update check': True,
+ 'core/view mode': 'default',
# The other display settings (display position and dimensions) are defined in the ScreenList class due to a
# circular dependency.
- u'core/display on monitor': True,
- u'core/override position': False,
- u'images/background color': u'#000000',
- u'media/players': u'webkit',
- u'media/override player': QtCore.Qt.Unchecked,
- u'players/background color': u'#000000',
- u'servicemanager/last directory': u'',
- u'servicemanager/last file': u'',
- u'servicemanager/service theme': u'',
- u'SettingsImport/file_date_created': datetime.datetime.now().strftime("%Y-%m-%d %H:%M"),
- u'SettingsImport/Make_Changes': u'At_Own_RISK',
- u'SettingsImport/type': u'OpenLP_settings_export',
- u'SettingsImport/version': u'',
- u'shortcuts/aboutItem': [QtGui.QKeySequence(u'Ctrl+F1')],
- u'shortcuts/addToService': [],
- u'shortcuts/audioPauseItem': [],
- u'shortcuts/displayTagItem': [],
- u'shortcuts/blankScreen': [QtGui.QKeySequence(QtCore.Qt.Key_Period)],
- u'shortcuts/collapse': [QtGui.QKeySequence(QtCore.Qt.Key_Minus)],
- u'shortcuts/desktopScreen': [QtGui.QKeySequence(u'D')],
- u'shortcuts/delete': [],
- u'shortcuts/down': [QtGui.QKeySequence(QtCore.Qt.Key_Down)],
- u'shortcuts/editSong': [],
- u'shortcuts/escapeItem': [QtGui.QKeySequence(QtCore.Qt.Key_Escape)],
- u'shortcuts/expand': [QtGui.QKeySequence(QtCore.Qt.Key_Plus)],
- u'shortcuts/exportThemeItem': [],
- u'shortcuts/fileNewItem': [QtGui.QKeySequence(u'Ctrl+N')],
- u'shortcuts/fileSaveAsItem': [QtGui.QKeySequence(u'Ctrl+Shift+S')],
- u'shortcuts/fileExitItem': [QtGui.QKeySequence(u'Alt+F4')],
- u'shortcuts/fileSaveItem': [QtGui.QKeySequence(u'Ctrl+S')],
- u'shortcuts/fileOpenItem': [QtGui.QKeySequence(u'Ctrl+O')],
- u'shortcuts/goLive': [],
- u'shortcuts/importThemeItem': [],
- u'shortcuts/importBibleItem': [],
- u'shortcuts/listViewBiblesDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
- u'shortcuts/listViewBiblesPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
- QtGui.QKeySequence(QtCore.Qt.Key_Return)],
- u'shortcuts/listViewBiblesLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
- QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
- u'shortcuts/listViewBiblesServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
- QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
- u'shortcuts/listViewCustomDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
- u'shortcuts/listViewCustomPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
- QtGui.QKeySequence(QtCore.Qt.Key_Return)],
- u'shortcuts/listViewCustomLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
- QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
- u'shortcuts/listViewCustomServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
- QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
- u'shortcuts/listViewImagesDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
- u'shortcuts/listViewImagesPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
- QtGui.QKeySequence(QtCore.Qt.Key_Return)],
- u'shortcuts/listViewImagesLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
- QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
- u'shortcuts/listViewImagesServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
- QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
- u'shortcuts/listViewMediaDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
- u'shortcuts/listViewMediaPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
- QtGui.QKeySequence(QtCore.Qt.Key_Return)],
- u'shortcuts/listViewMediaLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
- QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
- u'shortcuts/listViewMediaServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
- QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
- u'shortcuts/listViewPresentationsDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
- u'shortcuts/listViewPresentationsPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
- QtGui.QKeySequence(QtCore.Qt.Key_Return)],
- u'shortcuts/listViewPresentationsLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
- QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
- u'shortcuts/listViewPresentationsServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
- QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
- u'shortcuts/listViewSongsDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
- u'shortcuts/listViewSongsPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
- QtGui.QKeySequence(QtCore.Qt.Key_Return)],
- u'shortcuts/listViewSongsLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
- QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
- u'shortcuts/listViewSongsServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
- QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
- u'shortcuts/lockPanel': [],
- u'shortcuts/modeDefaultItem': [],
- u'shortcuts/modeLiveItem': [],
- u'shortcuts/make_live': [QtGui.QKeySequence(QtCore.Qt.Key_Enter), QtGui.QKeySequence(QtCore.Qt.Key_Return)],
- u'shortcuts/moveUp': [QtGui.QKeySequence(QtCore.Qt.Key_PageUp)],
- u'shortcuts/moveTop': [QtGui.QKeySequence(QtCore.Qt.Key_Home)],
- u'shortcuts/modeSetupItem': [],
- u'shortcuts/moveBottom': [QtGui.QKeySequence(QtCore.Qt.Key_End)],
- u'shortcuts/moveDown': [QtGui.QKeySequence(QtCore.Qt.Key_PageDown)],
- u'shortcuts/nextTrackItem': [],
- u'shortcuts/nextItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Down),
+ 'core/display on monitor': True,
+ 'core/override position': False,
+ 'images/background color': '#000000',
+ 'media/players': 'webkit',
+ 'media/override player': QtCore.Qt.Unchecked,
+ 'players/background color': '#000000',
+ 'servicemanager/last directory': '',
+ 'servicemanager/last file': '',
+ 'servicemanager/service theme': '',
+ 'SettingsImport/file_date_created': datetime.datetime.now().strftime("%Y-%m-%d %H:%M"),
+ 'SettingsImport/Make_Changes': 'At_Own_RISK',
+ 'SettingsImport/type': 'OpenLP_settings_export',
+ 'SettingsImport/version': '',
+ 'shortcuts/aboutItem': [QtGui.QKeySequence('Ctrl+F1')],
+ 'shortcuts/addToService': [],
+ 'shortcuts/audioPauseItem': [],
+ 'shortcuts/displayTagItem': [],
+ 'shortcuts/blankScreen': [QtGui.QKeySequence(QtCore.Qt.Key_Period)],
+ 'shortcuts/collapse': [QtGui.QKeySequence(QtCore.Qt.Key_Minus)],
+ 'shortcuts/desktopScreen': [QtGui.QKeySequence('D')],
+ 'shortcuts/delete': [],
+ 'shortcuts/down': [QtGui.QKeySequence(QtCore.Qt.Key_Down)],
+ 'shortcuts/editSong': [],
+ 'shortcuts/escapeItem': [QtGui.QKeySequence(QtCore.Qt.Key_Escape)],
+ 'shortcuts/expand': [QtGui.QKeySequence(QtCore.Qt.Key_Plus)],
+ 'shortcuts/exportThemeItem': [],
+ 'shortcuts/fileNewItem': [QtGui.QKeySequence('Ctrl+N')],
+ 'shortcuts/fileSaveAsItem': [QtGui.QKeySequence('Ctrl+Shift+S')],
+ 'shortcuts/fileExitItem': [QtGui.QKeySequence('Alt+F4')],
+ 'shortcuts/fileSaveItem': [QtGui.QKeySequence('Ctrl+S')],
+ 'shortcuts/fileOpenItem': [QtGui.QKeySequence('Ctrl+O')],
+ 'shortcuts/goLive': [],
+ 'shortcuts/importThemeItem': [],
+ 'shortcuts/importBibleItem': [],
+ 'shortcuts/listViewBiblesDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
+ 'shortcuts/listViewBiblesPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
+ QtGui.QKeySequence(QtCore.Qt.Key_Return)],
+ 'shortcuts/listViewBiblesLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
+ QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
+ 'shortcuts/listViewBiblesServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
+ QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
+ 'shortcuts/listViewCustomDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
+ 'shortcuts/listViewCustomPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
+ QtGui.QKeySequence(QtCore.Qt.Key_Return)],
+ 'shortcuts/listViewCustomLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
+ QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
+ 'shortcuts/listViewCustomServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
+ QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
+ 'shortcuts/listViewImagesDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
+ 'shortcuts/listViewImagesPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
+ QtGui.QKeySequence(QtCore.Qt.Key_Return)],
+ 'shortcuts/listViewImagesLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
+ QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
+ 'shortcuts/listViewImagesServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
+ QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
+ 'shortcuts/listViewMediaDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
+ 'shortcuts/listViewMediaPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
+ QtGui.QKeySequence(QtCore.Qt.Key_Return)],
+ 'shortcuts/listViewMediaLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
+ QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
+ 'shortcuts/listViewMediaServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
+ QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
+ 'shortcuts/listViewPresentationsDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
+ 'shortcuts/listViewPresentationsPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
+ QtGui.QKeySequence(QtCore.Qt.Key_Return)],
+ 'shortcuts/listViewPresentationsLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
+ QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
+ 'shortcuts/listViewPresentationsServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
+ QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
+ 'shortcuts/listViewSongsDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
+ 'shortcuts/listViewSongsPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
+ QtGui.QKeySequence(QtCore.Qt.Key_Return)],
+ 'shortcuts/listViewSongsLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
+ QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
+ 'shortcuts/listViewSongsServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
+ QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
+ 'shortcuts/lockPanel': [],
+ 'shortcuts/modeDefaultItem': [],
+ 'shortcuts/modeLiveItem': [],
+ 'shortcuts/make_live': [QtGui.QKeySequence(QtCore.Qt.Key_Enter), QtGui.QKeySequence(QtCore.Qt.Key_Return)],
+ 'shortcuts/moveUp': [QtGui.QKeySequence(QtCore.Qt.Key_PageUp)],
+ 'shortcuts/moveTop': [QtGui.QKeySequence(QtCore.Qt.Key_Home)],
+ 'shortcuts/modeSetupItem': [],
+ 'shortcuts/moveBottom': [QtGui.QKeySequence(QtCore.Qt.Key_End)],
+ 'shortcuts/moveDown': [QtGui.QKeySequence(QtCore.Qt.Key_PageDown)],
+ 'shortcuts/nextTrackItem': [],
+ 'shortcuts/nextItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Down),
QtGui.QKeySequence(QtCore.Qt.Key_PageDown)],
- u'shortcuts/nextItem_preview': [],
- u'shortcuts/nextService': [QtGui.QKeySequence(QtCore.Qt.Key_Right)],
- u'shortcuts/newService': [],
- u'shortcuts/offlineHelpItem': [],
- u'shortcuts/onlineHelpItem': [QtGui.QKeySequence(u'Alt+F1')],
- u'shortcuts/openService': [],
- u'shortcuts/saveService': [],
- u'shortcuts/previousItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Up),
+ 'shortcuts/nextItem_preview': [],
+ 'shortcuts/nextService': [QtGui.QKeySequence(QtCore.Qt.Key_Right)],
+ 'shortcuts/newService': [],
+ 'shortcuts/offlineHelpItem': [],
+ 'shortcuts/onlineHelpItem': [QtGui.QKeySequence('Alt+F1')],
+ 'shortcuts/openService': [],
+ 'shortcuts/saveService': [],
+ 'shortcuts/previousItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Up),
QtGui.QKeySequence(QtCore.Qt.Key_PageUp)],
- u'shortcuts/playbackPause': [],
- u'shortcuts/playbackPlay': [],
- u'shortcuts/playbackStop': [],
- u'shortcuts/playSlidesLoop': [],
- u'shortcuts/playSlidesOnce': [],
- u'shortcuts/previousService': [QtGui.QKeySequence(QtCore.Qt.Key_Left)],
- u'shortcuts/previousItem_preview': [],
- u'shortcuts/printServiceItem': [QtGui.QKeySequence(u'Ctrl+P')],
- u'shortcuts/songExportItem': [],
- u'shortcuts/songUsageStatus': [QtGui.QKeySequence(QtCore.Qt.Key_F4)],
- u'shortcuts/searchShortcut': [QtGui.QKeySequence(u'Ctrl+F')],
- u'shortcuts/settingsShortcutsItem': [],
- u'shortcuts/settingsImportItem': [],
- u'shortcuts/settingsPluginListItem': [QtGui.QKeySequence(u'Alt+F7')],
- u'shortcuts/songUsageDelete': [],
- u'shortcuts/settingsConfigureItem': [],
- u'shortcuts/shortcutAction_B': [QtGui.QKeySequence(u'B')],
- u'shortcuts/shortcutAction_C': [QtGui.QKeySequence(u'C')],
- u'shortcuts/shortcutAction_E': [QtGui.QKeySequence(u'E')],
- u'shortcuts/shortcutAction_I': [QtGui.QKeySequence(u'I')],
- u'shortcuts/shortcutAction_O': [QtGui.QKeySequence(u'O')],
- u'shortcuts/shortcutAction_P': [QtGui.QKeySequence(u'P')],
- u'shortcuts/shortcutAction_V': [QtGui.QKeySequence(u'V')],
- u'shortcuts/shortcutAction_0': [QtGui.QKeySequence(u'0')],
- u'shortcuts/shortcutAction_1': [QtGui.QKeySequence(u'1')],
- u'shortcuts/shortcutAction_2': [QtGui.QKeySequence(u'2')],
- u'shortcuts/shortcutAction_3': [QtGui.QKeySequence(u'3')],
- u'shortcuts/shortcutAction_4': [QtGui.QKeySequence(u'4')],
- u'shortcuts/shortcutAction_5': [QtGui.QKeySequence(u'5')],
- u'shortcuts/shortcutAction_6': [QtGui.QKeySequence(u'6')],
- u'shortcuts/shortcutAction_7': [QtGui.QKeySequence(u'7')],
- u'shortcuts/shortcutAction_8': [QtGui.QKeySequence(u'8')],
- u'shortcuts/shortcutAction_9': [QtGui.QKeySequence(u'9')],
- u'shortcuts/settingsExportItem': [],
- u'shortcuts/songUsageReport': [],
- u'shortcuts/songImportItem': [],
- u'shortcuts/themeScreen': [QtGui.QKeySequence(u'T')],
- u'shortcuts/toolsReindexItem': [],
- u'shortcuts/toolsFindDuplicates': [],
- u'shortcuts/toolsAlertItem': [QtGui.QKeySequence(u'F7')],
- u'shortcuts/toolsFirstTimeWizard': [],
- u'shortcuts/toolsOpenDataFolder': [],
- u'shortcuts/toolsAddToolItem': [],
- u'shortcuts/updateThemeImages': [],
- u'shortcuts/up': [QtGui.QKeySequence(QtCore.Qt.Key_Up)],
- u'shortcuts/viewThemeManagerItem': [QtGui.QKeySequence(u'F10')],
- u'shortcuts/viewMediaManagerItem': [QtGui.QKeySequence(u'F8')],
- u'shortcuts/viewPreviewPanel': [QtGui.QKeySequence(u'F11')],
- u'shortcuts/viewLivePanel': [QtGui.QKeySequence(u'F12')],
- u'shortcuts/viewServiceManagerItem': [QtGui.QKeySequence(u'F9')],
- u'shortcuts/webSiteItem': [],
- u'themes/global theme': u'',
- u'themes/last directory': u'',
- u'themes/last directory export': u'',
- u'themes/last directory import': u'',
- u'themes/theme level': ThemeLevel.Song,
- u'user interface/live panel': True,
- u'user interface/live splitter geometry': QtCore.QByteArray(),
- u'user interface/lock panel': False,
- u'user interface/main window geometry': QtCore.QByteArray(),
- u'user interface/main window position': QtCore.QPoint(0, 0),
- u'user interface/main window splitter geometry': QtCore.QByteArray(),
- u'user interface/main window state': QtCore.QByteArray(),
- u'user interface/preview panel': True,
- u'user interface/preview splitter geometry': QtCore.QByteArray()
+ 'shortcuts/playbackPause': [],
+ 'shortcuts/playbackPlay': [],
+ 'shortcuts/playbackStop': [],
+ 'shortcuts/playSlidesLoop': [],
+ 'shortcuts/playSlidesOnce': [],
+ 'shortcuts/previousService': [QtGui.QKeySequence(QtCore.Qt.Key_Left)],
+ 'shortcuts/previousItem_preview': [],
+ 'shortcuts/printServiceItem': [QtGui.QKeySequence('Ctrl+P')],
+ 'shortcuts/songExportItem': [],
+ 'shortcuts/songUsageStatus': [QtGui.QKeySequence(QtCore.Qt.Key_F4)],
+ 'shortcuts/searchShortcut': [QtGui.QKeySequence('Ctrl+F')],
+ 'shortcuts/settingsShortcutsItem': [],
+ 'shortcuts/settingsImportItem': [],
+ 'shortcuts/settingsPluginListItem': [QtGui.QKeySequence('Alt+F7')],
+ 'shortcuts/songUsageDelete': [],
+ 'shortcuts/settingsConfigureItem': [],
+ 'shortcuts/shortcutAction_B': [QtGui.QKeySequence('B')],
+ 'shortcuts/shortcutAction_C': [QtGui.QKeySequence('C')],
+ 'shortcuts/shortcutAction_E': [QtGui.QKeySequence('E')],
+ 'shortcuts/shortcutAction_I': [QtGui.QKeySequence('I')],
+ 'shortcuts/shortcutAction_O': [QtGui.QKeySequence('O')],
+ 'shortcuts/shortcutAction_P': [QtGui.QKeySequence('P')],
+ 'shortcuts/shortcutAction_V': [QtGui.QKeySequence('V')],
+ 'shortcuts/shortcutAction_0': [QtGui.QKeySequence('0')],
+ 'shortcuts/shortcutAction_1': [QtGui.QKeySequence('1')],
+ 'shortcuts/shortcutAction_2': [QtGui.QKeySequence('2')],
+ 'shortcuts/shortcutAction_3': [QtGui.QKeySequence('3')],
+ 'shortcuts/shortcutAction_4': [QtGui.QKeySequence('4')],
+ 'shortcuts/shortcutAction_5': [QtGui.QKeySequence('5')],
+ 'shortcuts/shortcutAction_6': [QtGui.QKeySequence('6')],
+ 'shortcuts/shortcutAction_7': [QtGui.QKeySequence('7')],
+ 'shortcuts/shortcutAction_8': [QtGui.QKeySequence('8')],
+ 'shortcuts/shortcutAction_9': [QtGui.QKeySequence('9')],
+ 'shortcuts/settingsExportItem': [],
+ 'shortcuts/songUsageReport': [],
+ 'shortcuts/songImportItem': [],
+ 'shortcuts/themeScreen': [QtGui.QKeySequence('T')],
+ 'shortcuts/toolsReindexItem': [],
+ 'shortcuts/toolsFindDuplicates': [],
+ 'shortcuts/toolsAlertItem': [QtGui.QKeySequence('F7')],
+ 'shortcuts/toolsFirstTimeWizard': [],
+ 'shortcuts/toolsOpenDataFolder': [],
+ 'shortcuts/toolsAddToolItem': [],
+ 'shortcuts/updateThemeImages': [],
+ 'shortcuts/up': [QtGui.QKeySequence(QtCore.Qt.Key_Up)],
+ 'shortcuts/viewThemeManagerItem': [QtGui.QKeySequence('F10')],
+ 'shortcuts/viewMediaManagerItem': [QtGui.QKeySequence('F8')],
+ 'shortcuts/viewPreviewPanel': [QtGui.QKeySequence('F11')],
+ 'shortcuts/viewLivePanel': [QtGui.QKeySequence('F12')],
+ 'shortcuts/viewServiceManagerItem': [QtGui.QKeySequence('F9')],
+ 'shortcuts/webSiteItem': [],
+ 'themes/global theme': '',
+ 'themes/last directory': '',
+ 'themes/last directory export': '',
+ 'themes/last directory import': '',
+ 'themes/theme level': ThemeLevel.Song,
+ 'user interface/live panel': True,
+ 'user interface/live splitter geometry': QtCore.QByteArray(),
+ 'user interface/lock panel': False,
+ 'user interface/main window geometry': QtCore.QByteArray(),
+ 'user interface/main window position': QtCore.QPoint(0, 0),
+ 'user interface/main window splitter geometry': QtCore.QByteArray(),
+ 'user interface/main window state': QtCore.QByteArray(),
+ 'user interface/preview panel': True,
+ 'user interface/preview splitter geometry': QtCore.QByteArray()
}
- __file_path__ = u''
+ __file_path__ = ''
__obsolete_settings__ = [
# Changed during 1.9.x development.
- (u'bibles/bookname language', u'bibles/book name language', []),
- (u'general/enable slide loop', u'advanced/slide limits', [(SlideLimits.Wrap, True), (SlideLimits.End, False)]),
- (u'songs/ccli number', u'core/ccli number', []),
- (u'media/use phonon', u'', []),
+ ('bibles/bookname language', 'bibles/book name language', []),
+ ('general/enable slide loop', 'advanced/slide limits', [(SlideLimits.Wrap, True), (SlideLimits.End, False)]),
+ ('songs/ccli number', 'core/ccli number', []),
+ ('media/use phonon', '', []),
# Changed during 2.1.x development.
- (u'advanced/stylesheet fix', u'', []),
- (u'bibles/last directory 1', u'bibles/last directory import', []),
- (u'media/background color', u'players/background color', []),
- (u'themes/last directory', u'themes/last directory import', []),
- (u'themes/last directory 1', u'themes/last directory export', []),
- (u'songs/last directory 1', u'songs/last directory import', []),
- (u'songusage/last directory 1', u'songusage/last directory export', []),
- (u'user interface/mainwindow splitter geometry', u'user interface/main window splitter geometry', []),
- (u'shortcuts/makeLive', u'shortcuts/make_live', []),
- (u'general/audio repeat list', u'core/audio repeat list', []),
- (u'general/auto open', u'core/auto open', []),
- (u'general/auto preview', u'core/auto preview', []),
- (u'general/audio start paused', u'core/audio start paused', []),
- (u'general/auto unblank', u'core/auto unblank', []),
- (u'general/blank warning', u'core/blank warning', []),
- (u'general/ccli number', u'core/ccli number', []),
- (u'general/has run wizard', u'core/has run wizard', []),
- (u'general/language', u'core/language', []),
- (u'general/last version test', u'core/last version test', []),
- (u'general/loop delay', u'core/loop delay', []),
- (u'general/recent files', u'core/recent files', []),
- (u'general/save prompt', u'core/save prompt', []),
- (u'general/screen blank', u'core/screen blank', []),
- (u'general/show splash', u'core/show splash', []),
- (u'general/songselect password', u'core/songselect password', []),
- (u'general/songselect username', u'core/songselect username', []),
- (u'general/update check', u'core/update check', []),
- (u'general/view mode', u'core/view mode', []),
- (u'general/display on monitor', u'core/display on monitor', []),
- (u'general/override position', u'core/override position', []),
- (u'general/x position', u'core/x position', []),
- (u'general/y position', u'core/y position', []),
- (u'general/monitor', u'core/monitor', []),
- (u'general/height', u'core/height', []),
- (u'general/monitor', u'core/monitor', []),
- (u'general/width', u'core/width', [])
+ ('advanced/stylesheet fix', '', []),
+ ('bibles/last directory 1', 'bibles/last directory import', []),
+ ('media/background color', 'players/background color', []),
+ ('themes/last directory', 'themes/last directory import', []),
+ ('themes/last directory 1', 'themes/last directory export', []),
+ ('songs/last directory 1', 'songs/last directory import', []),
+ ('songusage/last directory 1', 'songusage/last directory export', []),
+ ('user interface/mainwindow splitter geometry', 'user interface/main window splitter geometry', []),
+ ('shortcuts/makeLive', 'shortcuts/make_live', []),
+ ('general/audio repeat list', 'core/audio repeat list', []),
+ ('general/auto open', 'core/auto open', []),
+ ('general/auto preview', 'core/auto preview', []),
+ ('general/audio start paused', 'core/audio start paused', []),
+ ('general/auto unblank', 'core/auto unblank', []),
+ ('general/blank warning', 'core/blank warning', []),
+ ('general/ccli number', 'core/ccli number', []),
+ ('general/has run wizard', 'core/has run wizard', []),
+ ('general/language', 'core/language', []),
+ ('general/last version test', 'core/last version test', []),
+ ('general/loop delay', 'core/loop delay', []),
+ ('general/recent files', 'core/recent files', []),
+ ('general/save prompt', 'core/save prompt', []),
+ ('general/screen blank', 'core/screen blank', []),
+ ('general/show splash', 'core/show splash', []),
+ ('general/songselect password', 'core/songselect password', []),
+ ('general/songselect username', 'core/songselect username', []),
+ ('general/update check', 'core/update check', []),
+ ('general/view mode', 'core/view mode', []),
+ ('general/display on monitor', 'core/display on monitor', []),
+ ('general/override position', 'core/override position', []),
+ ('general/x position', 'core/x position', []),
+ ('general/y position', 'core/y position', []),
+ ('general/monitor', 'core/monitor', []),
+ ('general/height', 'core/height', []),
+ ('general/monitor', 'core/monitor', []),
+ ('general/width', 'core/width', [])
]
@staticmethod
@@ -354,7 +354,7 @@
``default_values``
A dict with setting keys and their default values.
"""
- Settings.__default_settings__ = dict(default_values.items() + Settings.__default_settings__.items())
+ Settings.__default_settings__ = dict(list(default_values.items()) + list(Settings.__default_settings__.items()))
@staticmethod
def set_filename(ini_file):
@@ -372,7 +372,7 @@
"""
# Make sure the string is translated (when building the dict the string is not translated because the translate
# function was not set up as this stage).
- Settings.__default_settings__[u'advanced/default service name'] = UiStrings().DefaultServiceName
+ Settings.__default_settings__['advanced/default service name'] = UiStrings().DefaultServiceName
def __init__(self, *args):
"""
@@ -388,7 +388,7 @@
Get the default value of the given key
"""
if self.group():
- key = self.group() + u'/' + key
+ key = self.group() + '/' + key
return Settings.__default_settings__[key]
def remove_obsolete_settings(self):
@@ -427,7 +427,7 @@
"""
# if group() is not empty the group has not been specified together with the key.
if self.group():
- default_value = Settings.__default_settings__[self.group() + u'/' + key]
+ default_value = Settings.__default_settings__[self.group() + '/' + key]
else:
default_value = Settings.__default_settings__[key]
setting = super(Settings, self).value(key, default_value)
@@ -454,8 +454,8 @@
if setting is None:
# An empty string saved to the settings results in a None type being returned.
# Convert it to empty unicode string.
- if isinstance(default_value, unicode):
- return u''
+ if isinstance(default_value, str):
+ return ''
# An empty list saved to the settings results in a None type being returned.
else:
return []
@@ -464,7 +464,7 @@
if isinstance(setting, bool):
return setting
# Sometimes setting is string instead of a boolean.
- return setting == u'true'
+ return setting == 'true'
if isinstance(default_value, int):
return int(setting)
return setting
@@ -484,16 +484,16 @@
# Do NOT do this anywhere else!
settings = QtCore.QSettings(self.fileName(), Settings.IniFormat)
settings.beginGroup(plugin.settings_section)
- if settings.contains(u'%s count' % plugin.name):
+ if settings.contains('%s count' % plugin.name):
# Get the count.
- list_count = int(settings.value(u'%s count' % plugin.name, 0))
+ list_count = int(settings.value('%s count' % plugin.name, 0))
if list_count:
for counter in range(list_count):
# The keys were named e. g.: "image 0"
- item = settings.value(u'%s %d' % (plugin.name, counter), u'')
+ item = settings.value('%s %d' % (plugin.name, counter), '')
if item:
files_list.append(item)
- settings.remove(u'%s %d' % (plugin.name, counter))
- settings.remove(u'%s count' % plugin.name)
+ settings.remove('%s %d' % (plugin.name, counter))
+ settings.remove('%s count' % plugin.name)
settings.endGroup()
return files_list
=== modified file 'openlp/core/lib/settingstab.py'
--- openlp/core/lib/settingstab.py 2013-07-18 11:23:59 +0000
+++ openlp/core/lib/settingstab.py 2013-08-31 18:18:25 +0000
@@ -30,7 +30,7 @@
The :mod:`~openlp.core.lib.settingstab` module contains the base SettingsTab class which plugins use for adding their
own tab to the settings dialog.
"""
-from __future__ import division
+
from PyQt4 import QtGui
@@ -69,18 +69,18 @@
Setup the tab's interface.
"""
self.tab_layout = QtGui.QHBoxLayout(self)
- self.tab_layout.setObjectName(u'tab_layout')
+ self.tab_layout.setObjectName('tab_layout')
self.left_column = QtGui.QWidget(self)
- self.left_column.setObjectName(u'left_column')
+ self.left_column.setObjectName('left_column')
self.left_layout = QtGui.QVBoxLayout(self.left_column)
self.left_layout.setMargin(0)
- self.left_layout.setObjectName(u'left_layout')
+ self.left_layout.setObjectName('left_layout')
self.tab_layout.addWidget(self.left_column)
self.right_column = QtGui.QWidget(self)
- self.right_column.setObjectName(u'right_column')
+ self.right_column.setObjectName('right_column')
self.right_layout = QtGui.QVBoxLayout(self.right_column)
self.right_layout.setMargin(0)
- self.right_layout.setObjectName(u'right_layout')
+ self.right_layout.setObjectName('right_layout')
self.tab_layout.addWidget(self.right_column)
def resizeEvent(self, event=None):
@@ -145,8 +145,8 @@
"""
Adds the service manager to the class dynamically
"""
- if not hasattr(self, u'_service_manager'):
- self._service_manager = Registry().get(u'service_manager')
+ if not hasattr(self, '_service_manager'):
+ self._service_manager = Registry().get('service_manager')
return self._service_manager
service_manager = property(_get_service_manager)
@@ -155,8 +155,8 @@
"""
Adds the main window to the class dynamically
"""
- if not hasattr(self, u'_main_window'):
- self._main_window = Registry().get(u'main_window')
+ if not hasattr(self, '_main_window'):
+ self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
@@ -165,8 +165,8 @@
"""
Adds the Renderer to the class dynamically
"""
- if not hasattr(self, u'_renderer'):
- self._renderer = Registry().get(u'renderer')
+ if not hasattr(self, '_renderer'):
+ self._renderer = Registry().get('renderer')
return self._renderer
renderer = property(_get_renderer)
@@ -175,8 +175,8 @@
"""
Adds the theme manager to the class dynamically
"""
- if not hasattr(self, u'_theme_manager'):
- self._theme_manager = Registry().get(u'theme_manager')
+ if not hasattr(self, '_theme_manager'):
+ self._theme_manager = Registry().get('theme_manager')
return self._theme_manager
theme_manager = property(_get_theme_manager)
@@ -185,8 +185,8 @@
"""
Adds the media controller to the class dynamically
"""
- if not hasattr(self, u'_media_controller'):
- self._media_controller = Registry().get(u'media_controller')
+ if not hasattr(self, '_media_controller'):
+ self._media_controller = Registry().get('media_controller')
return self._media_controller
media_controller = property(_get_media_controller)
@@ -195,8 +195,8 @@
"""
Adds the plugin manager to the class dynamically
"""
- if not hasattr(self, u'_settings_form'):
- self._settings_form = Registry().get(u'settings_form')
+ if not hasattr(self, '_settings_form'):
+ self._settings_form = Registry().get('settings_form')
return self._settings_form
settings_form = property(_get_settings_form)
=== modified file 'openlp/core/lib/spelltextedit.py'
--- openlp/core/lib/spelltextedit.py 2013-07-18 19:04:38 +0000
+++ openlp/core/lib/spelltextedit.py 2013-08-31 18:18:25 +0000
@@ -70,7 +70,7 @@
self.highlighter.spelling_dictionary = self.dictionary
except (Error, DictNotFoundError):
ENCHANT_AVAILABLE = False
- log.debug(u'Could not load default dictionary')
+ log.debug('Could not load default dictionary')
def mousePressEvent(self, event):
"""
@@ -117,7 +117,7 @@
tag_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Formatting Tags'))
if self.formatting_tags_allowed:
for html in FormattingTags.get_html_tags():
- action = SpellAction(html[u'desc'], tag_menu)
+ action = SpellAction(html['desc'], tag_menu)
action.correct.connect(self.html_tag)
tag_menu.addAction(action)
popup_menu.insertSeparator(popup_menu.actions()[0])
@@ -151,27 +151,27 @@
Replaces the selected text with word.
"""
for html in FormattingTags.get_html_tags():
- if tag == html[u'desc']:
+ if tag == html['desc']:
cursor = self.textCursor()
if self.textCursor().hasSelection():
text = cursor.selectedText()
cursor.beginEditBlock()
cursor.removeSelectedText()
- cursor.insertText(html[u'start tag'])
+ cursor.insertText(html['start tag'])
cursor.insertText(text)
- cursor.insertText(html[u'end tag'])
+ cursor.insertText(html['end tag'])
cursor.endEditBlock()
else:
cursor = self.textCursor()
- cursor.insertText(html[u'start tag'])
- cursor.insertText(html[u'end tag'])
+ cursor.insertText(html['start tag'])
+ cursor.insertText(html['end tag'])
class Highlighter(QtGui.QSyntaxHighlighter):
"""
Provides a text highlighter for pointing out spelling errors in text.
"""
- WORDS = u'(?iu)[\w\']+'
+ WORDS = '(?iu)[\w\']+'
def __init__(self, *args):
"""
@@ -186,7 +186,7 @@
"""
if not self.spelling_dictionary:
return
- text = unicode(text)
+ text = str(text)
char_format = QtGui.QTextCharFormat()
char_format.setUnderlineColor(QtCore.Qt.red)
char_format.setUnderlineStyle(QtGui.QTextCharFormat.SpellCheckUnderline)
@@ -199,7 +199,7 @@
"""
A special QAction that returns the text in a signal.
"""
- correct = QtCore.pyqtSignal(unicode)
+ correct = QtCore.pyqtSignal(str)
def __init__(self, *args):
"""
=== modified file 'openlp/core/lib/theme.py'
--- openlp/core/lib/theme.py 2013-03-26 18:13:21 +0000
+++ openlp/core/lib/theme.py 2013-08-31 18:18:25 +0000
@@ -111,26 +111,26 @@
Return a string representation of a background type.
"""
if background_type == BackgroundType.Solid:
- return u'solid'
+ return 'solid'
elif background_type == BackgroundType.Gradient:
- return u'gradient'
+ return 'gradient'
elif background_type == BackgroundType.Image:
- return u'image'
+ return 'image'
elif background_type == BackgroundType.Transparent:
- return u'transparent'
+ return 'transparent'
@staticmethod
def from_string(type_string):
"""
Return a background type for the given string.
"""
- if type_string == u'solid':
+ if type_string == 'solid':
return BackgroundType.Solid
- elif type_string == u'gradient':
+ elif type_string == 'gradient':
return BackgroundType.Gradient
- elif type_string == u'image':
+ elif type_string == 'image':
return BackgroundType.Image
- elif type_string == u'transparent':
+ elif type_string == 'transparent':
return BackgroundType.Transparent
@@ -150,30 +150,30 @@
Return a string representation of a background gradient type.
"""
if gradient_type == BackgroundGradientType.Horizontal:
- return u'horizontal'
+ return 'horizontal'
elif gradient_type == BackgroundGradientType.Vertical:
- return u'vertical'
+ return 'vertical'
elif gradient_type == BackgroundGradientType.Circular:
- return u'circular'
+ return 'circular'
elif gradient_type == BackgroundGradientType.LeftTop:
- return u'leftTop'
+ return 'leftTop'
elif gradient_type == BackgroundGradientType.LeftBottom:
- return u'leftBottom'
+ return 'leftBottom'
@staticmethod
def from_string(type_string):
"""
Return a background gradient type for the given string.
"""
- if type_string == u'horizontal':
+ if type_string == 'horizontal':
return BackgroundGradientType.Horizontal
- elif type_string == u'vertical':
+ elif type_string == 'vertical':
return BackgroundGradientType.Vertical
- elif type_string == u'circular':
+ elif type_string == 'circular':
return BackgroundGradientType.Circular
- elif type_string == u'leftTop':
+ elif type_string == 'leftTop':
return BackgroundGradientType.LeftTop
- elif type_string == u'leftBottom':
+ elif type_string == 'leftBottom':
return BackgroundGradientType.LeftBottom
@@ -186,7 +186,7 @@
Center = 2
Justify = 3
- Names = [u'left', u'right', u'center', u'justify']
+ Names = ['left', 'right', 'center', 'justify']
class VerticalType(object):
@@ -197,21 +197,21 @@
Middle = 1
Bottom = 2
- Names = [u'top', u'middle', u'bottom']
-
-
-BOOLEAN_LIST = [u'bold', u'italics', u'override', u'outline', u'shadow', u'slide_transition']
-
-INTEGER_LIST = [u'size', u'line_adjustment', u'x', u'height', u'y', u'width', u'shadow_size', u'outline_size',
- u'horizontal_align', u'vertical_align', u'wrap_style']
+ Names = ['top', 'middle', 'bottom']
+
+
+BOOLEAN_LIST = ['bold', 'italics', 'override', 'outline', 'shadow', 'slide_transition']
+
+INTEGER_LIST = ['size', 'line_adjustment', 'x', 'height', 'y', 'width', 'shadow_size', 'outline_size',
+ 'horizontal_align', 'vertical_align', 'wrap_style']
class ThemeXML(object):
"""
A class to encapsulate the Theme XML.
"""
- FIRST_CAMEL_REGEX = re.compile(u'(.)([A-Z][a-z]+)')
- SECOND_CAMEL_REGEX = re.compile(u'([a-z0-9])([A-Z])')
+ FIRST_CAMEL_REGEX = re.compile('(.)([A-Z][a-z]+)')
+ SECOND_CAMEL_REGEX = re.compile('([a-z0-9])([A-Z])')
def __init__(self):
"""
@@ -228,7 +228,7 @@
``path``
The path name to be added.
"""
- if self.background_type == u'image':
+ if self.background_type == 'image':
if self.background_filename and path:
self.theme_name = self.theme_name.strip()
self.background_filename = self.background_filename.strip()
@@ -239,10 +239,10 @@
Create a new theme XML document.
"""
self.theme_xml = Document()
- self.theme = self.theme_xml.createElement(u'theme')
+ self.theme = self.theme_xml.createElement('theme')
self.theme_xml.appendChild(self.theme)
- self.theme.setAttribute(u'version', u'2.0')
- self.name = self.theme_xml.createElement(u'name')
+ self.theme.setAttribute('version', '2.0')
+ self.name = self.theme_xml.createElement('name')
text_node = self.theme_xml.createTextNode(name)
self.name.appendChild(text_node)
self.theme.appendChild(self.name)
@@ -251,8 +251,8 @@
"""
Add a transparent background.
"""
- background = self.theme_xml.createElement(u'background')
- background.setAttribute(u'type', u'transparent')
+ background = self.theme_xml.createElement('background')
+ background.setAttribute('type', 'transparent')
self.theme.appendChild(background)
def add_background_solid(self, bkcolor):
@@ -262,10 +262,10 @@
``bkcolor``
The color of the background.
"""
- background = self.theme_xml.createElement(u'background')
- background.setAttribute(u'type', u'solid')
+ background = self.theme_xml.createElement('background')
+ background.setAttribute('type', 'solid')
self.theme.appendChild(background)
- self.child_element(background, u'color', unicode(bkcolor))
+ self.child_element(background, 'color', str(bkcolor))
def add_background_gradient(self, startcolor, endcolor, direction):
"""
@@ -280,15 +280,15 @@
``direction``
The direction of the gradient.
"""
- background = self.theme_xml.createElement(u'background')
- background.setAttribute(u'type', u'gradient')
+ background = self.theme_xml.createElement('background')
+ background.setAttribute('type', 'gradient')
self.theme.appendChild(background)
# Create startColor element
- self.child_element(background, u'startColor', unicode(startcolor))
+ self.child_element(background, 'startColor', str(startcolor))
# Create endColor element
- self.child_element(background, u'endColor', unicode(endcolor))
+ self.child_element(background, 'endColor', str(endcolor))
# Create direction element
- self.child_element(background, u'direction', unicode(direction))
+ self.child_element(background, 'direction', str(direction))
def add_background_image(self, filename, borderColor):
"""
@@ -297,17 +297,17 @@
``filename``
The file name of the image.
"""
- background = self.theme_xml.createElement(u'background')
- background.setAttribute(u'type', u'image')
+ background = self.theme_xml.createElement('background')
+ background.setAttribute('type', 'image')
self.theme.appendChild(background)
# Create Filename element
- self.child_element(background, u'filename', filename)
+ self.child_element(background, 'filename', filename)
# Create endColor element
- self.child_element(background, u'borderColor', unicode(borderColor))
+ self.child_element(background, 'borderColor', str(borderColor))
- def add_font(self, name, color, size, override, fonttype=u'main', bold=u'False', italics=u'False',
- line_adjustment=0, xpos=0, ypos=0, width=0, height=0, outline=u'False', outline_color=u'#ffffff',
- outline_pixel=2, shadow=u'False', shadow_color=u'#ffffff', shadow_pixel=5):
+ def add_font(self, name, color, size, override, fonttype='main', bold='False', italics='False',
+ line_adjustment=0, xpos=0, ypos=0, width=0, height=0, outline='False', outline_color='#ffffff',
+ outline_pixel=2, shadow='False', shadow_color='#ffffff', shadow_pixel=5):
"""
Add a Font.
@@ -363,41 +363,41 @@
How big the Shadow is
"""
- background = self.theme_xml.createElement(u'font')
- background.setAttribute(u'type', fonttype)
+ background = self.theme_xml.createElement('font')
+ background.setAttribute('type', fonttype)
self.theme.appendChild(background)
# Create Font name element
- self.child_element(background, u'name', name)
+ self.child_element(background, 'name', name)
# Create Font color element
- self.child_element(background, u'color', unicode(color))
+ self.child_element(background, 'color', str(color))
# Create Proportion name element
- self.child_element(background, u'size', unicode(size))
+ self.child_element(background, 'size', str(size))
# Create weight name element
- self.child_element(background, u'bold', unicode(bold))
+ self.child_element(background, 'bold', str(bold))
# Create italics name element
- self.child_element(background, u'italics', unicode(italics))
+ self.child_element(background, 'italics', str(italics))
# Create indentation name element
- self.child_element(background, u'line_adjustment', unicode(line_adjustment))
+ self.child_element(background, 'line_adjustment', str(line_adjustment))
# Create Location element
- element = self.theme_xml.createElement(u'location')
- element.setAttribute(u'override', unicode(override))
- element.setAttribute(u'x', unicode(xpos))
- element.setAttribute(u'y', unicode(ypos))
- element.setAttribute(u'width', unicode(width))
- element.setAttribute(u'height', unicode(height))
+ element = self.theme_xml.createElement('location')
+ element.setAttribute('override', str(override))
+ element.setAttribute('x', str(xpos))
+ element.setAttribute('y', str(ypos))
+ element.setAttribute('width', str(width))
+ element.setAttribute('height', str(height))
background.appendChild(element)
# Shadow
- element = self.theme_xml.createElement(u'shadow')
- element.setAttribute(u'shadowColor', unicode(shadow_color))
- element.setAttribute(u'shadowSize', unicode(shadow_pixel))
- value = self.theme_xml.createTextNode(unicode(shadow))
+ element = self.theme_xml.createElement('shadow')
+ element.setAttribute('shadowColor', str(shadow_color))
+ element.setAttribute('shadowSize', str(shadow_pixel))
+ value = self.theme_xml.createTextNode(str(shadow))
element.appendChild(value)
background.appendChild(element)
# Outline
- element = self.theme_xml.createElement(u'outline')
- element.setAttribute(u'outlineColor', unicode(outline_color))
- element.setAttribute(u'outlineSize', unicode(outline_pixel))
- value = self.theme_xml.createTextNode(unicode(outline))
+ element = self.theme_xml.createElement('outline')
+ element.setAttribute('outlineColor', str(outline_color))
+ element.setAttribute('outlineSize', str(outline_pixel))
+ value = self.theme_xml.createTextNode(str(outline))
element.appendChild(value)
background.appendChild(element)
@@ -415,21 +415,21 @@
Whether the slide transition is active.
"""
- background = self.theme_xml.createElement(u'display')
+ background = self.theme_xml.createElement('display')
self.theme.appendChild(background)
# Horizontal alignment
- element = self.theme_xml.createElement(u'horizontalAlign')
- value = self.theme_xml.createTextNode(unicode(horizontal))
+ element = self.theme_xml.createElement('horizontalAlign')
+ value = self.theme_xml.createTextNode(str(horizontal))
element.appendChild(value)
background.appendChild(element)
# Vertical alignment
- element = self.theme_xml.createElement(u'verticalAlign')
- value = self.theme_xml.createTextNode(unicode(vertical))
+ element = self.theme_xml.createElement('verticalAlign')
+ value = self.theme_xml.createTextNode(str(vertical))
element.appendChild(value)
background.appendChild(element)
# Slide Transition
- element = self.theme_xml.createElement(u'slideTransition')
- value = self.theme_xml.createTextNode(unicode(transition))
+ element = self.theme_xml.createElement('slideTransition')
+ value = self.theme_xml.createTextNode(str(transition))
element.appendChild(value)
background.appendChild(element)
@@ -449,24 +449,24 @@
"""
current_screen = ScreenList().current
self.font_main_y = 0
- self.font_main_width = current_screen[u'size'].width() - 20
- self.font_main_height = current_screen[u'size'].height() * 9 / 10
- self.font_footer_width = current_screen[u'size'].width() - 20
- self.font_footer_y = current_screen[u'size'].height() * 9 / 10
- self.font_footer_height = current_screen[u'size'].height() / 10
+ self.font_main_width = current_screen['size'].width() - 20
+ self.font_main_height = current_screen['size'].height() * 9 / 10
+ self.font_footer_width = current_screen['size'].width() - 20
+ self.font_footer_y = current_screen['size'].height() * 9 / 10
+ self.font_footer_height = current_screen['size'].height() / 10
def dump_xml(self):
"""
Dump the XML to file used for debugging
"""
- return self.theme_xml.toprettyxml(indent=u' ')
+ return self.theme_xml.toprettyxml(indent=' ')
def extract_xml(self):
"""
Print out the XML string.
"""
self._build_xml_from_attrs()
- return self.theme_xml.toxml(u'utf-8').decode(u'utf-8')
+ return self.theme_xml.toxml('utf-8').decode('utf-8')
def extract_formatted_xml(self):
"""
@@ -482,7 +482,7 @@
``xml``
The XML string to parse.
"""
- self.parse_xml(unicode(xml))
+ self.parse_xml(str(xml))
def parse_xml(self, xml):
"""
@@ -492,31 +492,31 @@
The XML string to parse.
"""
# remove encoding string
- line = xml.find(u'?>')
+ line = xml.find('?>')
if line:
xml = xml[line + 2:]
try:
theme_xml = objectify.fromstring(xml)
except etree.XMLSyntaxError:
- log.exception(u'Invalid xml %s', xml)
+ log.exception('Invalid xml %s', xml)
return
xml_iter = theme_xml.getiterator()
for element in xml_iter:
- master = u''
- if element.tag == u'background':
+ master = ''
+ if element.tag == 'background':
if element.attrib:
for attr in element.attrib:
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']
+ if parent.tag == 'font':
+ master = parent.tag + '_' + parent.attrib['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 parent.tag == 'display':
+ if element.tag.startswith('shadow') or element.tag.startswith('outline'):
+ self._create_attr('font_main', element.tag, element.text)
master = parent.tag
- if parent.tag == u'background':
+ if parent.tag == 'background':
master = parent.tag
if master:
self._create_attr(master, element.tag, element.text)
@@ -524,13 +524,13 @@
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 == 'shadow' or element.tag == 'outline':
if not attr.startswith(element.tag):
- base_element = element.tag + u'_' + attr
+ base_element = element.tag + '_' + 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)
+ if element.tag == 'name':
+ self._create_attr('theme', element.tag, element.text)
def _translate_tags(self, master, element, value):
"""
@@ -538,21 +538,21 @@
"""
master = master.strip().lstrip()
element = element.strip().lstrip()
- value = unicode(value).strip().lstrip()
- if master == u'display':
- if element == u'wrapStyle':
+ value = str(value).strip().lstrip()
+ if master == 'display':
+ if element == 'wrapStyle':
return True, None, None, None
- if element.startswith(u'shadow') or element.startswith(u'outline'):
- master = u'font_main'
+ if element.startswith('shadow') or element.startswith('outline'):
+ master = 'font_main'
# fix bold font
- if element == u'weight':
- element = u'bold'
- if value == u'Normal':
+ if element == 'weight':
+ element = 'bold'
+ if value == 'Normal':
value = False
else:
value = True
- if element == u'proportion':
- element = u'size'
+ if element == 'proportion':
+ element = 'size'
return False, master, element, value
def _create_attr(self, master, element, value):
@@ -563,19 +563,19 @@
if reject:
return
field = self._de_hump(element)
- tag = master + u'_' + field
+ tag = master + '_' + field
if field in BOOLEAN_LIST:
setattr(self, tag, str_to_bool(value))
elif field in INTEGER_LIST:
setattr(self, tag, int(value))
else:
# make string value unicode
- if not isinstance(value, unicode):
- value = unicode(str(value), u'utf-8')
+ if not isinstance(value, str):
+ value = str(str(value), 'utf-8')
# None means an empty string so lets have one.
- if value == u'None':
- value = u''
- setattr(self, tag, unicode(value).strip().lstrip())
+ if value == 'None':
+ value = ''
+ setattr(self, tag, str(value).strip().lstrip())
def __str__(self):
"""
@@ -583,9 +583,9 @@
"""
theme_strings = []
for key in dir(self):
- if key[0:1] != u'_':
- theme_strings.append(u'%30s: %s' % (key, getattr(self, key)))
- return u'\n'.join(theme_strings)
+ if key[0:1] != '_':
+ theme_strings.append('%30s: %s' % (key, getattr(self, key)))
+ return '\n'.join(theme_strings)
def _de_hump(self, name):
"""
@@ -616,7 +616,7 @@
self.font_main_name,
self.font_main_color,
self.font_main_size,
- self.font_main_override, u'main',
+ self.font_main_override, 'main',
self.font_main_bold,
self.font_main_italics,
self.font_main_line_adjustment,
@@ -635,7 +635,7 @@
self.font_footer_name,
self.font_footer_color,
self.font_footer_size,
- self.font_footer_override, u'footer',
+ self.font_footer_override, 'footer',
self.font_footer_bold,
self.font_footer_italics,
0, # line adjustment
=== modified file 'openlp/core/lib/toolbar.py'
--- openlp/core/lib/toolbar.py 2013-07-18 11:23:59 +0000
+++ openlp/core/lib/toolbar.py 2013-08-31 18:18:25 +0000
@@ -51,7 +51,7 @@
# useful to be able to reuse button icons...
self.setIconSize(QtCore.QSize(20, 20))
self.actions = {}
- log.debug(u'Init done for %s' % parent.__class__.__name__)
+ log.debug('Init done for %s' % parent.__class__.__name__)
def add_toolbar_action(self, name, **kwargs):
"""
@@ -84,4 +84,4 @@
if handle in self.actions:
self.actions[handle].setVisible(visible)
else:
- log.warn(u'No handle "%s" in actions list.', unicode(handle))
+ log.warn('No handle "%s" in actions list.', str(handle))
=== modified file 'openlp/core/lib/treewidgetwithdnd.py'
--- openlp/core/lib/treewidgetwithdnd.py 2013-07-18 14:11:39 +0000
+++ openlp/core/lib/treewidgetwithdnd.py 2013-08-31 18:18:25 +0000
@@ -40,7 +40,7 @@
"""
Provide a tree widget to store objects and handle drag and drop events
"""
- def __init__(self, parent=None, name=u''):
+ def __init__(self, parent=None, name=''):
"""
Initialise the tree widget
"""
@@ -59,8 +59,8 @@
"""
self.setAcceptDrops(True)
self.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
- Registry().register_function((u'%s_dnd' % self.mimeDataText), self.parent().load_file)
- Registry().register_function((u'%s_dnd_internal' % self.mimeDataText), self.parent().dnd_move_internal)
+ Registry().register_function(('%s_dnd' % self.mimeDataText), self.parent().load_file)
+ Registry().register_function(('%s_dnd_internal' % self.mimeDataText), self.parent().dnd_move_internal)
def mouseMoveEvent(self, event):
"""
@@ -132,11 +132,11 @@
listing = os.listdir(local_file)
for file_name in listing:
files.append(os.path.join(local_file, file_name))
- Registry().execute(u'%s_dnd' % self.mimeDataText, {'files': files, 'target': self.itemAt(event.pos())})
+ Registry().execute('%s_dnd' % self.mimeDataText, {'files': files, 'target': self.itemAt(event.pos())})
elif self.allow_internal_dnd:
event.setDropAction(QtCore.Qt.CopyAction)
event.accept()
- Registry().execute(u'%s_dnd_internal' % self.mimeDataText, self.itemAt(event.pos()))
+ Registry().execute('%s_dnd_internal' % self.mimeDataText, self.itemAt(event.pos()))
else:
event.ignore()
=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py 2013-03-07 08:05:43 +0000
+++ openlp/core/lib/ui.py 2013-08-31 18:18:25 +0000
@@ -52,16 +52,16 @@
"""
parent.welcome_page = QtGui.QWizardPage()
parent.welcome_page.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(image))
- parent.welcome_page.setObjectName(u'welcome_page')
+ parent.welcome_page.setObjectName('welcome_page')
parent.welcome_layout = QtGui.QVBoxLayout(parent.welcome_page)
- parent.welcome_layout.setObjectName(u'WelcomeLayout')
+ parent.welcome_layout.setObjectName('WelcomeLayout')
parent.title_label = QtGui.QLabel(parent.welcome_page)
- parent.title_label.setObjectName(u'title_label')
+ parent.title_label.setObjectName('title_label')
parent.welcome_layout.addWidget(parent.title_label)
parent.welcome_layout.addSpacing(40)
parent.information_label = QtGui.QLabel(parent.welcome_page)
parent.information_label.setWordWrap(True)
- parent.information_label.setObjectName(u'information_label')
+ parent.information_label.setObjectName('information_label')
parent.welcome_layout.addWidget(parent.information_label)
parent.welcome_layout.addStretch()
parent.addPage(parent.welcome_page)
@@ -89,15 +89,15 @@
if custom_buttons is None:
custom_buttons = []
buttons = QtGui.QDialogButtonBox.NoButton
- if u'ok' in standard_buttons:
+ if 'ok' in standard_buttons:
buttons |= QtGui.QDialogButtonBox.Ok
- if u'save' in standard_buttons:
+ if 'save' in standard_buttons:
buttons |= QtGui.QDialogButtonBox.Save
- if u'cancel' in standard_buttons:
+ if 'cancel' in standard_buttons:
buttons |= QtGui.QDialogButtonBox.Cancel
- if u'close' in standard_buttons:
+ if 'close' in standard_buttons:
buttons |= QtGui.QDialogButtonBox.Close
- if u'defaults' in standard_buttons:
+ if 'defaults' in standard_buttons:
buttons |= QtGui.QDialogButtonBox.RestoreDefaults
button_box = QtGui.QDialogButtonBox(dialog)
button_box.setObjectName(name)
@@ -131,7 +131,7 @@
if question:
return QtGui.QMessageBox.critical(parent, UiStrings().Error, message,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
- return Registry().get(u'main_window').error_message(title if title else UiStrings().Error, message)
+ return Registry().get('main_window').error_message(title if title else UiStrings().Error, message)
def create_horizontal_adjusting_combo_box(parent, name):
@@ -177,37 +177,37 @@
``enabled``
False in case the button should be disabled.
"""
- if u'role' in 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.'))
- 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.'))
- 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.'))
+ if 'role' in kwargs:
+ role = kwargs.pop('role')
+ if role == 'delete':
+ kwargs.setdefault('text', UiStrings().Delete)
+ kwargs.setdefault('tooltip', translate('OpenLP.Ui', 'Delete the selected item.'))
+ elif role == 'up':
+ kwargs.setdefault('icon', ':/services/service_up.png')
+ kwargs.setdefault('tooltip', translate('OpenLP.Ui', 'Move selection up one position.'))
+ elif role == 'down':
+ kwargs.setdefault('icon', ':/services/service_down.png')
+ kwargs.setdefault('tooltip', translate('OpenLP.Ui', 'Move selection down one position.'))
else:
- log.warn(u'The role "%s" is not defined in create_push_button().', role)
- if kwargs.pop(u'class', u'') == u'toolbutton':
+ log.warn('The role "%s" is not defined in create_push_button().', role)
+ if kwargs.pop('class', '') == 'toolbutton':
button = QtGui.QToolButton(parent)
else:
button = QtGui.QPushButton(parent)
button.setObjectName(name)
- if kwargs.get(u'text'):
- button.setText(kwargs.pop(u'text'))
- if kwargs.get(u'icon'):
- button.setIcon(build_icon(kwargs.pop(u'icon')))
- if kwargs.get(u'tooltip'):
- button.setToolTip(kwargs.pop(u'tooltip'))
- if not kwargs.pop(u'enabled', True):
+ if kwargs.get('text'):
+ button.setText(kwargs.pop('text'))
+ if kwargs.get('icon'):
+ button.setIcon(build_icon(kwargs.pop('icon')))
+ if kwargs.get('tooltip'):
+ button.setToolTip(kwargs.pop('tooltip'))
+ if not kwargs.pop('enabled', True):
button.setEnabled(False)
- if kwargs.get(u'click'):
- button.clicked.connect(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)
+ if kwargs.get('click'):
+ button.clicked.connect(kwargs.pop('click'))
+ for key in list(kwargs.keys()):
+ if key not in ['text', 'icon', 'tooltip', 'click']:
+ log.warn('Parameter %s was not consumed in create_button().', key)
return button
@@ -265,45 +265,45 @@
"""
action = QtGui.QAction(parent)
action.setObjectName(name)
- if kwargs.get(u'text'):
- action.setText(kwargs.pop(u'text'))
- if kwargs.get(u'icon'):
- action.setIcon(build_icon(kwargs.pop(u'icon')))
- if kwargs.get(u'tooltip'):
- action.setToolTip(kwargs.pop(u'tooltip'))
- if kwargs.get(u'statustip'):
- action.setStatusTip(kwargs.pop(u'statustip'))
- if kwargs.get(u'checked') is not None:
+ if kwargs.get('text'):
+ action.setText(kwargs.pop('text'))
+ if kwargs.get('icon'):
+ action.setIcon(build_icon(kwargs.pop('icon')))
+ if kwargs.get('tooltip'):
+ action.setToolTip(kwargs.pop('tooltip'))
+ if kwargs.get('statustip'):
+ action.setStatusTip(kwargs.pop('statustip'))
+ if kwargs.get('checked') is not None:
action.setCheckable(True)
- action.setChecked(kwargs.pop(u'checked'))
- if not kwargs.pop(u'enabled', True):
+ action.setChecked(kwargs.pop('checked'))
+ if not kwargs.pop('enabled', True):
action.setEnabled(False)
- if not kwargs.pop(u'visible', True):
+ if not kwargs.pop('visible', True):
action.setVisible(False)
- if kwargs.pop(u'separator', False):
+ if kwargs.pop('separator', False):
action.setSeparator(True)
- if u'data' in kwargs:
- action.setData(kwargs.pop(u'data'))
- if kwargs.pop(u'can_shortcuts', False):
+ if 'data' in kwargs:
+ action.setData(kwargs.pop('data'))
+ if kwargs.pop('can_shortcuts', False):
action_list = ActionList.get_instance()
- action_list.add_action(action, kwargs.pop(u'category', None))
- if u'context' in kwargs:
- action.setShortcutContext(kwargs.pop(u'context'))
- if kwargs.get(u'triggers'):
- action.triggered.connect(kwargs.pop(u'triggers'))
- for key in kwargs.keys():
- if key not in [u'text', u'icon', u'tooltip', u'statustip', u'checked', u'can_shortcuts',
- u'category', u'triggers']:
- log.warn(u'Parameter %s was not consumed in create_action().', key)
+ action_list.add_action(action, kwargs.pop('category', None))
+ if 'context' in kwargs:
+ action.setShortcutContext(kwargs.pop('context'))
+ if kwargs.get('triggers'):
+ action.triggered.connect(kwargs.pop('triggers'))
+ for key in list(kwargs.keys()):
+ if key not in ['text', 'icon', 'tooltip', 'statustip', 'checked', 'can_shortcuts',
+ 'category', 'triggers']:
+ log.warn('Parameter %s was not consumed in create_action().', key)
return action
-def create_widget_action(parent, name=u'', **kwargs):
+def create_widget_action(parent, name='', **kwargs):
"""
Return a new QAction by calling ``create_action(parent, name, **kwargs)``. The shortcut context defaults to
``QtCore.Qt.WidgetShortcut`` and the action is added to the parents action list.
"""
- kwargs.setdefault(u'context', QtCore.Qt.WidgetShortcut)
+ kwargs.setdefault('context', QtCore.Qt.WidgetShortcut)
action = create_action(parent, name, **kwargs)
parent.addAction(action)
return action
=== modified file 'openlp/core/resources.py'
--- openlp/core/resources.py 2013-04-06 10:20:17 +0000
+++ openlp/core/resources.py 2013-08-31 18:18:25 +0000
@@ -32,7 +32,7 @@
"""
from PyQt4 import QtCore
-qt_resource_data = "\
+qt_resource_data = b"\
\x00\x00\x02\xfa\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
@@ -82089,7 +82089,7 @@
\x60\x82\
"
-qt_resource_name = "\
+qt_resource_name = b"\
\x00\x07\
\x00\x47\x69\x53\
\x00\x69\
@@ -82757,7 +82757,7 @@
\x00\x6d\x00\x70\x00\x6f\x00\x72\x00\x74\x00\x5f\x00\x6c\x00\x6f\x00\x61\x00\x64\x00\x2e\x00\x70\x00\x6e\x00\x67\
"
-qt_resource_struct = "\
+qt_resource_struct = b"\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x13\x00\x00\x00\x01\
\x00\x00\x00\xe6\x00\x02\x00\x00\x00\x06\x00\x00\x00\x8c\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x04\x00\x00\x00\x88\
=== modified file 'openlp/core/theme/theme.py'
--- openlp/core/theme/theme.py 2013-02-02 21:16:42 +0000
+++ openlp/core/theme/theme.py 2013-08-31 18:18:25 +0000
@@ -37,22 +37,22 @@
from PyQt4 import QtGui
DELPHI_COLORS = {
- u'clAqua': 0x00FFFF,
- u'clBlack': 0x000000,
- u'clBlue': 0x0000FF,
- u'clFuchsia': 0xFF00FF,
- u'clGray': 0x808080,
- u'clGreen': 0x008000,
- u'clLime': 0x00FF00,
- u'clMaroon': 0x800000,
- u'clNavy': 0x000080,
- u'clOlive': 0x808000,
- u'clPurple': 0x800080,
- u'clRed': 0xFF0000,
- u'clSilver': 0xC0C0C0,
- u'clTeal': 0x008080,
- u'clWhite': 0xFFFFFF,
- u'clYellow': 0xFFFF00
+ 'clAqua': 0x00FFFF,
+ 'clBlack': 0x000000,
+ 'clBlue': 0x0000FF,
+ 'clFuchsia': 0xFF00FF,
+ 'clGray': 0x808080,
+ 'clGreen': 0x008000,
+ 'clLime': 0x00FF00,
+ 'clMaroon': 0x800000,
+ 'clNavy': 0x000080,
+ 'clOlive': 0x808000,
+ 'clPurple': 0x800080,
+ 'clRed': 0xFF0000,
+ 'clSilver': 0xC0C0C0,
+ 'clTeal': 0x008080,
+ 'clWhite': 0xFFFFFF,
+ 'clYellow': 0xFFFF00
}
BLANK_STYLE_XML = \
@@ -195,9 +195,9 @@
keys = dir(self)
keys.sort()
for key in keys:
- if key[0:1] != u'_':
- theme_strings.append(u'_%s_' % (getattr(self, key)))
- return u''.join(theme_strings)
+ if key[0:1] != '_':
+ theme_strings.append('_%s_' % (getattr(self, key)))
+ return ''.join(theme_strings)
def _set_from_xml(self, xml):
"""
@@ -206,18 +206,18 @@
``xml``
The data to apply to the theme
"""
- root = ElementTree(element=XML(xml.encode(u'ascii', u'xmlcharrefreplace')))
+ root = ElementTree(element=XML(xml.encode('ascii', 'xmlcharrefreplace')))
xml_iter = root.getiterator()
for element in xml_iter:
delphi_color_change = False
- if element.tag != u'Theme':
+ if element.tag != 'Theme':
element_text = element.text
val = 0
if element_text is None:
val = element_text
# strings need special handling to sort the colours out
- if isinstance(element_text, basestring):
- if element_text[0] == u'$':
+ if isinstance(element_text, str):
+ if element_text[0] == '$':
# might be a hex number
try:
val = int(element_text[1:], 16)
@@ -232,7 +232,7 @@
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('Color') > 0 or (element.tag.find('BackgroundParameter') == 0 and
isinstance(val, int))):
# convert to a wx.Colour
if not delphi_color_change:
@@ -247,6 +247,6 @@
"""
theme_strings = []
for key in dir(self):
- if key[0:1] != u'_':
- theme_strings.append(u'%30s : %s' % (key, getattr(self, key)))
- return u'\n'.join(theme_strings)
+ if key[0:1] != '_':
+ theme_strings.append('%30s : %s' % (key, getattr(self, key)))
+ return '\n'.join(theme_strings)
=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py 2013-04-15 18:01:59 +0000
+++ openlp/core/ui/__init__.py 2013-08-31 18:18:25 +0000
@@ -77,28 +77,28 @@
Plugin = 2
-from firsttimeform import FirstTimeForm
-from firsttimelanguageform import FirstTimeLanguageForm
-from themelayoutform import ThemeLayoutForm
-from themeform import ThemeForm
-from filerenameform import FileRenameForm
-from starttimeform import StartTimeForm
-from maindisplay import MainDisplay, Display
-from servicenoteform import ServiceNoteForm
-from serviceitemeditform import ServiceItemEditForm
-from slidecontroller import SlideController, DisplayController
-from splashscreen import SplashScreen
-from generaltab import GeneralTab
-from themestab import ThemesTab
-from advancedtab import AdvancedTab
-from aboutform import AboutForm
-from pluginform import PluginForm
-from settingsform import SettingsForm
-from formattingtagform import FormattingTagForm
-from shortcutlistform import ShortcutListForm
-from mediadockmanager import MediaDockManager
-from servicemanager import ServiceManager
-from thememanager import ThemeManager
+from .firsttimeform import FirstTimeForm
+from .firsttimelanguageform import FirstTimeLanguageForm
+from .themelayoutform import ThemeLayoutForm
+from .themeform import ThemeForm
+from .filerenameform import FileRenameForm
+from .starttimeform import StartTimeForm
+from .maindisplay import MainDisplay, Display
+from .servicenoteform import ServiceNoteForm
+from .serviceitemeditform import ServiceItemEditForm
+from .slidecontroller import SlideController, DisplayController
+from .splashscreen import SplashScreen
+from .generaltab import GeneralTab
+from .themestab import ThemesTab
+from .advancedtab import AdvancedTab
+from .aboutform import AboutForm
+from .pluginform import PluginForm
+from .settingsform import SettingsForm
+from .formattingtagform import FormattingTagForm
+from .shortcutlistform import ShortcutListForm
+from .mediadockmanager import MediaDockManager
+from .servicemanager import ServiceManager
+from .thememanager import ThemeManager
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay', 'SlideController', 'ServiceManager',
'ThemeManager', 'MediaDockManager', 'ServiceItemEditForm', 'FirstTimeForm', 'FirstTimeLanguageForm', 'ThemeForm',
=== modified file 'openlp/core/ui/aboutdialog.py'
--- openlp/core/ui/aboutdialog.py 2013-06-01 18:16:34 +0000
+++ openlp/core/ui/aboutdialog.py 2013-08-31 18:18:25 +0000
@@ -42,46 +42,46 @@
"""
Set up the UI for the dialog.
"""
- about_dialog.setObjectName(u'about_dialog')
- about_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
+ about_dialog.setObjectName('about_dialog')
+ about_dialog.setWindowIcon(build_icon(':/icon/openlp-logo-16x16.png'))
self.about_dialog_layout = QtGui.QVBoxLayout(about_dialog)
- self.about_dialog_layout.setObjectName(u'about_dialog_layout')
+ self.about_dialog_layout.setObjectName('about_dialog_layout')
self.logo_label = QtGui.QLabel(about_dialog)
- self.logo_label.setPixmap(QtGui.QPixmap(u':/graphics/openlp-about-logo.png'))
- self.logo_label.setObjectName(u'logo_label')
+ self.logo_label.setPixmap(QtGui.QPixmap(':/graphics/openlp-about-logo.png'))
+ self.logo_label.setObjectName('logo_label')
self.about_dialog_layout.addWidget(self.logo_label)
self.about_notebook = QtGui.QTabWidget(about_dialog)
- self.about_notebook.setObjectName(u'about_notebook')
+ self.about_notebook.setObjectName('about_notebook')
self.about_tab = QtGui.QWidget()
- self.about_tab.setObjectName(u'about_tab')
+ self.about_tab.setObjectName('about_tab')
self.about_tab_layout = QtGui.QVBoxLayout(self.about_tab)
- self.about_tab_layout.setObjectName(u'about_tab_layout')
+ self.about_tab_layout.setObjectName('about_tab_layout')
self.about_text_edit = QtGui.QPlainTextEdit(self.about_tab)
self.about_text_edit.setReadOnly(True)
- self.about_text_edit.setObjectName(u'about_text_edit')
+ self.about_text_edit.setObjectName('about_text_edit')
self.about_tab_layout.addWidget(self.about_text_edit)
- self.about_notebook.addTab(self.about_tab, u'')
+ self.about_notebook.addTab(self.about_tab, '')
self.credits_tab = QtGui.QWidget()
- self.credits_tab.setObjectName(u'credits_tab')
+ self.credits_tab.setObjectName('credits_tab')
self.credits_tab_layout = QtGui.QVBoxLayout(self.credits_tab)
- self.credits_tab_layout.setObjectName(u'credits_tab_layout')
+ self.credits_tab_layout.setObjectName('credits_tab_layout')
self.credits_text_edit = QtGui.QPlainTextEdit(self.credits_tab)
self.credits_text_edit.setReadOnly(True)
- self.credits_text_edit.setObjectName(u'credits_text_edit')
+ self.credits_text_edit.setObjectName('credits_text_edit')
self.credits_tab_layout.addWidget(self.credits_text_edit)
- self.about_notebook.addTab(self.credits_tab, u'')
+ self.about_notebook.addTab(self.credits_tab, '')
self.license_tab = QtGui.QWidget()
- self.license_tab.setObjectName(u'license_tab')
+ self.license_tab.setObjectName('license_tab')
self.license_tab_layout = QtGui.QVBoxLayout(self.license_tab)
- self.license_tab_layout.setObjectName(u'license_tab_layout')
+ self.license_tab_layout.setObjectName('license_tab_layout')
self.license_text_edit = QtGui.QPlainTextEdit(self.license_tab)
self.license_text_edit.setReadOnly(True)
- self.license_text_edit.setObjectName(u'license_text_edit')
+ self.license_text_edit.setObjectName('license_text_edit')
self.license_tab_layout.addWidget(self.license_text_edit)
- self.about_notebook.addTab(self.license_tab, u'')
+ self.about_notebook.addTab(self.license_tab, '')
self.about_dialog_layout.addWidget(self.about_notebook)
- self.volunteer_button = create_button(None, u'volunteer_button', icon=u':/system/system_volunteer.png')
- self.button_box = create_button_box(about_dialog, u'button_box', [u'close'], [self.volunteer_button])
+ self.volunteer_button = create_button(None, 'volunteer_button', icon=':/system/system_volunteer.png')
+ self.button_box = create_button_box(about_dialog, 'button_box', ['close'], [self.volunteer_button])
self.about_dialog_layout.addWidget(self.button_box)
self.retranslateUi(about_dialog)
self.about_notebook.setCurrentIndex(0)
@@ -90,7 +90,7 @@
"""
Dynamically translate the UI.
"""
- about_dialog.setWindowTitle(u'%s OpenLP' % UiStrings().About)
+ about_dialog.setWindowTitle('%s OpenLP' % UiStrings().About)
self.about_text_edit.setPlainText(translate('OpenLP.AboutForm',
'OpenLP <version><revision> - Open Source Lyrics '
'Projection\n'
@@ -108,63 +108,63 @@
'consider volunteering by using the button below.'
))
self.about_notebook.setTabText(self.about_notebook.indexOf(self.about_tab), UiStrings().About)
- lead = u'Raoul "superfly" Snyman'
- developers = [u'Tim "TRB143" Bentley', u'Jonathan "gushie" Corwin',
- u'Michael "cocooncrash" Gorven',
- u'Andreas "googol" Preikschat', u'Raoul "superfly" Snyman',
- u'Martin "mijiti" Thompson', u'Jon "Meths" Tibble']
- contributors = [u'Gerald "jerryb" Britton',
- u'Samuel "MrGamgee" Findlay', u'Scott "sguerrieri" Guerrieri',
- u'Matthias "matthub" Hub', u'Meinert "m2j" Jordan',
- u'Armin "orangeshirt" K\xf6hler', u'Erik "luen" Lundin',
- u'Edwin "edwinlunando" Lunando', u'Brian "brianmeyer" Meyer',
- u'Joshua "milleja46" Miller', u'Stevan "ElderP" Pettit',
- u'Mattias "mahfiaz" P\xf5ldaru', u'Christian "crichter" Richter',
- u'Philip "Phill" Ridout', u'Simon "samscudder" Scudder',
- u'Jeffrey "whydoubt" Smith', u'Maikel Stuivenberg',
- u'Dave "Dave42W" Warnock', u'Frode "frodus" Woldsund',
- u'Martin "matysek" Zibricky', u'Patrick "mohij" Zimmermann']
- testers = [u'Philip "Phill" Ridout', u'Wesley "wrst" Stout',
- u'John "jseagull1" Cegalis (lead)']
+ lead = 'Raoul "superfly" Snyman'
+ developers = ['Tim "TRB143" Bentley', 'Jonathan "gushie" Corwin',
+ 'Michael "cocooncrash" Gorven',
+ 'Andreas "googol" Preikschat', 'Raoul "superfly" Snyman',
+ 'Martin "mijiti" Thompson', 'Jon "Meths" Tibble']
+ contributors = ['Gerald "jerryb" Britton',
+ 'Samuel "MrGamgee" Findlay', 'Scott "sguerrieri" Guerrieri',
+ 'Matthias "matthub" Hub', 'Meinert "m2j" Jordan',
+ 'Armin "orangeshirt" K\xf6hler', 'Erik "luen" Lundin',
+ 'Edwin "edwinlunando" Lunando', 'Brian "brianmeyer" Meyer',
+ 'Joshua "milleja46" Miller', 'Stevan "ElderP" Pettit',
+ 'Mattias "mahfiaz" P\xf5ldaru', 'Christian "crichter" Richter',
+ 'Philip "Phill" Ridout', 'Simon "samscudder" Scudder',
+ 'Jeffrey "whydoubt" Smith', 'Maikel Stuivenberg',
+ 'Dave "Dave42W" Warnock', 'Frode "frodus" Woldsund',
+ 'Martin "matysek" Zibricky', 'Patrick "mohij" Zimmermann']
+ testers = ['Philip "Phill" Ridout', 'Wesley "wrst" Stout',
+ 'John "jseagull1" Cegalis (lead)']
packagers = ['Thomas "tabthorpe" Abthorpe (FreeBSD)',
- u'Tim "TRB143" Bentley (Fedora and Android)',
- u'Matthias "matthub" Hub (Mac OS X)',
- u'Joseph "jdmulloy" Mulloy (openSUSE)',
- u'Stevan "ElderP" Pettit (Windows)',
- u'Raoul "superfly" Snyman (Debian, Ubuntu)',
- u'Garrett "floft" Wilson (Arch Linux)']
+ 'Tim "TRB143" Bentley (Fedora and Android)',
+ 'Matthias "matthub" Hub (Mac OS X)',
+ 'Joseph "jdmulloy" Mulloy (openSUSE)',
+ 'Stevan "ElderP" Pettit (Windows)',
+ 'Raoul "superfly" Snyman (Debian, Ubuntu)',
+ 'Garrett "floft" Wilson (Arch Linux)']
translators = {
- u'af': [u'Johan "nuvolari" Mynhardt'],
- u'cs': [u'Martin "matysek" Zibricky'],
- u'da': [u'Henrik "Hsonesson" Sonesson'],
- u'de': [u'Patrick "madmuffin" Br\xfcckner',
- u'Meinert "m2j" Jordan', u'Andreas "googol" Preikschat',
- u'Christian "crichter" Richter'],
- u'en_GB': [u'Tim "TRB143" Bentley', u'Jonathan "gushie" Corwin'],
- u'en_ZA': [u'Raoul "superfly" Snyman',
- u'Johan "nuvolari" Mynhardt'],
- u'el': [u'Alexander Siozos'],
- u'es': [u'Josu\xe9 Z\xfa\xf1iga', u'Christian Gonzalez'],
- u'et': [u'Mattias "mahfiaz" P\xf5ldaru'],
- u'fi': [u'Jori "joribu" Brander', u'Tobbe "tobbeb" Bildo'],
- u'fr': [u'Stephan\xe9 "stbrunner" Brunner', u'Jeremie "jnau05"',
- u'Carl "carl.fischer" Fischer'],
- u'hu': [u'Gyuris Gell\xe9rt'],
- u'id': [u'Mico "bangmico" Siahaan', u' ign_christian'],
- u'ja': [u'Kunio "Kunio" Nakamaru', u'Chris Haris'],
- u'nb': [u'Atle "pendlaren" Weibell', u'Frode "frodus" Woldsund'],
- u'nl': [u'Arjen "typovar" van Voorst'],
- u'pt_BR': [u'David Mederiros', u'Rafael "rafaellerm" Lerm',
- u'Eduardo Levi Chaves',
- u'Gustavo Bim', u'Rog\xeanio Bel\xe9m', u'Samuel'
- u'Simon "samscudder" Scudder', u'Van Der Fran'],
- u'ru': [u'Sergey "ratz" Ratz'],
- u'sv': [u'Erik "luen" Lundin'],
- u'ta_LK': [u'"Prasad"'],
- u'zh_CN': [u' "executor" ']
+ 'af': ['Johan "nuvolari" Mynhardt'],
+ 'cs': ['Martin "matysek" Zibricky'],
+ 'da': ['Henrik "Hsonesson" Sonesson'],
+ 'de': ['Patrick "madmuffin" Br\xfcckner',
+ 'Meinert "m2j" Jordan', 'Andreas "googol" Preikschat',
+ 'Christian "crichter" Richter'],
+ 'en_GB': ['Tim "TRB143" Bentley', 'Jonathan "gushie" Corwin'],
+ 'en_ZA': ['Raoul "superfly" Snyman',
+ 'Johan "nuvolari" Mynhardt'],
+ 'el': ['Alexander Siozos'],
+ 'es': ['Josu\xe9 Z\xfa\xf1iga', 'Christian Gonzalez'],
+ 'et': ['Mattias "mahfiaz" P\xf5ldaru'],
+ 'fi': ['Jori "joribu" Brander', 'Tobbe "tobbeb" Bildo'],
+ 'fr': ['Stephan\xe9 "stbrunner" Brunner', 'Jeremie "jnau05"',
+ 'Carl "carl.fischer" Fischer'],
+ 'hu': ['Gyuris Gell\xe9rt'],
+ 'id': ['Mico "bangmico" Siahaan', ' ign_christian'],
+ 'ja': ['Kunio "Kunio" Nakamaru', 'Chris Haris'],
+ 'nb': ['Atle "pendlaren" Weibell', 'Frode "frodus" Woldsund'],
+ 'nl': ['Arjen "typovar" van Voorst'],
+ 'pt_BR': ['David Mederiros', 'Rafael "rafaellerm" Lerm',
+ 'Eduardo Levi Chaves',
+ 'Gustavo Bim', 'Rog\xeanio Bel\xe9m', 'Samuel'
+ 'Simon "samscudder" Scudder', 'Van Der Fran'],
+ 'ru': ['Sergey "ratz" Ratz'],
+ 'sv': ['Erik "luen" Lundin'],
+ 'ta_LK': ['"Prasad"'],
+ 'zh_CN': [' "executor" ']
}
- documentors = [u'Wesley "wrst" Stout',
- u'John "jseagull1" Cegalis (lead)']
+ documentors = ['Wesley "wrst" Stout',
+ 'John "jseagull1" Cegalis (lead)']
self.credits_text_edit.setPlainText(translate('OpenLP.AboutForm',
'Project Lead\n'
' %s\n'
@@ -244,43 +244,43 @@
' 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),
- u'\n '.join(contributors), u'\n '.join(testers),
- u'\n '.join(packagers), u'\n '.join(translators[u'af']),
- u'\n '.join(translators[u'cs']),
- u'\n '.join(translators[u'da']),
- u'\n '.join(translators[u'de']),
- u'\n '.join(translators[u'el']),
- u'\n '.join(translators[u'en_GB']),
- u'\n '.join(translators[u'en_ZA']),
- u'\n '.join(translators[u'es']),
- u'\n '.join(translators[u'et']),
- u'\n '.join(translators[u'fi']),
- u'\n '.join(translators[u'fr']),
- u'\n '.join(translators[u'hu']),
- u'\n '.join(translators[u'id']),
- u'\n '.join(translators[u'ja']),
- u'\n '.join(translators[u'nb']),
- u'\n '.join(translators[u'nl']),
- u'\n '.join(translators[u'pt_BR']),
- u'\n '.join(translators[u'ru']),
- u'\n '.join(translators[u'sv']),
- u'\n '.join(translators[u'ta_LK']),
- u'\n '.join(translators[u'zh_CN']),
- u'\n '.join(documentors)))
+ ' He has set us free.') % (lead, '\n '.join(developers),
+ '\n '.join(contributors), '\n '.join(testers),
+ '\n '.join(packagers), '\n '.join(translators['af']),
+ '\n '.join(translators['cs']),
+ '\n '.join(translators['da']),
+ '\n '.join(translators['de']),
+ '\n '.join(translators['el']),
+ '\n '.join(translators['en_GB']),
+ '\n '.join(translators['en_ZA']),
+ '\n '.join(translators['es']),
+ '\n '.join(translators['et']),
+ '\n '.join(translators['fi']),
+ '\n '.join(translators['fr']),
+ '\n '.join(translators['hu']),
+ '\n '.join(translators['id']),
+ '\n '.join(translators['ja']),
+ '\n '.join(translators['nb']),
+ '\n '.join(translators['nl']),
+ '\n '.join(translators['pt_BR']),
+ '\n '.join(translators['ru']),
+ '\n '.join(translators['sv']),
+ '\n '.join(translators['ta_LK']),
+ '\n '.join(translators['zh_CN']),
+ '\n '.join(documentors)))
self.about_notebook.setTabText(self.about_notebook.indexOf(self.credits_tab),
translate('OpenLP.AboutForm', 'Credits'))
copyright_note = translate('OpenLP.AboutForm',
'Copyright \xa9 2004-2013 %s\n'
- 'Portions copyright \xa9 2004-2013 %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, '
- u'Brian T. Meyer, Stevan Pettit, Andreas Preikschat, '
- u'Mattias P\xf5ldaru, Christian Richter, '
- u'Philip Ridout, Simon Scudder, Jeffrey Smith, Maikel Stuivenberg, '
- u'Martin Thompson, Jon Tibble, Dave Warnock, Frode Woldsund, '
- u'Martin Zibricky, Patrick Zimmermann')
+ 'Portions copyright \xa9 2004-2013 %s') % ('Raoul Snyman',
+ 'Tim Bentley, Gerald Britton, Jonathan Corwin, Samuel Findlay, '
+ 'Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, '
+ 'Armin K\xf6hler, Erik Lundin, Edwin Lunando, Joshua Miller, '
+ 'Brian T. Meyer, Stevan Pettit, Andreas Preikschat, '
+ 'Mattias P\xf5ldaru, Christian Richter, '
+ 'Philip Ridout, Simon Scudder, Jeffrey Smith, Maikel Stuivenberg, '
+ 'Martin Thompson, Jon Tibble, Dave Warnock, Frode Woldsund, '
+ 'Martin Zibricky, Patrick Zimmermann')
licence = translate('OpenLP.AboutForm',
'This program is free software; you can redistribute it and/or '
'modify it under the terms of the GNU General Public License as '
@@ -662,7 +662,7 @@
'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.license_text_edit.setPlainText(u'%s\n\n%s\n\n%s\n\n\n%s' % (copyright_note, licence, disclaimer, gpl_text))
+ self.license_text_edit.setPlainText('%s\n\n%s\n\n%s\n\n\n%s' % (copyright_note, licence, disclaimer, gpl_text))
self.about_notebook.setTabText(self.about_notebook.indexOf(self.license_tab),
translate('OpenLP.AboutForm', 'License'))
self.volunteer_button.setText(translate('OpenLP.AboutForm', 'Volunteer'))
=== modified file 'openlp/core/ui/aboutform.py'
--- openlp/core/ui/aboutform.py 2013-07-18 14:11:39 +0000
+++ openlp/core/ui/aboutform.py 2013-08-31 18:18:25 +0000
@@ -32,7 +32,7 @@
from PyQt4 import QtCore, QtGui
-from aboutdialog import Ui_AboutDialog
+from .aboutdialog import Ui_AboutDialog
from openlp.core.lib import translate
from openlp.core.utils import get_application_version
@@ -50,12 +50,12 @@
application_version = get_application_version()
self.setupUi(self)
about_text = self.about_text_edit.toPlainText()
- about_text = about_text.replace(u'<version>', application_version[u'version'])
- if application_version[u'build']:
- build_text = translate('OpenLP.AboutForm', ' build %s') % application_version[u'build']
+ about_text = about_text.replace('<version>', application_version['version'])
+ if application_version['build']:
+ build_text = translate('OpenLP.AboutForm', ' build %s') % application_version['build']
else:
- build_text = u''
- about_text = about_text.replace(u'<revision>', build_text)
+ build_text = ''
+ about_text = about_text.replace('<revision>', build_text)
self.about_text_edit.setPlainText(about_text)
self.volunteer_button.clicked.connect(self.on_volunteer_button_clicked)
@@ -64,4 +64,4 @@
Launch a web browser and go to the contribute page on the site.
"""
import webbrowser
- webbrowser.open_new(u'http://openlp.org/en/contribute')
+ webbrowser.open_new('http://openlp.org/en/contribute')
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py 2013-07-18 19:10:19 +0000
+++ openlp/core/ui/advancedtab.py 2013-08-31 18:18:25 +0000
@@ -52,119 +52,119 @@
"""
Initialise the settings tab
"""
- self.default_image = u':/graphics/openlp-splash-screen.png'
- self.default_color = u'#ffffff'
+ self.default_image = ':/graphics/openlp-splash-screen.png'
+ self.default_color = '#ffffff'
self.data_exists = False
- self.icon_path = u':/system/system_settings.png'
+ self.icon_path = ':/system/system_settings.png'
advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced')
- super(AdvancedTab, self).__init__(parent, u'Advanced', advanced_translated)
+ super(AdvancedTab, self).__init__(parent, 'Advanced', advanced_translated)
def setupUi(self):
"""
Configure the UI elements for the tab.
"""
- self.setObjectName(u'AdvancedTab')
+ self.setObjectName('AdvancedTab')
super(AdvancedTab, self).setupUi()
self.ui_group_box = QtGui.QGroupBox(self.left_column)
- self.ui_group_box.setObjectName(u'ui_group_box')
+ self.ui_group_box.setObjectName('ui_group_box')
self.ui_layout = QtGui.QFormLayout(self.ui_group_box)
- self.ui_layout.setObjectName(u'ui_layout')
+ self.ui_layout.setObjectName('ui_layout')
self.recent_label = QtGui.QLabel(self.ui_group_box)
- self.recent_label.setObjectName(u'recent_label')
+ self.recent_label.setObjectName('recent_label')
self.recent_spin_box = QtGui.QSpinBox(self.ui_group_box)
- self.recent_spin_box.setObjectName(u'recent_spin_box')
+ self.recent_spin_box.setObjectName('recent_spin_box')
self.recent_spin_box.setMinimum(0)
self.ui_layout.addRow(self.recent_label, self.recent_spin_box)
self.media_plugin_check_box = QtGui.QCheckBox(self.ui_group_box)
- self.media_plugin_check_box.setObjectName(u'media_plugin_check_box')
+ self.media_plugin_check_box.setObjectName('media_plugin_check_box')
self.ui_layout.addRow(self.media_plugin_check_box)
self.double_click_live_check_box = QtGui.QCheckBox(self.ui_group_box)
- self.double_click_live_check_box.setObjectName(u'double_click_live_check_box')
+ self.double_click_live_check_box.setObjectName('double_click_live_check_box')
self.ui_layout.addRow(self.double_click_live_check_box)
self.single_click_preview_check_box = QtGui.QCheckBox(self.ui_group_box)
- self.single_click_preview_check_box.setObjectName(u'single_click_preview_check_box')
+ self.single_click_preview_check_box.setObjectName('single_click_preview_check_box')
self.ui_layout.addRow(self.single_click_preview_check_box)
self.expand_service_item_check_box = QtGui.QCheckBox(self.ui_group_box)
- self.expand_service_item_check_box.setObjectName(u'expand_service_item_check_box')
+ self.expand_service_item_check_box.setObjectName('expand_service_item_check_box')
self.ui_layout.addRow(self.expand_service_item_check_box)
self.enable_auto_close_check_box = QtGui.QCheckBox(self.ui_group_box)
- self.enable_auto_close_check_box.setObjectName(u'enable_auto_close_check_box')
+ self.enable_auto_close_check_box.setObjectName('enable_auto_close_check_box')
self.ui_layout.addRow(self.enable_auto_close_check_box)
self.left_layout.addWidget(self.ui_group_box)
# Default service name
self.service_name_group_box = QtGui.QGroupBox(self.left_column)
- self.service_name_group_box.setObjectName(u'service_name_group_box')
+ self.service_name_group_box.setObjectName('service_name_group_box')
self.service_name_layout = QtGui.QFormLayout(self.service_name_group_box)
self.service_name_check_box = QtGui.QCheckBox(self.service_name_group_box)
- self.service_name_check_box.setObjectName(u'service_name_check_box')
- self.service_name_layout.setObjectName(u'service_name_layout')
+ self.service_name_check_box.setObjectName('service_name_check_box')
+ self.service_name_layout.setObjectName('service_name_layout')
self.service_name_layout.addRow(self.service_name_check_box)
self.service_name_time_label = QtGui.QLabel(self.service_name_group_box)
- self.service_name_time_label.setObjectName(u'service_name_time_label')
+ self.service_name_time_label.setObjectName('service_name_time_label')
self.service_name_day = QtGui.QComboBox(self.service_name_group_box)
- self.service_name_day.addItems([u'', u'', u'', u'', u'', u'', u'', u''])
- self.service_name_day.setObjectName(u'service_name_day')
+ self.service_name_day.addItems(['', '', '', '', '', '', '', ''])
+ self.service_name_day.setObjectName('service_name_day')
self.service_name_time = QtGui.QTimeEdit(self.service_name_group_box)
- self.service_name_time.setObjectName(u'service_name_time')
+ self.service_name_time.setObjectName('service_name_time')
self.service_name_time_layout = QtGui.QHBoxLayout()
- self.service_name_time_layout.setObjectName(u'service_name_time_layout')
+ self.service_name_time_layout.setObjectName('service_name_time_layout')
self.service_name_time_layout.addWidget(self.service_name_day)
self.service_name_time_layout.addWidget(self.service_name_time)
self.service_name_layout.addRow(self.service_name_time_label, self.service_name_time_layout)
self.service_name_label = QtGui.QLabel(self.service_name_group_box)
- self.service_name_label.setObjectName(u'service_name_label')
+ self.service_name_label.setObjectName('service_name_label')
self.service_name_edit = QtGui.QLineEdit(self.service_name_group_box)
- self.service_name_edit.setObjectName(u'service_name_edit')
+ self.service_name_edit.setObjectName('service_name_edit')
self.service_name_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+]+'), self))
self.service_name_revert_button = QtGui.QToolButton(self.service_name_group_box)
- self.service_name_revert_button.setObjectName(u'service_name_revert_button')
- self.service_name_revert_button.setIcon(build_icon(u':/general/general_revert.png'))
+ self.service_name_revert_button.setObjectName('service_name_revert_button')
+ self.service_name_revert_button.setIcon(build_icon(':/general/general_revert.png'))
self.service_name_button_layout = QtGui.QHBoxLayout()
- self.service_name_button_layout.setObjectName(u'service_name_button_layout')
+ self.service_name_button_layout.setObjectName('service_name_button_layout')
self.service_name_button_layout.addWidget(self.service_name_edit)
self.service_name_button_layout.addWidget(self.service_name_revert_button)
self.service_name_layout.addRow(self.service_name_label, self.service_name_button_layout)
self.service_name_example_label = QtGui.QLabel(self.service_name_group_box)
- self.service_name_example_label.setObjectName(u'service_name_example_label')
+ self.service_name_example_label.setObjectName('service_name_example_label')
self.service_name_example = QtGui.QLabel(self.service_name_group_box)
- self.service_name_example.setObjectName(u'service_name_example')
+ self.service_name_example.setObjectName('service_name_example')
self.service_name_layout.addRow(self.service_name_example_label, self.service_name_example)
self.left_layout.addWidget(self.service_name_group_box)
# Data Directory
self.data_directory_group_box = QtGui.QGroupBox(self.left_column)
- self.data_directory_group_box.setObjectName(u'data_directory_group_box')
+ self.data_directory_group_box.setObjectName('data_directory_group_box')
self.data_directory_layout = QtGui.QFormLayout(self.data_directory_group_box)
- self.data_directory_layout.setObjectName(u'data_directory_layout')
+ self.data_directory_layout.setObjectName('data_directory_layout')
self.data_directory_current_label = QtGui.QLabel(self.data_directory_group_box)
- self.data_directory_current_label.setObjectName(u'data_directory_current_label')
+ self.data_directory_current_label.setObjectName('data_directory_current_label')
self.data_directory_label = QtGui.QLabel(self.data_directory_group_box)
- self.data_directory_label.setObjectName(u'data_directory_label')
+ self.data_directory_label.setObjectName('data_directory_label')
self.data_directory_new_label = QtGui.QLabel(self.data_directory_group_box)
- self.data_directory_new_label.setObjectName(u'data_directory_current_label')
+ self.data_directory_new_label.setObjectName('data_directory_current_label')
self.new_data_directory_edit = QtGui.QLineEdit(self.data_directory_group_box)
- self.new_data_directory_edit.setObjectName(u'new_data_directory_edit')
+ self.new_data_directory_edit.setObjectName('new_data_directory_edit')
self.new_data_directory_edit.setReadOnly(True)
self.new_data_directory_has_files_label = QtGui.QLabel(self.data_directory_group_box)
- self.new_data_directory_has_files_label.setObjectName(u'new_data_directory_has_files_label')
+ self.new_data_directory_has_files_label.setObjectName('new_data_directory_has_files_label')
self.new_data_directory_has_files_label.setWordWrap(True)
self.data_directory_browse_button = QtGui.QToolButton(self.data_directory_group_box)
- self.data_directory_browse_button.setObjectName(u'data_directory_browse_button')
- self.data_directory_browse_button.setIcon(build_icon(u':/general/general_open.png'))
+ self.data_directory_browse_button.setObjectName('data_directory_browse_button')
+ self.data_directory_browse_button.setIcon(build_icon(':/general/general_open.png'))
self.data_directory_default_button = QtGui.QToolButton(self.data_directory_group_box)
- self.data_directory_default_button.setObjectName(u'data_directory_default_button')
- self.data_directory_default_button.setIcon(build_icon(u':/general/general_revert.png'))
+ self.data_directory_default_button.setObjectName('data_directory_default_button')
+ self.data_directory_default_button.setIcon(build_icon(':/general/general_revert.png'))
self.data_directory_cancel_button = QtGui.QToolButton(self.data_directory_group_box)
- self.data_directory_cancel_button.setObjectName(u'data_directory_cancel_button')
- self.data_directory_cancel_button.setIcon(build_icon(u':/general/general_delete.png'))
+ self.data_directory_cancel_button.setObjectName('data_directory_cancel_button')
+ self.data_directory_cancel_button.setIcon(build_icon(':/general/general_delete.png'))
self.new_data_directory_label_layout = QtGui.QHBoxLayout()
- self.new_data_directory_label_layout.setObjectName(u'new_data_directory_label_layout')
+ self.new_data_directory_label_layout.setObjectName('new_data_directory_label_layout')
self.new_data_directory_label_layout.addWidget(self.new_data_directory_edit)
self.new_data_directory_label_layout.addWidget(self.data_directory_browse_button)
self.new_data_directory_label_layout.addWidget(self.data_directory_default_button)
self.data_directory_copy_check_layout = QtGui.QHBoxLayout()
- self.data_directory_copy_check_layout.setObjectName(u'data_directory_copy_check_layout')
+ self.data_directory_copy_check_layout.setObjectName('data_directory_copy_check_layout')
self.data_directory_copy_check_box = QtGui.QCheckBox(self.data_directory_group_box)
- self.data_directory_copy_check_box.setObjectName(u'data_directory_copy_check_box')
+ self.data_directory_copy_check_box.setObjectName('data_directory_copy_check_box')
self.data_directory_copy_check_layout.addWidget(self.data_directory_copy_check_box)
self.data_directory_copy_check_layout.addStretch()
self.data_directory_copy_check_layout.addWidget(self.data_directory_cancel_button)
@@ -176,26 +176,26 @@
self.left_layout.addStretch()
# Default Image
self.default_image_group_box = QtGui.QGroupBox(self.right_column)
- self.default_image_group_box.setObjectName(u'default_image_group_box')
+ self.default_image_group_box.setObjectName('default_image_group_box')
self.default_image_layout = QtGui.QFormLayout(self.default_image_group_box)
- self.default_image_layout.setObjectName(u'default_image_layout')
+ self.default_image_layout.setObjectName('default_image_layout')
self.default_color_label = QtGui.QLabel(self.default_image_group_box)
- self.default_color_label.setObjectName(u'default_color_label')
+ self.default_color_label.setObjectName('default_color_label')
self.default_color_button = QtGui.QPushButton(self.default_image_group_box)
- self.default_color_button.setObjectName(u'default_color_button')
+ self.default_color_button.setObjectName('default_color_button')
self.default_image_layout.addRow(self.default_color_label, self.default_color_button)
self.default_file_label = QtGui.QLabel(self.default_image_group_box)
- self.default_file_label.setObjectName(u'default_file_label')
+ self.default_file_label.setObjectName('default_file_label')
self.default_file_edit = QtGui.QLineEdit(self.default_image_group_box)
- self.default_file_edit.setObjectName(u'default_file_edit')
+ self.default_file_edit.setObjectName('default_file_edit')
self.default_browse_button = QtGui.QToolButton(self.default_image_group_box)
- self.default_browse_button.setObjectName(u'default_browse_button')
- self.default_browse_button.setIcon(build_icon(u':/general/general_open.png'))
+ self.default_browse_button.setObjectName('default_browse_button')
+ self.default_browse_button.setIcon(build_icon(':/general/general_open.png'))
self.default_revert_button = QtGui.QToolButton(self.default_image_group_box)
- self.default_revert_button.setObjectName(u'default_revert_button')
- self.default_revert_button.setIcon(build_icon(u':/general/general_revert.png'))
+ self.default_revert_button.setObjectName('default_revert_button')
+ self.default_revert_button.setIcon(build_icon(':/general/general_revert.png'))
self.default_file_layout = QtGui.QHBoxLayout()
- self.default_file_layout.setObjectName(u'default_file_layout')
+ self.default_file_layout.setObjectName('default_file_layout')
self.default_file_layout.addWidget(self.default_file_edit)
self.default_file_layout.addWidget(self.default_browse_button)
self.default_file_layout.addWidget(self.default_revert_button)
@@ -203,41 +203,41 @@
self.right_layout.addWidget(self.default_image_group_box)
# Hide mouse
self.hide_mouse_group_box = QtGui.QGroupBox(self.right_column)
- self.hide_mouse_group_box.setObjectName(u'hide_mouse_group_box')
+ self.hide_mouse_group_box.setObjectName('hide_mouse_group_box')
self.hide_mouse_layout = QtGui.QVBoxLayout(self.hide_mouse_group_box)
- self.hide_mouse_layout.setObjectName(u'hide_mouse_layout')
+ self.hide_mouse_layout.setObjectName('hide_mouse_layout')
self.hide_mouse_check_box = QtGui.QCheckBox(self.hide_mouse_group_box)
- self.hide_mouse_check_box.setObjectName(u'hide_mouse_check_box')
+ self.hide_mouse_check_box.setObjectName('hide_mouse_check_box')
self.hide_mouse_layout.addWidget(self.hide_mouse_check_box)
self.right_layout.addWidget(self.hide_mouse_group_box)
# Service Item Slide Limits
self.slide_group_box = QtGui.QGroupBox(self.right_column)
- self.slide_group_box.setObjectName(u'slide_group_box')
+ self.slide_group_box.setObjectName('slide_group_box')
self.slide_layout = QtGui.QVBoxLayout(self.slide_group_box)
- self.slide_layout.setObjectName(u'slide_layout')
+ self.slide_layout.setObjectName('slide_layout')
self.slide_label = QtGui.QLabel(self.slide_group_box)
self.slide_label.setWordWrap(True)
self.slide_layout.addWidget(self.slide_label)
self.end_slide_radio_button = QtGui.QRadioButton(self.slide_group_box)
- self.end_slide_radio_button.setObjectName(u'end_slide_radio_button')
+ self.end_slide_radio_button.setObjectName('end_slide_radio_button')
self.slide_layout.addWidget(self.end_slide_radio_button)
self.wrap_slide_radio_button = QtGui.QRadioButton(self.slide_group_box)
- self.wrap_slide_radio_button.setObjectName(u'wrap_slide_radio_button')
+ self.wrap_slide_radio_button.setObjectName('wrap_slide_radio_button')
self.slide_layout.addWidget(self.wrap_slide_radio_button)
self.next_item_radio_button = QtGui.QRadioButton(self.slide_group_box)
- self.next_item_radio_button.setObjectName(u'next_item_radio_button')
+ self.next_item_radio_button.setObjectName('next_item_radio_button')
self.slide_layout.addWidget(self.next_item_radio_button)
self.right_layout.addWidget(self.slide_group_box)
# Display Workarounds
self.display_workaround_group_box = QtGui.QGroupBox(self.left_column)
- self.display_workaround_group_box.setObjectName(u'display_workaround_group_box')
+ self.display_workaround_group_box.setObjectName('display_workaround_group_box')
self.display_workaround_layout = QtGui.QVBoxLayout(self.display_workaround_group_box)
- self.display_workaround_layout.setObjectName(u'display_workaround_layout')
+ self.display_workaround_layout.setObjectName('display_workaround_layout')
self.x11_bypass_check_box = QtGui.QCheckBox(self.display_workaround_group_box)
- self.x11_bypass_check_box.setObjectName(u'x11_bypass_check_box')
+ self.x11_bypass_check_box.setObjectName('x11_bypass_check_box')
self.display_workaround_layout.addWidget(self.x11_bypass_check_box)
self.alternate_rows_check_box = QtGui.QCheckBox(self.display_workaround_group_box)
- self.alternate_rows_check_box.setObjectName(u'alternate_rows_check_box')
+ self.alternate_rows_check_box.setObjectName('alternate_rows_check_box')
self.display_workaround_layout.addWidget(self.alternate_rows_check_box)
self.right_layout.addWidget(self.display_workaround_group_box)
self.right_layout.addStretch()
@@ -337,29 +337,29 @@
# 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.recent_spin_box.setMaximum(settings.value(u'max recent files'))
- self.recent_spin_box.setValue(settings.value(u'recent file count'))
- self.media_plugin_check_box.setChecked(settings.value(u'save current plugin'))
- self.double_click_live_check_box.setChecked(settings.value(u'double click live'))
- self.single_click_preview_check_box.setChecked(settings.value(u'single click preview'))
- self.expand_service_item_check_box.setChecked(settings.value(u'expand service item'))
- self.enable_auto_close_check_box.setChecked(settings.value(u'enable exit confirmation'))
- self.hide_mouse_check_box.setChecked(settings.value(u'hide mouse'))
- self.service_name_day.setCurrentIndex(settings.value(u'default service day'))
- self.service_name_time.setTime(QtCore.QTime(settings.value(u'default service hour'),
- settings.value(u'default service minute')))
+ self.recent_spin_box.setMaximum(settings.value('max recent files'))
+ self.recent_spin_box.setValue(settings.value('recent file count'))
+ self.media_plugin_check_box.setChecked(settings.value('save current plugin'))
+ self.double_click_live_check_box.setChecked(settings.value('double click live'))
+ self.single_click_preview_check_box.setChecked(settings.value('single click preview'))
+ self.expand_service_item_check_box.setChecked(settings.value('expand service item'))
+ self.enable_auto_close_check_box.setChecked(settings.value('enable exit confirmation'))
+ self.hide_mouse_check_box.setChecked(settings.value('hide mouse'))
+ self.service_name_day.setCurrentIndex(settings.value('default service day'))
+ self.service_name_time.setTime(QtCore.QTime(settings.value('default service hour'),
+ settings.value('default service minute')))
self.should_update_service_name_example = True
- self.service_name_edit.setText(settings.value(u'default service name'))
- default_service_enabled = settings.value(u'default service enabled')
+ self.service_name_edit.setText(settings.value('default service name'))
+ default_service_enabled = settings.value('default service enabled')
self.service_name_check_box.setChecked(default_service_enabled)
self.service_name_check_box_toggled(default_service_enabled)
- self.x11_bypass_check_box.setChecked(settings.value(u'x11 bypass wm'))
- self.default_color = settings.value(u'default color')
- self.default_file_edit.setText(settings.value(u'default image'))
- self.slide_limits = settings.value(u'slide limits')
+ self.x11_bypass_check_box.setChecked(settings.value('x11 bypass wm'))
+ self.default_color = settings.value('default color')
+ self.default_file_edit.setText(settings.value('default image'))
+ self.slide_limits = settings.value('slide limits')
# Prevent the dialog displayed by the alternate_rows_check_box to display.
self.alternate_rows_check_box.blockSignals(True)
- self.alternate_rows_check_box.setChecked(settings.value(u'alternate rows'))
+ self.alternate_rows_check_box.setChecked(settings.value('alternate rows'))
self.alternate_rows_check_box.blockSignals(False)
if self.slide_limits == SlideLimits.End:
self.end_slide_radio_button.setChecked(True)
@@ -374,7 +374,7 @@
# Since data location can be changed, make sure the path is present.
self.current_data_path = AppLocation.get_data_path()
if not os.path.exists(self.current_data_path):
- log.error(u'Data path not found %s' % self.current_data_path)
+ log.error('Data path not found %s' % self.current_data_path)
answer = QtGui.QMessageBox.critical(self,
translate('OpenLP.AdvancedTab', 'Data Directory Error'),
translate('OpenLP.AdvancedTab', 'OpenLP data directory was not found\n\n%s\n\n'
@@ -387,17 +387,17 @@
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
- log.info(u'User requested termination')
+ log.info('User requested termination')
self.main_window.clean_up()
sys.exit()
# Set data location to default.
- settings.remove(u'advanced/data path')
+ settings.remove('advanced/data path')
self.current_data_path = AppLocation.get_data_path()
- log.warning(u'User requested data path set to default %s' % self.current_data_path)
+ log.warning('User requested data path set to default %s' % self.current_data_path)
self.data_directory_label.setText(os.path.abspath(self.current_data_path))
- self.default_color_button.setStyleSheet(u'background-color: %s' % self.default_color)
+ self.default_color_button.setStyleSheet('background-color: %s' % self.default_color)
# Don't allow data directory move if running portable.
- if settings.value(u'advanced/is portable'):
+ if settings.value('advanced/is portable'):
self.data_directory_group_box.hide()
def save(self):
@@ -406,32 +406,32 @@
"""
settings = Settings()
settings.beginGroup(self.settings_section)
- settings.setValue(u'default service enabled', self.service_name_check_box.isChecked())
+ settings.setValue('default service enabled', self.service_name_check_box.isChecked())
service_name = self.service_name_edit.text()
preset_is_valid = self.generate_service_name_example()[0]
if service_name == UiStrings().DefaultServiceName or not preset_is_valid:
- settings.remove(u'default service name')
+ settings.remove('default service name')
self.service_name_edit.setText(service_name)
else:
- settings.setValue(u'default service name', service_name)
- settings.setValue(u'default service day', self.service_name_day.currentIndex())
- settings.setValue(u'default service hour', self.service_name_time.time().hour())
- settings.setValue(u'default service minute', self.service_name_time.time().minute())
- settings.setValue(u'recent file count', self.recent_spin_box.value())
- settings.setValue(u'save current plugin', self.media_plugin_check_box.isChecked())
- settings.setValue(u'double click live', self.double_click_live_check_box.isChecked())
- settings.setValue(u'single click preview', self.single_click_preview_check_box.isChecked())
- settings.setValue(u'expand service item', self.expand_service_item_check_box.isChecked())
- settings.setValue(u'enable exit confirmation', self.enable_auto_close_check_box.isChecked())
- settings.setValue(u'hide mouse', self.hide_mouse_check_box.isChecked())
- settings.setValue(u'alternate rows', self.alternate_rows_check_box.isChecked())
- settings.setValue(u'default color', self.default_color)
- settings.setValue(u'default image', self.default_file_edit.text())
- settings.setValue(u'slide limits', self.slide_limits)
- if self.x11_bypass_check_box.isChecked() != settings.value(u'x11 bypass wm'):
- settings.setValue(u'x11 bypass wm', self.x11_bypass_check_box.isChecked())
- self.settings_form.register_post_process(u'config_screen_changed')
- self.settings_form.register_post_process(u'slidecontroller_update_slide_limits')
+ settings.setValue('default service name', service_name)
+ settings.setValue('default service day', self.service_name_day.currentIndex())
+ settings.setValue('default service hour', self.service_name_time.time().hour())
+ settings.setValue('default service minute', self.service_name_time.time().minute())
+ settings.setValue('recent file count', self.recent_spin_box.value())
+ settings.setValue('save current plugin', self.media_plugin_check_box.isChecked())
+ settings.setValue('double click live', self.double_click_live_check_box.isChecked())
+ settings.setValue('single click preview', self.single_click_preview_check_box.isChecked())
+ settings.setValue('expand service item', self.expand_service_item_check_box.isChecked())
+ settings.setValue('enable exit confirmation', self.enable_auto_close_check_box.isChecked())
+ settings.setValue('hide mouse', self.hide_mouse_check_box.isChecked())
+ settings.setValue('alternate rows', self.alternate_rows_check_box.isChecked())
+ settings.setValue('default color', self.default_color)
+ settings.setValue('default image', self.default_file_edit.text())
+ settings.setValue('slide limits', self.slide_limits)
+ if self.x11_bypass_check_box.isChecked() != settings.value('x11 bypass wm'):
+ settings.setValue('x11 bypass wm', self.x11_bypass_check_box.isChecked())
+ self.settings_form.register_post_process('config_screen_changed')
+ self.settings_form.register_post_process('slidecontroller_update_slide_limits')
settings.endGroup()
def cancel(self):
@@ -469,7 +469,7 @@
minute=self.service_name_time.time().minute()
)
try:
- service_name_example = format_time(unicode(self.service_name_edit.text()), local_time)
+ service_name_example = format_time(str(self.service_name_edit.text()), local_time)
except ValueError:
preset_is_valid = False
service_name_example = translate('OpenLP.AdvancedTab', 'Syntax error.')
@@ -505,13 +505,13 @@
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.default_color), self)
if new_color.isValid():
self.default_color = new_color.name()
- self.default_color_button.setStyleSheet(u'background-color: %s' % self.default_color)
+ self.default_color_button.setStyleSheet('background-color: %s' % self.default_color)
def on_default_browse_button_clicked(self):
"""
Select an image for the default display screen.
"""
- file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(), UiStrings().AllFiles)
+ file_filters = '%s;;%s (*.*) (*)' % (get_images_filter(), UiStrings().AllFiles)
filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.AdvancedTab', 'Open File'), '',
file_filters)
if filename:
@@ -522,7 +522,7 @@
"""
Browse for a new data directory location.
"""
- old_root_path = unicode(self.data_directory_label.text())
+ old_root_path = str(self.data_directory_label.text())
# Get the new directory location.
new_data_path = QtGui.QFileDialog.getExistingDirectory(
self, translate('OpenLP.AdvancedTab', 'Select Data Directory Location'), old_root_path,
@@ -590,7 +590,7 @@
"""
Check if there's already data in the target directory.
"""
- test_path = os.path.join(data_path, u'songs')
+ test_path = os.path.join(data_path, 'songs')
self.data_directory_copy_check_box.show()
if os.path.exists(test_path):
self.data_exists = True
@@ -628,7 +628,7 @@
"""
Revert the default screen back to the default settings.
"""
- self.default_file_edit.setText(u':/graphics/openlp-splash-screen.png')
+ self.default_file_edit.setText(':/graphics/openlp-splash-screen.png')
self.default_file_edit.setFocus()
def on_alternate_rows_check_box_toggled(self, checked):
=== modified file 'openlp/core/ui/exceptiondialog.py'
--- openlp/core/ui/exceptiondialog.py 2013-03-05 14:14:37 +0000
+++ openlp/core/ui/exceptiondialog.py 2013-08-31 18:18:25 +0000
@@ -44,44 +44,44 @@
"""
Set up the UI.
"""
- exception_dialog.setObjectName(u'exception_dialog')
+ exception_dialog.setObjectName('exception_dialog')
self.exception_layout = QtGui.QVBoxLayout(exception_dialog)
- self.exception_layout.setObjectName(u'exception_layout')
+ self.exception_layout.setObjectName('exception_layout')
self.message_layout = QtGui.QHBoxLayout()
- self.message_layout.setObjectName(u'messageLayout')
+ self.message_layout.setObjectName('messageLayout')
self.message_layout.addSpacing(12)
self.bug_label = QtGui.QLabel(exception_dialog)
- self.bug_label.setPixmap(QtGui.QPixmap(u':/graphics/exception.png'))
+ self.bug_label.setPixmap(QtGui.QPixmap(':/graphics/exception.png'))
self.bug_label.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
- self.bug_label.setObjectName(u'bug_label')
+ self.bug_label.setObjectName('bug_label')
self.message_layout.addWidget(self.bug_label)
self.message_layout.addSpacing(12)
self.message_label = QtGui.QLabel(exception_dialog)
self.message_label.setWordWrap(True)
- self.message_label.setObjectName(u'message_label')
+ self.message_label.setObjectName('message_label')
self.message_layout.addWidget(self.message_label)
self.exception_layout.addLayout(self.message_layout)
self.description_explanation = QtGui.QLabel(exception_dialog)
- self.description_explanation.setObjectName(u'description_explanation')
+ self.description_explanation.setObjectName('description_explanation')
self.exception_layout.addWidget(self.description_explanation)
self.description_text_edit = QtGui.QPlainTextEdit(exception_dialog)
- self.description_text_edit.setObjectName(u'description_text_edit')
+ self.description_text_edit.setObjectName('description_text_edit')
self.exception_layout.addWidget(self.description_text_edit)
self.description_word_count = QtGui.QLabel(exception_dialog)
- self.description_word_count.setObjectName(u'description_word_count')
+ self.description_word_count.setObjectName('description_word_count')
self.exception_layout.addWidget(self.description_word_count)
self.exception_text_edit = QtGui.QPlainTextEdit(exception_dialog)
self.exception_text_edit.setReadOnly(True)
- self.exception_text_edit.setObjectName(u'exception_text_edit')
+ self.exception_text_edit.setObjectName('exception_text_edit')
self.exception_layout.addWidget(self.exception_text_edit)
- self.send_report_button = create_button(exception_dialog, u'send_report_button',
- icon=u':/general/general_email.png', click=self.on_send_report_button_clicked)
- self.save_report_button = create_button(exception_dialog, u'save_report_button',
- icon=u':/general/general_save.png', click=self.on_save_report_button_clicked)
- self.attach_tile_button = create_button(exception_dialog, u'attach_tile_button',
- icon=u':/general/general_open.png', click=self.on_attach_file_button_clicked)
- self.button_box = create_button_box(exception_dialog, u'button_box',
- [u'close'], [self.send_report_button, self.save_report_button, self.attach_tile_button])
+ self.send_report_button = create_button(exception_dialog, 'send_report_button',
+ icon=':/general/general_email.png', click=self.on_send_report_button_clicked)
+ self.save_report_button = create_button(exception_dialog, 'save_report_button',
+ icon=':/general/general_save.png', click=self.on_save_report_button_clicked)
+ self.attach_tile_button = create_button(exception_dialog, 'attach_tile_button',
+ icon=':/general/general_open.png', click=self.on_attach_file_button_clicked)
+ self.button_box = create_button_box(exception_dialog, 'button_box',
+ ['close'], [self.send_report_button, self.save_report_button, self.attach_tile_button])
self.exception_layout.addWidget(self.button_box)
self.retranslateUi(exception_dialog)
=== modified file 'openlp/core/ui/exceptionform.py'
--- openlp/core/ui/exceptionform.py 2013-07-21 20:34:51 +0000
+++ openlp/core/ui/exceptionform.py 2013-08-31 18:18:25 +0000
@@ -46,55 +46,55 @@
from PyQt4.phonon import Phonon
PHONON_VERSION = Phonon.phononVersion()
except ImportError:
- PHONON_VERSION = u'-'
+ PHONON_VERSION = '-'
try:
import migrate
- MIGRATE_VERSION = getattr(migrate, u'__version__', u'< 0.7')
+ MIGRATE_VERSION = getattr(migrate, '__version__', '< 0.7')
except ImportError:
- MIGRATE_VERSION = u'-'
+ MIGRATE_VERSION = '-'
try:
import chardet
CHARDET_VERSION = chardet.__version__
except ImportError:
- CHARDET_VERSION = u'-'
+ CHARDET_VERSION = '-'
try:
import enchant
ENCHANT_VERSION = enchant.__version__
except ImportError:
- ENCHANT_VERSION = u'-'
+ ENCHANT_VERSION = '-'
try:
import mako
MAKO_VERSION = mako.__version__
except ImportError:
- MAKO_VERSION = u'-'
+ MAKO_VERSION = '-'
try:
import icu
try:
ICU_VERSION = icu.VERSION
except AttributeError:
- ICU_VERSION = u'OK'
+ ICU_VERSION = 'OK'
except ImportError:
- ICU_VERSION = u'-'
+ ICU_VERSION = '-'
try:
import cherrypy
CHERRYPY_VERSION = cherrypy.__version__
except ImportError:
- CHERRYPY_VERSION = u'-'
+ CHERRYPY_VERSION = '-'
try:
WEBKIT_VERSION = QtWebKit.qWebKitVersion()
except AttributeError:
- WEBKIT_VERSION = u'-'
+ WEBKIT_VERSION = '-'
try:
from openlp.core.ui.media.vlcplayer import VERSION
VLC_VERSION = VERSION
except ImportError:
- VLC_VERSION = u'-'
+ VLC_VERSION = '-'
from openlp.core.lib import UiStrings, Settings, translate
from openlp.core.utils import get_application_version
-from exceptiondialog import Ui_ExceptionDialog
+from .exceptiondialog import Ui_ExceptionDialog
log = logging.getLogger(__name__)
@@ -109,13 +109,13 @@
"""
super(ExceptionForm, self).__init__(self.main_window)
self.setupUi(self)
- self.settings_section = u'crashreport'
+ self.settings_section = 'crashreport'
def exec_(self):
"""
Show the dialog.
"""
- self.description_text_edit.setPlainText(u'')
+ self.description_text_edit.setPlainText('')
self.on_description_updated()
self.file_attachment = None
return QtGui.QDialog.exec_(self)
@@ -128,29 +128,29 @@
description = self.description_text_edit.toPlainText()
traceback = self.exception_text_edit.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 + \
- u'PyQt4: %s\n' % Qt.PYQT_VERSION_STR + \
- u'QtWebkit: %s\n' % WEBKIT_VERSION + \
- u'SQLAlchemy: %s\n' % sqlalchemy.__version__ + \
- u'SQLAlchemy Migrate: %s\n' % MIGRATE_VERSION + \
- u'BeautifulSoup: %s\n' % bs4.__version__ + \
- u'lxml: %s\n' % etree.__version__ + \
- u'Chardet: %s\n' % CHARDET_VERSION + \
- u'PyEnchant: %s\n' % ENCHANT_VERSION + \
- u'Mako: %s\n' % MAKO_VERSION + \
- u'CherryPy: %s\n' % CHERRYPY_VERSION + \
- u'pyICU: %s\n' % ICU_VERSION + \
- u'pyUNO bridge: %s\n' % self._pyuno_import() + \
- u'VLC: %s\n' % VLC_VERSION
- if platform.system() == u'Linux':
- if os.environ.get(u'KDE_FULL_SESSION') == u'true':
- system += u'Desktop: KDE SC\n'
- elif os.environ.get(u'GNOME_DESKTOP_SESSION_ID'):
- system += u'Desktop: GNOME\n'
- elif os.environ.get(u'DESKTOP_SESSION') == u'xfce':
- system += u'Desktop: Xfce\n'
+ libraries = 'Python: %s\n' % platform.python_version() + \
+ 'Qt4: %s\n' % Qt.qVersion() + \
+ 'Phonon: %s\n' % PHONON_VERSION + \
+ 'PyQt4: %s\n' % Qt.PYQT_VERSION_STR + \
+ 'QtWebkit: %s\n' % WEBKIT_VERSION + \
+ 'SQLAlchemy: %s\n' % sqlalchemy.__version__ + \
+ 'SQLAlchemy Migrate: %s\n' % MIGRATE_VERSION + \
+ 'BeautifulSoup: %s\n' % bs4.__version__ + \
+ 'lxml: %s\n' % etree.__version__ + \
+ 'Chardet: %s\n' % CHARDET_VERSION + \
+ 'PyEnchant: %s\n' % ENCHANT_VERSION + \
+ 'Mako: %s\n' % MAKO_VERSION + \
+ 'CherryPy: %s\n' % CHERRYPY_VERSION + \
+ 'pyICU: %s\n' % ICU_VERSION + \
+ 'pyUNO bridge: %s\n' % self._pyuno_import() + \
+ 'VLC: %s\n' % VLC_VERSION
+ if platform.system() == 'Linux':
+ if os.environ.get('KDE_FULL_SESSION') == 'true':
+ system += 'Desktop: KDE SC\n'
+ elif os.environ.get('GNOME_DESKTOP_SESSION_ID'):
+ system += 'Desktop: GNOME\n'
+ elif os.environ.get('DESKTOP_SESSION') == 'xfce':
+ system += 'Desktop: Xfce\n'
return (openlp_version, description, traceback, system, libraries)
def on_save_report_button_clicked(self):
@@ -166,24 +166,24 @@
'--- Library Versions ---\n%s\n')
filename = QtGui.QFileDialog.getSaveFileName(self,
translate('OpenLP.ExceptionForm', 'Save Crash Report'),
- Settings().value(self.settings_section + u'/last directory'),
+ Settings().value(self.settings_section + '/last directory'),
translate('OpenLP.ExceptionForm', 'Text files (*.txt *.log *.text)'))
if filename:
- filename = unicode(filename).replace(u'/', os.path.sep)
- Settings().setValue(self.settings_section + u'/last directory', os.path.dirname(filename))
+ filename = str(filename).replace('/', os.path.sep)
+ Settings().setValue(self.settings_section + '/last directory', os.path.dirname(filename))
report_text = report_text % self._create_report()
try:
- report_file = open(filename, u'w')
+ report_file = open(filename, 'w')
try:
report_file.write(report_text)
except UnicodeError:
report_file.close()
- report_file = open(filename, u'wb')
- report_file.write(report_text.encode(u'utf-8'))
+ report_file = open(filename, 'wb')
+ report_file.write(report_text.encode('utf-8'))
finally:
report_file.close()
except IOError:
- log.exception(u'Failed to write crash report')
+ log.exception('Failed to write crash report')
finally:
report_file.close()
@@ -201,19 +201,19 @@
'Please add the information that bug reports are favoured written '
'in English.')
content = self._create_report()
- source = u''
- exception = u''
- for line in content[2].split(u'\n'):
+ source = ''
+ exception = ''
+ for line in content[2].split('\n'):
if re.search(r'[/\\]openlp[/\\]', line):
source = re.sub(r'.*[/\\]openlp[/\\](.*)".*', r'\1', line)
- if u':' in line:
- exception = line.split(u'\n')[-1].split(u':')[0]
- subject = u'Bug report: %s in %s' % (exception, source)
- mailto_url = QtCore.QUrl(u'mailto:bugs@xxxxxxxxxx')
- mailto_url.addQueryItem(u'subject', subject)
- mailto_url.addQueryItem(u'body', body % content)
+ if ':' in line:
+ exception = line.split('\n')[-1].split(':')[0]
+ subject = 'Bug report: %s in %s' % (exception, source)
+ mailto_url = QtCore.QUrl('mailto:bugs@xxxxxxxxxx')
+ mailto_url.addQueryItem('subject', subject)
+ mailto_url.addQueryItem('body', body % content)
if self.file_attachment:
- mailto_url.addQueryItem(u'attach', self.file_attachment)
+ mailto_url.addQueryItem('attach', self.file_attachment)
QtGui.QDesktopServices.openUrl(mailto_url)
def on_description_updated(self):
@@ -235,10 +235,10 @@
"""
files = QtGui.QFileDialog.getOpenFileName(
self, translate('ImagePlugin.ExceptionDialog', 'Select Attachment'),
- Settings().value(self.settings_section + u'/last directory'), u'%s (*.*) (*)' % UiStrings().AllFiles)
- log.info(u'New files(s) %s', unicode(files))
+ Settings().value(self.settings_section + '/last directory'), '%s (*.*) (*)' % UiStrings().AllFiles)
+ log.info('New files(s) %s', str(files))
if files:
- self.file_attachment = unicode(files)
+ self.file_attachment = str(files)
def __button_state(self, state):
"""
@@ -256,24 +256,24 @@
"""
try:
import uno
- arg = uno.createUnoStruct(u'com.sun.star.beans.PropertyValue')
- arg.Name = u'nodepath'
- arg.Value = u'/org.openoffice.Setup/Product'
+ arg = uno.createUnoStruct('com.sun.star.beans.PropertyValue')
+ arg.Name = 'nodepath'
+ arg.Value = '/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,))
- return node.getByName(u'ooSetupVersion')
+ provider = context.ServiceManager.createInstance('com.sun.star.configuration.ConfigurationProvider')
+ node = provider.createInstanceWithArguments('com.sun.star.configuration.ConfigurationAccess', (arg,))
+ return node.getByName('ooSetupVersion')
except ImportError:
- return u'-'
+ return '-'
except:
- return u'- (Possible non-standard UNO installation)'
+ return '- (Possible non-standard UNO installation)'
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
- if not hasattr(self, u'_main_window'):
- self._main_window = Registry().get(u'main_window')
+ if not hasattr(self, '_main_window'):
+ self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
=== modified file 'openlp/core/ui/filerenamedialog.py'
--- openlp/core/ui/filerenamedialog.py 2013-03-07 17:58:15 +0000
+++ openlp/core/ui/filerenamedialog.py 2013-08-31 18:18:25 +0000
@@ -43,18 +43,18 @@
"""
Set up the UI
"""
- file_rename_dialog.setObjectName(u'file_rename_dialog')
+ file_rename_dialog.setObjectName('file_rename_dialog')
file_rename_dialog.resize(300, 10)
self.dialog_layout = QtGui.QGridLayout(file_rename_dialog)
- self.dialog_layout.setObjectName(u'dialog_layout')
+ self.dialog_layout.setObjectName('dialog_layout')
self.file_name_label = QtGui.QLabel(file_rename_dialog)
- self.file_name_label.setObjectName(u'file_name_label')
+ self.file_name_label.setObjectName('file_name_label')
self.dialog_layout.addWidget(self.file_name_label, 0, 0)
self.file_name_edit = QtGui.QLineEdit(file_rename_dialog)
self.file_name_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self))
- self.file_name_edit.setObjectName(u'file_name_edit')
+ self.file_name_edit.setObjectName('file_name_edit')
self.dialog_layout.addWidget(self.file_name_edit, 0, 1)
- self.button_box = create_button_box(file_rename_dialog, u'button_box', [u'cancel', u'ok'])
+ self.button_box = create_button_box(file_rename_dialog, 'button_box', ['cancel', 'ok'])
self.dialog_layout.addWidget(self.button_box, 1, 0, 1, 2)
self.retranslateUi(file_rename_dialog)
self.setMaximumHeight(self.sizeHint().height())
=== modified file 'openlp/core/ui/filerenameform.py'
--- openlp/core/ui/filerenameform.py 2013-06-23 17:32:25 +0000
+++ openlp/core/ui/filerenameform.py 2013-08-31 18:18:25 +0000
@@ -32,7 +32,7 @@
from PyQt4 import QtGui
-from filerenamedialog import Ui_FileRenameDialog
+from .filerenamedialog import Ui_FileRenameDialog
from openlp.core.lib import translate, Registry
@@ -45,7 +45,7 @@
"""
Constructor
"""
- super(FileRenameForm, self).__init__(Registry().get(u'main_window'))
+ super(FileRenameForm, self).__init__(Registry().get('main_window'))
self.setupUi(self)
def exec_(self, copy=False):
@@ -63,8 +63,8 @@
"""
Adds the main window to the class dynamically
"""
- if not hasattr(self, u'_main_window'):
- self._main_window = Registry().get(u'main_window')
+ if not hasattr(self, '_main_window'):
+ self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
=== modified file 'openlp/core/ui/firsttimeform.py'
--- openlp/core/ui/firsttimeform.py 2013-07-07 14:41:43 +0000
+++ openlp/core/ui/firsttimeform.py 2013-08-31 18:18:25 +0000
@@ -37,13 +37,13 @@
import urllib.parse
import urllib.error
from tempfile import gettempdir
-from ConfigParser import SafeConfigParser
+from configparser import SafeConfigParser
from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginStatus, Settings, Registry, build_icon, check_directory_exists, translate
from openlp.core.utils import AppLocation, get_web_page
-from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
+from .firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
log = logging.getLogger(__name__)
@@ -56,18 +56,18 @@
"""
Overridden method to run the thread.
"""
- themes = self.parent().config.get(u'themes', u'files')
- themes = themes.split(u',')
+ themes = self.parent().config.get('themes', 'files')
+ themes = themes.split(',')
config = self.parent().config
for theme in themes:
# Stop if the wizard has been cancelled.
if self.parent().was_download_cancelled:
return
- title = config.get(u'theme_%s' % theme, u'title')
- 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(gettempdir(), u'openlp', screenshot))
+ title = config.get('theme_%s' % theme, 'title')
+ filename = config.get('theme_%s' % theme, 'filename')
+ screenshot = config.get('theme_%s' % theme, 'screenshot')
+ urllib.request.urlretrieve('%s%s' % (self.parent().web, screenshot),
+ os.path.join(gettempdir(), 'openlp', screenshot))
item = QtGui.QListWidgetItem(title, self.parent().themes_list_widget)
item.setData(QtCore.Qt.UserRole, filename)
item.setCheckState(QtCore.Qt.Unchecked)
@@ -78,7 +78,7 @@
"""
This is the Theme Import Wizard, which allows easy creation and editing of OpenLP themes.
"""
- log.info(u'ThemeWizardForm loaded')
+ log.info('ThemeWizardForm loaded')
def __init__(self, screens, parent=None):
"""
@@ -88,9 +88,9 @@
self.setupUi(self)
self.screens = screens
# check to see if we have web access
- self.web = u'http://openlp.org/files/frw/'
+ self.web = 'http://openlp.org/files/frw/'
self.config = SafeConfigParser()
- self.web_access = get_web_page(u'%s%s' % (self.web, u'download.cfg'))
+ self.web_access = get_web_page('%s%s' % (self.web, 'download.cfg'))
if self.web_access:
files = self.web_access.read()
self.config.read_string(files.decode())
@@ -101,7 +101,7 @@
self.cancel_button.clicked.connect(self.on_cancel_button_clicked)
self.no_internet_finish_button.clicked.connect(self.on_no_internet_finish_button_clicked)
self.currentIdChanged.connect(self.on_current_id_changed)
- Registry().register_function(u'config_screen_changed', self.update_screen_list_combo)
+ Registry().register_function('config_screen_changed', self.update_screen_list_combo)
def exec_(self):
"""
@@ -115,31 +115,31 @@
Set up display at start of theme edit.
"""
self.restart()
- check_directory_exists(os.path.join(gettempdir(), u'openlp'))
+ check_directory_exists(os.path.join(gettempdir(), 'openlp'))
self.no_internet_finish_button.setVisible(False)
# Check if this is a re-run of the wizard.
- self.has_run_wizard = Settings().value(u'core/has run wizard')
+ self.has_run_wizard = Settings().value('core/has run wizard')
# Sort out internet access for downloads
if self.web_access:
- songs = self.config.get(u'songs', u'languages')
- songs = songs.split(u',')
+ songs = self.config.get('songs', 'languages')
+ songs = songs.split(',')
for song in songs:
- title = self.config.get(u'songs_%s' % song, u'title')
- filename = self.config.get(u'songs_%s' % song, u'filename')
+ title = self.config.get('songs_%s' % song, 'title')
+ filename = self.config.get('songs_%s' % song, 'filename')
item = QtGui.QListWidgetItem(title, self.songs_list_widget)
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',')
+ bible_languages = self.config.get('bibles', 'languages')
+ bible_languages = bible_languages.split(',')
for lang in bible_languages:
- language = self.config.get(u'bibles_%s' % lang, u'title')
+ language = self.config.get('bibles_%s' % lang, 'title')
langItem = QtGui.QTreeWidgetItem(self.bibles_tree_widget, [language])
- bibles = self.config.get(u'bibles_%s' % lang, u'translations')
- bibles = bibles.split(u',')
+ bibles = self.config.get('bibles_%s' % lang, 'translations')
+ bibles = bibles.split(',')
for bible in bibles:
- title = self.config.get(u'bible_%s' % bible, u'title')
- filename = self.config.get(u'bible_%s' % bible, u'filename')
+ title = self.config.get('bible_%s' % bible, 'title')
+ filename = self.config.get('bible_%s' % bible, 'filename')
item = QtGui.QTreeWidgetItem(langItem, [title])
item.setData(0, QtCore.Qt.UserRole, filename)
item.setCheckState(0, QtCore.Qt.Unchecked)
@@ -192,7 +192,7 @@
self.no_internet_label.setText(self.no_internet_text + self.cancelWizardText)
elif page_id == FirstTimePage.Defaults:
self.theme_combo_box.clear()
- for iter in xrange(self.themes_list_widget.count()):
+ for iter in range(self.themes_list_widget.count()):
item = self.themes_list_widget.item(iter)
if item.checkState() == QtCore.Qt.Checked:
self.theme_combo_box.addItem(item.text())
@@ -202,7 +202,7 @@
index = self.theme_combo_box.findText(theme)
if index == -1:
self.theme_combo_box.addItem(theme)
- default_theme = Settings().value(u'themes/global theme')
+ default_theme = Settings().value('themes/global theme')
# Pre-select the current default theme.
index = self.theme_combo_box.findText(default_theme)
self.theme_combo_box.setCurrentIndex(index)
@@ -253,7 +253,7 @@
self.application.set_busy_cursor()
self._perform_wizard()
self.application.set_normal_cursor()
- Settings().setValue(u'core/has run wizard', True)
+ Settings().setValue('core/has run wizard', True)
self.close()
def url_get_file(self, url, f_path):
@@ -263,7 +263,7 @@
"""
block_count = 0
block_size = 4096
- url_file = urllib2.urlopen(url)
+ url_file = urllib.request.urlopen(url)
filename = open(f_path, "wb")
# Download until finished or canceled.
while not self.was_download_cancelled:
@@ -283,16 +283,16 @@
This method builds the theme screenshots' icons for all items in the
``self.themes_list_widget``.
"""
- themes = self.config.get(u'themes', u'files')
- themes = themes.split(u',')
+ themes = self.config.get('themes', 'files')
+ themes = themes.split(',')
for theme in themes:
- filename = self.config.get(u'theme_%s' % theme, u'filename')
- screenshot = self.config.get(u'theme_%s' % theme, u'screenshot')
- for index in xrange(self.themes_list_widget.count()):
+ filename = self.config.get('theme_%s' % theme, 'filename')
+ screenshot = self.config.get('theme_%s' % theme, 'screenshot')
+ for index in range(self.themes_list_widget.count()):
item = self.themes_list_widget.item(index)
if item.data(QtCore.Qt.UserRole) == filename:
break
- item.setIcon(build_icon(os.path.join(gettempdir(), u'openlp', screenshot)))
+ item.setIcon(build_icon(os.path.join(gettempdir(), 'openlp', screenshot)))
def _getFileSize(self, url):
"""
@@ -337,12 +337,12 @@
self.finish_button.setVisible(False)
self.application.process_events()
# Loop through the songs list and increase for each selected item
- for i in xrange(self.songs_list_widget.count()):
+ for i in range(self.songs_list_widget.count()):
self.application.process_events()
item = self.songs_list_widget.item(i)
if item.checkState() == QtCore.Qt.Checked:
filename = item.data(QtCore.Qt.UserRole)
- size = self._getFileSize(u'%s%s' % (self.web, filename))
+ size = self._getFileSize('%s%s' % (self.web, filename))
self.max_progress += size
# Loop through the Bibles list and increase for each selected item
iterator = QtGui.QTreeWidgetItemIterator(self.bibles_tree_widget)
@@ -351,16 +351,16 @@
item = iterator.value()
if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
filename = item.data(0, QtCore.Qt.UserRole)
- size = self._getFileSize(u'%s%s' % (self.web, filename))
+ size = self._getFileSize('%s%s' % (self.web, filename))
self.max_progress += size
iterator += 1
# Loop through the themes list and increase for each selected item
- for i in xrange(self.themes_list_widget.count()):
+ for i in range(self.themes_list_widget.count()):
self.application.process_events()
item = self.themes_list_widget.item(i)
if item.checkState() == QtCore.Qt.Checked:
filename = item.data(QtCore.Qt.UserRole)
- size = self._getFileSize(u'%s%s' % (self.web, filename))
+ size = self._getFileSize('%s%s' % (self.web, filename))
self.max_progress += size
if self.max_progress:
# Add on 2 for plugins status setting plus a "finished" point.
@@ -374,7 +374,7 @@
else:
self.progress_bar.setVisible(False)
self.progress_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Setting Up'))
- self.progress_page.setSubTitle(u'Setup complete.')
+ self.progress_page.setSubTitle('Setup complete.')
self.repaint()
self.application.process_events()
# Try to give the wizard a chance to repaint itself
@@ -411,32 +411,32 @@
"""
# Set plugin states
self._increment_progress_bar(translate('OpenLP.FirstTimeWizard', 'Enabling selected plugins...'))
- self._set_plugin_status(self.songs_check_box, u'songs/status')
- self._set_plugin_status(self.bible_check_box, u'bibles/status')
+ self._set_plugin_status(self.songs_check_box, 'songs/status')
+ self._set_plugin_status(self.bible_check_box, 'bibles/status')
# TODO Presentation plugin is not yet working on Mac OS X.
# For now just ignore it.
if sys.platform != 'darwin':
- self._set_plugin_status(self.presentation_check_box, u'presentations/status')
- self._set_plugin_status(self.image_check_box, u'images/status')
- self._set_plugin_status(self.media_check_box, u'media/status')
- self._set_plugin_status(self.remote_check_box, u'remotes/status')
- self._set_plugin_status(self.custom_check_box, u'custom/status')
- self._set_plugin_status(self.song_usage_check_box, u'songusage/status')
- self._set_plugin_status(self.alert_check_box, u'alerts/status')
+ self._set_plugin_status(self.presentation_check_box, 'presentations/status')
+ self._set_plugin_status(self.image_check_box, 'images/status')
+ self._set_plugin_status(self.media_check_box, 'media/status')
+ self._set_plugin_status(self.remote_check_box, 'remotes/status')
+ self._set_plugin_status(self.custom_check_box, 'custom/status')
+ self._set_plugin_status(self.song_usage_check_box, 'songusage/status')
+ self._set_plugin_status(self.alert_check_box, 'alerts/status')
if self.web_access:
# Build directories for downloads
- songs_destination = os.path.join(gettempdir(), u'openlp')
- bibles_destination = AppLocation.get_section_data_path(u'bibles')
- themes_destination = AppLocation.get_section_data_path(u'themes')
+ songs_destination = os.path.join(gettempdir(), 'openlp')
+ bibles_destination = AppLocation.get_section_data_path('bibles')
+ themes_destination = AppLocation.get_section_data_path('themes')
# Download songs
- for i in xrange(self.songs_list_widget.count()):
+ for i in range(self.songs_list_widget.count()):
item = self.songs_list_widget.item(i)
if item.checkState() == QtCore.Qt.Checked:
filename = item.data(QtCore.Qt.UserRole)
self._increment_progress_bar(self.downloading % filename, 0)
self.previous_size = 0
- destination = os.path.join(songs_destination, unicode(filename))
- self.url_get_file(u'%s%s' % (self.web, filename), destination)
+ destination = os.path.join(songs_destination, str(filename))
+ self.url_get_file('%s%s' % (self.web, filename), destination)
# Download Bibles
bibles_iterator = QtGui.QTreeWidgetItemIterator(
self.bibles_tree_widget)
@@ -446,23 +446,23 @@
bible = item.data(0, QtCore.Qt.UserRole)
self._increment_progress_bar(self.downloading % bible, 0)
self.previous_size = 0
- self.url_get_file(u'%s%s' % (self.web, bible), os.path.join(bibles_destination, bible))
+ self.url_get_file('%s%s' % (self.web, bible), os.path.join(bibles_destination, bible))
bibles_iterator += 1
# Download themes
- for i in xrange(self.themes_list_widget.count()):
+ for i in range(self.themes_list_widget.count()):
item = self.themes_list_widget.item(i)
if item.checkState() == QtCore.Qt.Checked:
theme = item.data(QtCore.Qt.UserRole)
self._increment_progress_bar(self.downloading % theme, 0)
self.previous_size = 0
- self.url_get_file(u'%s%s' % (self.web, theme), os.path.join(themes_destination, theme))
+ self.url_get_file('%s%s' % (self.web, theme), os.path.join(themes_destination, theme))
# Set Default Display
if self.display_combo_box.currentIndex() != -1:
- Settings().setValue(u'core/monitor', self.display_combo_box.currentIndex())
+ Settings().setValue('core/monitor', self.display_combo_box.currentIndex())
self.screens.set_current_display(self.display_combo_box.currentIndex())
# Set Global Theme
if self.theme_combo_box.currentIndex() != -1:
- Settings().setValue(u'themes/global theme', self.theme_combo_box.currentText())
+ Settings().setValue('themes/global theme', self.theme_combo_box.currentText())
def _set_plugin_status(self, field, tag):
"""
@@ -475,8 +475,8 @@
"""
Adds the theme manager to the class dynamically
"""
- if not hasattr(self, u'_theme_manager'):
- self._theme_manager = Registry().get(u'theme_manager')
+ if not hasattr(self, '_theme_manager'):
+ self._theme_manager = Registry().get('theme_manager')
return self._theme_manager
theme_manager = property(_get_theme_manager)
@@ -486,11 +486,11 @@
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
- if os.name == u'nt':
- return Registry().get(u'application')
+ if os.name == 'nt':
+ return Registry().get('application')
else:
- if not hasattr(self, u'_application'):
- self._application = Registry().get(u'application')
+ if not hasattr(self, '_application'):
+ self._application = Registry().get('application')
return self._application
application = property(_get_application)
=== modified file 'openlp/core/ui/firsttimelanguagedialog.py'
--- openlp/core/ui/firsttimelanguagedialog.py 2013-04-18 17:45:14 +0000
+++ openlp/core/ui/firsttimelanguagedialog.py 2013-08-31 18:18:25 +0000
@@ -43,26 +43,26 @@
"""
Set up the UI.
"""
- language_dialog.setObjectName(u'language_dialog')
+ language_dialog.setObjectName('language_dialog')
language_dialog.resize(300, 50)
self.dialog_layout = QtGui.QVBoxLayout(language_dialog)
self.dialog_layout.setContentsMargins(8, 8, 8, 8)
self.dialog_layout.setSpacing(8)
- self.dialog_layout.setObjectName(u'dialog_layout')
+ self.dialog_layout.setObjectName('dialog_layout')
self.info_label = QtGui.QLabel(language_dialog)
- self.info_label.setObjectName(u'info_label')
+ self.info_label.setObjectName('info_label')
self.dialog_layout.addWidget(self.info_label)
self.language_layout = QtGui.QHBoxLayout()
- self.language_layout.setObjectName(u'language_layout')
+ self.language_layout.setObjectName('language_layout')
self.language_label = QtGui.QLabel(language_dialog)
- self.language_label.setObjectName(u'language_label')
+ self.language_label.setObjectName('language_label')
self.language_layout.addWidget(self.language_label)
self.language_combo_box = QtGui.QComboBox(language_dialog)
self.language_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
self.language_combo_box.setObjectName("language_combo_box")
self.language_layout.addWidget(self.language_combo_box)
self.dialog_layout.addLayout(self.language_layout)
- self.button_box = create_button_box(language_dialog, u'button_box', [u'cancel', u'ok'])
+ self.button_box = create_button_box(language_dialog, 'button_box', ['cancel', 'ok'])
self.dialog_layout.addWidget(self.button_box)
self.retranslateUi(language_dialog)
self.setMaximumHeight(self.sizeHint().height())
=== modified file 'openlp/core/ui/firsttimelanguageform.py'
--- openlp/core/ui/firsttimelanguageform.py 2013-07-18 14:19:01 +0000
+++ openlp/core/ui/firsttimelanguageform.py 2013-08-31 18:18:25 +0000
@@ -33,7 +33,7 @@
from openlp.core.lib.ui import create_action
from openlp.core.utils import LanguageManager
-from firsttimelanguagedialog import Ui_FirstTimeLanguageDialog
+from .firsttimelanguagedialog import Ui_FirstTimeLanguageDialog
class FirstTimeLanguageForm(QtGui.QDialog, Ui_FirstTimeLanguageDialog):
@@ -47,7 +47,7 @@
super(FirstTimeLanguageForm, self).__init__(parent)
self.setupUi(self)
self.qmList = LanguageManager.get_qm_list()
- self.language_combo_box.addItem(u'Autodetect')
+ self.language_combo_box.addItem('Autodetect')
self.language_combo_box.addItems(sorted(self.qmList.keys()))
def exec_(self):
=== modified file 'openlp/core/ui/firsttimewizard.py'
--- openlp/core/ui/firsttimewizard.py 2013-05-11 17:41:26 +0000
+++ openlp/core/ui/firsttimewizard.py 2013-08-31 18:18:25 +0000
@@ -59,7 +59,7 @@
"""
Set up the UI.
"""
- first_time_wizard.setObjectName(u'first_time_wizard')
+ first_time_wizard.setObjectName('first_time_wizard')
first_time_wizard.resize(550, 386)
first_time_wizard.setModal(True)
first_time_wizard.setWizardStyle(QtGui.QWizard.ModernStyle)
@@ -70,92 +70,92 @@
self.cancel_button = self.button(QtGui.QWizard.CancelButton)
self.next_button = self.button(QtGui.QWizard.NextButton)
self.back_button = self.button(QtGui.QWizard.BackButton)
- add_welcome_page(first_time_wizard, u':/wizards/wizard_firsttime.bmp')
+ add_welcome_page(first_time_wizard, ':/wizards/wizard_firsttime.bmp')
# The plugins page
self.plugin_page = QtGui.QWizardPage()
- self.plugin_page.setObjectName(u'plugin_page')
+ self.plugin_page.setObjectName('plugin_page')
self.plugin_layout = QtGui.QVBoxLayout(self.plugin_page)
self.plugin_layout.setContentsMargins(40, 15, 40, 0)
- self.plugin_layout.setObjectName(u'plugin_layout')
+ self.plugin_layout.setObjectName('plugin_layout')
self.songs_check_box = QtGui.QCheckBox(self.plugin_page)
self.songs_check_box.setChecked(True)
- self.songs_check_box.setObjectName(u'songs_check_box')
+ self.songs_check_box.setObjectName('songs_check_box')
self.plugin_layout.addWidget(self.songs_check_box)
self.custom_check_box = QtGui.QCheckBox(self.plugin_page)
self.custom_check_box.setChecked(True)
- self.custom_check_box.setObjectName(u'custom_check_box')
+ self.custom_check_box.setObjectName('custom_check_box')
self.plugin_layout.addWidget(self.custom_check_box)
self.bible_check_box = QtGui.QCheckBox(self.plugin_page)
self.bible_check_box.setChecked(True)
- self.bible_check_box.setObjectName(u'bible_check_box')
+ self.bible_check_box.setObjectName('bible_check_box')
self.plugin_layout.addWidget(self.bible_check_box)
self.image_check_box = QtGui.QCheckBox(self.plugin_page)
self.image_check_box.setChecked(True)
- self.image_check_box.setObjectName(u'image_check_box')
+ self.image_check_box.setObjectName('image_check_box')
self.plugin_layout.addWidget(self.image_check_box)
# TODO Presentation plugin is not yet working on Mac OS X.
# For now just ignore it.
if sys.platform != 'darwin':
self.presentation_check_box = QtGui.QCheckBox(self.plugin_page)
self.presentation_check_box.setChecked(True)
- self.presentation_check_box.setObjectName(u'presentation_check_box')
+ self.presentation_check_box.setObjectName('presentation_check_box')
self.plugin_layout.addWidget(self.presentation_check_box)
self.media_check_box = QtGui.QCheckBox(self.plugin_page)
self.media_check_box.setChecked(True)
- self.media_check_box.setObjectName(u'media_check_box')
+ self.media_check_box.setObjectName('media_check_box')
self.plugin_layout.addWidget(self.media_check_box)
self.remote_check_box = QtGui.QCheckBox(self.plugin_page)
- self.remote_check_box.setObjectName(u'remote_check_box')
+ self.remote_check_box.setObjectName('remote_check_box')
self.plugin_layout.addWidget(self.remote_check_box)
self.song_usage_check_box = QtGui.QCheckBox(self.plugin_page)
self.song_usage_check_box.setChecked(True)
- self.song_usage_check_box.setObjectName(u'song_usage_check_box')
+ self.song_usage_check_box.setObjectName('song_usage_check_box')
self.plugin_layout.addWidget(self.song_usage_check_box)
self.alert_check_box = QtGui.QCheckBox(self.plugin_page)
self.alert_check_box.setChecked(True)
- self.alert_check_box.setObjectName(u'alert_check_box')
+ self.alert_check_box.setObjectName('alert_check_box')
self.plugin_layout.addWidget(self.alert_check_box)
first_time_wizard.setPage(FirstTimePage.Plugins, self.plugin_page)
# The "you don't have an internet connection" page.
self.no_internet_page = QtGui.QWizardPage()
- self.no_internet_page.setObjectName(u'no_internet_page')
+ self.no_internet_page.setObjectName('no_internet_page')
self.no_internet_layout = QtGui.QVBoxLayout(self.no_internet_page)
self.no_internet_layout.setContentsMargins(50, 30, 50, 40)
- self.no_internet_layout.setObjectName(u'no_internet_layout')
+ self.no_internet_layout.setObjectName('no_internet_layout')
self.no_internet_label = QtGui.QLabel(self.no_internet_page)
self.no_internet_label.setWordWrap(True)
- self.no_internet_label.setObjectName(u'no_internet_label')
+ self.no_internet_label.setObjectName('no_internet_label')
self.no_internet_layout.addWidget(self.no_internet_label)
first_time_wizard.setPage(FirstTimePage.NoInternet, self.no_internet_page)
# The song samples page
self.songs_page = QtGui.QWizardPage()
- self.songs_page.setObjectName(u'songs_page')
+ self.songs_page.setObjectName('songs_page')
self.songs_layout = QtGui.QVBoxLayout(self.songs_page)
self.songs_layout.setContentsMargins(50, 20, 50, 20)
- self.songs_layout.setObjectName(u'songs_layout')
+ self.songs_layout.setObjectName('songs_layout')
self.songs_list_widget = QtGui.QListWidget(self.songs_page)
self.songs_list_widget.setAlternatingRowColors(True)
- self.songs_list_widget.setObjectName(u'songs_list_widget')
+ self.songs_list_widget.setObjectName('songs_list_widget')
self.songs_layout.addWidget(self.songs_list_widget)
first_time_wizard.setPage(FirstTimePage.Songs, self.songs_page)
# The Bible samples page
self.bibles_page = QtGui.QWizardPage()
- self.bibles_page.setObjectName(u'bibles_page')
+ self.bibles_page.setObjectName('bibles_page')
self.bibles_layout = QtGui.QVBoxLayout(self.bibles_page)
self.bibles_layout.setContentsMargins(50, 20, 50, 20)
- self.bibles_layout.setObjectName(u'bibles_layout')
+ self.bibles_layout.setObjectName('bibles_layout')
self.bibles_tree_widget = QtGui.QTreeWidget(self.bibles_page)
self.bibles_tree_widget.setAlternatingRowColors(True)
self.bibles_tree_widget.header().setVisible(False)
- self.bibles_tree_widget.setObjectName(u'bibles_tree_widget')
+ self.bibles_tree_widget.setObjectName('bibles_tree_widget')
self.bibles_layout.addWidget(self.bibles_tree_widget)
first_time_wizard.setPage(FirstTimePage.Bibles, self.bibles_page)
# The theme samples page
self.themes_page = QtGui.QWizardPage()
- self.themes_page.setObjectName(u'themes_page')
+ self.themes_page.setObjectName('themes_page')
self.themes_layout = QtGui.QVBoxLayout(self.themes_page)
self.themes_layout.setContentsMargins(20, 50, 20, 60)
- self.themes_layout.setObjectName(u'themes_layout')
+ self.themes_layout.setObjectName('themes_layout')
self.themes_list_widget = QtGui.QListWidget(self.themes_page)
self.themes_list_widget.setViewMode(QtGui.QListView.IconMode)
self.themes_list_widget.setMovement(QtGui.QListView.Static)
@@ -164,42 +164,42 @@
self.themes_list_widget.setUniformItemSizes(True)
self.themes_list_widget.setIconSize(QtCore.QSize(133, 100))
self.themes_list_widget.setWrapping(False)
- self.themes_list_widget.setObjectName(u'themes_list_widget')
+ self.themes_list_widget.setObjectName('themes_list_widget')
self.themes_layout.addWidget(self.themes_list_widget)
first_time_wizard.setPage(FirstTimePage.Themes, self.themes_page)
# the default settings page
self.defaults_page = QtGui.QWizardPage()
- self.defaults_page.setObjectName(u'defaults_page')
+ self.defaults_page.setObjectName('defaults_page')
self.defaults_layout = QtGui.QFormLayout(self.defaults_page)
self.defaults_layout.setContentsMargins(50, 20, 50, 20)
- self.defaults_layout.setObjectName(u'defaults_layout')
+ self.defaults_layout.setObjectName('defaults_layout')
self.display_label = QtGui.QLabel(self.defaults_page)
- self.display_label.setObjectName(u'display_label')
+ self.display_label.setObjectName('display_label')
self.display_combo_box = QtGui.QComboBox(self.defaults_page)
self.display_combo_box.setEditable(False)
self.display_combo_box.setInsertPolicy(QtGui.QComboBox.NoInsert)
- self.display_combo_box.setObjectName(u'display_combo_box')
+ self.display_combo_box.setObjectName('display_combo_box')
self.defaults_layout.addRow(self.display_label, self.display_combo_box)
self.theme_label = QtGui.QLabel(self.defaults_page)
- self.theme_label.setObjectName(u'theme_label')
+ self.theme_label.setObjectName('theme_label')
self.theme_combo_box = QtGui.QComboBox(self.defaults_page)
self.theme_combo_box.setEditable(False)
self.theme_combo_box.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.theme_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
- self.theme_combo_box.setObjectName(u'theme_combo_box')
+ self.theme_combo_box.setObjectName('theme_combo_box')
self.defaults_layout.addRow(self.theme_label, self.theme_combo_box)
first_time_wizard.setPage(FirstTimePage.Defaults, self.defaults_page)
# Progress page
self.progress_page = QtGui.QWizardPage()
- self.progress_page.setObjectName(u'progress_page')
+ self.progress_page.setObjectName('progress_page')
self.progress_layout = QtGui.QVBoxLayout(self.progress_page)
self.progress_layout.setMargin(48)
- self.progress_layout.setObjectName(u'progress_layout')
+ self.progress_layout.setObjectName('progress_layout')
self.progress_label = QtGui.QLabel(self.progress_page)
- self.progress_label.setObjectName(u'progress_label')
+ self.progress_label.setObjectName('progress_label')
self.progress_layout.addWidget(self.progress_label)
self.progress_bar = QtGui.QProgressBar(self.progress_page)
- self.progress_bar.setObjectName(u'progress_bar')
+ self.progress_bar.setObjectName('progress_bar')
self.progress_layout.addWidget(self.progress_bar)
first_time_wizard.setPage(FirstTimePage.Progress, self.progress_page)
self.retranslateUi(first_time_wizard)
@@ -209,7 +209,7 @@
Translate the UI on the fly
"""
first_time_wizard.setWindowTitle(translate('OpenLP.FirstTimeWizard', 'First Time Wizard'))
- self.title_label.setText(u'<span style="font-size:14pt; font-weight:600;">%s</span>' %
+ self.title_label.setText('<span style="font-size:14pt; font-weight:600;">%s</span>' %
translate('OpenLP.FirstTimeWizard', 'Welcome to the First Time Wizard'))
self.information_label.setText(translate('OpenLP.FirstTimeWizard',
'This wizard will help you to configure OpenLP for initial use. Click the next button below to start.'))
=== modified file 'openlp/core/ui/formattingtagdialog.py'
--- openlp/core/ui/formattingtagdialog.py 2013-03-06 22:32:59 +0000
+++ openlp/core/ui/formattingtagdialog.py 2013-08-31 18:18:25 +0000
@@ -43,11 +43,11 @@
"""
Set up the UI
"""
- formatting_tag_dialog.setObjectName(u'formatting_tag_dialog')
+ formatting_tag_dialog.setObjectName('formatting_tag_dialog')
formatting_tag_dialog.resize(725, 548)
self.list_data_grid_layout = QtGui.QGridLayout(formatting_tag_dialog)
self.list_data_grid_layout.setMargin(8)
- self.list_data_grid_layout.setObjectName(u'list_data_grid_layout')
+ self.list_data_grid_layout.setObjectName('list_data_grid_layout')
self.tag_table_widget = QtGui.QTableWidget(formatting_tag_dialog)
self.tag_table_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.tag_table_widget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
@@ -55,7 +55,7 @@
self.tag_table_widget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
self.tag_table_widget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
self.tag_table_widget.setCornerButtonEnabled(False)
- self.tag_table_widget.setObjectName(u'tag_table_widget')
+ self.tag_table_widget.setObjectName('tag_table_widget')
self.tag_table_widget.setColumnCount(4)
self.tag_table_widget.setRowCount(0)
self.tag_table_widget.horizontalHeader().setStretchLastSection(True)
@@ -69,55 +69,55 @@
self.tag_table_widget.setHorizontalHeaderItem(3, item)
self.list_data_grid_layout.addWidget(self.tag_table_widget, 0, 0, 1, 1)
self.horizontal_layout = QtGui.QHBoxLayout()
- self.horizontal_layout.setObjectName(u'horizontal_layout')
+ self.horizontal_layout.setObjectName('horizontal_layout')
spacer_item = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontal_layout.addItem(spacer_item)
self.delete_push_button = QtGui.QPushButton(formatting_tag_dialog)
- self.delete_push_button.setObjectName(u'delete_push_button')
+ self.delete_push_button.setObjectName('delete_push_button')
self.horizontal_layout.addWidget(self.delete_push_button)
self.list_data_grid_layout.addLayout(self.horizontal_layout, 1, 0, 1, 1)
self.edit_group_box = QtGui.QGroupBox(formatting_tag_dialog)
- self.edit_group_box.setObjectName(u'edit_group_box')
+ self.edit_group_box.setObjectName('edit_group_box')
self.data_grid_layout = QtGui.QGridLayout(self.edit_group_box)
- self.data_grid_layout.setObjectName(u'data_grid_layout')
+ self.data_grid_layout.setObjectName('data_grid_layout')
self.description_label = QtGui.QLabel(self.edit_group_box)
self.description_label.setAlignment(QtCore.Qt.AlignCenter)
- self.description_label.setObjectName(u'description_label')
+ self.description_label.setObjectName('description_label')
self.data_grid_layout.addWidget(self.description_label, 0, 0, 1, 1)
self.description_line_edit = QtGui.QLineEdit(self.edit_group_box)
- self.description_line_edit.setObjectName(u'description_line_edit')
+ self.description_line_edit.setObjectName('description_line_edit')
self.data_grid_layout.addWidget(self.description_line_edit, 0, 1, 2, 1)
self.new_push_button = QtGui.QPushButton(self.edit_group_box)
- self.new_push_button.setObjectName(u'new_push_button')
+ self.new_push_button.setObjectName('new_push_button')
self.data_grid_layout.addWidget(self.new_push_button, 0, 2, 2, 1)
self.tag_label = QtGui.QLabel(self.edit_group_box)
self.tag_label.setAlignment(QtCore.Qt.AlignCenter)
- self.tag_label.setObjectName(u'tag_label')
+ self.tag_label.setObjectName('tag_label')
self.data_grid_layout.addWidget(self.tag_label, 2, 0, 1, 1)
self.tag_line_edit = QtGui.QLineEdit(self.edit_group_box)
self.tag_line_edit.setMaximumSize(QtCore.QSize(50, 16777215))
self.tag_line_edit.setMaxLength(5)
- self.tag_line_edit.setObjectName(u'tag_line_edit')
+ self.tag_line_edit.setObjectName('tag_line_edit')
self.data_grid_layout.addWidget(self.tag_line_edit, 2, 1, 1, 1)
self.start_tag_label = QtGui.QLabel(self.edit_group_box)
self.start_tag_label.setAlignment(QtCore.Qt.AlignCenter)
- self.start_tag_label.setObjectName(u'start_tag_label')
+ self.start_tag_label.setObjectName('start_tag_label')
self.data_grid_layout.addWidget(self.start_tag_label, 3, 0, 1, 1)
self.start_tag_line_edit = QtGui.QLineEdit(self.edit_group_box)
- self.start_tag_line_edit.setObjectName(u'start_tag_line_edit')
+ self.start_tag_line_edit.setObjectName('start_tag_line_edit')
self.data_grid_layout.addWidget(self.start_tag_line_edit, 3, 1, 1, 1)
self.end_tag_label = QtGui.QLabel(self.edit_group_box)
self.end_tag_label.setAlignment(QtCore.Qt.AlignCenter)
- self.end_tag_label.setObjectName(u'end_tag_label')
+ self.end_tag_label.setObjectName('end_tag_label')
self.data_grid_layout.addWidget(self.end_tag_label, 4, 0, 1, 1)
self.end_tag_line_edit = QtGui.QLineEdit(self.edit_group_box)
- self.end_tag_line_edit.setObjectName(u'end_tag_line_edit')
+ self.end_tag_line_edit.setObjectName('end_tag_line_edit')
self.data_grid_layout.addWidget(self.end_tag_line_edit, 4, 1, 1, 1)
self.save_push_button = QtGui.QPushButton(self.edit_group_box)
- self.save_push_button.setObjectName(u'save_push_button')
+ self.save_push_button.setObjectName('save_push_button')
self.data_grid_layout.addWidget(self.save_push_button, 4, 2, 1, 1)
self.list_data_grid_layout.addWidget(self.edit_group_box, 2, 0, 1, 1)
- self.button_box = create_button_box(formatting_tag_dialog, u'button_box', [u'close'])
+ self.button_box = create_button_box(formatting_tag_dialog, 'button_box', ['close'])
self.list_data_grid_layout.addWidget(self.button_box, 3, 0, 1, 1)
self.retranslateUi(formatting_tag_dialog)
=== modified file 'openlp/core/ui/formattingtagform.py'
--- openlp/core/ui/formattingtagform.py 2013-08-31 15:23:46 +0000
+++ openlp/core/ui/formattingtagform.py 2013-08-31 18:18:25 +0000
@@ -76,11 +76,11 @@
self.save_push_button.setEnabled(False)
self.selected = self.tag_table_widget.currentRow()
html = FormattingTags.get_html_tags()[self.selected]
- self.description_line_edit.setText(html[u'desc'])
- self.tag_line_edit.setText(self._strip(html[u'start tag']))
- self.start_tag_line_edit.setText(html[u'start html'])
- self.end_tag_line_edit.setText(html[u'end html'])
- if html[u'protected']:
+ self.description_line_edit.setText(html['desc'])
+ self.tag_line_edit.setText(self._strip(html['start tag']))
+ self.start_tag_line_edit.setText(html['start html'])
+ self.end_tag_line_edit.setText(html['end html'])
+ if html['protected']:
self.description_line_edit.setEnabled(False)
self.tag_line_edit.setEnabled(False)
self.start_tag_line_edit.setEnabled(False)
@@ -105,20 +105,20 @@
Add a new tag to list only if it is not a duplicate.
"""
for html in FormattingTags.get_html_tags():
- if self._strip(html[u'start tag']) == u'n':
+ if self._strip(html['start tag']) == 'n':
critical_error_message_box(
translate('OpenLP.FormattingTagForm', 'Update Error'),
translate('OpenLP.FormattingTagForm', 'Tag "n" already defined.'))
return
# Add new tag to list
tag = {
- u'desc': translate('OpenLP.FormattingTagForm', 'New Tag'),
- u'start tag': u'{n}',
- u'start html': translate('OpenLP.FormattingTagForm', '<HTML here>'),
- u'end tag': u'{/n}',
- u'end html': translate('OpenLP.FormattingTagForm', '</and here>'),
- u'protected': False,
- u'temporary': False
+ 'desc': translate('OpenLP.FormattingTagForm', 'New Tag'),
+ 'start tag': '{n}',
+ 'start html': translate('OpenLP.FormattingTagForm', '<HTML here>'),
+ 'end tag': '{/n}',
+ 'end html': translate('OpenLP.FormattingTagForm', '</and here>'),
+ 'protected': False,
+ 'temporary': False
}
FormattingTags.add_html_tags([tag])
FormattingTags.save_html_tags()
@@ -150,18 +150,18 @@
html = html_expands[self.selected]
tag = self.tag_line_edit.text()
for linenumber, html1 in enumerate(html_expands):
- if self._strip(html1[u'start tag']) == tag and linenumber != self.selected:
+ if self._strip(html1['start tag']) == tag and linenumber != self.selected:
critical_error_message_box(
translate('OpenLP.FormattingTagForm', 'Update Error'),
translate('OpenLP.FormattingTagForm', 'Tag %s already defined.') % tag)
return
- html[u'desc'] = self.description_line_edit.text()
- html[u'start html'] = self.start_tag_line_edit.text()
- html[u'end html'] = self.end_tag_line_edit.text()
- html[u'start tag'] = u'{%s}' % tag
- html[u'end tag'] = u'{/%s}' % tag
+ html['desc'] = self.description_line_edit.text()
+ html['start html'] = self.start_tag_line_edit.text()
+ html['end html'] = self.end_tag_line_edit.text()
+ html['start tag'] = '{%s}' % tag
+ html['end tag'] = '{/%s}' % tag
# Keep temporary tags when the user changes one.
- html[u'temporary'] = False
+ html['temporary'] = False
self.selected = -1
FormattingTags.save_html_tags()
self._reloadTable()
@@ -177,18 +177,18 @@
self.delete_push_button.setEnabled(False)
for linenumber, html in enumerate(FormattingTags.get_html_tags()):
self.tag_table_widget.setRowCount(self.tag_table_widget.rowCount() + 1)
- self.tag_table_widget.setItem(linenumber, 0, QtGui.QTableWidgetItem(html[u'desc']))
- self.tag_table_widget.setItem(linenumber, 1, QtGui.QTableWidgetItem(self._strip(html[u'start tag'])))
- self.tag_table_widget.setItem(linenumber, 2, QtGui.QTableWidgetItem(html[u'start html']))
- self.tag_table_widget.setItem(linenumber, 3, QtGui.QTableWidgetItem(html[u'end html']))
+ self.tag_table_widget.setItem(linenumber, 0, QtGui.QTableWidgetItem(html['desc']))
+ self.tag_table_widget.setItem(linenumber, 1, QtGui.QTableWidgetItem(self._strip(html['start tag'])))
+ self.tag_table_widget.setItem(linenumber, 2, QtGui.QTableWidgetItem(html['start html']))
+ self.tag_table_widget.setItem(linenumber, 3, QtGui.QTableWidgetItem(html['end html']))
# Permanent (persistent) tags do not have this key.
- if u'temporary' not in html:
- html[u'temporary'] = False
+ if 'temporary' not in html:
+ html['temporary'] = False
self.tag_table_widget.resizeRowsToContents()
- self.description_line_edit.setText(u'')
- self.tag_line_edit.setText(u'')
- self.start_tag_line_edit.setText(u'')
- self.end_tag_line_edit.setText(u'')
+ self.description_line_edit.setText('')
+ self.tag_line_edit.setText('')
+ self.start_tag_line_edit.setText('')
+ self.end_tag_line_edit.setText('')
self.description_line_edit.setEnabled(False)
self.tag_line_edit.setEnabled(False)
self.start_tag_line_edit.setEnabled(False)
@@ -198,6 +198,6 @@
"""
Remove tag wrappers for editing.
"""
- tag = tag.replace(u'{', u'')
- tag = tag.replace(u'}', u'')
+ tag = tag.replace('{', '')
+ tag = tag.replace('}', '')
return tag
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2013-07-18 19:10:19 +0000
+++ openlp/core/ui/generaltab.py 2013-08-31 18:18:25 +0000
@@ -47,63 +47,63 @@
Initialise the general settings tab
"""
self.screens = ScreenList()
- self.icon_path = u':/icon/openlp-logo-16x16.png'
+ self.icon_path = ':/icon/openlp-logo-16x16.png'
general_translated = translate('OpenLP.GeneralTab', 'General')
- super(GeneralTab, self).__init__(parent, u'Core', general_translated)
+ super(GeneralTab, self).__init__(parent, 'Core', general_translated)
def setupUi(self):
"""
Create the user interface for the general settings tab
"""
- self.setObjectName(u'GeneralTab')
+ self.setObjectName('GeneralTab')
super(GeneralTab, self).setupUi()
self.tab_layout.setStretch(1, 1)
# Monitors
self.monitor_group_box = QtGui.QGroupBox(self.left_column)
- self.monitor_group_box.setObjectName(u'monitor_group_box')
+ self.monitor_group_box.setObjectName('monitor_group_box')
self.monitor_layout = QtGui.QGridLayout(self.monitor_group_box)
- self.monitor_layout.setObjectName(u'monitor_layout')
+ self.monitor_layout.setObjectName('monitor_layout')
self.monitor_radio_button = QtGui.QRadioButton(self.monitor_group_box)
- self.monitor_radio_button.setObjectName(u'monitor_radio_button')
+ self.monitor_radio_button.setObjectName('monitor_radio_button')
self.monitor_layout.addWidget(self.monitor_radio_button, 0, 0, 1, 5)
self.monitor_combo_box = QtGui.QComboBox(self.monitor_group_box)
- self.monitor_combo_box.setObjectName(u'monitor_combo_box')
+ self.monitor_combo_box.setObjectName('monitor_combo_box')
self.monitor_layout.addWidget(self.monitor_combo_box, 1, 1, 1, 4)
# Display Position
self.override_radio_button = QtGui.QRadioButton(self.monitor_group_box)
- self.override_radio_button.setObjectName(u'override_radio_button')
+ self.override_radio_button.setObjectName('override_radio_button')
self.monitor_layout.addWidget(self.override_radio_button, 2, 0, 1, 5)
# Custom position
self.custom_x_label = QtGui.QLabel(self.monitor_group_box)
- self.custom_x_label.setObjectName(u'custom_x_label')
+ self.custom_x_label.setObjectName('custom_x_label')
self.monitor_layout.addWidget(self.custom_x_label, 3, 1)
self.custom_X_value_edit = QtGui.QSpinBox(self.monitor_group_box)
- self.custom_X_value_edit.setObjectName(u'custom_X_value_edit')
+ self.custom_X_value_edit.setObjectName('custom_X_value_edit')
self.custom_X_value_edit.setRange(-9999, 9999)
self.monitor_layout.addWidget(self.custom_X_value_edit, 4, 1)
self.custom_y_label = QtGui.QLabel(self.monitor_group_box)
- self.custom_y_label.setObjectName(u'custom_y_label')
+ self.custom_y_label.setObjectName('custom_y_label')
self.monitor_layout.addWidget(self.custom_y_label, 3, 2)
self.custom_Y_value_edit = QtGui.QSpinBox(self.monitor_group_box)
- self.custom_Y_value_edit.setObjectName(u'custom_Y_value_edit')
+ self.custom_Y_value_edit.setObjectName('custom_Y_value_edit')
self.custom_Y_value_edit.setRange(-9999, 9999)
self.monitor_layout.addWidget(self.custom_Y_value_edit, 4, 2)
self.custom_width_label = QtGui.QLabel(self.monitor_group_box)
- self.custom_width_label.setObjectName(u'custom_width_label')
+ self.custom_width_label.setObjectName('custom_width_label')
self.monitor_layout.addWidget(self.custom_width_label, 3, 3)
self.custom_width_value_edit = QtGui.QSpinBox(self.monitor_group_box)
- self.custom_width_value_edit.setObjectName(u'custom_width_value_edit')
+ self.custom_width_value_edit.setObjectName('custom_width_value_edit')
self.custom_width_value_edit.setRange(1, 9999)
self.monitor_layout.addWidget(self.custom_width_value_edit, 4, 3)
self.custom_height_label = QtGui.QLabel(self.monitor_group_box)
- self.custom_height_label.setObjectName(u'custom_height_label')
+ self.custom_height_label.setObjectName('custom_height_label')
self.monitor_layout.addWidget(self.custom_height_label, 3, 4)
self.custom_height_value_edit = QtGui.QSpinBox(self.monitor_group_box)
- self.custom_height_value_edit.setObjectName(u'custom_height_value_edit')
+ self.custom_height_value_edit.setObjectName('custom_height_value_edit')
self.custom_height_value_edit.setRange(1, 9999)
self.monitor_layout.addWidget(self.custom_height_value_edit, 4, 4)
self.display_on_monitor_check = QtGui.QCheckBox(self.monitor_group_box)
- self.display_on_monitor_check.setObjectName(u'monitor_combo_box')
+ self.display_on_monitor_check.setObjectName('monitor_combo_box')
self.monitor_layout.addWidget(self.display_on_monitor_check, 5, 0, 1, 5)
# Set up the stretchiness of each column, so that the first column
# less stretchy (and therefore smaller) than the others
@@ -115,77 +115,77 @@
self.left_layout.addWidget(self.monitor_group_box)
# CCLI Details
self.ccli_group_box = QtGui.QGroupBox(self.left_column)
- self.ccli_group_box.setObjectName(u'ccli_group_box')
+ self.ccli_group_box.setObjectName('ccli_group_box')
self.ccli_layout = QtGui.QFormLayout(self.ccli_group_box)
- self.ccli_layout.setObjectName(u'ccli_layout')
+ self.ccli_layout.setObjectName('ccli_layout')
self.number_label = QtGui.QLabel(self.ccli_group_box)
- self.number_label.setObjectName(u'number_label')
+ self.number_label.setObjectName('number_label')
self.number_edit = QtGui.QLineEdit(self.ccli_group_box)
self.number_edit.setValidator(QtGui.QIntValidator())
- self.number_edit.setObjectName(u'number_edit')
+ self.number_edit.setObjectName('number_edit')
self.ccli_layout.addRow(self.number_label, self.number_edit)
self.username_label = QtGui.QLabel(self.ccli_group_box)
- self.username_label.setObjectName(u'username_label')
+ self.username_label.setObjectName('username_label')
self.username_edit = QtGui.QLineEdit(self.ccli_group_box)
- self.username_edit.setObjectName(u'username_edit')
+ self.username_edit.setObjectName('username_edit')
self.ccli_layout.addRow(self.username_label, self.username_edit)
self.password_label = QtGui.QLabel(self.ccli_group_box)
- self.password_label.setObjectName(u'password_label')
+ self.password_label.setObjectName('password_label')
self.password_edit = QtGui.QLineEdit(self.ccli_group_box)
self.password_edit.setEchoMode(QtGui.QLineEdit.Password)
- self.password_edit.setObjectName(u'password_edit')
+ self.password_edit.setObjectName('password_edit')
self.ccli_layout.addRow(self.password_label, self.password_edit)
self.left_layout.addWidget(self.ccli_group_box)
# Background audio
self.audio_group_box = QtGui.QGroupBox(self.left_column)
- self.audio_group_box.setObjectName(u'audio_group_box')
+ self.audio_group_box.setObjectName('audio_group_box')
self.audio_layout = QtGui.QVBoxLayout(self.audio_group_box)
- self.audio_layout.setObjectName(u'audio_layout')
+ self.audio_layout.setObjectName('audio_layout')
self.start_paused_check_box = QtGui.QCheckBox(self.audio_group_box)
- self.start_paused_check_box.setObjectName(u'start_paused_check_box')
+ self.start_paused_check_box.setObjectName('start_paused_check_box')
self.audio_layout.addWidget(self.start_paused_check_box)
self.repeat_list_check_box = QtGui.QCheckBox(self.audio_group_box)
- self.repeat_list_check_box.setObjectName(u'repeat_list_check_box')
+ self.repeat_list_check_box.setObjectName('repeat_list_check_box')
self.audio_layout.addWidget(self.repeat_list_check_box)
self.left_layout.addWidget(self.audio_group_box)
self.left_layout.addStretch()
# Application Startup
self.startup_group_box = QtGui.QGroupBox(self.right_column)
- self.startup_group_box.setObjectName(u'startup_group_box')
+ self.startup_group_box.setObjectName('startup_group_box')
self.startup_layout = QtGui.QVBoxLayout(self.startup_group_box)
- self.startup_layout.setObjectName(u'startup_layout')
+ self.startup_layout.setObjectName('startup_layout')
self.warning_check_box = QtGui.QCheckBox(self.startup_group_box)
- self.warning_check_box.setObjectName(u'warning_check_box')
+ self.warning_check_box.setObjectName('warning_check_box')
self.startup_layout.addWidget(self.warning_check_box)
self.auto_open_check_box = QtGui.QCheckBox(self.startup_group_box)
- self.auto_open_check_box.setObjectName(u'auto_open_check_box')
+ self.auto_open_check_box.setObjectName('auto_open_check_box')
self.startup_layout.addWidget(self.auto_open_check_box)
self.show_splash_check_box = QtGui.QCheckBox(self.startup_group_box)
- self.show_splash_check_box.setObjectName(u'show_splash_check_box')
+ self.show_splash_check_box.setObjectName('show_splash_check_box')
self.startup_layout.addWidget(self.show_splash_check_box)
self.check_for_updates_check_box = QtGui.QCheckBox(self.startup_group_box)
- self.check_for_updates_check_box.setObjectName(u'check_for_updates_check_box')
+ self.check_for_updates_check_box.setObjectName('check_for_updates_check_box')
self.startup_layout.addWidget(self.check_for_updates_check_box)
self.right_layout.addWidget(self.startup_group_box)
# Application Settings
self.settings_group_box = QtGui.QGroupBox(self.right_column)
- self.settings_group_box.setObjectName(u'settings_group_box')
+ self.settings_group_box.setObjectName('settings_group_box')
self.settings_layout = QtGui.QFormLayout(self.settings_group_box)
- self.settings_layout.setObjectName(u'settings_layout')
+ self.settings_layout.setObjectName('settings_layout')
self.save_check_service_check_box = QtGui.QCheckBox(self.settings_group_box)
- self.save_check_service_check_box.setObjectName(u'save_check_service_check_box')
+ self.save_check_service_check_box.setObjectName('save_check_service_check_box')
self.settings_layout.addRow(self.save_check_service_check_box)
self.auto_unblank_check_box = QtGui.QCheckBox(self.settings_group_box)
- self.auto_unblank_check_box.setObjectName(u'auto_unblank_check_box')
+ self.auto_unblank_check_box.setObjectName('auto_unblank_check_box')
self.settings_layout.addRow(self.auto_unblank_check_box)
self.auto_preview_check_box = QtGui.QCheckBox(self.settings_group_box)
- self.auto_preview_check_box.setObjectName(u'auto_preview_check_box')
+ self.auto_preview_check_box.setObjectName('auto_preview_check_box')
self.settings_layout.addRow(self.auto_preview_check_box)
# Moved here from image tab
self.timeout_label = QtGui.QLabel(self.settings_group_box)
- self.timeout_label.setObjectName(u'timeout_label')
+ self.timeout_label.setObjectName('timeout_label')
self.timeout_spin_box = QtGui.QSpinBox(self.settings_group_box)
- self.timeout_spin_box.setObjectName(u'timeout_spin_box')
+ self.timeout_spin_box.setObjectName('timeout_spin_box')
self.timeout_spin_box.setRange(1, 180)
self.settings_layout.addRow(self.timeout_label, self.timeout_spin_box)
self.right_layout.addWidget(self.settings_group_box)
@@ -198,7 +198,7 @@
self.custom_X_value_edit.valueChanged.connect(self.on_display_changed)
self.monitor_combo_box.currentIndexChanged.connect(self.on_display_changed)
# Reload the tab, as the screen resolution/count may have changed.
- Registry().register_function(u'config_screen_changed', self.load)
+ Registry().register_function('config_screen_changed', self.load)
# Remove for now
self.username_label.setVisible(False)
self.username_edit.setVisible(False)
@@ -247,28 +247,28 @@
settings.beginGroup(self.settings_section)
self.monitor_combo_box.clear()
self.monitor_combo_box.addItems(self.screens.get_screen_list())
- monitorNumber = settings.value(u'monitor')
+ monitorNumber = settings.value('monitor')
self.monitor_combo_box.setCurrentIndex(monitorNumber)
- self.number_edit.setText(settings.value(u'ccli number'))
- self.username_edit.setText(settings.value(u'songselect username'))
- self.password_edit.setText(settings.value(u'songselect password'))
- self.save_check_service_check_box.setChecked(settings.value(u'save prompt'))
- self.auto_unblank_check_box.setChecked(settings.value(u'auto unblank'))
+ self.number_edit.setText(settings.value('ccli number'))
+ self.username_edit.setText(settings.value('songselect username'))
+ self.password_edit.setText(settings.value('songselect password'))
+ self.save_check_service_check_box.setChecked(settings.value('save prompt'))
+ self.auto_unblank_check_box.setChecked(settings.value('auto unblank'))
self.display_on_monitor_check.setChecked(self.screens.display)
- self.warning_check_box.setChecked(settings.value(u'blank warning'))
- self.auto_open_check_box.setChecked(settings.value(u'auto open'))
- self.show_splash_check_box.setChecked(settings.value(u'show splash'))
- self.check_for_updates_check_box.setChecked(settings.value(u'update check'))
- self.auto_preview_check_box.setChecked(settings.value(u'auto preview'))
- self.timeout_spin_box.setValue(settings.value(u'loop delay'))
- self.monitor_radio_button.setChecked(not settings.value(u'override position',))
- self.override_radio_button.setChecked(settings.value(u'override position'))
- self.custom_X_value_edit.setValue(settings.value(u'x position'))
- self.custom_Y_value_edit.setValue(settings.value(u'y position'))
- self.custom_height_value_edit.setValue(settings.value(u'height'))
- self.custom_width_value_edit.setValue(settings.value(u'width'))
- self.start_paused_check_box.setChecked(settings.value(u'audio start paused'))
- self.repeat_list_check_box.setChecked(settings.value(u'audio repeat list'))
+ self.warning_check_box.setChecked(settings.value('blank warning'))
+ self.auto_open_check_box.setChecked(settings.value('auto open'))
+ self.show_splash_check_box.setChecked(settings.value('show splash'))
+ self.check_for_updates_check_box.setChecked(settings.value('update check'))
+ self.auto_preview_check_box.setChecked(settings.value('auto preview'))
+ self.timeout_spin_box.setValue(settings.value('loop delay'))
+ self.monitor_radio_button.setChecked(not settings.value('override position',))
+ self.override_radio_button.setChecked(settings.value('override position'))
+ self.custom_X_value_edit.setValue(settings.value('x position'))
+ self.custom_Y_value_edit.setValue(settings.value('y position'))
+ self.custom_height_value_edit.setValue(settings.value('height'))
+ self.custom_width_value_edit.setValue(settings.value('width'))
+ self.start_paused_check_box.setChecked(settings.value('audio start paused'))
+ self.repeat_list_check_box.setChecked(settings.value('audio repeat list'))
settings.endGroup()
self.monitor_combo_box.setDisabled(self.override_radio_button.isChecked())
self.custom_X_value_edit.setEnabled(self.override_radio_button.isChecked())
@@ -283,26 +283,26 @@
"""
settings = Settings()
settings.beginGroup(self.settings_section)
- settings.setValue(u'monitor', self.monitor_combo_box.currentIndex())
- settings.setValue(u'display on monitor', self.display_on_monitor_check.isChecked())
- settings.setValue(u'blank warning', self.warning_check_box.isChecked())
- settings.setValue(u'auto open', self.auto_open_check_box.isChecked())
- settings.setValue(u'show splash', self.show_splash_check_box.isChecked())
- settings.setValue(u'update check', self.check_for_updates_check_box.isChecked())
- settings.setValue(u'save prompt', self.save_check_service_check_box.isChecked())
- settings.setValue(u'auto unblank', self.auto_unblank_check_box.isChecked())
- settings.setValue(u'auto preview', self.auto_preview_check_box.isChecked())
- settings.setValue(u'loop delay', self.timeout_spin_box.value())
- settings.setValue(u'ccli number', self.number_edit.displayText())
- settings.setValue(u'songselect username', self.username_edit.displayText())
- settings.setValue(u'songselect password', self.password_edit.displayText())
- settings.setValue(u'x position', self.custom_X_value_edit.value())
- settings.setValue(u'y position', self.custom_Y_value_edit.value())
- settings.setValue(u'height', self.custom_height_value_edit.value())
- settings.setValue(u'width', self.custom_width_value_edit.value())
- settings.setValue(u'override position', self.override_radio_button.isChecked())
- settings.setValue(u'audio start paused', self.start_paused_check_box.isChecked())
- settings.setValue(u'audio repeat list', self.repeat_list_check_box.isChecked())
+ settings.setValue('monitor', self.monitor_combo_box.currentIndex())
+ settings.setValue('display on monitor', self.display_on_monitor_check.isChecked())
+ settings.setValue('blank warning', self.warning_check_box.isChecked())
+ settings.setValue('auto open', self.auto_open_check_box.isChecked())
+ settings.setValue('show splash', self.show_splash_check_box.isChecked())
+ settings.setValue('update check', self.check_for_updates_check_box.isChecked())
+ settings.setValue('save prompt', self.save_check_service_check_box.isChecked())
+ settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked())
+ settings.setValue('auto preview', self.auto_preview_check_box.isChecked())
+ settings.setValue('loop delay', self.timeout_spin_box.value())
+ settings.setValue('ccli number', self.number_edit.displayText())
+ settings.setValue('songselect username', self.username_edit.displayText())
+ settings.setValue('songselect password', self.password_edit.displayText())
+ settings.setValue('x position', self.custom_X_value_edit.value())
+ settings.setValue('y position', self.custom_Y_value_edit.value())
+ settings.setValue('height', self.custom_height_value_edit.value())
+ settings.setValue('width', self.custom_width_value_edit.value())
+ settings.setValue('override position', self.override_radio_button.isChecked())
+ settings.setValue('audio start paused', self.start_paused_check_box.isChecked())
+ settings.setValue('audio repeat list', self.repeat_list_check_box.isChecked())
settings.endGroup()
# On save update the screens as well
self.post_set_up(True)
@@ -311,13 +311,13 @@
"""
Apply settings after settings tab has loaded and most of the system so must be delayed
"""
- self.settings_form.register_post_process(u'slidecontroller_live_spin_delay')
+ self.settings_form.register_post_process('slidecontroller_live_spin_delay')
# Do not continue on start up.
if not postUpdate:
return
self.screens.set_current_display(self.monitor_combo_box.currentIndex())
self.screens.display = self.display_on_monitor_check.isChecked()
- self.screens.override[u'size'] = QtCore.QRect(
+ self.screens.override['size'] = QtCore.QRect(
self.custom_X_value_edit.value(),
self.custom_Y_value_edit.value(),
self.custom_width_value_edit.value(),
@@ -327,7 +327,7 @@
else:
self.screens.reset_current_display()
if self.display_changed:
- self.settings_form.register_post_process(u'config_screen_changed')
+ self.settings_form.register_post_process('config_screen_changed')
self.display_changed = False
def on_override_radio_button_pressed(self, checked):
=== modified file 'openlp/core/ui/listpreviewwidget.py'
--- openlp/core/ui/listpreviewwidget.py 2013-06-18 19:32:04 +0000
+++ openlp/core/ui/listpreviewwidget.py 2013-08-31 18:18:25 +0000
@@ -30,7 +30,7 @@
The :mod:`listpreviewwidget` is a widget that lists the slides in the slide controller.
It is based on a QTableWidget but represents its contents in list form.
"""
-from __future__ import division
+
from PyQt4 import QtCore, QtGui
from openlp.core.lib import ImageSource, Registry, ServiceItem
@@ -103,15 +103,15 @@
item = QtGui.QTableWidgetItem()
slide_height = 0
if self.service_item.is_text():
- if frame[u'verseTag']:
+ if frame['verseTag']:
# These tags are already translated.
- verse_def = frame[u'verseTag']
- verse_def = u'%s%s' % (verse_def[0], verse_def[1:])
- two_line_def = u'%s\n%s' % (verse_def[0], verse_def[1:])
+ verse_def = frame['verseTag']
+ verse_def = '%s%s' % (verse_def[0], verse_def[1:])
+ two_line_def = '%s\n%s' % (verse_def[0], verse_def[1:])
row = two_line_def
else:
row += 1
- item.setText(frame[u'text'])
+ item.setText(frame['text'])
else:
label = QtGui.QLabel()
label.setMargin(4)
@@ -120,14 +120,14 @@
else:
label.setScaledContents(True)
if self.service_item.is_command():
- label.setPixmap(QtGui.QPixmap(frame[u'image']))
+ label.setPixmap(QtGui.QPixmap(frame['image']))
else:
- image = self.image_manager.get_image(frame[u'path'], ImageSource.ImagePlugin)
+ image = self.image_manager.get_image(frame['path'], ImageSource.ImagePlugin)
label.setPixmap(QtGui.QPixmap.fromImage(image))
self.setCellWidget(framenumber, 0, label)
slide_height = width // self.screen_ratio
row += 1
- text.append(unicode(row))
+ text.append(str(row))
self.setItem(framenumber, 0, item)
if slide_height:
self.setRowHeight(framenumber, slide_height)
@@ -165,8 +165,8 @@
"""
Adds the image manager to the class dynamically.
"""
- if not hasattr(self, u'_image_manager'):
- self._image_manager = Registry().get(u'image_manager')
+ if not hasattr(self, '_image_manager'):
+ self._image_manager = Registry().get('image_manager')
return self._image_manager
image_manager = property(_get_image_manager)
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2013-07-18 19:44:28 +0000
+++ openlp/core/ui/maindisplay.py 2013-08-31 18:18:25 +0000
@@ -35,7 +35,7 @@
* `http://html5demos.com/two-videos`_
"""
-from __future__ import division
+
import cgi
import logging
import os
@@ -84,11 +84,11 @@
"""
Set up and build the screen base
"""
- log.debug(u'Start Display base setup (live = %s)' % self.is_live)
- self.setGeometry(self.screen[u'size'])
- log.debug(u'Setup webView')
+ log.debug('Start Display base setup (live = %s)' % self.is_live)
+ self.setGeometry(self.screen['size'])
+ log.debug('Setup webView')
self.web_view = QtWebKit.QWebView(self)
- self.web_view.setGeometry(0, 0, self.screen[u'size'].width(), self.screen[u'size'].height())
+ self.web_view.setGeometry(0, 0, self.screen['size'].width(), self.screen['size'].height())
self.web_view.settings().setAttribute(QtWebKit.QWebSettings.PluginsEnabled, True)
palette = self.web_view.palette()
palette.setBrush(QtGui.QPalette.Base, QtCore.Qt.transparent)
@@ -114,7 +114,7 @@
"""
Called by webView event to show display is fully loaded
"""
- log.debug(u'is web loaded')
+ log.debug('is web loaded')
self.web_loaded = True
@@ -139,9 +139,9 @@
self.audio_player = None
self.first_time = True
self.web_loaded = True
- self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
+ self.setStyleSheet('border: 0px; margin: 0px; padding: 0px;')
window_flags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint
- if Settings().value(u'advanced/x11 bypass wm'):
+ if Settings().value('advanced/x11 bypass wm'):
window_flags |= QtCore.Qt.X11BypassWindowManagerHint
# TODO: The following combination of window_flags works correctly
# on Mac OS X. For next OpenLP version we should test it on other
@@ -151,15 +151,15 @@
window_flags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Window
# For primary screen ensure it stays above the OS X dock
# and menu bar
- if self.screens.current[u'primary']:
+ if self.screens.current['primary']:
self.setWindowState(QtCore.Qt.WindowFullScreen)
self.setWindowFlags(window_flags)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.set_transparency(False)
if self.is_live:
- Registry().register_function(u'live_display_hide', self.hide_display)
- Registry().register_function(u'live_display_show', self.show_display)
- Registry().register_function(u'update_display_css', self.css_changed)
+ Registry().register_function('live_display_hide', self.hide_display)
+ Registry().register_function('live_display_show', self.show_display)
+ Registry().register_function('update_display_css', self.css_changed)
def set_transparency(self, enabled):
"""
@@ -189,35 +189,35 @@
"""
Set up and build the output screen
"""
- log.debug(u'Start MainDisplay setup (live = %s)' % self.is_live)
+ log.debug('Start MainDisplay setup (live = %s)' % self.is_live)
self.screen = self.screens.current
self.setVisible(False)
Display.setup(self)
if self.is_live:
# Build the initial frame.
background_color = QtGui.QColor()
- background_color.setNamedColor(Settings().value(u'advanced/default color'))
+ background_color.setNamedColor(Settings().value('advanced/default color'))
if not background_color.isValid():
background_color = QtCore.Qt.white
- image_file = Settings().value(u'advanced/default image')
+ image_file = Settings().value('advanced/default image')
splash_image = QtGui.QImage(image_file)
self.initial_fame = QtGui.QImage(
- self.screen[u'size'].width(),
- self.screen[u'size'].height(),
+ self.screen['size'].width(),
+ self.screen['size'].height(),
QtGui.QImage.Format_ARGB32_Premultiplied)
painter_image = QtGui.QPainter()
painter_image.begin(self.initial_fame)
painter_image.fillRect(self.initial_fame.rect(), background_color)
painter_image.drawImage(
- (self.screen[u'size'].width() - splash_image.width()) // 2,
- (self.screen[u'size'].height() - splash_image.height()) // 2,
+ (self.screen['size'].width() - splash_image.width()) // 2,
+ (self.screen['size'].height() - splash_image.height()) // 2,
splash_image)
service_item = ServiceItem()
service_item.bg_image_bytes = image_to_byte(self.initial_fame)
self.web_view.setHtml(build_html(service_item, self.screen, self.is_live, None,
plugins=self.plugin_manager.plugins))
self.__hideMouse()
- log.debug(u'Finished MainDisplay setup')
+ log.debug('Finished MainDisplay setup')
def text(self, slide, animate=True):
"""
@@ -229,13 +229,13 @@
``animate``
Perform transitions if applicable when setting the text
"""
- log.debug(u'text to display')
+ log.debug('text to display')
# Wait for the webview to update before displaying text.
while not self.web_loaded:
self.application.process_events()
- self.setGeometry(self.screen[u'size'])
+ self.setGeometry(self.screen['size'])
if animate:
- self.frame.evaluateJavaScript(u'show_text("%s")' % slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
+ self.frame.evaluateJavaScript('show_text("%s")' % slide.replace('\\', '\\\\').replace('\"', '\\\"'))
else:
# This exists for https://bugs.launchpad.net/openlp/+bug/1016843
# For unknown reasons if evaluateJavaScript is called
@@ -253,16 +253,16 @@
``text``
The text to be displayed.
"""
- log.debug(u'alert to display')
+ log.debug('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('\\', '\\\\').replace('\"', '\\\"')
+ if self.height() != self.screen['size'].height() or not self.isVisible():
shrink = True
- js = u'show_alert("%s", "%s")' % (text_prepared, u'top')
+ js = 'show_alert("%s", "%s")' % (text_prepared, 'top')
else:
shrink = False
- js = u'show_alert("%s", "")' % text_prepared
+ js = 'show_alert("%s", "")' % text_prepared
height = self.frame.evaluateJavaScript(js)
if shrink:
if text:
@@ -270,22 +270,22 @@
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['size'].left(), (self.screen['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['size'].left(), self.screen['size'].height() - alert_height)
else:
self.setVisible(False)
- self.setGeometry(self.screen[u'size'])
+ self.setGeometry(self.screen['size'])
def direct_image(self, path, background):
"""
API for replacement backgrounds so Images are added directly to cache.
"""
self.image_manager.add_image(path, ImageSource.ImagePlugin, background)
- if not hasattr(self, u'service_item'):
+ if not hasattr(self, 'service_item'):
return False
- self.override[u'image'] = path
- self.override[u'theme'] = self.service_item.themedata.background_filename
+ self.override['image'] = path
+ self.override['theme'] = self.service_item.themedata.background_filename
self.image(path)
# Update the preview frame.
if self.is_live:
@@ -302,7 +302,7 @@
passed to identify the image. If the image has changed it has to be
re-added to the image manager.
"""
- log.debug(u'image to display')
+ log.debug('image to display')
image = self.image_manager.get_image_bytes(path, ImageSource.ImagePlugin)
self.controller.media_controller.media_reset(self.controller)
self.display_image(image)
@@ -311,11 +311,11 @@
"""
Display an image, as is.
"""
- self.setGeometry(self.screen[u'size'])
+ self.setGeometry(self.screen['size'])
if image:
- js = u'show_image("data:image/png;base64,%s");' % image
+ js = 'show_image("data:image/png;base64,%s");' % image
else:
- js = u'show_image("");'
+ js = 'show_image("");'
self.frame.evaluateJavaScript(js)
def reset_image(self):
@@ -323,8 +323,8 @@
Reset the background image to the service item image. Used after the
image plugin has changed the background.
"""
- log.debug(u'reset_image')
- if hasattr(self, u'service_item'):
+ log.debug('reset_image')
+ if hasattr(self, 'service_item'):
self.display_image(self.service_item.bg_image_bytes)
else:
self.display_image(None)
@@ -338,15 +338,15 @@
"""
Generates a preview of the image displayed.
"""
- log.debug(u'preview for %s', self.is_live)
+ log.debug('preview for %s', self.is_live)
was_visible = self.isVisible()
self.application.process_events()
# We must have a service item to preview.
- if self.is_live and hasattr(self, u'service_item'):
+ if self.is_live and hasattr(self, 'service_item'):
# Wait for the fade to finish before geting the preview.
# Important otherwise preview will have incorrect text if at all!
if self.service_item.themedata and self.service_item.themedata.display_slide_transition:
- while not self.frame.evaluateJavaScript(u'show_text_completed()'):
+ while not self.frame.evaluateJavaScript('show_text_completed()'):
self.application.process_events()
# Wait for the webview to update before getting the preview.
# Important otherwise first preview will miss the background !
@@ -362,18 +362,18 @@
# Single screen active
if self.screens.display_count == 1:
# Only make visible if setting enabled.
- if Settings().value(u'core/display on monitor'):
+ if Settings().value('core/display on monitor'):
self.setVisible(True)
else:
self.setVisible(True)
return QtGui.QPixmap.grabWidget(self)
- def build_html(self, service_item, image_path=u''):
+ def build_html(self, service_item, image_path=''):
"""
Store the service_item and build the new HTML from it. Add the
HTML to the display
"""
- log.debug(u'build_html')
+ log.debug('build_html')
self.web_loaded = False
self.initial_fame = None
self.service_item = service_item
@@ -381,16 +381,16 @@
# We have an image override so keep the image till the theme changes.
if self.override:
# We have an video override so allow it to be stopped.
- if u'video' in self.override:
- Registry().execute(u'video_background_replaced')
+ if 'video' in self.override:
+ Registry().execute('video_background_replaced')
self.override = {}
# We have a different theme.
- elif self.override[u'theme'] != service_item.themedata.background_filename:
- Registry().execute(u'live_theme_changed')
+ elif self.override['theme'] != service_item.themedata.background_filename:
+ Registry().execute('live_theme_changed')
self.override = {}
else:
# replace the background
- background = self.image_manager.get_image_bytes(self.override[u'image'], ImageSource.ImagePlugin)
+ background = self.image_manager.get_image_bytes(self.override['image'], ImageSource.ImagePlugin)
self.set_transparency(self.service_item.themedata.background_type ==
BackgroundType.to_string(BackgroundType.Transparent))
if self.service_item.themedata.background_filename:
@@ -403,15 +403,15 @@
image_bytes = None
html = build_html(self.service_item, self.screen, self.is_live, background, image_bytes,
plugins=self.plugin_manager.plugins)
- log.debug(u'buildHtml - pre setHtml')
+ log.debug('buildHtml - pre setHtml')
self.web_view.setHtml(html)
- log.debug(u'buildHtml - post setHtml')
+ log.debug('buildHtml - post setHtml')
if service_item.foot_text:
self.footer(service_item.foot_text)
# if was hidden keep it hidden
if self.hide_mode and self.is_live and not service_item.is_media():
- if Settings().value(u'core/auto unblank'):
- Registry().execute(u'slidecontroller_live_unblank')
+ if Settings().value('core/auto unblank'):
+ Registry().execute('slidecontroller_live_unblank')
else:
self.hide_display(self.hide_mode)
self.__hideMouse()
@@ -420,8 +420,8 @@
"""
Display the Footer
"""
- log.debug(u'footer')
- js = u'show_footer(\'' + text.replace(u'\\', u'\\\\').replace(u'\'', u'\\\'') + u'\')'
+ log.debug('footer')
+ js = 'show_footer(\'' + text.replace('\\', '\\\\').replace('\'', '\\\'') + '\')'
self.frame.evaluateJavaScript(js)
def hide_display(self, mode=HideMode.Screen):
@@ -429,18 +429,18 @@
Hide the display by making all layers transparent
Store the images so they can be replaced when required
"""
- log.debug(u'hide_display mode = %d', mode)
+ log.debug('hide_display mode = %d', mode)
if self.screens.display_count == 1:
# Only make visible if setting enabled.
- if not Settings().value(u'core/display on monitor'):
+ if not Settings().value('core/display on monitor'):
return
if mode == HideMode.Screen:
- self.frame.evaluateJavaScript(u'show_blank("desktop");')
+ self.frame.evaluateJavaScript('show_blank("desktop");')
self.setVisible(False)
elif mode == HideMode.Blank or self.initial_fame:
- self.frame.evaluateJavaScript(u'show_blank("black");')
+ self.frame.evaluateJavaScript('show_blank("black");')
else:
- self.frame.evaluateJavaScript(u'show_blank("theme");')
+ self.frame.evaluateJavaScript('show_blank("theme");')
if mode != HideMode.Screen:
if self.isHidden():
self.setVisible(True)
@@ -452,10 +452,10 @@
Show the stored layers so the screen reappears as it was originally.
Make the stored images None to release memory.
"""
- log.debug(u'show_display')
+ log.debug('show_display')
if self.screens.display_count == 1:
# Only make visible if setting enabled.
- if not Settings().value(u'core/display on monitor'):
+ if not Settings().value('core/display on monitor'):
return
self.frame.evaluateJavaScript('show_blank("show");')
if self.isHidden():
@@ -463,13 +463,13 @@
self.hide_mode = None
# Trigger actions when display is active again.
if self.is_live:
- Registry().execute(u'live_display_active')
+ Registry().execute('live_display_active')
def __hideMouse(self):
"""
Hide mouse cursor when moved over display.
"""
- if Settings().value(u'advanced/hide mouse'):
+ if Settings().value('advanced/hide mouse'):
self.setCursor(QtCore.Qt.BlankCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
else:
@@ -480,8 +480,8 @@
"""
Adds the Renderer to the class dynamically
"""
- if not hasattr(self, u'_plugin_manager'):
- self._plugin_manager = Registry().get(u'plugin_manager')
+ if not hasattr(self, '_plugin_manager'):
+ self._plugin_manager = Registry().get('plugin_manager')
return self._plugin_manager
plugin_manager = property(_get_plugin_manager)
@@ -490,8 +490,8 @@
"""
Adds the image manager to the class dynamically
"""
- if not hasattr(self, u'_image_manager'):
- self._image_manager = Registry().get(u'image_manager')
+ if not hasattr(self, '_image_manager'):
+ self._image_manager = Registry().get('image_manager')
return self._image_manager
image_manager = property(_get_image_manager)
@@ -501,11 +501,11 @@
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
- if os.name == u'nt':
- return Registry().get(u'application')
+ if os.name == 'nt':
+ return Registry().get('application')
else:
- if not hasattr(self, u'_application'):
- self._application = Registry().get(u'application')
+ if not hasattr(self, '_application'):
+ self._application = Registry().get('application')
return self._application
application = property(_get_application)
@@ -514,8 +514,8 @@
"""
Adds the live controller to the class dynamically
"""
- if not hasattr(self, u'_live_controller'):
- self._live_controller = Registry().get(u'live_controller')
+ if not hasattr(self, '_live_controller'):
+ self._live_controller = Registry().get('live_controller')
return self._live_controller
live_controller = property(_get_live_controller)
@@ -526,7 +526,7 @@
This Class will play audio only allowing components to work with a
soundtrack independent of the user interface.
"""
- log.info(u'AudioPlayer Loaded')
+ log.info('AudioPlayer Loaded')
def __init__(self, parent):
"""
@@ -535,7 +535,7 @@
``parent``
The parent widget.
"""
- log.debug(u'AudioPlayer Initialisation started')
+ log.debug('AudioPlayer Initialisation started')
super(AudioPlayer, self).__init__(parent)
self.currentIndex = -1
self.playlist = []
@@ -569,7 +569,7 @@
When the audio track finishes.
"""
if self.repeat:
- log.debug(u'Repeat is enabled... here we go again!')
+ log.debug('Repeat is enabled... here we go again!')
self.media_object.clearQueue()
self.media_object.clear()
self.currentIndex = -1
@@ -594,7 +594,7 @@
"""
We want to play the file so start it
"""
- log.debug(u'AudioPlayer.play() called')
+ log.debug('AudioPlayer.play() called')
if self.currentIndex == -1:
self.on_about_to_finish()
self.media_object.play()
@@ -603,14 +603,14 @@
"""
Pause the Audio
"""
- log.debug(u'AudioPlayer.pause() called')
+ log.debug('AudioPlayer.pause() called')
self.media_object.pause()
def stop(self):
"""
Stop the Audio and clean up
"""
- log.debug(u'AudioPlayer.stop() called')
+ log.debug('AudioPlayer.stop() called')
self.media_object.stop()
def add_to_playlist(self, filenames):
@@ -622,7 +622,7 @@
"""
if not isinstance(filenames, list):
filenames = [filenames]
- self.playlist.extend(map(Phonon.MediaSource, filenames))
+ self.playlist.extend(list(map(Phonon.MediaSource, filenames)))
def next(self):
"""
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2013-08-22 18:47:08 +0000
+++ openlp/core/ui/mainwindow.py 2013-08-31 18:18:25 +0000
@@ -88,165 +88,165 @@
"""
Set up the user interface
"""
- main_window.setObjectName(u'MainWindow')
- main_window.setWindowIcon(build_icon(u':/icon/openlp-logo-64x64.png'))
+ main_window.setObjectName('MainWindow')
+ main_window.setWindowIcon(build_icon(':/icon/openlp-logo-64x64.png'))
main_window.setDockNestingEnabled(True)
# Set up the main container, which contains all the other form widgets.
self.main_content = QtGui.QWidget(main_window)
- self.main_content.setObjectName(u'main_content')
+ self.main_content.setObjectName('main_content')
self.main_contentLayout = QtGui.QHBoxLayout(self.main_content)
self.main_contentLayout.setSpacing(0)
self.main_contentLayout.setMargin(0)
- self.main_contentLayout.setObjectName(u'main_contentLayout')
+ self.main_contentLayout.setObjectName('main_contentLayout')
main_window.setCentralWidget(self.main_content)
self.control_splitter = QtGui.QSplitter(self.main_content)
self.control_splitter.setOrientation(QtCore.Qt.Horizontal)
- self.control_splitter.setObjectName(u'control_splitter')
+ self.control_splitter.setObjectName('control_splitter')
self.main_contentLayout.addWidget(self.control_splitter)
# Create slide controllers
self.preview_controller = SlideController(self)
self.live_controller = SlideController(self, True)
- preview_visible = Settings().value(u'user interface/preview panel')
+ preview_visible = Settings().value('user interface/preview panel')
self.preview_controller.panel.setVisible(preview_visible)
- live_visible = Settings().value(u'user interface/live panel')
- panel_locked = Settings().value(u'user interface/lock panel')
+ live_visible = Settings().value('user interface/live panel')
+ panel_locked = Settings().value('user interface/lock panel')
self.live_controller.panel.setVisible(live_visible)
# Create menu
self.menu_bar = QtGui.QMenuBar(main_window)
- self.menu_bar.setObjectName(u'menu_bar')
+ self.menu_bar.setObjectName('menu_bar')
self.file_menu = QtGui.QMenu(self.menu_bar)
- self.file_menu.setObjectName(u'fileMenu')
+ self.file_menu.setObjectName('fileMenu')
self.recent_files_menu = QtGui.QMenu(self.file_menu)
- self.recent_files_menu.setObjectName(u'recentFilesMenu')
+ self.recent_files_menu.setObjectName('recentFilesMenu')
self.file_import_menu = QtGui.QMenu(self.file_menu)
- self.file_import_menu.setObjectName(u'file_import_menu')
+ self.file_import_menu.setObjectName('file_import_menu')
self.file_export_menu = QtGui.QMenu(self.file_menu)
- self.file_export_menu.setObjectName(u'file_export_menu')
+ self.file_export_menu.setObjectName('file_export_menu')
# View Menu
self.view_menu = QtGui.QMenu(self.menu_bar)
- self.view_menu.setObjectName(u'viewMenu')
+ self.view_menu.setObjectName('viewMenu')
self.view_modeMenu = QtGui.QMenu(self.view_menu)
- self.view_modeMenu.setObjectName(u'viewModeMenu')
+ self.view_modeMenu.setObjectName('viewModeMenu')
# Tools Menu
self.tools_menu = QtGui.QMenu(self.menu_bar)
- self.tools_menu.setObjectName(u'tools_menu')
+ self.tools_menu.setObjectName('tools_menu')
# Settings Menu
self.settings_menu = QtGui.QMenu(self.menu_bar)
- self.settings_menu.setObjectName(u'settingsMenu')
+ self.settings_menu.setObjectName('settingsMenu')
self.settings_language_menu = QtGui.QMenu(self.settings_menu)
- self.settings_language_menu.setObjectName(u'settingsLanguageMenu')
+ self.settings_language_menu.setObjectName('settingsLanguageMenu')
# Help Menu
self.help_menu = QtGui.QMenu(self.menu_bar)
- self.help_menu.setObjectName(u'helpMenu')
+ self.help_menu.setObjectName('helpMenu')
main_window.setMenuBar(self.menu_bar)
self.status_bar = QtGui.QStatusBar(main_window)
- self.status_bar.setObjectName(u'status_bar')
+ self.status_bar.setObjectName('status_bar')
main_window.setStatusBar(self.status_bar)
self.load_progress_bar = QtGui.QProgressBar(self.status_bar)
- self.load_progress_bar.setObjectName(u'load_progress_bar')
+ self.load_progress_bar.setObjectName('load_progress_bar')
self.status_bar.addPermanentWidget(self.load_progress_bar)
self.load_progress_bar.hide()
self.load_progress_bar.setValue(0)
self.load_progress_bar.setStyleSheet(PROGRESSBAR_STYLE)
self.default_theme_label = QtGui.QLabel(self.status_bar)
- self.default_theme_label.setObjectName(u'default_theme_label')
+ self.default_theme_label.setObjectName('default_theme_label')
self.status_bar.addPermanentWidget(self.default_theme_label)
# Create the MediaManager
- self.media_manager_dock = OpenLPDockWidget(main_window, u'media_manager_dock',
- u':/system/system_mediamanager.png')
+ self.media_manager_dock = OpenLPDockWidget(main_window, 'media_manager_dock',
+ ':/system/system_mediamanager.png')
self.media_manager_dock.setStyleSheet(MEDIA_MANAGER_STYLE)
# Create the media toolbox
self.media_tool_box = QtGui.QToolBox(self.media_manager_dock)
- self.media_tool_box.setObjectName(u'media_tool_box')
+ self.media_tool_box.setObjectName('media_tool_box')
self.media_manager_dock.setWidget(self.media_tool_box)
main_window.addDockWidget(QtCore.Qt.LeftDockWidgetArea, self.media_manager_dock)
# Create the service manager
- self.service_manager_dock = OpenLPDockWidget(main_window, u'service_manager_dock',
- u':/system/system_servicemanager.png')
+ self.service_manager_dock = OpenLPDockWidget(main_window, 'service_manager_dock',
+ ':/system/system_servicemanager.png')
self.service_manager_contents = ServiceManager(self.service_manager_dock)
self.service_manager_dock.setWidget(self.service_manager_contents)
main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.service_manager_dock)
# Create the theme manager
- self.theme_manager_dock = OpenLPDockWidget(main_window, u'theme_manager_dock',
- u':/system/system_thememanager.png')
+ self.theme_manager_dock = OpenLPDockWidget(main_window, 'theme_manager_dock',
+ ':/system/system_thememanager.png')
self.theme_manager_contents = ThemeManager(self.theme_manager_dock)
- self.theme_manager_contents.setObjectName(u'theme_manager_contents')
+ self.theme_manager_contents.setObjectName('theme_manager_contents')
self.theme_manager_dock.setWidget(self.theme_manager_contents)
main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.theme_manager_dock)
# Create the menu items
action_list = ActionList.get_instance()
action_list.add_category(UiStrings().File, CategoryOrder.standard_menu)
- self.file_new_item = create_action(main_window, u'fileNewItem',
- icon=u':/general/general_new.png',
+ self.file_new_item = create_action(main_window, 'fileNewItem',
+ icon=':/general/general_new.png',
can_shortcuts=True,
category=UiStrings().File,
triggers=self.service_manager_contents.on_new_service_clicked)
- self.file_open_item = create_action(main_window, u'fileOpenItem',
- icon=u':/general/general_open.png',
+ self.file_open_item = create_action(main_window, 'fileOpenItem',
+ icon=':/general/general_open.png',
can_shortcuts=True,
category=UiStrings().File,
triggers=self.service_manager_contents.on_load_service_clicked)
- self.file_save_item = create_action(main_window, u'fileSaveItem',
- icon=u':/general/general_save.png',
+ self.file_save_item = create_action(main_window, 'fileSaveItem',
+ icon=':/general/general_save.png',
can_shortcuts=True,
category=UiStrings().File,
triggers=self.service_manager_contents.save_file)
- self.file_save_as_item = create_action(main_window, u'fileSaveAsItem',
+ self.file_save_as_item = create_action(main_window, 'fileSaveAsItem',
can_shortcuts=True,
category=UiStrings().File,
triggers=self.service_manager_contents.save_file_as)
self.print_service_order_item = create_action(main_window,
- u'printServiceItem', can_shortcuts=True,
+ 'printServiceItem', can_shortcuts=True,
category=UiStrings().File,
triggers=self.service_manager_contents.print_service_order)
- self.file_exit_item = create_action(main_window, u'fileExitItem',
- icon=u':/system/system_exit.png',
+ self.file_exit_item = create_action(main_window, 'fileExitItem',
+ icon=':/system/system_exit.png',
can_shortcuts=True,
category=UiStrings().File, triggers=main_window.close)
# Give QT Extra Hint that this is the Exit Menu Item
self.file_exit_item.setMenuRole(QtGui.QAction.QuitRole)
action_list.add_category(UiStrings().Import, CategoryOrder.standard_menu)
self.import_theme_item = create_action(
- main_window, u'importThemeItem', category=UiStrings().Import, can_shortcuts=True)
- self.import_language_item = create_action(main_window, u'importLanguageItem')
+ main_window, 'importThemeItem', category=UiStrings().Import, can_shortcuts=True)
+ self.import_language_item = create_action(main_window, 'importLanguageItem')
action_list.add_category(UiStrings().Export, CategoryOrder.standard_menu)
self.export_theme_item = create_action(
- main_window, u'exportThemeItem', category=UiStrings().Export, can_shortcuts=True)
- self.export_language_item = create_action(main_window, u'exportLanguageItem')
+ main_window, 'exportThemeItem', category=UiStrings().Export, can_shortcuts=True)
+ self.export_language_item = create_action(main_window, 'exportLanguageItem')
action_list.add_category(UiStrings().View, CategoryOrder.standard_menu)
self.view_media_manager_item = create_action(main_window,
- u'viewMediaManagerItem',
- icon=u':/system/system_mediamanager.png',
+ 'viewMediaManagerItem',
+ icon=':/system/system_mediamanager.png',
checked=self.media_manager_dock.isVisible(),
can_shortcuts=True,
category=UiStrings().View, triggers=self.toggle_media_manager)
self.view_theme_manager_item = create_action(main_window,
- u'viewThemeManagerItem', can_shortcuts=True,
- icon=u':/system/system_thememanager.png',
+ 'viewThemeManagerItem', can_shortcuts=True,
+ icon=':/system/system_thememanager.png',
checked=self.theme_manager_dock.isVisible(),
category=UiStrings().View, triggers=self.toggle_theme_manager)
self.view_service_manager_item = create_action(main_window,
- u'viewServiceManagerItem', can_shortcuts=True,
- icon=u':/system/system_servicemanager.png',
+ 'viewServiceManagerItem', can_shortcuts=True,
+ icon=':/system/system_servicemanager.png',
checked=self.service_manager_dock.isVisible(),
category=UiStrings().View, triggers=self.toggle_service_manager)
- self.view_preview_panel = create_action(main_window, u'viewPreviewPanel',
+ self.view_preview_panel = create_action(main_window, 'viewPreviewPanel',
can_shortcuts=True, checked=preview_visible,
category=UiStrings().View, triggers=self.set_preview_panel_visibility)
- self.view_live_panel = create_action(main_window, u'viewLivePanel',
+ self.view_live_panel = create_action(main_window, 'viewLivePanel',
can_shortcuts=True, checked=live_visible,
category=UiStrings().View, triggers=self.set_live_panel_visibility)
- self.lock_panel = create_action(main_window, u'lockPanel',
+ self.lock_panel = create_action(main_window, 'lockPanel',
can_shortcuts=True, checked=panel_locked,
category=UiStrings().View,
triggers=self.set_lock_panel)
action_list.add_category(UiStrings().ViewMode, CategoryOrder.standard_menu)
self.mode_default_Item = create_action(
- main_window, u'modeDefaultItem', checked=False, category=UiStrings().ViewMode, can_shortcuts=True)
+ main_window, 'modeDefaultItem', checked=False, category=UiStrings().ViewMode, can_shortcuts=True)
self.mode_setup_item = create_action(
- main_window, u'modeSetupItem', checked=False, category=UiStrings().ViewMode, can_shortcuts=True)
+ main_window, 'modeSetupItem', checked=False, category=UiStrings().ViewMode, can_shortcuts=True)
self.mode_live_item = create_action(
- main_window, u'modeLiveItem', checked=True, category=UiStrings().ViewMode, can_shortcuts=True)
+ main_window, 'modeLiveItem', checked=True, category=UiStrings().ViewMode, can_shortcuts=True)
self.mode_group = QtGui.QActionGroup(main_window)
self.mode_group.addAction(self.mode_default_Item)
self.mode_group.addAction(self.mode_setup_item)
@@ -254,64 +254,64 @@
self.mode_default_Item.setChecked(True)
action_list.add_category(UiStrings().Tools, CategoryOrder.standard_menu)
self.tools_add_tool_item = create_action(main_window,
- u'toolsAddToolItem', icon=u':/tools/tools_add.png', category=UiStrings().Tools, can_shortcuts=True)
+ 'toolsAddToolItem', icon=':/tools/tools_add.png', category=UiStrings().Tools, can_shortcuts=True)
self.tools_open_data_folder = create_action(main_window,
- u'toolsOpenDataFolder', icon=u':/general/general_open.png', category=UiStrings().Tools, can_shortcuts=True)
+ 'toolsOpenDataFolder', icon=':/general/general_open.png', category=UiStrings().Tools, can_shortcuts=True)
self.tools_first_time_wizard = create_action(main_window,
- u'toolsFirstTimeWizard', icon=u':/general/general_revert.png',
+ 'toolsFirstTimeWizard', icon=':/general/general_revert.png',
category=UiStrings().Tools, can_shortcuts=True)
self.update_theme_images = create_action(main_window,
- u'updateThemeImages', category=UiStrings().Tools, can_shortcuts=True)
+ 'updateThemeImages', category=UiStrings().Tools, can_shortcuts=True)
action_list.add_category(UiStrings().Settings, CategoryOrder.standard_menu)
self.settingsPluginListItem = create_action(main_window,
- u'settingsPluginListItem',
- icon=u':/system/settings_plugin_list.png',
+ 'settingsPluginListItem',
+ icon=':/system/settings_plugin_list.png',
can_shortcuts=True,
category=UiStrings().Settings, triggers=self.on_plugin_item_clicked)
# i18n Language Items
- self.auto_language_item = create_action(main_window, u'autoLanguageItem', checked=LanguageManager.auto_language)
+ self.auto_language_item = create_action(main_window, 'autoLanguageItem', checked=LanguageManager.auto_language)
self.language_group = QtGui.QActionGroup(main_window)
self.language_group.setExclusive(True)
- self.language_group.setObjectName(u'languageGroup')
+ self.language_group.setObjectName('languageGroup')
add_actions(self.language_group, [self.auto_language_item])
qm_list = LanguageManager.get_qm_list()
saved_language = LanguageManager.get_language()
for key in sorted(qm_list.keys()):
language_item = create_action(main_window, key, checked=qm_list[key] == saved_language)
add_actions(self.language_group, [language_item])
- self.settings_shortcuts_item = create_action(main_window, u'settingsShortcutsItem',
- icon=u':/system/system_configure_shortcuts.png', category=UiStrings().Settings, can_shortcuts=True)
+ self.settings_shortcuts_item = create_action(main_window, 'settingsShortcutsItem',
+ icon=':/system/system_configure_shortcuts.png', category=UiStrings().Settings, can_shortcuts=True)
# Formatting Tags were also known as display tags.
- self.formatting_tag_item = create_action(main_window, u'displayTagItem',
- icon=u':/system/tag_editor.png', category=UiStrings().Settings, can_shortcuts=True)
- self.settings_configure_item = create_action(main_window, u'settingsConfigureItem',
- icon=u':/system/system_settings.png', can_shortcuts=True, category=UiStrings().Settings)
+ self.formatting_tag_item = create_action(main_window, 'displayTagItem',
+ icon=':/system/tag_editor.png', category=UiStrings().Settings, can_shortcuts=True)
+ self.settings_configure_item = create_action(main_window, 'settingsConfigureItem',
+ icon=':/system/system_settings.png', can_shortcuts=True, category=UiStrings().Settings)
# Give QT Extra Hint that this is the Preferences Menu Item
self.settings_configure_item.setMenuRole(QtGui.QAction.PreferencesRole)
self.settings_import_item = create_action(
- main_window, u'settingsImportItem', category=UiStrings().Import, can_shortcuts=True)
+ main_window, 'settingsImportItem', category=UiStrings().Import, can_shortcuts=True)
self.settings_export_item = create_action(
- main_window, u'settingsExportItem', category=UiStrings().Export, can_shortcuts=True)
+ main_window, 'settingsExportItem', category=UiStrings().Export, can_shortcuts=True)
action_list.add_category(UiStrings().Help, CategoryOrder.standard_menu)
- self.about_item = create_action(main_window, u'aboutItem', icon=u':/system/system_about.png',
+ self.about_item = create_action(main_window, 'aboutItem', icon=':/system/system_about.png',
can_shortcuts=True, category=UiStrings().Help, triggers=self.on_about_item_clicked)
# Give QT Extra Hint that this is an About Menu Item
self.about_item.setMenuRole(QtGui.QAction.AboutRole)
- if os.name == u'nt':
+ if os.name == 'nt':
self.localHelpFile = os.path.join(
AppLocation.get_directory(AppLocation.AppDir), 'OpenLP.chm')
- self.offlineHelpItem = create_action(main_window, u'offlineHelpItem',
- icon=u':/system/system_help_contents.png',
+ self.offlineHelpItem = create_action(main_window, 'offlineHelpItem',
+ icon=':/system/system_help_contents.png',
can_shortcuts=True,
category=UiStrings().Help, triggers=self.on_offline_help_clicked)
- self.on_line_help_item = create_action(main_window, u'onlineHelpItem',
- icon=u':/system/system_online_help.png',
+ self.on_line_help_item = create_action(main_window, 'onlineHelpItem',
+ icon=':/system/system_online_help.png',
can_shortcuts=True,
category=UiStrings().Help, triggers=self.on_online_help_clicked)
- self.web_site_item = create_action(main_window, u'webSiteItem', can_shortcuts=True, category=UiStrings().Help)
+ self.web_site_item = create_action(main_window, 'webSiteItem', can_shortcuts=True, category=UiStrings().Help)
# Shortcuts not connected to buttons or menu entires.
self.search_shortcut_action = create_action(main_window,
- u'searchShortcut', can_shortcuts=True, category=translate('OpenLP.MainWindow', 'General'),
+ 'searchShortcut', can_shortcuts=True, category=translate('OpenLP.MainWindow', 'General'),
triggers=self.on_search_shortcut_triggered)
add_actions(self.file_import_menu, (self.settings_import_item, None, self.import_theme_item,
self.import_language_item))
@@ -330,7 +330,7 @@
add_actions(self.settings_language_menu, self.language_group.actions())
# Order things differently in OS X so that Preferences menu item in the
# app menu is correct (this gets picked up automatically by Qt).
- if sys.platform == u'darwin':
+ if sys.platform == 'darwin':
add_actions(self.settings_menu, (self.settingsPluginListItem, self.settings_language_menu.menuAction(),
None, self.settings_configure_item, self.settings_shortcuts_item, self.formatting_tag_item))
else:
@@ -340,7 +340,7 @@
add_actions(self.tools_menu, (self.tools_open_data_folder, None))
add_actions(self.tools_menu, (self.tools_first_time_wizard, None))
add_actions(self.tools_menu, [self.update_theme_images])
- if os.name == u'nt':
+ if os.name == 'nt':
add_actions(self.help_menu, (self.offlineHelpItem, self.on_line_help_item, None, self.web_site_item,
self.about_item))
else:
@@ -433,7 +433,7 @@
self.settingsPluginListItem.setStatusTip(translate('OpenLP.MainWindow', 'List the Plugins'))
self.about_item.setText(translate('OpenLP.MainWindow', '&About'))
self.about_item.setStatusTip(translate('OpenLP.MainWindow', 'More information about OpenLP'))
- if os.name == u'nt':
+ if os.name == 'nt':
self.offlineHelpItem.setText(translate('OpenLP.MainWindow', '&User Guide'))
self.on_line_help_item.setText(translate('OpenLP.MainWindow', '&Online Help'))
self.search_shortcut_action.setText(UiStrings().Search)
@@ -469,27 +469,27 @@
"""
The main window.
"""
- log.info(u'MainWindow loaded')
+ log.info('MainWindow loaded')
def __init__(self):
"""
This constructor sets up the interface, the various managers, and the plugins.
"""
super(MainWindow, self).__init__()
- Registry().register(u'main_window', self)
+ Registry().register('main_window', self)
self.clipboard = self.application.clipboard()
self.arguments = self.application.args
# Set up settings sections for the main application (not for use by plugins).
- self.ui_settings_section = u'user interface'
- self.general_settings_section = u'core'
- self.advanced_settings_section = u'advanced'
- self.shortcuts_settings_section = u'shortcuts'
- self.service_manager_settings_section = u'servicemanager'
- self.songs_settings_section = u'songs'
- self.themes_settings_section = u'themes'
- self.players_settings_section = u'players'
- self.display_tags_section = u'displayTags'
- self.header_section = u'SettingsImport'
+ self.ui_settings_section = 'user interface'
+ self.general_settings_section = 'core'
+ self.advanced_settings_section = 'advanced'
+ self.shortcuts_settings_section = 'shortcuts'
+ self.service_manager_settings_section = 'servicemanager'
+ self.songs_settings_section = 'songs'
+ self.themes_settings_section = 'themes'
+ self.players_settings_section = 'players'
+ self.display_tags_section = 'displayTags'
+ self.header_section = 'SettingsImport'
self.recent_files = []
self.timer_id = 0
self.timer_version_id = 0
@@ -537,10 +537,10 @@
self.media_tool_box.currentChanged.connect(self.on_media_tool_box_changed)
self.application.set_busy_cursor()
# Simple message boxes
- Registry().register_function(u'theme_update_global', self.default_theme_changed)
- Registry().register_function(u'openlp_version_check', self.version_notice)
- Registry().register_function(u'config_screen_changed', self.screen_changed)
- Registry().register_function(u'bootstrap_post_set_up', self.restore_current_media_manager_item)
+ Registry().register_function('theme_update_global', self.default_theme_changed)
+ Registry().register_function('openlp_version_check', self.version_notice)
+ Registry().register_function('config_screen_changed', self.screen_changed)
+ Registry().register_function('bootstrap_post_set_up', self.restore_current_media_manager_item)
self.renderer = Renderer()
# Reset the cursor
self.application.set_normal_cursor()
@@ -549,9 +549,9 @@
"""
Called on start up to restore the last active media plugin.
"""
- log.info(u'Load data from Settings')
- if Settings().value(u'advanced/save current plugin'):
- saved_plugin_id = Settings().value(u'advanced/current media plugin')
+ log.info('Load data from Settings')
+ if Settings().value('advanced/save current plugin'):
+ saved_plugin_id = Settings().value('advanced/current media plugin')
if saved_plugin_id != -1:
self.media_tool_box.setCurrentIndex(saved_plugin_id)
@@ -579,10 +579,10 @@
Notifies the user that a newer version of OpenLP is available.
Triggered by delay thread and cannot display popup.
"""
- log.debug(u'version_notice')
+ log.debug('version_notice')
version_text = translate('OpenLP.MainWindow', 'Version %s of OpenLP is now available for download (you are '
'currently running version %s). \n\nYou can download the latest version from http://openlp.org/.')
- self.version_text = version_text % (version, get_application_version()[u'full'])
+ self.version_text = version_text % (version, get_application_version()['full'])
def show(self):
"""
@@ -597,19 +597,19 @@
for a in self.arguments:
args.extend([a])
filename = args[0]
- if not isinstance(filename, unicode):
- filename = unicode(filename, sys.getfilesystemencoding())
+ if not isinstance(filename, str):
+ filename = str(filename, sys.getfilesystemencoding())
self.service_manager_contents.load_file(filename)
- elif Settings().value(self.general_settings_section + u'/auto open'):
+ elif Settings().value(self.general_settings_section + '/auto open'):
self.service_manager_contents.load_Last_file()
self.timer_version_id = self.startTimer(1000)
- view_mode = Settings().value(u'%s/view mode' % self.general_settings_section)
- if view_mode == u'default':
+ view_mode = Settings().value('%s/view mode' % self.general_settings_section)
+ if view_mode == 'default':
self.mode_default_Item.setChecked(True)
- elif view_mode == u'setup':
+ elif view_mode == 'setup':
self.setViewMode(True, True, False, True, False)
self.mode_setup_item.setChecked(True)
- elif view_mode == u'live':
+ elif view_mode == 'live':
self.setViewMode(False, True, False, False, True)
self.mode_live_item.setChecked(True)
@@ -629,11 +629,11 @@
"""
self.application.process_events()
for plugin in self.plugin_manager.plugins:
- if hasattr(plugin, u'first_time'):
+ if hasattr(plugin, 'first_time'):
self.application.process_events()
plugin.first_time()
self.application.process_events()
- temp_dir = os.path.join(unicode(gettempdir()), u'openlp')
+ temp_dir = os.path.join(str(gettempdir()), 'openlp')
shutil.rmtree(temp_dir, True)
def on_first_time_wzard_clicked(self):
@@ -671,10 +671,10 @@
else:
self.activePlugin.toggle_status(PluginStatus.Inactive)
# Set global theme and
- Registry().execute(u'theme_update_global', self.theme_manager_contents.global_theme)
+ Registry().execute('theme_update_global', self.theme_manager_contents.global_theme)
self.theme_manager_contents.load_first_time_themes()
# Check if any Bibles downloaded. If there are, they will be processed.
- Registry().execute(u'bibles_load_list', True)
+ Registry().execute('bibles_load_list', True)
self.application.set_normal_cursor()
def is_display_blank(self):
@@ -683,8 +683,8 @@
"""
settings = Settings()
self.live_controller.main_display_set_background()
- if settings.value(u'%s/screen blank' % self.general_settings_section):
- if settings.value(u'%s/blank warning' % self.general_settings_section):
+ if settings.value('%s/screen blank' % self.general_settings_section):
+ if settings.value('%s/blank warning' % self.general_settings_section):
QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'OpenLP Main Display Blanked'),
translate('OpenLP.MainWindow', 'The Main Display has been blanked out'))
@@ -698,7 +698,7 @@
``message``
The message to be displayed.
"""
- if hasattr(self.application, u'splash'):
+ if hasattr(self.application, 'splash'):
self.application.splash.close()
QtGui.QMessageBox.critical(self, title, message)
@@ -712,7 +712,7 @@
``message``
The message to be displayed.
"""
- if hasattr(self.application, u'splash'):
+ if hasattr(self.application, 'splash'):
self.application.splash.close()
QtGui.QMessageBox.warning(self, title, message)
@@ -726,7 +726,7 @@
``message``
The message to be displayed.
"""
- if hasattr(self.application, u'splash'):
+ if hasattr(self.application, 'splash'):
self.application.splash.close()
QtGui.QMessageBox.information(self, title, message)
@@ -735,7 +735,7 @@
Load the OpenLP website
"""
import webbrowser
- webbrowser.open_new(u'http://openlp.org/')
+ webbrowser.open_new('http://openlp.org/')
def on_offline_help_clicked(self):
"""
@@ -748,7 +748,7 @@
Load the online OpenLP manual
"""
import webbrowser
- webbrowser.open_new(u'http://manual.openlp.org/')
+ webbrowser.open_new('http://manual.openlp.org/')
def on_about_item_clicked(self):
"""
@@ -829,24 +829,24 @@
setting_sections.extend([self.players_settings_section])
setting_sections.extend([self.display_tags_section])
setting_sections.extend([self.header_section])
- setting_sections.extend([u'crashreport'])
+ setting_sections.extend(['crashreport'])
# Add plugin sections.
setting_sections.extend([plugin.name for plugin in self.plugin_manager.plugins])
# Copy the settings file to the tmp dir, because we do not want to change the original one.
- temp_directory = os.path.join(unicode(gettempdir()), u'openlp')
+ temp_directory = os.path.join(str(gettempdir()), 'openlp')
check_directory_exists(temp_directory)
temp_config = os.path.join(temp_directory, os.path.basename(import_file_name))
shutil.copyfile(import_file_name, temp_config)
settings = Settings()
import_settings = Settings(temp_config, Settings.IniFormat)
# Convert image files
- log.info(u'hook upgrade_plugin_settings')
+ log.info('hook upgrade_plugin_settings')
self.plugin_manager.hook_upgrade_plugin_settings(import_settings)
# Remove/rename old settings to prepare the import.
import_settings.remove_obsolete_settings()
# Lets do a basic sanity check. If it contains this string we can assume it was created by OpenLP and so we'll
# load what we can from it, and just silently ignore anything we don't recognise.
- if import_settings.value(u'SettingsImport/type') != u'OpenLP_settings_export':
+ if import_settings.value('SettingsImport/type') != 'OpenLP_settings_export':
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'Import settings'),
translate('OpenLP.MainWindow', 'The file you have selected does not appear to be a valid OpenLP '
'settings file.\n\nProcessing has terminated and no changes have been made.'),
@@ -856,28 +856,28 @@
for section_key in import_keys:
# We need to handle the really bad files.
try:
- section, key = section_key.split(u'/')
+ section, key = section_key.split('/')
except ValueError:
- section = u'unknown'
- key = u''
+ section = 'unknown'
+ key = ''
# Switch General back to lowercase.
- if section == u'General' or section == u'%General':
- section = u'general'
+ if section == 'General' or section == '%General':
+ section = 'general'
section_key = section + "/" + key
# Make sure it's a valid section for us.
if not section in setting_sections:
continue
# We have a good file, import it.
for section_key in import_keys:
- if u'eneral' in section_key:
+ if 'eneral' in section_key:
section_key = section_key.lower()
value = import_settings.value(section_key)
if value is not None:
- settings.setValue(u'%s' % (section_key), value)
+ settings.setValue('%s' % (section_key), value)
now = datetime.now()
settings.beginGroup(self.header_section)
- settings.setValue(u'file_imported', import_file_name)
- settings.setValue(u'file_date_imported', now.strftime("%Y-%m-%d %H:%M"))
+ settings.setValue('file_imported', import_file_name)
+ settings.setValue('file_date_imported', now.strftime("%Y-%m-%d %H:%M"))
settings.endGroup()
settings.sync()
# We must do an immediate restart or current configuration will overwrite what was just imported when
@@ -900,9 +900,9 @@
if not export_file_name:
return
# Make sure it's a .conf file.
- if not export_file_name.endswith(u'conf'):
- export_file_name += u'.conf'
- temp_file = os.path.join(gettempdir(), u'openlp', u'exportConf.tmp')
+ if not export_file_name.endswith('conf'):
+ export_file_name += '.conf'
+ temp_file = os.path.join(gettempdir(), 'openlp', 'exportConf.tmp')
self.save_settings()
setting_sections = []
# Add main sections.
@@ -933,15 +933,15 @@
# Write INI format using Qsettings.
# Write our header.
export_settings.beginGroup(self.header_section)
- export_settings.setValue(u'Make_Changes', u'At_Own_RISK')
- export_settings.setValue(u'type', u'OpenLP_settings_export')
- export_settings.setValue(u'file_date_created', now.strftime("%Y-%m-%d %H:%M"))
- export_settings.setValue(u'version', application_version[u'full'])
+ export_settings.setValue('Make_Changes', 'At_Own_RISK')
+ export_settings.setValue('type', 'OpenLP_settings_export')
+ export_settings.setValue('file_date_created', now.strftime("%Y-%m-%d %H:%M"))
+ export_settings.setValue('version', application_version['full'])
export_settings.endGroup()
# Write all the sections and keys.
for section_key in keys:
# FIXME: We are conflicting with the standard "General" section.
- if u'eneral' in section_key:
+ if 'eneral' in section_key:
section_key = section_key.lower()
key_value = settings.value(section_key)
if key_value is not None:
@@ -950,12 +950,12 @@
# Temp CONF file has been written. Blanks in keys are now '%20'.
# Read the temp file and output the user's CONF file with blanks to
# make it more readable.
- temp_conf = open(temp_file, u'r')
- export_conf = open(export_file_name, u'w')
+ temp_conf = open(temp_file, 'r')
+ export_conf = open(export_file_name, 'w')
for file_record in temp_conf:
# Get rid of any invalid entries.
- if file_record.find(u'@Invalid()') == -1:
- file_record = file_record.replace(u'%20', u' ')
+ if file_record.find('@Invalid()') == -1:
+ file_record = file_record.replace('%20', ' ')
export_conf.write(file_record)
temp_conf.close()
export_conf.close()
@@ -965,27 +965,27 @@
"""
Put OpenLP into "Default" view mode.
"""
- self.setViewMode(True, True, True, True, True, u'default')
+ self.setViewMode(True, True, True, True, True, 'default')
def on_mode_setup_item_clicked(self):
"""
Put OpenLP into "Setup" view mode.
"""
- self.setViewMode(True, True, False, True, False, u'setup')
+ self.setViewMode(True, True, False, True, False, 'setup')
def on_mode_live_item_clicked(self):
"""
Put OpenLP into "Live" view mode.
"""
- self.setViewMode(False, True, False, False, True, u'live')
+ self.setViewMode(False, True, False, False, True, 'live')
- def setViewMode(self, media=True, service=True, theme=True, preview=True, live=True, mode=u''):
+ def setViewMode(self, media=True, service=True, theme=True, preview=True, live=True, mode=''):
"""
Set OpenLP to a different view mode.
"""
if mode:
settings = Settings()
- settings.setValue(u'%s/view mode' % self.general_settings_section, mode)
+ settings.setValue('%s/view mode' % self.general_settings_section, mode)
self.media_manager_dock.setVisible(media)
self.service_manager_dock.setVisible(service)
self.theme_manager_dock.setVisible(theme)
@@ -996,7 +996,7 @@
"""
The screen has changed so we have to update components such as the renderer.
"""
- log.debug(u'screen_changed')
+ log.debug('screen_changed')
self.application.set_busy_cursor()
self.image_manager.update_display()
self.renderer.update_display()
@@ -1033,7 +1033,7 @@
else:
event.ignore()
else:
- if Settings().value(u'advanced/enable exit confirmation'):
+ if Settings().value('advanced/enable exit confirmation'):
ret = QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'Close OpenLP'),
translate('OpenLP.MainWindow', 'Are you sure you want to close OpenLP?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
@@ -1060,10 +1060,10 @@
# Clean temporary files used by services
self.service_manager_contents.clean_up()
if save_settings:
- if Settings().value(u'advanced/save current plugin'):
- Settings().setValue(u'advanced/current media plugin', self.media_tool_box.currentIndex())
+ if Settings().value('advanced/save current plugin'):
+ Settings().setValue('advanced/current media plugin', self.media_tool_box.currentIndex())
# Call the cleanup method to shutdown plugins.
- log.info(u'cleanup plugins')
+ log.info('cleanup plugins')
self.plugin_manager.finalise_plugins()
if save_settings:
# Save settings
@@ -1075,9 +1075,9 @@
if self.live_controller.display:
self.live_controller.display.close()
self.live_controller.display = None
- if os.name == u'nt':
+ if os.name == 'nt':
# Needed for Windows to stop crashes on exit
- Registry().remove(u'application')
+ Registry().remove('application')
def set_service_modified(self, modified, file_name):
"""
@@ -1090,9 +1090,9 @@
The file name of the service file.
"""
if modified:
- title = u'%s - %s*' % (UiStrings().OLPV2x, file_name)
+ title = '%s - %s*' % (UiStrings().OLPV2x, file_name)
else:
- title = u'%s - %s' % (UiStrings().OLPV2x, file_name)
+ title = '%s - %s' % (UiStrings().OLPV2x, file_name)
self.setWindowTitle(title)
def show_status_message(self, message):
@@ -1106,7 +1106,7 @@
Update the default theme indicator in the status bar
"""
self.default_theme_label.setText(translate('OpenLP.MainWindow', 'Default Theme: %s') %
- Settings().value(u'themes/global theme'))
+ Settings().value('themes/global theme'))
def toggle_media_manager(self):
"""
@@ -1136,7 +1136,7 @@
False - Hidden
"""
self.preview_controller.panel.setVisible(visible)
- Settings().setValue(u'user interface/preview panel', visible)
+ Settings().setValue('user interface/preview panel', visible)
self.view_preview_panel.setChecked(visible)
def set_lock_panel(self, lock):
@@ -1161,7 +1161,7 @@
self.view_theme_manager_item.setEnabled(True)
self.view_preview_panel.setEnabled(True)
self.view_live_panel.setEnabled(True)
- Settings().setValue(u'user interface/lock panel', lock)
+ Settings().setValue('user interface/lock panel', lock)
def set_live_panel_visibility(self, visible):
"""
@@ -1173,28 +1173,28 @@
False - Hidden
"""
self.live_controller.panel.setVisible(visible)
- Settings().setValue(u'user interface/live panel', visible)
+ Settings().setValue('user interface/live panel', visible)
self.view_live_panel.setChecked(visible)
def load_settings(self):
"""
Load the main window settings.
"""
- log.debug(u'Loading QSettings')
+ log.debug('Loading QSettings')
settings = Settings()
# Remove obsolete entries.
- settings.remove(u'custom slide')
- settings.remove(u'service')
+ settings.remove('custom slide')
+ settings.remove('service')
settings.beginGroup(self.general_settings_section)
- self.recent_files = settings.value(u'recent files')
+ self.recent_files = settings.value('recent files')
settings.endGroup()
settings.beginGroup(self.ui_settings_section)
- self.move(settings.value(u'main window position'))
- self.restoreGeometry(settings.value(u'main window geometry'))
- self.restoreState(settings.value(u'main window state'))
- self.live_controller.splitter.restoreState(settings.value(u'live splitter geometry'))
- self.preview_controller.splitter.restoreState(settings.value(u'preview splitter geometry'))
- self.control_splitter.restoreState(settings.value(u'main window splitter geometry'))
+ self.move(settings.value('main window position'))
+ self.restoreGeometry(settings.value('main window geometry'))
+ self.restoreState(settings.value('main window state'))
+ self.live_controller.splitter.restoreState(settings.value('live splitter geometry'))
+ self.preview_controller.splitter.restoreState(settings.value('preview splitter geometry'))
+ self.control_splitter.restoreState(settings.value('main window splitter geometry'))
#This needs to be called after restoreState(), because saveState() also saves the "Collapsible" property
#which was True (by default) < OpenLP 2.1.
self.control_splitter.setChildrenCollapsible(False)
@@ -1207,37 +1207,37 @@
# Exit if we just did a settings import.
if self.settingsImported:
return
- log.debug(u'Saving QSettings')
+ log.debug('Saving QSettings')
settings = Settings()
settings.beginGroup(self.general_settings_section)
- settings.setValue(u'recent files', self.recent_files)
+ settings.setValue('recent files', self.recent_files)
settings.endGroup()
settings.beginGroup(self.ui_settings_section)
- settings.setValue(u'main window position', self.pos())
- settings.setValue(u'main window state', self.saveState())
- settings.setValue(u'main window geometry', self.saveGeometry())
- settings.setValue(u'live splitter geometry', self.live_controller.splitter.saveState())
- settings.setValue(u'preview splitter geometry', self.preview_controller.splitter.saveState())
- settings.setValue(u'main window splitter geometry', self.control_splitter.saveState())
+ settings.setValue('main window position', self.pos())
+ settings.setValue('main window state', self.saveState())
+ settings.setValue('main window geometry', self.saveGeometry())
+ settings.setValue('live splitter geometry', self.live_controller.splitter.saveState())
+ settings.setValue('preview splitter geometry', self.preview_controller.splitter.saveState())
+ settings.setValue('main window splitter geometry', self.control_splitter.saveState())
settings.endGroup()
def update_recent_files_menu(self):
"""
Updates the recent file menu with the latest list of service files accessed.
"""
- recent_file_count = Settings().value(u'advanced/recent file count')
+ recent_file_count = Settings().value('advanced/recent file count')
existing_recent_files = [recentFile for recentFile in self.recent_files
- if os.path.isfile(unicode(recentFile))]
+ if os.path.isfile(str(recentFile))]
recent_files_to_display = existing_recent_files[0:recent_file_count]
self.recent_files_menu.clear()
for file_id, filename in enumerate(recent_files_to_display):
log.debug('Recent file name: %s', filename)
- action = create_action(self, u'',
- text=u'&%d %s' % (file_id + 1, os.path.splitext(os.path.basename(
- unicode(filename)))[0]), data=filename,
+ action = create_action(self, '',
+ text='&%d %s' % (file_id + 1, os.path.splitext(os.path.basename(
+ str(filename)))[0]), data=filename,
triggers=self.service_manager_contents.on_recent_service_clicked)
self.recent_files_menu.addAction(action)
- clear_recent_files_action = create_action(self, u'',
+ clear_recent_files_action = create_action(self, '',
text=translate('OpenLP.MainWindow', 'Clear List', 'Clear List of recent files'),
statustip=translate('OpenLP.MainWindow', 'Clear the list of recent files.'),
enabled=bool(self.recent_files),
@@ -1255,7 +1255,7 @@
# 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.
- max_recent_files = Settings().value(u'advanced/max recent files')
+ max_recent_files = Settings().value('advanced/max recent files')
if filename:
# Add some cleanup to reduce duplication in the recent file list
filename = os.path.abspath(filename)
@@ -1308,12 +1308,12 @@
if event.timerId() == self.timer_version_id:
self.timer_version_id = 0
# Has the thread passed some data to be displayed so display it and stop all waiting
- if hasattr(self, u'version_text'):
+ if hasattr(self, 'version_text'):
QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'OpenLP Version Updated'),
self.version_text)
else:
# the thread has not confirmed it is running or it has not yet sent any data so lets keep waiting
- if not hasattr(self, u'version_update_running') or self.version_update_running:
+ if not hasattr(self, 'version_update_running') or self.version_update_running:
self.timer_version_id = self.startTimer(1000)
self.application.process_events()
@@ -1333,34 +1333,34 @@
"""
Change the data directory.
"""
- log.info(u'Changing data path to %s' % self.new_data_path)
- old_data_path = unicode(AppLocation.get_data_path())
+ log.info('Changing data path to %s' % self.new_data_path)
+ old_data_path = str(AppLocation.get_data_path())
# Copy OpenLP data to new location if requested.
self.application.set_busy_cursor()
if self.copy_data:
- log.info(u'Copying data to new path')
+ log.info('Copying data to new path')
try:
self.showStatusMessage(
translate('OpenLP.MainWindow', 'Copying OpenLP data to new data directory location - %s '
'- Please wait for copy to finish').replace('%s', self.new_data_path))
dir_util.copy_tree(old_data_path, self.new_data_path)
- log.info(u'Copy sucessful')
- except (IOError, os.error, DistutilsFileError), why:
+ log.info('Copy sucessful')
+ except (IOError, os.error, DistutilsFileError) as why:
self.application.set_normal_cursor()
- log.exception(u'Data copy failed %s' % unicode(why))
+ log.exception('Data copy failed %s' % str(why))
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'),
translate('OpenLP.MainWindow',
- 'OpenLP Data directory copy failed\n\n%s').replace('%s', unicode(why)),
+ 'OpenLP Data directory copy failed\n\n%s').replace('%s', str(why)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
return False
else:
- log.info(u'No data copy requested')
+ log.info('No data copy requested')
# Change the location of data directory in config file.
settings = QtCore.QSettings()
- settings.setValue(u'advanced/data path', self.new_data_path)
+ settings.setValue('advanced/data path', self.new_data_path)
# Check if the new data path is our default.
if self.new_data_path == AppLocation.get_directory(AppLocation.DataDir):
- settings.remove(u'advanced/data path')
+ settings.remove('advanced/data path')
self.application.set_normal_cursor()
def _get_application(self):
@@ -1368,11 +1368,11 @@
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
- if os.name == u'nt':
- return Registry().get(u'application')
+ if os.name == 'nt':
+ return Registry().get('application')
else:
- if not hasattr(self, u'_application'):
- self._application = Registry().get(u'application')
+ if not hasattr(self, '_application'):
+ self._application = Registry().get('application')
return self._application
application = property(_get_application)
=== modified file 'openlp/core/ui/media/__init__.py'
--- openlp/core/ui/media/__init__.py 2013-02-02 06:32:29 +0000
+++ openlp/core/ui/media/__init__.py 2013-08-31 18:18:25 +0000
@@ -80,21 +80,21 @@
This method extracts the configured media players and overridden player
from the settings.
"""
- log.debug(u'get_media_players')
- saved_players = Settings().value(u'media/players')
+ log.debug('get_media_players')
+ saved_players = Settings().value('media/players')
reg_ex = QtCore.QRegExp(".*\[(.*)\].*")
- if Settings().value(u'media/override player') == QtCore.Qt.Checked:
+ if Settings().value('media/override player') == QtCore.Qt.Checked:
if reg_ex.exactMatch(saved_players):
- overridden_player = u'%s' % reg_ex.cap(1)
+ overridden_player = '%s' % reg_ex.cap(1)
else:
- overridden_player = u'auto'
+ overridden_player = 'auto'
else:
- overridden_player = u''
- saved_players_list = saved_players.replace(u'[', u'').replace(u']', u'').split(u',')
+ overridden_player = ''
+ saved_players_list = saved_players.replace('[', '').replace(']', '').split(',')
return saved_players_list, overridden_player
-def set_media_players(players_list, overridden_player=u'auto'):
+def set_media_players(players_list, overridden_player='auto'):
"""
This method saves the configured media players and overridden player to the
settings
@@ -105,13 +105,13 @@
``overridden_player``
Here an special media player is chosen for all media actions.
"""
- log.debug(u'set_media_players')
- players = u','.join(players_list)
- if Settings().value(u'media/override player') == QtCore.Qt.Checked and overridden_player != u'auto':
- players = players.replace(overridden_player, u'[%s]' % overridden_player)
- Settings().setValue(u'media/players', players)
-
-from mediacontroller import MediaController
-from playertab import PlayerTab
-
-__all__ = [u'MediaController', u'PlayerTab']
+ log.debug('set_media_players')
+ players = ','.join(players_list)
+ if Settings().value('media/override player') == QtCore.Qt.Checked and overridden_player != 'auto':
+ players = players.replace(overridden_player, '[%s]' % overridden_player)
+ Settings().setValue('media/players', players)
+
+from .mediacontroller import MediaController
+from .playertab import PlayerTab
+
+__all__ = ['MediaController', 'PlayerTab']
=== modified file 'openlp/core/ui/media/mediacontroller.py'
--- openlp/core/ui/media/mediacontroller.py 2013-07-18 14:14:29 +0000
+++ openlp/core/ui/media/mediacontroller.py 2013-08-31 18:18:25 +0000
@@ -62,7 +62,7 @@
Override event to allow hover time to be displayed.
"""
time_value = QtGui.QStyle.sliderValueFromPosition(self.minimum(), self.maximum(), event.x(), self.width())
- self.setToolTip(u'%s' % datetime.timedelta(seconds=int(time_value / 1000)))
+ self.setToolTip('%s' % datetime.timedelta(seconds=int(time_value / 1000)))
QtGui.QSlider.mouseMoveEvent(self, event)
def mousePressEvent(self, event):
@@ -97,8 +97,8 @@
"""
Constructor
"""
- Registry().register(u'media_controller', self)
- Registry().register_function(u'bootstrap_initialise', self.check_available_media_players)
+ Registry().register('media_controller', self)
+ Registry().register_function('bootstrap_initialise', self.check_available_media_players)
self.media_players = {}
self.display_controllers = {}
self.current_media_players = {}
@@ -107,26 +107,26 @@
self.timer.setInterval(200)
# Signals
self.timer.timeout.connect(self.media_state)
- Registry().register_function(u'playbackPlay', self.media_play_msg)
- Registry().register_function(u'playbackPause', self.media_pause_msg)
- Registry().register_function(u'playbackStop', self.media_stop_msg)
- Registry().register_function(u'seek_slider', self.media_seek_msg)
- Registry().register_function(u'volume_slider', self.media_volume_msg)
- Registry().register_function(u'media_hide', self.media_hide)
- Registry().register_function(u'media_blank', self.media_blank)
- Registry().register_function(u'media_unblank', self.media_unblank)
+ Registry().register_function('playbackPlay', self.media_play_msg)
+ Registry().register_function('playbackPause', self.media_pause_msg)
+ Registry().register_function('playbackStop', self.media_stop_msg)
+ Registry().register_function('seek_slider', self.media_seek_msg)
+ Registry().register_function('volume_slider', self.media_volume_msg)
+ Registry().register_function('media_hide', self.media_hide)
+ Registry().register_function('media_blank', self.media_blank)
+ Registry().register_function('media_unblank', self.media_unblank)
# Signals for background video
- Registry().register_function(u'songs_hide', self.media_hide)
- Registry().register_function(u'songs_unblank', self.media_unblank)
- Registry().register_function(u'mediaitem_media_rebuild', self._set_active_players)
- Registry().register_function(u'mediaitem_suffixes', self._generate_extensions_lists)
+ Registry().register_function('songs_hide', self.media_hide)
+ Registry().register_function('songs_unblank', self.media_unblank)
+ Registry().register_function('mediaitem_media_rebuild', self._set_active_players)
+ Registry().register_function('mediaitem_suffixes', self._generate_extensions_lists)
def _set_active_players(self):
"""
Set the active players and available media files
"""
saved_players = get_media_players()[0]
- for player in self.media_players.keys():
+ for player in list(self.media_players.keys()):
self.media_players[player].is_active = player in saved_players
def _generate_extensions_lists(self):
@@ -134,14 +134,14 @@
Set the active players and available media files
"""
self.audio_extensions_list = []
- for player in self.media_players.values():
+ for player in list(self.media_players.values()):
if player.is_active:
for item in player.audio_extensions_list:
if not item in self.audio_extensions_list:
self.audio_extensions_list.append(item)
self.service_manager.supported_suffixes(item[2:])
self.video_extensions_list = []
- for player in self.media_players.values():
+ for player in list(self.media_players.values()):
if player.is_active:
for item in player.video_extensions_list:
if item not in self.video_extensions_list:
@@ -162,20 +162,20 @@
"""
Check to see if we have any media Player's available.
"""
- log.debug(u'_check_available_media_players')
- controller_dir = os.path.join(AppLocation.get_directory(AppLocation.AppDir), u'core', u'ui', u'media')
+ log.debug('_check_available_media_players')
+ controller_dir = os.path.join(AppLocation.get_directory(AppLocation.AppDir), 'core', 'ui', 'media')
for filename in os.listdir(controller_dir):
- if filename.endswith(u'player.py') and not filename == 'mediaplayer.py':
+ if filename.endswith('player.py') and not filename == 'mediaplayer.py':
path = os.path.join(controller_dir, filename)
if os.path.isfile(path):
- modulename = u'openlp.core.ui.media.' + os.path.splitext(filename)[0]
- log.debug(u'Importing controller %s', modulename)
+ modulename = 'openlp.core.ui.media.' + os.path.splitext(filename)[0]
+ log.debug('Importing controller %s', modulename)
try:
__import__(modulename, globals(), locals(), [])
# On some platforms importing vlc.py might cause
# also OSError exceptions. (e.g. Mac OS X)
except (ImportError, OSError):
- log.warn(u'Failed to import %s on path %s', modulename, path)
+ log.warn('Failed to import %s on path %s', modulename, path)
player_classes = MediaPlayer.__subclasses__()
for player_class in player_classes:
player = player_class(self)
@@ -198,11 +198,11 @@
Check if there is a running media Player and do updating stuff (e.g.
update the UI)
"""
- if not self.current_media_players.keys():
+ if not list(self.current_media_players.keys()):
self.timer.stop()
else:
any_active = False
- for source in self.current_media_players.keys():
+ for source in list(self.current_media_players.keys()):
display = self._define_display(self.display_controllers[source])
self.current_media_players[source].resize(display)
self.current_media_players[source].update_ui(display)
@@ -212,7 +212,7 @@
if any_active:
return
# no players are active anymore
- for source in self.current_media_players.keys():
+ for source in list(self.current_media_players.keys()):
if self.current_media_players[source].state != MediaState.Paused:
display = self._define_display(self.display_controllers[source])
display.controller.seek_slider.setSliderPosition(0)
@@ -222,8 +222,8 @@
"""
Add css style sheets to htmlbuilder
"""
- css = u''
- for player in self.media_players.values():
+ css = ''
+ for player in list(self.media_players.values()):
if player.is_active:
css += player.get_media_display_css()
return css
@@ -232,8 +232,8 @@
"""
Add javascript functions to htmlbuilder
"""
- js = u''
- for player in self.media_players.values():
+ js = ''
+ for player in list(self.media_players.values()):
if player.is_active:
js += player.get_media_display_javascript()
return js
@@ -242,8 +242,8 @@
"""
Add html code to htmlbuilder
"""
- html = u''
- for player in self.media_players.values():
+ html = ''
+ for player in list(self.media_players.values()):
if player.is_active:
html += player.get_media_display_html()
return html
@@ -268,14 +268,14 @@
controller.media_info = MediaInfo()
# Build a Media ToolBar
controller.mediabar = OpenLPToolbar(controller)
- controller.mediabar.add_toolbar_action(u'playbackPlay', text=u'media_playback_play',
- icon=u':/slides/media_playback_start.png',
+ controller.mediabar.add_toolbar_action('playbackPlay', text='media_playback_play',
+ icon=':/slides/media_playback_start.png',
tooltip=translate('OpenLP.SlideController', 'Start playing media.'), triggers=controller.send_to_plugins)
- controller.mediabar.add_toolbar_action(u'playbackPause', text=u'media_playback_pause',
- icon=u':/slides/media_playback_pause.png',
+ controller.mediabar.add_toolbar_action('playbackPause', text='media_playback_pause',
+ icon=':/slides/media_playback_pause.png',
tooltip=translate('OpenLP.SlideController', 'Pause playing media.'), triggers=controller.send_to_plugins)
- controller.mediabar.add_toolbar_action(u'playbackStop', text=u'media_playback_stop',
- icon=u':/slides/media_playback_stop.png',
+ controller.mediabar.add_toolbar_action('playbackStop', text='media_playback_stop',
+ icon=':/slides/media_playback_stop.png',
tooltip=translate('OpenLP.SlideController', 'Stop playing media.'), triggers=controller.send_to_plugins)
# Build the seek_slider.
controller.seek_slider = MediaSlider(QtCore.Qt.Horizontal, self, controller)
@@ -284,7 +284,7 @@
controller.seek_slider.setMouseTracking(True)
controller.seek_slider.setToolTip(translate('OpenLP.SlideController', 'Video position.'))
controller.seek_slider.setGeometry(QtCore.QRect(90, 260, 221, 24))
- controller.seek_slider.setObjectName(u'seek_slider')
+ controller.seek_slider.setObjectName('seek_slider')
controller.mediabar.add_toolbar_widget(controller.seek_slider)
# Build the volume_slider.
controller.volume_slider = QtGui.QSlider(QtCore.Qt.Horizontal)
@@ -296,7 +296,7 @@
controller.volume_slider.setToolTip(translate('OpenLP.SlideController', 'Audio Volume.'))
controller.volume_slider.setValue(controller.media_info.volume)
controller.volume_slider.setGeometry(QtCore.QRect(90, 160, 221, 24))
- controller.volume_slider.setObjectName(u'volume_slider')
+ controller.volume_slider.setObjectName('volume_slider')
controller.mediabar.add_toolbar_widget(controller.volume_slider)
controller.controller_layout.addWidget(controller.mediabar)
controller.mediabar.setVisible(False)
@@ -324,7 +324,7 @@
return
if preview:
display.has_audio = False
- for player in self.media_players.values():
+ for player in list(self.media_players.values()):
if player.is_active:
player.setup(display)
@@ -343,7 +343,7 @@
controller.mediabar.setVisible(value)
if controller.is_live and controller.display:
if self.current_media_players and value:
- if self.current_media_players[controller.controller_type] != self.media_players[u'webkit']:
+ if self.current_media_players[controller.controller_type] != self.media_players['webkit']:
controller.display.set_transparency(False)
def resize(self, display, player):
@@ -375,7 +375,7 @@
``video_behind_text``
Is the video to be played behind text.
"""
- log.debug(u'video')
+ log.debug('video')
is_valid = False
controller = self.display_controllers[source]
# stop running videos
@@ -387,8 +387,8 @@
display = self._define_display(controller)
if controller.is_live:
is_valid = self._check_file_type(controller, display, service_item)
- display.override[u'theme'] = u''
- display.override[u'video'] = True
+ display.override['theme'] = ''
+ display.override['video'] = True
if controller.media_info.is_background:
# ignore start/end time
controller.media_info.start_time = 0
@@ -405,7 +405,7 @@
return False
# dont care about actual theme, set a black background
if controller.is_live and not controller.media_info.is_background:
- display.frame.evaluateJavaScript(u'show_video( "setBackBoard", null, null, null,"visible");')
+ display.frame.evaluateJavaScript('show_video( "setBackBoard", null, null, null,"visible");')
# now start playing - Preview is autoplay!
autoplay = False
# Preview requested
@@ -415,7 +415,7 @@
elif not hidden or controller.media_info.is_background or service_item.will_auto_start:
autoplay = True
# Unblank on load set
- elif Settings().value(u'core/auto unblank'):
+ elif Settings().value('core/auto unblank'):
autoplay = True
if autoplay:
if not self.media_play(controller):
@@ -423,7 +423,7 @@
translate('MediaPlugin.MediaItem', 'Unsupported File'))
return False
self.set_controls_visible(controller, True)
- log.debug(u'use %s controller' % self.current_media_players[controller.controller_type])
+ log.debug('use %s controller' % self.current_media_players[controller.controller_type])
return True
def media_length(self, service_item):
@@ -434,7 +434,7 @@
The ServiceItem containing the details to be played.
"""
controller = self.display_controllers[DisplayControllerType.Plugin]
- log.debug(u'media_length')
+ log.debug('media_length')
# stop running videos
self.media_reset(controller)
controller.media_info = MediaInfo()
@@ -452,7 +452,7 @@
return False
service_item.set_media_length(controller.media_info.length)
self.media_stop(controller)
- log.debug(u'use %s controller' % self.current_media_players[controller.controller_type])
+ log.debug('use %s controller' % self.current_media_players[controller.controller_type])
return True
def _check_file_type(self, controller, display, service_item):
@@ -469,7 +469,7 @@
if service_item.processor != UiStrings().Automatic:
used_players = [service_item.processor.lower()]
if controller.media_info.file_info.isFile():
- suffix = u'*.%s' % controller.media_info.file_info.suffix().lower()
+ suffix = '*.%s' % controller.media_info.file_info.suffix().lower()
for title in used_players:
player = self.media_players[title]
if suffix in player.video_extensions_list:
@@ -504,7 +504,7 @@
``msg``
First element is the controller which should be used
"""
- log.debug(u'media_play_msg')
+ log.debug('media_play_msg')
self.media_play(msg[0], status)
def media_play(self, controller, status=True):
@@ -514,7 +514,7 @@
``controller``
The controller to be played
"""
- log.debug(u'media_play')
+ log.debug('media_play')
controller.seek_slider.blockSignals(True)
controller.volume_slider.blockSignals(True)
display = self._define_display(controller)
@@ -527,16 +527,16 @@
else:
self.media_volume(controller, controller.media_info.volume)
if status:
- display.frame.evaluateJavaScript(u'show_blank("desktop");')
+ display.frame.evaluateJavaScript('show_blank("desktop");')
self.current_media_players[controller.controller_type].set_visible(display, True)
# Flash needs to be played and will not AutoPlay
if controller.media_info.is_flash:
- controller.mediabar.actions[u'playbackPlay'].setVisible(True)
- controller.mediabar.actions[u'playbackPause'].setVisible(False)
+ controller.mediabar.actions['playbackPlay'].setVisible(True)
+ controller.mediabar.actions['playbackPause'].setVisible(False)
else:
- controller.mediabar.actions[u'playbackPlay'].setVisible(False)
- controller.mediabar.actions[u'playbackPause'].setVisible(True)
- controller.mediabar.actions[u'playbackStop'].setVisible(True)
+ controller.mediabar.actions['playbackPlay'].setVisible(False)
+ controller.mediabar.actions['playbackPause'].setVisible(True)
+ controller.mediabar.actions['playbackStop'].setVisible(True)
if controller.is_live:
if controller.hide_menu.defaultAction().isChecked():
controller.hide_menu.defaultAction().trigger()
@@ -554,7 +554,7 @@
``msg``
First element is the controller which should be used
"""
- log.debug(u'media_pause_msg')
+ log.debug('media_pause_msg')
self.media_pause(msg[0])
def media_pause(self, controller):
@@ -564,12 +564,12 @@
``controller``
The Controller to be paused
"""
- log.debug(u'media_pause')
+ log.debug('media_pause')
display = self._define_display(controller)
self.current_media_players[controller.controller_type].pause(display)
- controller.mediabar.actions[u'playbackPlay'].setVisible(True)
- controller.mediabar.actions[u'playbackStop'].setVisible(True)
- controller.mediabar.actions[u'playbackPause'].setVisible(False)
+ controller.mediabar.actions['playbackPlay'].setVisible(True)
+ controller.mediabar.actions['playbackStop'].setVisible(True)
+ controller.mediabar.actions['playbackPause'].setVisible(False)
def media_stop_msg(self, msg):
"""
@@ -578,7 +578,7 @@
``msg``
First element is the controller which should be used
"""
- log.debug(u'media_stop_msg')
+ log.debug('media_stop_msg')
self.media_stop(msg[0])
def media_stop(self, controller):
@@ -588,16 +588,16 @@
``controller``
The controller that needs to be stopped
"""
- log.debug(u'media_stop')
+ log.debug('media_stop')
display = self._define_display(controller)
if controller.controller_type in self.current_media_players:
- display.frame.evaluateJavaScript(u'show_blank("black");')
+ display.frame.evaluateJavaScript('show_blank("black");')
self.current_media_players[controller.controller_type].stop(display)
self.current_media_players[controller.controller_type].set_visible(display, False)
controller.seek_slider.setSliderPosition(0)
- controller.mediabar.actions[u'playbackPlay'].setVisible(True)
- controller.mediabar.actions[u'playbackStop'].setVisible(False)
- controller.mediabar.actions[u'playbackPause'].setVisible(False)
+ controller.mediabar.actions['playbackPlay'].setVisible(True)
+ controller.mediabar.actions['playbackStop'].setVisible(False)
+ controller.mediabar.actions['playbackPause'].setVisible(False)
def media_volume_msg(self, msg):
"""
@@ -617,7 +617,7 @@
``msg``
First element is the controller which should be used
"""
- log.debug(u'media_volume %d' % volume)
+ log.debug('media_volume %d' % volume)
display = self._define_display(controller)
self.current_media_players[controller.controller_type].volume(display, volume)
controller.volume_slider.setValue(volume)
@@ -630,7 +630,7 @@
First element is the controller which should be used
Second element is a list with the seek value as first element
"""
- log.debug(u'media_seek')
+ log.debug('media_seek')
controller = msg[0]
seek_value = msg[1][0]
self.media_seek(controller, seek_value)
@@ -646,7 +646,7 @@
The value to set.
"""
- log.debug(u'media_seek')
+ log.debug('media_seek')
display = self._define_display(controller)
self.current_media_players[controller.controller_type].seek(display, seek_value)
@@ -654,14 +654,14 @@
"""
Responds to the request to reset a loaded video
"""
- log.debug(u'media_reset')
+ log.debug('media_reset')
self.set_controls_visible(controller, False)
display = self._define_display(controller)
if controller.controller_type in self.current_media_players:
display.override = {}
self.current_media_players[controller.controller_type].reset(display)
self.current_media_players[controller.controller_type].set_visible(display, False)
- display.frame.evaluateJavaScript(u'show_video( "setBackBoard", null, null, null,"hidden");')
+ display.frame.evaluateJavaScript('show_video( "setBackBoard", null, null, null,"hidden");')
del self.current_media_players[controller.controller_type]
def media_hide(self, msg):
@@ -692,7 +692,7 @@
hide_mode = msg[2]
if not is_live:
return
- Registry().execute(u'live_display_hide', hide_mode)
+ Registry().execute('live_display_hide', hide_mode)
display = self._define_display(self.live_controller)
if self.current_media_players[self.live_controller.controller_type].state == MediaState.Playing:
self.current_media_players[self.live_controller.controller_type].pause(display)
@@ -706,7 +706,7 @@
First element is not relevant in this context
Second element is the boolean for Live indication
"""
- Registry().execute(u'live_display_show')
+ Registry().execute('live_display_show')
is_live = msg[1]
if not is_live:
return
@@ -742,8 +742,8 @@
"""
Adds the plugin manager to the class dynamically
"""
- if not hasattr(self, u'_service_manager'):
- self._service_manager = Registry().get(u'service_manager')
+ if not hasattr(self, '_service_manager'):
+ self._service_manager = Registry().get('service_manager')
return self._service_manager
service_manager = property(_get_service_manager)
@@ -752,8 +752,8 @@
"""
Adds the live controller to the class dynamically
"""
- if not hasattr(self, u'_live_controller'):
- self._live_controller = Registry().get(u'live_controller')
+ if not hasattr(self, '_live_controller'):
+ self._live_controller = Registry().get('live_controller')
return self._live_controller
live_controller = property(_get_live_controller)
=== modified file 'openlp/core/ui/media/mediaplayer.py'
--- openlp/core/ui/media/mediaplayer.py 2013-06-24 16:54:23 +0000
+++ openlp/core/ui/media/mediaplayer.py 2013-08-31 18:18:25 +0000
@@ -41,7 +41,7 @@
pluggable media display framework.
"""
- def __init__(self, parent, name=u'media_player'):
+ def __init__(self, parent, name='media_player'):
"""
Constructor
"""
@@ -133,36 +133,36 @@
"""
Add css style sheets to htmlbuilder
"""
- return u''
+ return ''
def get_media_display_javascript(self):
"""
Add javascript functions to htmlbuilder
"""
- return u''
+ return ''
def get_media_display_html(self):
"""
Add html code to htmlbuilder
"""
- return u''
+ return ''
def get_info(self):
"""
Returns Information about the player
"""
- return u''
+ return ''
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
- if os.name == u'nt':
- return Registry().get(u'application')
+ if os.name == 'nt':
+ return Registry().get('application')
else:
- if not hasattr(self, u'_application'):
- self._application = Registry().get(u'application')
+ if not hasattr(self, '_application'):
+ self._application = Registry().get('application')
return self._application
application = property(_get_application)
\ No newline at end of file
=== modified file 'openlp/core/ui/media/phononplayer.py'
--- openlp/core/ui/media/phononplayer.py 2013-07-18 14:14:29 +0000
+++ openlp/core/ui/media/phononplayer.py 2013-08-31 18:18:25 +0000
@@ -45,23 +45,23 @@
log = logging.getLogger(__name__)
ADDITIONAL_EXT = {
- u'audio/ac3': [u'.ac3'],
- u'audio/flac': [u'.flac'],
- u'audio/x-m4a': [u'.m4a'],
- u'audio/midi': [u'.mid', u'.midi'],
- u'audio/x-mp3': [u'.mp3'],
- u'audio/mpeg': [u'.mp3', u'.mp2', u'.mpga', u'.mpega', u'.m4a'],
- u'audio/qcelp': [u'.qcp'],
- u'audio/x-wma': [u'.wma'],
- u'audio/x-ms-wma': [u'.wma'],
- u'video/x-flv': [u'.flv'],
- u'video/x-matroska': [u'.mpv', u'.mkv'],
- u'video/x-wmv': [u'.wmv'],
- u'video/x-mpg': [u'.mpg'],
- u'video/mpeg': [u'.mp4', u'.mts', u'.mov'],
- u'video/x-ms-wmv': [u'.wmv']}
+ 'audio/ac3': ['.ac3'],
+ 'audio/flac': ['.flac'],
+ 'audio/x-m4a': ['.m4a'],
+ 'audio/midi': ['.mid', '.midi'],
+ 'audio/x-mp3': ['.mp3'],
+ 'audio/mpeg': ['.mp3', '.mp2', '.mpga', '.mpega', '.m4a'],
+ 'audio/qcelp': ['.qcp'],
+ 'audio/x-wma': ['.wma'],
+ 'audio/x-ms-wma': ['.wma'],
+ 'video/x-flv': ['.flv'],
+ 'video/x-matroska': ['.mpv', '.mkv'],
+ 'video/x-wmv': ['.wmv'],
+ 'video/x-mpg': ['.mpg'],
+ 'video/mpeg': ['.mp4', '.mts', '.mov'],
+ 'video/x-ms-wmv': ['.wmv']}
-VIDEO_CSS = u"""
+VIDEO_CSS = """
#videobackboard {
z-index:3;
background-color: %(bgcolor)s;
@@ -87,17 +87,17 @@
"""
Constructor
"""
- super(PhononPlayer, self).__init__(parent, u'phonon')
- self.original_name = u'Phonon'
- self.display_name = u'&Phonon'
+ super(PhononPlayer, self).__init__(parent, 'phonon')
+ self.original_name = 'Phonon'
+ self.display_name = '&Phonon'
self.parent = parent
self.additional_extensions = ADDITIONAL_EXT
mimetypes.init()
for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
- mimetype = unicode(mimetype)
- if mimetype.startswith(u'audio/'):
+ mimetype = str(mimetype)
+ if mimetype.startswith('audio/'):
self._addToList(self.audio_extensions_list, mimetype)
- elif mimetype.startswith(u'video/'):
+ elif mimetype.startswith('video/'):
self._addToList(self.video_extensions_list, mimetype)
def _addToList(self, mimetype_list, mimetype):
@@ -105,22 +105,22 @@
Add mimetypes to the provided list
"""
# Add all extensions which mimetypes provides us for supported types.
- extensions = mimetypes.guess_all_extensions(unicode(mimetype))
+ extensions = mimetypes.guess_all_extensions(str(mimetype))
for extension in extensions:
- ext = u'*%s' % extension
+ ext = '*%s' % extension
if ext not in mimetype_list:
mimetype_list.append(ext)
- log.info(u'MediaPlugin: %s extensions: %s' % (mimetype, u' '.join(extensions)))
+ log.info('MediaPlugin: %s extensions: %s' % (mimetype, ' '.join(extensions)))
# Add extensions for this mimetype from self.additional_extensions.
# This hack clears mimetypes' and operating system's shortcomings
# by providing possibly missing extensions.
- if mimetype in self.additional_extensions.keys():
+ if mimetype in list(self.additional_extensions.keys()):
for extension in self.additional_extensions[mimetype]:
- ext = u'*%s' % extension
+ ext = '*%s' % extension
if ext not in mimetype_list:
mimetype_list.append(ext)
- log.info(u'MediaPlugin: %s additional extensions: %s' %
- (mimetype, u' '.join(self.additional_extensions[mimetype])))
+ log.info('MediaPlugin: %s additional extensions: %s' %
+ (mimetype, ' '.join(self.additional_extensions[mimetype])))
def setup(self, display):
"""
@@ -147,7 +147,7 @@
"""
Load a video into the display
"""
- log.debug(u'load vid in Phonon Controller')
+ log.debug('load vid in Phonon Controller')
controller = display.controller
volume = controller.media_info.volume
path = controller.media_info.file_info.absoluteFilePath()
@@ -268,8 +268,8 @@
"""
Add css style sheets to htmlbuilder
"""
- background = QtGui.QColor(Settings().value(u'players/background color')).name()
- return VIDEO_CSS % {u'bgcolor': background}
+ background = QtGui.QColor(Settings().value('players/background color')).name()
+ return VIDEO_CSS % {'bgcolor': background}
def get_info(self):
"""
@@ -277,7 +277,7 @@
"""
return(translate('Media.player', 'Phonon is a media player which '
'interacts with the operating system to provide media capabilities.') +
- 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/>')
+ '<br/> <strong>' + translate('Media.player', 'Audio') +
+ '</strong><br/>' + str(self.audio_extensions_list) +
+ '<br/><strong>' + translate('Media.player', 'Video') +
+ '</strong><br/>' + str(self.video_extensions_list) + '<br/>')
=== modified file 'openlp/core/ui/media/playertab.py'
--- openlp/core/ui/media/playertab.py 2013-07-18 19:10:19 +0000
+++ openlp/core/ui/media/playertab.py 2013-08-31 18:18:25 +0000
@@ -57,30 +57,30 @@
"""
self.media_players = Registry().get('media_controller').media_players
self.saved_used_players = None
- self.icon_path = u':/media/multimedia-player.png'
+ self.icon_path = ':/media/multimedia-player.png'
player_translated = translate('OpenLP.PlayerTab', 'Players')
- super(PlayerTab, self).__init__(parent, u'Players', player_translated)
+ super(PlayerTab, self).__init__(parent, 'Players', player_translated)
def setupUi(self):
"""
Set up the UI
"""
- self.setObjectName(u'MediaTab')
+ self.setObjectName('MediaTab')
super(PlayerTab, self).setupUi()
self.background_color_group_box = QtGui.QGroupBox(self.left_column)
- self.background_color_group_box.setObjectName(u'background_color_group_box')
+ self.background_color_group_box.setObjectName('background_color_group_box')
self.form_layout = QtGui.QFormLayout(self.background_color_group_box)
- self.form_layout.setObjectName(u'form_layout')
+ self.form_layout.setObjectName('form_layout')
self.color_layout = QtGui.QHBoxLayout()
self.background_color_label = QtGui.QLabel(self.background_color_group_box)
- self.background_color_label.setObjectName(u'background_color_label')
+ self.background_color_label.setObjectName('background_color_label')
self.color_layout.addWidget(self.background_color_label)
self.background_color_button = QtGui.QPushButton(self.background_color_group_box)
- self.background_color_button.setObjectName(u'background_color_button')
+ self.background_color_button.setObjectName('background_color_button')
self.color_layout.addWidget(self.background_color_button)
self.form_layout.addRow(self.color_layout)
self.information_label = QtGui.QLabel(self.background_color_group_box)
- self.information_label.setObjectName(u'information_label')
+ self.information_label.setObjectName('information_label')
self.information_label.setWordWrap(True)
self.form_layout.addRow(self.information_label)
self.left_layout.addWidget(self.background_color_group_box)
@@ -88,15 +88,15 @@
self.right_column.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.right_layout.addStretch()
self.media_player_group_box = QtGui.QGroupBox(self.left_column)
- self.media_player_group_box.setObjectName(u'media_player_group_box')
+ self.media_player_group_box.setObjectName('media_player_group_box')
self.media_player_layout = QtGui.QVBoxLayout(self.media_player_group_box)
- self.media_player_layout.setObjectName(u'media_player_layout')
+ self.media_player_layout.setObjectName('media_player_layout')
self.player_check_boxes = {}
self.left_layout.addWidget(self.media_player_group_box)
self.player_order_group_box = QtGui.QGroupBox(self.left_column)
- self.player_order_group_box.setObjectName(u'player_order_group_box')
+ self.player_order_group_box.setObjectName('player_order_group_box')
self.player_order_layout = QtGui.QHBoxLayout(self.player_order_group_box)
- self.player_order_layout.setObjectName(u'player_order_layout')
+ self.player_order_layout.setObjectName('player_order_layout')
self.player_order_list_widget = QtGui.QListWidget(self.player_order_group_box)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
@@ -106,14 +106,14 @@
self.player_order_list_widget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.player_order_list_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.player_order_list_widget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
- self.player_order_list_widget.setObjectName(u'player_order_list_widget')
+ self.player_order_list_widget.setObjectName('player_order_list_widget')
self.player_order_layout.addWidget(self.player_order_list_widget)
self.ordering_button_layout = QtGui.QVBoxLayout()
- self.ordering_button_layout.setObjectName(u'ordering_button_layout')
+ self.ordering_button_layout.setObjectName('ordering_button_layout')
self.ordering_button_layout.addStretch(1)
- self.ordering_up_button = create_button(self, u'ordering_up_button', role=u'up',
+ self.ordering_up_button = create_button(self, 'ordering_up_button', role='up',
click=self.on_up_button_clicked)
- self.ordering_down_button = create_button(self, u'ordering_down_button', role=u'down',
+ self.ordering_down_button = create_button(self, 'ordering_down_button', role='down',
click=self.on_down_button_clicked)
self.ordering_button_layout.addWidget(self.ordering_up_button)
self.ordering_button_layout.addWidget(self.ordering_down_button)
@@ -144,7 +144,7 @@
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.background_color), self)
if new_color.isValid():
self.background_color = new_color.name()
- self.background_color_button.setStyleSheet(u'background-color: %s' % self.background_color)
+ self.background_color_button.setStyleSheet('background-color: %s' % self.background_color)
def on_player_check_box_changed(self, check_state):
"""
@@ -165,13 +165,13 @@
"""
self.player_order_list_widget.clear()
for player in self.used_players:
- if player in self.player_check_boxes.keys():
+ if player in list(self.player_check_boxes.keys()):
if len(self.used_players) == 1:
# At least one media player has to stay active
- self.player_check_boxes[u'%s' % player].setEnabled(False)
+ self.player_check_boxes['%s' % player].setEnabled(False)
else:
- self.player_check_boxes[u'%s' % player].setEnabled(True)
- self.player_order_list_widget.addItem(self.media_players[unicode(player)].original_name)
+ self.player_check_boxes['%s' % player].setEnabled(True)
+ self.player_order_list_widget.addItem(self.media_players[str(player)].original_name)
def on_up_button_clicked(self):
"""
@@ -208,10 +208,10 @@
settings = Settings()
settings.beginGroup(self.settings_section)
self.update_player_list()
- self.background_color = settings.value(u'background color')
+ self.background_color = settings.value('background color')
self.initial_color = self.background_color
settings.endGroup()
- self.background_color_button.setStyleSheet(u'background-color: %s' % self.background_color)
+ self.background_color_button.setStyleSheet('background-color: %s' % self.background_color)
def save(self):
"""
@@ -219,25 +219,25 @@
"""
settings = Settings()
settings.beginGroup(self.settings_section)
- settings.setValue(u'background color', self.background_color)
+ settings.setValue('background color', self.background_color)
settings.endGroup()
old_players, override_player = get_media_players()
if self.used_players != old_players:
# clean old Media stuff
set_media_players(self.used_players, override_player)
- self.settings_form.register_post_process(u'mediaitem_suffix_reset')
- self.settings_form.register_post_process(u'mediaitem_media_rebuild')
- self.settings_form.register_post_process(u'config_screen_changed')
+ self.settings_form.register_post_process('mediaitem_suffix_reset')
+ self.settings_form.register_post_process('mediaitem_media_rebuild')
+ self.settings_form.register_post_process('config_screen_changed')
def post_set_up(self):
"""
Late setup for players as the MediaController has to be initialised first.
"""
- for key, player in self.media_players.iteritems():
+ for key, player in self.media_players.items():
player = self.media_players[key]
checkbox = MediaQCheckBox(self.media_player_group_box)
checkbox.setEnabled(player.available)
- checkbox.setObjectName(player.name + u'_check_box')
+ checkbox.setObjectName(player.name + '_check_box')
checkbox.setToolTip(player.get_info())
checkbox.set_player_name(player.name)
self.player_check_boxes[player.name] = checkbox
=== modified file 'openlp/core/ui/media/vendor/vlc.py'
--- openlp/core/ui/media/vendor/vlc.py 2013-04-05 09:05:39 +0000
+++ openlp/core/ui/media/vendor/vlc.py 2013-08-31 18:18:25 +0000
@@ -52,9 +52,9 @@
if sys.version_info[0] > 2:
str = str
- unicode = str
+ str = str
bytes = bytes
- basestring = (str, bytes)
+ str = (str, bytes)
PYTHON3 = True
def str_to_bytes(s):
"""Translate string or bytes to bytes.
@@ -73,14 +73,14 @@
return b
else:
str = str
- unicode = unicode
+ str = str
bytes = str
- basestring = basestring
+ str = str
PYTHON3 = False
def str_to_bytes(s):
"""Translate string or bytes to bytes.
"""
- if isinstance(s, unicode):
+ if isinstance(s, str):
return s.encode(sys.getfilesystemencoding())
else:
return s
@@ -89,7 +89,7 @@
"""Translate bytes to unicode string.
"""
if isinstance(b, str):
- return unicode(b, sys.getfilesystemencoding())
+ return str(b, sys.getfilesystemencoding())
else:
return b
@@ -110,7 +110,7 @@
p = find_library('libvlc.dll')
if p is None:
try: # some registry settings
- import _winreg as w # leaner than win32api, win32con
+ import winreg as w # leaner than win32api, win32con
for r in w.HKEY_LOCAL_MACHINE, w.HKEY_CURRENT_USER:
try:
r = w.OpenKey(r, 'Software\\VideoLAN\\VLC')
@@ -168,7 +168,7 @@
pass
try:
- _Ints = (int, long)
+ _Ints = (int, int)
except NameError: # no long in Python 3+
_Ints = int
_Seqs = (list, tuple)
@@ -1294,7 +1294,7 @@
i = args[0]
if isinstance(i, _Ints):
return _Constructor(cls, i)
- elif isinstance(i, basestring):
+ elif isinstance(i, str):
args = i.strip().split()
elif isinstance(i, _Seqs):
args = i
@@ -2078,7 +2078,7 @@
@param mrl: a media instance or a MRL.
@return: 0 on success, -1 if the media list is read-only.
"""
- if isinstance(mrl, basestring):
+ if isinstance(mrl, str):
mrl = (self.get_instance() or get_default_instance()).media_new(mrl)
return libvlc_media_list_add_media(self, mrl)
@@ -5910,9 +5910,9 @@
'''
l = ['event %s' % (event.type,)]
if args:
- l.extend(map(str, args))
+ l.extend(list(map(str, args)))
if kwds:
- l.extend(sorted('%s=%s' % t for t in kwds.items()))
+ l.extend(sorted('%s=%s' % t for t in list(kwds.items())))
print('Debug callback (%s)' % ', '.join(l))
if __name__ == '__main__':
=== modified file 'openlp/core/ui/media/vlcplayer.py'
--- openlp/core/ui/media/vlcplayer.py 2013-07-18 14:19:01 +0000
+++ openlp/core/ui/media/vlcplayer.py 2013-08-31 18:18:25 +0000
@@ -49,7 +49,7 @@
VLC_AVAILABLE = bool(vlc.get_default_instance())
except (ImportError, NameError, NotImplementedError):
pass
-except OSError, e:
+except OSError as e:
if sys.platform.startswith('win'):
if not isinstance(e, WindowsError) and e.winerror != 126:
raise
@@ -60,39 +60,39 @@
try:
VERSION = vlc.libvlc_get_version().decode('UTF-8')
except:
- VERSION = u'0.0.0'
+ VERSION = '0.0.0'
# LooseVersion does not work when a string contains letter and digits (e. g. 2.0.5 Twoflower).
# http://bugs.python.org/issue14894
if LooseVersion(VERSION.split()[0]) < LooseVersion('1.1.0'):
VLC_AVAILABLE = False
- log.debug(u'VLC could not be loaded, because the vlc version is too old: %s' % VERSION)
+ log.debug('VLC could not be loaded, because the vlc version is too old: %s' % VERSION)
-AUDIO_EXT = [u'*.mp3', u'*.wav', u'*.wma', u'*.ogg']
+AUDIO_EXT = ['*.mp3', '*.wav', '*.wma', '*.ogg']
VIDEO_EXT = [
- u'*.3gp',
- u'*.asf', u'*.wmv',
- u'*.au',
- u'*.avi',
- u'*.flv',
- u'*.mov',
- u'*.mp4', u'*.m4v',
- u'*.ogm', u'*.ogv',
- u'*.mkv', u'*.mka',
- u'*.ts', u'*.mpg',
- u'*.mpg', u'*.mp2',
- u'*.nsc',
- u'*.nsv',
- u'*.nut',
- u'*.ra', u'*.ram', u'*.rm', u'*.rv', u'*.rmbv',
- u'*.a52', u'*.dts', u'*.aac', u'*.flac', u'*.dv', u'*.vid',
- u'*.tta', u'*.tac',
- u'*.ty',
- u'*.dts',
- u'*.xa',
- u'*.iso',
- u'*.vob',
- u'*.webm'
+ '*.3gp',
+ '*.asf', '*.wmv',
+ '*.au',
+ '*.avi',
+ '*.flv',
+ '*.mov',
+ '*.mp4', '*.m4v',
+ '*.ogm', '*.ogv',
+ '*.mkv', '*.mka',
+ '*.ts', '*.mpg',
+ '*.mpg', '*.mp2',
+ '*.nsc',
+ '*.nsv',
+ '*.nut',
+ '*.ra', '*.ram', '*.rm', '*.rv', '*.rmbv',
+ '*.a52', '*.dts', '*.aac', '*.flac', '*.dv', '*.vid',
+ '*.tta', '*.tac',
+ '*.ty',
+ '*.dts',
+ '*.xa',
+ '*.iso',
+ '*.vob',
+ '*.webm'
]
@@ -105,9 +105,9 @@
"""
Constructor
"""
- super(VlcPlayer, self).__init__(parent, u'vlc')
- self.original_name = u'VLC'
- self.display_name = u'&VLC'
+ super(VlcPlayer, self).__init__(parent, 'vlc')
+ self.original_name = 'VLC'
+ self.display_name = '&VLC'
self.parent = parent
self.can_folder = True
self.audio_extensions_list = AUDIO_EXT
@@ -120,11 +120,11 @@
display.vlcWidget = QtGui.QFrame(display)
display.vlcWidget.setFrameStyle(QtGui.QFrame.NoFrame)
# creating a basic vlc instance
- command_line_options = u'--no-video-title-show'
+ command_line_options = '--no-video-title-show'
if not display.has_audio:
- command_line_options += u' --no-audio --no-video-title-show'
- if Settings().value(u'advanced/hide mouse') and display.controller.is_live:
- command_line_options += u' --mouse-hide-timeout=0'
+ command_line_options += ' --no-audio --no-video-title-show'
+ if Settings().value('advanced/hide mouse') and display.controller.is_live:
+ command_line_options += ' --mouse-hide-timeout=0'
display.vlcInstance = vlc.Instance(command_line_options)
# creating an empty vlc media player
display.vlcMediaPlayer = display.vlcInstance.media_player_new()
@@ -158,7 +158,7 @@
"""
Load a video into VLC
"""
- log.debug(u'load vid in Vlc Controller')
+ log.debug('load vid in Vlc Controller')
controller = display.controller
volume = controller.media_info.volume
file_path = str(controller.media_info.file_info.absoluteFilePath())
@@ -287,7 +287,7 @@
"""
return(translate('Media.player', 'VLC is an external player which '
'supports a number of different formats.') +
- 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/>')
+ '<br/> <strong>' + translate('Media.player', 'Audio') +
+ '</strong><br/>' + str(AUDIO_EXT) + '<br/><strong>' +
+ translate('Media.player', 'Video') + '</strong><br/>' +
+ str(VIDEO_EXT) + '<br/>')
=== modified file 'openlp/core/ui/media/webkitplayer.py'
--- openlp/core/ui/media/webkitplayer.py 2013-07-18 14:19:01 +0000
+++ openlp/core/ui/media/webkitplayer.py 2013-08-31 18:18:25 +0000
@@ -39,7 +39,7 @@
log = logging.getLogger(__name__)
-VIDEO_CSS = u"""
+VIDEO_CSS = """
#videobackboard {
z-index:3;
background-color: %(bgcolor)s;
@@ -50,7 +50,7 @@
}
"""
-VIDEO_JS = u"""
+VIDEO_JS = """
function show_video(state, path, volume, loop, variable_value){
// Sometimes video.currentTime stops slightly short of video.duration and video.ended is intermittent!
@@ -100,18 +100,18 @@
}
"""
-VIDEO_HTML = u"""
+VIDEO_HTML = """
<div id="videobackboard" class="size" style="visibility:hidden"></div>
<video id="video" class="size" style="visibility:hidden" autobuffer preload></video>
"""
-FLASH_CSS = u"""
+FLASH_CSS = """
#flash {
z-index:5;
}
"""
-FLASH_JS = u"""
+FLASH_JS = """
function getFlashMovieObject(movieName)
{
if (window.document[movieName]){
@@ -169,37 +169,37 @@
}
"""
-FLASH_HTML = u"""
+FLASH_HTML = """
<div id="flash" class="size" style="visibility:hidden"></div>
"""
VIDEO_EXT = [
- u'*.3gp',
- u'*.3gpp',
- u'*.3g2',
- u'*.3gpp2',
- u'*.aac',
- u'*.flv',
- u'*.f4a',
- u'*.f4b',
- u'*.f4p',
- u'*.f4v',
- u'*.mov',
- u'*.m4a',
- u'*.m4b',
- u'*.m4p',
- u'*.m4v',
- u'*.mkv',
- u'*.mp4',
- u'*.ogv',
- u'*.webm',
- u'*.mpg', u'*.wmv', u'*.mpeg', u'*.avi',
- u'*.swf'
+ '*.3gp',
+ '*.3gpp',
+ '*.3g2',
+ '*.3gpp2',
+ '*.aac',
+ '*.flv',
+ '*.f4a',
+ '*.f4b',
+ '*.f4p',
+ '*.f4v',
+ '*.mov',
+ '*.m4a',
+ '*.m4b',
+ '*.m4p',
+ '*.m4v',
+ '*.mkv',
+ '*.mp4',
+ '*.ogv',
+ '*.webm',
+ '*.mpg', '*.wmv', '*.mpeg', '*.avi',
+ '*.swf'
]
AUDIO_EXT = [
- u'*.mp3',
- u'*.ogg'
+ '*.mp3',
+ '*.ogg'
]
@@ -213,9 +213,9 @@
"""
Constructor
"""
- super(WebkitPlayer, self).__init__(parent, u'webkit')
- self.original_name = u'WebKit'
- self.display_name = u'&WebKit'
+ super(WebkitPlayer, self).__init__(parent, 'webkit')
+ self.original_name = 'WebKit'
+ self.display_name = '&WebKit'
self.parent = parent
self.can_background = True
self.audio_extensions_list = AUDIO_EXT
@@ -225,8 +225,8 @@
"""
Add css style sheets to htmlbuilder
"""
- background = QtGui.QColor(Settings().value(u'players/background color')).name()
- css = VIDEO_CSS % {u'bgcolor': background}
+ background = QtGui.QColor(Settings().value('players/background color')).name()
+ css = VIDEO_CSS % {'bgcolor': background}
return css + FLASH_CSS
def get_media_display_javascript(self):
@@ -259,7 +259,7 @@
"""
Load a video
"""
- log.debug(u'load vid in Webkit Controller')
+ log.debug('load vid in Webkit Controller')
controller = display.controller
if display.has_audio and not controller.media_info.is_background:
volume = controller.media_info.volume
@@ -268,15 +268,15 @@
vol = 0
path = controller.media_info.file_info.absoluteFilePath()
if controller.media_info.is_background:
- loop = u'true'
+ loop = 'true'
else:
- loop = u'false'
+ loop = 'false'
display.web_view.setVisible(True)
- if controller.media_info.file_info.suffix() == u'swf':
+ if controller.media_info.file_info.suffix() == 'swf':
controller.media_info.is_flash = True
- js = u'show_flash("load","%s");' % (path.replace(u'\\', u'\\\\'))
+ js = 'show_flash("load","%s");' % (path.replace('\\', '\\\\'))
else:
- js = u'show_video("load", "%s", %s, %s);' % (path.replace(u'\\', u'\\\\'), str(vol), loop)
+ js = 'show_video("load", "%s", %s, %s);' % (path.replace('\\', '\\\\'), str(vol), loop)
display.frame.evaluateJavaScript(js)
return True
@@ -298,9 +298,9 @@
start_time = controller.media_info.start_time
self.set_visible(display, True)
if controller.media_info.is_flash:
- display.frame.evaluateJavaScript(u'show_flash("play");')
+ display.frame.evaluateJavaScript('show_flash("play");')
else:
- display.frame.evaluateJavaScript(u'show_video("play");')
+ display.frame.evaluateJavaScript('show_video("play");')
if start_time > 0:
self.seek(display, controller.media_info.start_time * 1000)
# TODO add playing check and get the correct media length
@@ -315,9 +315,9 @@
"""
controller = display.controller
if controller.media_info.is_flash:
- display.frame.evaluateJavaScript(u'show_flash("pause");')
+ display.frame.evaluateJavaScript('show_flash("pause");')
else:
- display.frame.evaluateJavaScript(u'show_video("pause");')
+ display.frame.evaluateJavaScript('show_video("pause");')
self.state = MediaState.Paused
def stop(self, display):
@@ -326,9 +326,9 @@
"""
controller = display.controller
if controller.media_info.is_flash:
- display.frame.evaluateJavaScript(u'show_flash("stop");')
+ display.frame.evaluateJavaScript('show_flash("stop");')
else:
- display.frame.evaluateJavaScript(u'show_video("stop");')
+ display.frame.evaluateJavaScript('show_video("stop");')
self.state = MediaState.Stopped
def volume(self, display, volume):
@@ -340,7 +340,7 @@
if display.has_audio:
vol = float(volume) / float(100)
if not controller.media_info.is_flash:
- display.frame.evaluateJavaScript(u'show_video(null, null, %s);' % str(vol))
+ display.frame.evaluateJavaScript('show_video(null, null, %s);' % str(vol))
def seek(self, display, seek_value):
"""
@@ -349,10 +349,10 @@
controller = display.controller
if controller.media_info.is_flash:
seek = seek_value
- display.frame.evaluateJavaScript(u'show_flash("seek", null, null, "%s");' % (seek))
+ display.frame.evaluateJavaScript('show_flash("seek", null, null, "%s");' % (seek))
else:
seek = float(seek_value) / 1000
- display.frame.evaluateJavaScript(u'show_video("seek", null, null, null, "%f");' % (seek))
+ display.frame.evaluateJavaScript('show_video("seek", null, null, null, "%f");' % (seek))
def reset(self, display):
"""
@@ -360,9 +360,9 @@
"""
controller = display.controller
if controller.media_info.is_flash:
- display.frame.evaluateJavaScript(u'show_flash("close");')
+ display.frame.evaluateJavaScript('show_flash("close");')
else:
- display.frame.evaluateJavaScript(u'show_video("close");')
+ display.frame.evaluateJavaScript('show_video("close");')
self.state = MediaState.Off
def set_visible(self, display, status):
@@ -375,9 +375,9 @@
else:
is_visible = "hidden"
if controller.media_info.is_flash:
- display.frame.evaluateJavaScript(u'show_flash("setVisible", null, null, "%s");' % (is_visible))
+ display.frame.evaluateJavaScript('show_flash("setVisible", null, null, "%s");' % (is_visible))
else:
- display.frame.evaluateJavaScript(u'show_video("setVisible", null, null, null, "%s");' % (is_visible))
+ display.frame.evaluateJavaScript('show_video("setVisible", null, null, null, "%s");' % (is_visible))
def update_ui(self, display):
"""
@@ -385,16 +385,16 @@
"""
controller = display.controller
if controller.media_info.is_flash:
- current_time = display.frame.evaluateJavaScript(u'show_flash("current_time");')
- length = display.frame.evaluateJavaScript(u'show_flash("length");')
+ current_time = display.frame.evaluateJavaScript('show_flash("current_time");')
+ length = display.frame.evaluateJavaScript('show_flash("length");')
else:
- if display.frame.evaluateJavaScript(u'show_video("isEnded");'):
+ if display.frame.evaluateJavaScript('show_video("isEnded");'):
self.stop(display)
- current_time = display.frame.evaluateJavaScript(u'show_video("current_time");')
+ current_time = display.frame.evaluateJavaScript('show_video("current_time");')
# check if conversion was ok and value is not 'NaN'
if current_time and current_time != float('inf'):
current_time = int(current_time * 1000)
- length = display.frame.evaluateJavaScript(u'show_video("length");')
+ length = display.frame.evaluateJavaScript('show_video("length");')
# check if conversion was ok and value is not 'NaN'
if length and length != float('inf'):
length = int(length * 1000)
@@ -413,7 +413,7 @@
return(translate('Media.player', 'Webkit is a media player which runs '
'inside a web browser. This player allows text over video to be '
'rendered.') +
- 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/>')
+ '<br/> <strong>' + translate('Media.player', 'Audio') +
+ '</strong><br/>' + str(AUDIO_EXT) + '<br/><strong>' +
+ translate('Media.player', 'Video') + '</strong><br/>' +
+ str(VIDEO_EXT) + '<br/>')
=== modified file 'openlp/core/ui/mediadockmanager.py'
--- openlp/core/ui/mediadockmanager.py 2013-03-19 19:43:22 +0000
+++ openlp/core/ui/mediadockmanager.py 2013-08-31 18:18:25 +0000
@@ -57,8 +57,8 @@
An icon for this dock item
"""
visible_title = media_item.plugin.get_string(StringContent.VisibleName)
- log.info(u'Adding %s dock' % visible_title)
- self.media_dock.addItem(media_item, icon, visible_title[u'title'])
+ log.info('Adding %s dock' % visible_title)
+ self.media_dock.addItem(media_item, icon, visible_title['title'])
def insert_dock(self, media_item, icon, weight):
"""
@@ -67,14 +67,14 @@
For now add at end of stack if not present
"""
visible_title = media_item.plugin.get_string(StringContent.VisibleName)
- log.debug(u'Inserting %s dock' % visible_title[u'title'])
+ log.debug('Inserting %s dock' % visible_title['title'])
match = False
for dock_index in range(self.media_dock.count()):
if self.media_dock.widget(dock_index).settings_section == media_item.plugin.name:
match = True
break
if not match:
- self.media_dock.addItem(media_item, icon, visible_title[u'title'])
+ self.media_dock.addItem(media_item, icon, visible_title['title'])
def remove_dock(self, media_item):
"""
@@ -84,7 +84,7 @@
The item to add to the dock
"""
visible_title = media_item.plugin.get_string(StringContent.VisibleName)
- log.debug(u'remove %s dock' % visible_title[u'title'])
+ log.debug('remove %s dock' % visible_title['title'])
for dock_index in range(self.media_dock.count()):
if self.media_dock.widget(dock_index):
if self.media_dock.widget(dock_index).settings_section == media_item.plugin.name:
=== modified file 'openlp/core/ui/plugindialog.py'
--- openlp/core/ui/plugindialog.py 2013-02-05 08:05:28 +0000
+++ openlp/core/ui/plugindialog.py 2013-08-31 18:18:25 +0000
@@ -43,39 +43,39 @@
"""
Set up the UI
"""
- pluginViewDialog.setObjectName(u'pluginViewDialog')
+ pluginViewDialog.setObjectName('pluginViewDialog')
pluginViewDialog.setWindowModality(QtCore.Qt.ApplicationModal)
self.pluginLayout = QtGui.QVBoxLayout(pluginViewDialog)
- self.pluginLayout.setObjectName(u'pluginLayout')
+ self.pluginLayout.setObjectName('pluginLayout')
self.listLayout = QtGui.QHBoxLayout()
- self.listLayout.setObjectName(u'listLayout')
+ self.listLayout.setObjectName('listLayout')
self.pluginListWidget = QtGui.QListWidget(pluginViewDialog)
- self.pluginListWidget.setObjectName(u'pluginListWidget')
+ self.pluginListWidget.setObjectName('pluginListWidget')
self.listLayout.addWidget(self.pluginListWidget)
self.pluginInfoGroupBox = QtGui.QGroupBox(pluginViewDialog)
- self.pluginInfoGroupBox.setObjectName(u'pluginInfoGroupBox')
+ self.pluginInfoGroupBox.setObjectName('pluginInfoGroupBox')
self.pluginInfoLayout = QtGui.QFormLayout(self.pluginInfoGroupBox)
- self.pluginInfoLayout.setObjectName(u'pluginInfoLayout')
+ self.pluginInfoLayout.setObjectName('pluginInfoLayout')
self.statusLabel = QtGui.QLabel(self.pluginInfoGroupBox)
- self.statusLabel.setObjectName(u'statusLabel')
+ self.statusLabel.setObjectName('statusLabel')
self.statusComboBox = QtGui.QComboBox(self.pluginInfoGroupBox)
- self.statusComboBox.addItems((u'', u''))
- self.statusComboBox.setObjectName(u'statusComboBox')
+ self.statusComboBox.addItems(('', ''))
+ self.statusComboBox.setObjectName('statusComboBox')
self.pluginInfoLayout.addRow(self.statusLabel, self.statusComboBox)
self.versionLabel = QtGui.QLabel(self.pluginInfoGroupBox)
- self.versionLabel.setObjectName(u'versionLabel')
+ self.versionLabel.setObjectName('versionLabel')
self.versionNumberLabel = QtGui.QLabel(self.pluginInfoGroupBox)
- self.versionNumberLabel.setObjectName(u'versionNumberLabel')
+ self.versionNumberLabel.setObjectName('versionNumberLabel')
self.pluginInfoLayout.addRow(self.versionLabel, self.versionNumberLabel)
self.aboutLabel = QtGui.QLabel(self.pluginInfoGroupBox)
- self.aboutLabel.setObjectName(u'aboutLabel')
+ self.aboutLabel.setObjectName('aboutLabel')
self.aboutTextBrowser = QtGui.QTextBrowser(self.pluginInfoGroupBox)
self.aboutTextBrowser.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse)
- self.aboutTextBrowser.setObjectName(u'aboutTextBrowser')
+ self.aboutTextBrowser.setObjectName('aboutTextBrowser')
self.pluginInfoLayout.addRow(self.aboutLabel, self.aboutTextBrowser)
self.listLayout.addWidget(self.pluginInfoGroupBox)
self.pluginLayout.addLayout(self.listLayout)
- self.button_box = create_button_box(pluginViewDialog, u'button_box', [u'ok'])
+ self.button_box = create_button_box(pluginViewDialog, 'button_box', ['ok'])
self.pluginLayout.addWidget(self.button_box)
self.retranslateUi(pluginViewDialog)
@@ -85,8 +85,8 @@
"""
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.versionLabel.setText('%s:' % UiStrings().Version)
+ self.aboutLabel.setText('%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'))
=== modified file 'openlp/core/ui/pluginform.py'
--- openlp/core/ui/pluginform.py 2013-07-18 14:19:01 +0000
+++ openlp/core/ui/pluginform.py 2013-08-31 18:18:25 +0000
@@ -35,7 +35,7 @@
from PyQt4 import QtGui
from openlp.core.lib import PluginStatus, Registry, translate
-from plugindialog import Ui_PluginViewDialog
+from .plugindialog import Ui_PluginViewDialog
log = logging.getLogger(__name__)
@@ -80,13 +80,13 @@
else:
# PluginStatus.Inactive
status_text = translate('OpenLP.PluginForm', '%s (Inactive)')
- item.setText(status_text % plugin.name_strings[u'singular'])
+ item.setText(status_text % plugin.name_strings['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(
- translate('OpenLP.PluginForm', '%s (Inactive)') % plugin.name_strings[u'singular']))
+ translate('OpenLP.PluginForm', '%s (Inactive)') % plugin.name_strings['singular']))
self.pluginListWidget.setFixedWidth(pluginListWidth + self.pluginListWidget.iconSize().width() + 48)
def _clearDetails(self):
@@ -94,15 +94,15 @@
Clear the plugin details widgets
"""
self.statusComboBox.setCurrentIndex(-1)
- self.versionNumberLabel.setText(u'')
- self.aboutTextBrowser.setHtml(u'')
+ self.versionNumberLabel.setText('')
+ self.aboutTextBrowser.setHtml('')
self.statusComboBox.setEnabled(False)
def _setDetails(self):
"""
Set the details of the currently selected plugin
"""
- log.debug(u'PluginStatus: %s', str(self.activePlugin.status))
+ log.debug('PluginStatus: %s', str(self.activePlugin.status))
self.versionNumberLabel.setText(self.activePlugin.version)
self.aboutTextBrowser.setHtml(self.activePlugin.about())
self.programaticChange = True
@@ -120,11 +120,11 @@
if self.pluginListWidget.currentItem() is None:
self._clearDetails()
return
- plugin_name_singular = self.pluginListWidget.currentItem().text().split(u'(')[0][:-1]
+ plugin_name_singular = self.pluginListWidget.currentItem().text().split('(')[0][:-1]
self.activePlugin = None
for plugin in self.plugin_manager.plugins:
if plugin.status != PluginStatus.Disabled:
- if plugin.name_strings[u'singular'] == plugin_name_singular:
+ if plugin.name_strings['singular'] == plugin_name_singular:
self.activePlugin = plugin
break
if self.activePlugin:
@@ -153,14 +153,14 @@
elif self.activePlugin.status == PluginStatus.Disabled:
status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
self.pluginListWidget.currentItem().setText(
- status_text % self.activePlugin.name_strings[u'singular'])
+ status_text % self.activePlugin.name_strings['singular'])
def _get_plugin_manager(self):
"""
Adds the plugin manager to the class dynamically
"""
- if not hasattr(self, u'_plugin_manager'):
- self._plugin_manager = Registry().get(u'plugin_manager')
+ if not hasattr(self, '_plugin_manager'):
+ self._plugin_manager = Registry().get('plugin_manager')
return self._plugin_manager
plugin_manager = property(_get_plugin_manager)
@@ -170,11 +170,11 @@
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
- if os.name == u'nt':
- return Registry().get(u'application')
+ if os.name == 'nt':
+ return Registry().get('application')
else:
- if not hasattr(self, u'_application'):
- self._application = Registry().get(u'application')
+ if not hasattr(self, '_application'):
+ self._application = Registry().get('application')
return self._application
application = property(_get_application)
=== modified file 'openlp/core/ui/printservicedialog.py'
--- openlp/core/ui/printservicedialog.py 2013-03-08 08:14:39 +0000
+++ openlp/core/ui/printservicedialog.py 2013-08-31 18:18:25 +0000
@@ -54,45 +54,45 @@
"""
Set up the UI
"""
- print_service_dialog.setObjectName(u'print_service_dialog')
+ print_service_dialog.setObjectName('print_service_dialog')
print_service_dialog.resize(664, 594)
self.main_layout = QtGui.QVBoxLayout(print_service_dialog)
self.main_layout.setSpacing(0)
self.main_layout.setMargin(0)
- self.main_layout.setObjectName(u'main_layout')
+ self.main_layout.setObjectName('main_layout')
self.toolbar = QtGui.QToolBar(print_service_dialog)
self.toolbar.setIconSize(QtCore.QSize(22, 22))
self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
- self.print_button = self.toolbar.addAction(build_icon(u':/general/general_print.png'),
+ self.print_button = self.toolbar.addAction(build_icon(':/general/general_print.png'),
translate('OpenLP.PrintServiceForm', 'Print'))
self.options_button = QtGui.QToolButton(self.toolbar)
self.options_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
- self.options_button.setIcon(build_icon(u':/system/system_configure.png'))
+ self.options_button.setIcon(build_icon(':/system/system_configure.png'))
self.options_button.setCheckable(True)
self.toolbar.addWidget(self.options_button)
self.toolbar.addSeparator()
- self.plain_copy = self.toolbar.addAction(build_icon(u':/system/system_edit_copy.png'),
+ self.plain_copy = self.toolbar.addAction(build_icon(':/system/system_edit_copy.png'),
translate('OpenLP.PrintServiceForm', 'Copy'))
- self.html_copy = self.toolbar.addAction(build_icon(u':/system/system_edit_copy.png'),
+ self.html_copy = self.toolbar.addAction(build_icon(':/system/system_edit_copy.png'),
translate('OpenLP.PrintServiceForm', 'Copy as HTML'))
self.toolbar.addSeparator()
self.zoom_in_button = QtGui.QToolButton(self.toolbar)
- self.zoom_in_button.setIcon(build_icon(u':/general/general_zoom_in.png'))
- self.zoom_in_button.setObjectName(u'zoom_in_button')
+ self.zoom_in_button.setIcon(build_icon(':/general/general_zoom_in.png'))
+ self.zoom_in_button.setObjectName('zoom_in_button')
self.zoom_in_button.setIconSize(QtCore.QSize(22, 22))
self.toolbar.addWidget(self.zoom_in_button)
self.zoom_out_button = QtGui.QToolButton(self.toolbar)
- self.zoom_out_button.setIcon(build_icon(u':/general/general_zoom_out.png'))
- self.zoom_out_button.setObjectName(u'zoom_out_button')
+ self.zoom_out_button.setIcon(build_icon(':/general/general_zoom_out.png'))
+ self.zoom_out_button.setObjectName('zoom_out_button')
self.zoom_out_button.setIconSize(QtCore.QSize(22, 22))
self.toolbar.addWidget(self.zoom_out_button)
self.zoom_original_button = QtGui.QToolButton(self.toolbar)
- self.zoom_original_button.setIcon(build_icon(u':/general/general_zoom_original.png'))
- self.zoom_original_button.setObjectName(u'zoom_original_button')
+ self.zoom_original_button.setIcon(build_icon(':/general/general_zoom_original.png'))
+ self.zoom_original_button.setObjectName('zoom_original_button')
self.zoom_original_button.setIconSize(QtCore.QSize(22, 22))
self.toolbar.addWidget(self.zoom_original_button)
self.zoom_combo_box = QtGui.QComboBox(print_service_dialog)
- self.zoom_combo_box.setObjectName(u'zoom_combo_box')
+ self.zoom_combo_box.setObjectName('zoom_combo_box')
self.toolbar.addWidget(self.zoom_combo_box)
self.main_layout.addWidget(self.toolbar)
self.preview_widget = QtGui.QPrintPreviewWidget(print_service_dialog)
@@ -104,16 +104,16 @@
self.options_layout = QtGui.QVBoxLayout(self.options_widget)
self.options_layout.setContentsMargins(8, 8, 8, 8)
self.title_label = QtGui.QLabel(self.options_widget)
- self.title_label.setObjectName(u'title_label')
+ self.title_label.setObjectName('title_label')
self.options_layout.addWidget(self.title_label)
self.title_line_edit = QtGui.QLineEdit(self.options_widget)
- self.title_line_edit.setObjectName(u'title_line_edit')
+ self.title_line_edit.setObjectName('title_line_edit')
self.options_layout.addWidget(self.title_line_edit)
self.footer_label = QtGui.QLabel(self.options_widget)
- self.footer_label.setObjectName(u'footer_label')
+ self.footer_label.setObjectName('footer_label')
self.options_layout.addWidget(self.footer_label)
self.footer_text_edit = SpellTextEdit(self.options_widget, False)
- self.footer_text_edit.setObjectName(u'footer_text_edit')
+ self.footer_text_edit.setObjectName('footer_text_edit')
self.options_layout.addWidget(self.footer_text_edit)
self.options_group_box = QtGui.QGroupBox()
self.group_layout = QtGui.QVBoxLayout()
@@ -153,8 +153,8 @@
self.zoom_combo_box.addItems([
translate('OpenLP.PrintServiceDialog', 'Fit Page'),
translate('OpenLP.PrintServiceDialog', 'Fit Width'),
- u'100%',
- u'75%',
- u'50%',
- u'25%'
+ '100%',
+ '75%',
+ '50%',
+ '25%'
])
=== modified file 'openlp/core/ui/printserviceform.py'
--- openlp/core/ui/printserviceform.py 2013-07-18 14:19:01 +0000
+++ openlp/core/ui/printserviceform.py 2013-08-31 18:18:25 +0000
@@ -126,14 +126,14 @@
self.setupUi(self)
# Load the settings for the dialog.
settings = Settings()
- settings.beginGroup(u'advanced')
- self.slide_text_check_box.setChecked(settings.value(u'print slide text'))
- self.page_break_after_text.setChecked(settings.value(u'add page break'))
+ settings.beginGroup('advanced')
+ self.slide_text_check_box.setChecked(settings.value('print slide text'))
+ self.page_break_after_text.setChecked(settings.value('add page break'))
if not self.slide_text_check_box.isChecked():
self.page_break_after_text.setDisabled(True)
- self.meta_data_check_box.setChecked(settings.value(u'print file meta data'))
- self.notes_check_box.setChecked(settings.value(u'print notes'))
- self.zoom_combo_box.setCurrentIndex(settings.value(u'display size'))
+ self.meta_data_check_box.setChecked(settings.value('print file meta data'))
+ self.notes_check_box.setChecked(settings.value('print notes'))
+ self.zoom_combo_box.setCurrentIndex(settings.value('display size'))
settings.endGroup()
# Signals
self.print_button.triggered.connect(self.print_service_order)
@@ -165,24 +165,24 @@
"""
Creates the html text and updates the html of *self.document*.
"""
- html_data = self._add_element(u'html')
- self._add_element(u'head', parent=html_data)
- self._add_element(u'title', self.title_line_edit.text(), html_data.head)
- css_path = os.path.join(AppLocation.get_data_path(), u'service_print.css')
+ html_data = self._add_element('html')
+ self._add_element('head', parent=html_data)
+ self._add_element('title', self.title_line_edit.text(), html_data.head)
+ css_path = os.path.join(AppLocation.get_data_path(), 'service_print.css')
custom_css = get_text_file_string(css_path)
if not custom_css:
custom_css = DEFAULT_CSS
- self._add_element(u'style', custom_css, html_data.head, attribute=(u'type', u'text/css'))
- self._add_element(u'body', parent=html_data)
- self._add_element(u'h1', cgi.escape(self.title_line_edit.text()), html_data.body, classId=u'serviceTitle')
+ self._add_element('style', custom_css, html_data.head, attribute=('type', 'text/css'))
+ self._add_element('body', parent=html_data)
+ self._add_element('h1', cgi.escape(self.title_line_edit.text()), html_data.body, classId='serviceTitle')
for index, item in enumerate(self.service_manager.service_items):
- self._add_preview_item(html_data.body, item[u'service_item'], index)
+ self._add_preview_item(html_data.body, item['service_item'], index)
# Add the custom service notes:
if self.footer_text_edit.toPlainText():
- div = self._add_element(u'div', parent=html_data.body, classId=u'customNotes')
+ div = self._add_element('div', parent=html_data.body, classId='customNotes')
self._add_element(
- u'span', translate('OpenLP.ServiceManager', 'Custom Service Notes: '), div, classId=u'customNotesTitle')
- self._add_element(u'span', cgi.escape(self.footer_text_edit.toPlainText()), div, classId=u'customNotesText')
+ 'span', translate('OpenLP.ServiceManager', 'Custom Service Notes: '), div, classId='customNotesTitle')
+ self._add_element('span', cgi.escape(self.footer_text_edit.toPlainText()), div, classId='customNotesText')
self.document.setHtml(html.tostring(html_data).decode())
self.preview_widget.updatePreview()
@@ -190,51 +190,51 @@
"""
Add a preview item
"""
- div = self._add_element(u'div', classId=u'item', parent=body)
+ div = self._add_element('div', classId='item', parent=body)
# Add the title of the service item.
- item_title = self._add_element(u'h2', parent=div, classId=u'itemTitle')
- self._add_element(u'img', parent=item_title, attribute=(u'src', item.icon))
- self._add_element(u'span', u' ' + cgi.escape(item.get_display_title()), item_title)
+ item_title = self._add_element('h2', parent=div, classId='itemTitle')
+ self._add_element('img', parent=item_title, attribute=('src', item.icon))
+ self._add_element('span', ' ' + cgi.escape(item.get_display_title()), item_title)
if self.slide_text_check_box.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._add_element(u'div', parent=div, classId=u'itemText')
+ if not verse_def or verse_def != slide['verseTag']:
+ text_div = self._add_element('div', parent=div, classId='itemText')
else:
- self._add_element(u'br', parent=text_div)
- self._add_element(u'span', slide[u'html'], text_div)
- verse_def = slide[u'verseTag']
+ self._add_element('br', parent=text_div)
+ self._add_element('span', slide['html'], text_div)
+ verse_def = slide['verseTag']
# Break the page before the div element.
if index != 0 and self.page_break_after_text.isChecked():
- div.set(u'class', u'item newPage')
+ div.set('class', 'item newPage')
# Add the image names of the service item.
elif item.is_image():
- ol = self._add_element(u'ol', parent=div, classId=u'imageList')
+ ol = self._add_element('ol', parent=div, classId='imageList')
for slide in range(len(item.get_frames())):
- self._add_element(u'li', item.get_frame_title(slide), ol)
+ self._add_element('li', item.get_frame_title(slide), ol)
# add footer
foot_text = item.foot_text
- foot_text = foot_text.partition(u'<br>')[2]
+ foot_text = foot_text.partition('<br>')[2]
if foot_text:
- foot_text = cgi.escape(foot_text.replace(u'<br>', u'\n'))
- self._add_element(u'div', foot_text.replace(u'\n', u'<br>'), parent=div, classId=u'itemFooter')
+ foot_text = cgi.escape(foot_text.replace('<br>', '\n'))
+ self._add_element('div', foot_text.replace('\n', '<br>'), parent=div, classId='itemFooter')
# Add service items' notes.
if self.notes_check_box.isChecked():
if item.notes:
- p = self._add_element(u'div', classId=u'itemNotes', parent=div)
- self._add_element(u'span', translate('OpenLP.ServiceManager', 'Notes: '), p, classId=u'itemNotesTitle')
- self._add_element(u'span', cgi.escape(item.notes).replace(u'\n', u'<br>'), p, classId=u'itemNotesText')
+ p = self._add_element('div', classId='itemNotes', parent=div)
+ self._add_element('span', translate('OpenLP.ServiceManager', 'Notes: '), p, classId='itemNotesTitle')
+ self._add_element('span', cgi.escape(item.notes).replace('\n', '<br>'), p, classId='itemNotesText')
# Add play length of media files.
if item.is_media() and self.meta_data_check_box.isChecked():
tme = item.media_length
Follow ups