forked from openlp/openlp
commit
f8299ec309
10
openlp.py
10
openlp.py
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||
|
||||
|
@ -27,15 +27,7 @@
|
|||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
import sip
|
||||
import sys
|
||||
sip.setapi(u'QDate', 2)
|
||||
sip.setapi(u'QDateTime', 2)
|
||||
sip.setapi(u'QString', 2)
|
||||
sip.setapi(u'QTextStream', 2)
|
||||
sip.setapi(u'QTime', 2)
|
||||
sip.setapi(u'QUrl', 2)
|
||||
sip.setapi(u'QVariant', 2)
|
||||
|
||||
from openlp.core import main
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
The :mod:`openlp` module contains all the project produced OpenLP functionality
|
||||
"""
|
||||
|
||||
import core
|
||||
import plugins
|
||||
import openlp.core
|
||||
import openlp.plugins
|
||||
|
||||
__all__ = [u'core', u'plugins']
|
||||
|
|
|
@ -121,20 +121,19 @@ def get_text_file_string(text_file):
|
|||
if not os.path.isfile(text_file):
|
||||
return False
|
||||
file_handle = None
|
||||
content_string = None
|
||||
content = None
|
||||
try:
|
||||
file_handle = open(text_file, u'r')
|
||||
if not file_handle.read(3) == '\xEF\xBB\xBF':
|
||||
# no BOM was found
|
||||
file_handle.seek(0)
|
||||
content = file_handle.read()
|
||||
content_string = content.decode(u'utf-8')
|
||||
except (IOError, UnicodeError):
|
||||
log.exception(u'Failed to open text file %s' % text_file)
|
||||
finally:
|
||||
if file_handle:
|
||||
file_handle.close()
|
||||
return content_string
|
||||
return content
|
||||
|
||||
|
||||
def str_to_bool(string_value):
|
||||
|
@ -186,7 +185,7 @@ def image_to_byte(image):
|
|||
image.save(buffie, "PNG")
|
||||
log.debug(u'image_to_byte - end')
|
||||
# convert to base64 encoding so does not get missed!
|
||||
return byte_array.toBase64()
|
||||
return bytes(byte_array.toBase64()).decode('utf-8')
|
||||
|
||||
|
||||
def create_thumb(image_path, thumb_path, return_icon=True, size=None):
|
||||
|
|
|
@ -49,7 +49,7 @@ class OpenLPDockWidget(QtGui.QDockWidget):
|
|||
Initialise the DockWidget
|
||||
"""
|
||||
log.debug(u'Initialise the %s widget' % name)
|
||||
QtGui.QDockWidget.__init__(self, parent)
|
||||
super(OpenLPDockWidget, self).__init__(parent)
|
||||
if name:
|
||||
self.setObjectName(name)
|
||||
if icon:
|
||||
|
|
|
@ -62,9 +62,6 @@ class FormattingTags(object):
|
|||
# Remove key 'temporary' from tags. It is not needed to be saved.
|
||||
if u'temporary' in tag:
|
||||
del tag[u'temporary']
|
||||
for element in tag:
|
||||
if isinstance(tag[element], unicode):
|
||||
tag[element] = tag[element].encode('utf8')
|
||||
# Formatting Tags were also known as display tags.
|
||||
Settings().setValue(u'formattingTags/html_tags', json.dumps(tags) if tags else u'')
|
||||
|
||||
|
@ -156,15 +153,10 @@ class FormattingTags(object):
|
|||
u'end html': u'', u'protected': True, u'temporary': False})
|
||||
FormattingTags.add_html_tags(base_tags)
|
||||
FormattingTags.add_html_tags(temporary_tags)
|
||||
# Formatting Tags were also known as display tags.
|
||||
user_expands_string = str(Settings().value(u'formattingTags/html_tags'))
|
||||
# If we have some user ones added them as well
|
||||
if user_expands_string:
|
||||
user_tags = json.loads(user_expands_string)
|
||||
for tag in user_tags:
|
||||
for element in tag:
|
||||
if isinstance(tag[element], str):
|
||||
tag[element] = tag[element].decode('utf8')
|
||||
# If we have some user ones added them as well
|
||||
FormattingTags.add_html_tags(user_tags)
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -56,7 +56,7 @@ class ImageThread(QtCore.QThread):
|
|||
``manager``
|
||||
The image manager.
|
||||
"""
|
||||
QtCore.QThread.__init__(self, None)
|
||||
super(ImageThread, self).__init__(None)
|
||||
self.image_manager = manager
|
||||
|
||||
def run(self):
|
||||
|
@ -183,7 +183,7 @@ class ImageManager(QtCore.QObject):
|
|||
"""
|
||||
Constructor for the image manager.
|
||||
"""
|
||||
QtCore.QObject.__init__(self)
|
||||
super(ImageManager, self).__init__()
|
||||
Registry().register(u'image_manager', self)
|
||||
current_screen = ScreenList().current
|
||||
self.width = current_screen[u'size'].width()
|
||||
|
|
|
@ -44,7 +44,7 @@ class ListWidgetWithDnD(QtGui.QListWidget):
|
|||
"""
|
||||
Initialise the list widget
|
||||
"""
|
||||
QtGui.QListWidget.__init__(self, parent)
|
||||
super(ListWidgetWithDnD, self).__init__(parent)
|
||||
self.mimeDataText = name
|
||||
assert(self.mimeDataText)
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
Constructor to create the media manager item.
|
||||
"""
|
||||
QtGui.QWidget.__init__(self)
|
||||
super(MediaManagerItem, self).__init__()
|
||||
self.hide()
|
||||
self.whitespace = re.compile(r'[\W_]+', re.UNICODE)
|
||||
self.plugin = plugin
|
||||
|
|
|
@ -128,7 +128,7 @@ class Plugin(QtCore.QObject):
|
|||
|
||||
class MyPlugin(Plugin):
|
||||
def __init__(self):
|
||||
Plugin.__init__(self, u'MyPlugin', version=u'0.1')
|
||||
super(MyPlugin, self).__init__('MyPlugin', version=u'0.1')
|
||||
|
||||
``name``
|
||||
Defaults to *None*. The name of the plugin.
|
||||
|
@ -146,7 +146,7 @@ class Plugin(QtCore.QObject):
|
|||
Defaults to *None*, which means that the same version number is used as OpenLP's version number.
|
||||
"""
|
||||
log.debug(u'Plugin %s initialised' % name)
|
||||
QtCore.QObject.__init__(self)
|
||||
super(Plugin, self).__init__()
|
||||
self.name = name
|
||||
self.text_strings = {}
|
||||
self.set_plugin_text_strings()
|
||||
|
|
|
@ -46,7 +46,7 @@ class SearchEdit(QtGui.QLineEdit):
|
|||
"""
|
||||
Constructor.
|
||||
"""
|
||||
QtGui.QLineEdit.__init__(self, parent)
|
||||
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'))
|
||||
|
|
|
@ -52,7 +52,7 @@ class SettingsTab(QtGui.QWidget):
|
|||
``visible_title``
|
||||
The title of the tab, which is usually displayed on the tab.
|
||||
"""
|
||||
QtGui.QWidget.__init__(self, parent)
|
||||
super(SettingsTab, self).__init__(parent)
|
||||
self.tab_title = title
|
||||
self.tab_title_visible = visible_title
|
||||
self.settings_section = self.tab_title.lower()
|
||||
|
|
|
@ -60,7 +60,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
|
|||
Constructor.
|
||||
"""
|
||||
global ENCHANT_AVAILABLE
|
||||
QtGui.QPlainTextEdit.__init__(self, parent)
|
||||
super(SpellTextEdit, self).__init__(parent)
|
||||
self.formatting_tags_allowed = formatting_tags_allowed
|
||||
# Default dictionary based on the current locale.
|
||||
if ENCHANT_AVAILABLE:
|
||||
|
@ -177,7 +177,7 @@ class Highlighter(QtGui.QSyntaxHighlighter):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QSyntaxHighlighter.__init__(self, *args)
|
||||
super(Highlighter, self).__init__(*args)
|
||||
self.spelling_dictionary = None
|
||||
|
||||
def highlightBlock(self, text):
|
||||
|
@ -205,5 +205,5 @@ class SpellAction(QtGui.QAction):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QAction.__init__(self, *args)
|
||||
super(SpellAction, self).__init__(*args)
|
||||
self.triggered.connect(lambda x: self.correct.emit(self.text()))
|
||||
|
|
|
@ -473,7 +473,7 @@ class ThemeXML(object):
|
|||
Pull out the XML string formatted for human consumption
|
||||
"""
|
||||
self._build_xml_from_attrs()
|
||||
return self.theme_xml.toprettyxml(indent=u' ', newl=u'\n', encoding=u'utf-8')
|
||||
return self.theme_xml.toprettyxml(indent=' ', newl='\n', encoding='utf-8')
|
||||
|
||||
def parse(self, xml):
|
||||
"""
|
||||
|
|
|
@ -47,7 +47,7 @@ class OpenLPToolbar(QtGui.QToolBar):
|
|||
"""
|
||||
Initialise the toolbar.
|
||||
"""
|
||||
QtGui.QToolBar.__init__(self, parent)
|
||||
super(OpenLPToolbar, self).__init__(parent)
|
||||
# useful to be able to reuse button icons...
|
||||
self.setIconSize(QtCore.QSize(20, 20))
|
||||
self.actions = {}
|
||||
|
|
|
@ -44,7 +44,7 @@ class TreeWidgetWithDnD(QtGui.QTreeWidget):
|
|||
"""
|
||||
Initialise the tree widget
|
||||
"""
|
||||
QtGui.QTreeWidget.__init__(self, parent)
|
||||
super(TreeWidgetWithDnD, self).__init__(parent)
|
||||
self.mimeDataText = name
|
||||
self.allow_internal_dnd = False
|
||||
self.header().close()
|
||||
|
|
|
@ -46,7 +46,7 @@ class AboutForm(QtGui.QDialog, Ui_AboutDialog):
|
|||
"""
|
||||
Do some initialisation stuff
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(AboutForm, self).__init__(parent)
|
||||
application_version = get_application_version()
|
||||
self.setupUi(self)
|
||||
about_text = self.about_text_edit.toPlainText()
|
||||
|
|
|
@ -57,14 +57,14 @@ class AdvancedTab(SettingsTab):
|
|||
self.data_exists = False
|
||||
self.icon_path = u':/system/system_settings.png'
|
||||
advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced')
|
||||
SettingsTab.__init__(self, parent, u'Advanced', advanced_translated)
|
||||
super(AdvancedTab, self).__init__(parent, u'Advanced', advanced_translated)
|
||||
|
||||
def setupUi(self):
|
||||
"""
|
||||
Configure the UI elements for the tab.
|
||||
"""
|
||||
self.setObjectName(u'AdvancedTab')
|
||||
SettingsTab.setupUi(self)
|
||||
super(AdvancedTab, self).setupUi()
|
||||
self.ui_group_box = QtGui.QGroupBox(self.left_column)
|
||||
self.ui_group_box.setObjectName(u'ui_group_box')
|
||||
self.ui_layout = QtGui.QFormLayout(self.ui_group_box)
|
||||
|
|
|
@ -107,7 +107,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||
"""
|
||||
Constructor.
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, self.main_window)
|
||||
super(ExceptionForm, self).__init__(self.main_window)
|
||||
self.setupUi(self)
|
||||
self.settings_section = u'crashreport'
|
||||
|
||||
|
@ -276,4 +276,4 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||
self._main_window = Registry().get(u'main_window')
|
||||
return self._main_window
|
||||
|
||||
main_window = property(_get_main_window)
|
||||
main_window = property(_get_main_window)
|
||||
|
|
|
@ -45,7 +45,7 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, self.main_window)
|
||||
super(FileRenameForm, self).__init__(Registry().get(u'main_window'))
|
||||
self.setupUi(self)
|
||||
|
||||
def exec_(self, copy=False):
|
||||
|
|
|
@ -29,20 +29,20 @@
|
|||
"""
|
||||
This module contains the first time wizard.
|
||||
"""
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import urllib
|
||||
import urllib2
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
import urllib.error
|
||||
from tempfile import gettempdir
|
||||
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, get_filesystem_encoding
|
||||
from openlp.core.utils import AppLocation, get_web_page
|
||||
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -67,7 +67,7 @@ class ThemeScreenshotThread(QtCore.QThread):
|
|||
filename = config.get(u'theme_%s' % theme, u'filename')
|
||||
screenshot = config.get(u'theme_%s' % theme, u'screenshot')
|
||||
urllib.urlretrieve(u'%s%s' % (self.parent().web, screenshot),
|
||||
os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp', screenshot))
|
||||
os.path.join(gettempdir(), u'openlp', screenshot))
|
||||
item = QtGui.QListWidgetItem(title, self.parent().themes_list_widget)
|
||||
item.setData(QtCore.Qt.UserRole, filename)
|
||||
item.setCheckState(QtCore.Qt.Unchecked)
|
||||
|
@ -93,7 +93,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
self.web_access = get_web_page(u'%s%s' % (self.web, u'download.cfg'))
|
||||
if self.web_access:
|
||||
files = self.web_access.read()
|
||||
self.config.readfp(io.BytesIO(files))
|
||||
self.config.read_string(files.decode())
|
||||
self.update_screen_list_combo()
|
||||
self.was_download_cancelled = False
|
||||
self.theme_screenshot_thread = None
|
||||
|
@ -115,7 +115,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
Set up display at start of theme edit.
|
||||
"""
|
||||
self.restart()
|
||||
check_directory_exists(os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp'))
|
||||
check_directory_exists(os.path.join(gettempdir(), u'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')
|
||||
|
@ -124,8 +124,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
songs = self.config.get(u'songs', u'languages')
|
||||
songs = songs.split(u',')
|
||||
for song in songs:
|
||||
title = unicode(self.config.get(u'songs_%s' % song, u'title'), u'utf8')
|
||||
filename = unicode(self.config.get(u'songs_%s' % song, u'filename'), u'utf8')
|
||||
title = self.config.get(u'songs_%s' % song, u'title')
|
||||
filename = self.config.get(u'songs_%s' % song, u'filename')
|
||||
item = QtGui.QListWidgetItem(title, self.songs_list_widget)
|
||||
item.setData(QtCore.Qt.UserRole, filename)
|
||||
item.setCheckState(QtCore.Qt.Unchecked)
|
||||
|
@ -133,13 +133,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
bible_languages = self.config.get(u'bibles', u'languages')
|
||||
bible_languages = bible_languages.split(u',')
|
||||
for lang in bible_languages:
|
||||
language = unicode(self.config.get(u'bibles_%s' % lang, u'title'), u'utf8')
|
||||
language = self.config.get(u'bibles_%s' % lang, u'title')
|
||||
langItem = QtGui.QTreeWidgetItem(self.bibles_tree_widget, [language])
|
||||
bibles = self.config.get(u'bibles_%s' % lang, u'translations')
|
||||
bibles = bibles.split(u',')
|
||||
for bible in bibles:
|
||||
title = unicode(self.config.get(u'bible_%s' % bible, u'title'), u'utf8')
|
||||
filename = unicode(self.config.get(u'bible_%s' % bible, u'filename'))
|
||||
title = self.config.get(u'bible_%s' % bible, u'title')
|
||||
filename = self.config.get(u'bible_%s' % bible, u'filename')
|
||||
item = QtGui.QTreeWidgetItem(langItem, [title])
|
||||
item.setData(0, QtCore.Qt.UserRole, filename)
|
||||
item.setCheckState(0, QtCore.Qt.Unchecked)
|
||||
|
@ -292,8 +292,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
item = self.themes_list_widget.item(index)
|
||||
if item.data(QtCore.Qt.UserRole) == filename:
|
||||
break
|
||||
item.setIcon(build_icon(os.path.join(unicode(gettempdir(),
|
||||
get_filesystem_encoding()), u'openlp', screenshot)))
|
||||
item.setIcon(build_icon(os.path.join(gettempdir(), u'openlp', screenshot)))
|
||||
|
||||
def _getFileSize(self, url):
|
||||
"""
|
||||
|
@ -302,9 +301,9 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
``url``
|
||||
The URL of the file we want to download.
|
||||
"""
|
||||
site = urllib.urlopen(url)
|
||||
site = urllib.request.urlopen(url)
|
||||
meta = site.info()
|
||||
return int(meta.getheaders("Content-Length")[0])
|
||||
return int(meta.get("Content-Length"))
|
||||
|
||||
def _download_progress(self, count, block_size):
|
||||
"""
|
||||
|
@ -426,8 +425,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
self._set_plugin_status(self.alert_check_box, u'alerts/status')
|
||||
if self.web_access:
|
||||
# Build directories for downloads
|
||||
songs_destination = os.path.join(
|
||||
unicode(gettempdir(), get_filesystem_encoding()), u'openlp')
|
||||
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')
|
||||
# Download songs
|
||||
|
|
|
@ -44,7 +44,7 @@ class FirstTimeLanguageForm(QtGui.QDialog, Ui_FirstTimeLanguageDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(FirstTimeLanguageForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.qmList = LanguageManager.get_qm_list()
|
||||
self.language_combo_box.addItem(u'Autodetect')
|
||||
|
|
|
@ -46,7 +46,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(FormattingTagForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.tag_table_widget.itemSelectionChanged.connect(self.on_row_selected)
|
||||
self.new_push_button.clicked.connect(self.on_new_clicked)
|
||||
|
|
|
@ -49,14 +49,14 @@ class GeneralTab(SettingsTab):
|
|||
self.screens = ScreenList()
|
||||
self.icon_path = u':/icon/openlp-logo-16x16.png'
|
||||
general_translated = translate('OpenLP.GeneralTab', 'General')
|
||||
SettingsTab.__init__(self, parent, u'Core', general_translated)
|
||||
super(GeneralTab, self).__init__(parent, u'Core', general_translated)
|
||||
|
||||
def setupUi(self):
|
||||
"""
|
||||
Create the user interface for the general settings tab
|
||||
"""
|
||||
self.setObjectName(u'GeneralTab')
|
||||
SettingsTab.setupUi(self)
|
||||
super(GeneralTab, self).setupUi()
|
||||
self.tab_layout.setStretch(1, 1)
|
||||
# Monitors
|
||||
self.monitor_group_box = QtGui.QGroupBox(self.left_column)
|
||||
|
|
|
@ -65,11 +65,11 @@ class Display(QtGui.QGraphicsView):
|
|||
Constructor
|
||||
"""
|
||||
if live:
|
||||
QtGui.QGraphicsView.__init__(self)
|
||||
super(Display, self).__init__()
|
||||
# Overwrite the parent() method.
|
||||
self.parent = lambda: parent
|
||||
else:
|
||||
QtGui.QGraphicsView.__init__(self, parent)
|
||||
super(Display, self).__init__(parent)
|
||||
self.is_live = live
|
||||
self.controller = controller
|
||||
self.screen = {}
|
||||
|
@ -126,7 +126,7 @@ class MainDisplay(Display):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
Display.__init__(self, parent, live, controller)
|
||||
super(MainDisplay, self).__init__(parent, live, controller)
|
||||
self.screens = ScreenList()
|
||||
self.rebuild_css = False
|
||||
self.hide_mode = None
|
||||
|
@ -536,7 +536,7 @@ class AudioPlayer(QtCore.QObject):
|
|||
The parent widget.
|
||||
"""
|
||||
log.debug(u'AudioPlayer Initialisation started')
|
||||
QtCore.QObject.__init__(self, parent)
|
||||
super(AudioPlayer, self).__init__(parent)
|
||||
self.currentIndex = -1
|
||||
self.playlist = []
|
||||
self.repeat = False
|
||||
|
|
|
@ -47,8 +47,7 @@ from openlp.core.lib.ui import UiStrings, create_action
|
|||
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, SlideController, PluginForm, \
|
||||
MediaDockManager, ShortcutListForm, FormattingTagForm
|
||||
from openlp.core.ui.media import MediaController
|
||||
from openlp.core.utils import AppLocation, LanguageManager, add_actions, get_application_version, \
|
||||
get_filesystem_encoding
|
||||
from openlp.core.utils import AppLocation, LanguageManager, add_actions, get_application_version
|
||||
from openlp.core.utils.actions import ActionList, CategoryOrder
|
||||
from openlp.core.ui.firsttimeform import FirstTimeForm
|
||||
|
||||
|
@ -476,7 +475,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
"""
|
||||
This constructor sets up the interface, the various managers, and the plugins.
|
||||
"""
|
||||
QtGui.QMainWindow.__init__(self)
|
||||
super(MainWindow, self).__init__()
|
||||
Registry().register(u'main_window', self)
|
||||
self.clipboard = self.application.clipboard()
|
||||
self.arguments = self.application.args
|
||||
|
@ -903,7 +902,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
# 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(unicode(gettempdir(), get_filesystem_encoding()), u'openlp', u'exportConf.tmp')
|
||||
temp_file = os.path.join(gettempdir(), u'openlp', u'exportConf.tmp')
|
||||
self.save_settings()
|
||||
setting_sections = []
|
||||
# Add main sections.
|
||||
|
|
|
@ -53,7 +53,7 @@ class MediaSlider(QtGui.QSlider):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QSlider.__init__(self, direction)
|
||||
super(MediaSlider, self).__init__(direction)
|
||||
self.manager = manager
|
||||
self.controller = controller
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ class PhononPlayer(MediaPlayer):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
MediaPlayer.__init__(self, parent, u'phonon')
|
||||
super(PhononPlayer, self).__init__(parent, u'phonon')
|
||||
self.original_name = u'Phonon'
|
||||
self.display_name = u'&Phonon'
|
||||
self.parent = parent
|
||||
|
|
|
@ -55,18 +55,18 @@ class PlayerTab(SettingsTab):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
self.media_players = self.media_controller.media_players
|
||||
self.media_players = Registry().get('media_controller').media_players
|
||||
self.saved_used_players = None
|
||||
self.icon_path = u':/media/multimedia-player.png'
|
||||
player_translated = translate('OpenLP.PlayerTab', 'Players')
|
||||
SettingsTab.__init__(self, parent, u'Players', player_translated)
|
||||
super(PlayerTab, self).__init__(parent, u'Players', player_translated)
|
||||
|
||||
def setupUi(self):
|
||||
"""
|
||||
Set up the UI
|
||||
"""
|
||||
self.setObjectName(u'MediaTab')
|
||||
SettingsTab.setupUi(self)
|
||||
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.form_layout = QtGui.QFormLayout(self.background_color_group_box)
|
||||
|
|
|
@ -58,10 +58,12 @@ except OSError, e:
|
|||
|
||||
if VLC_AVAILABLE:
|
||||
try:
|
||||
VERSION = vlc.libvlc_get_version()
|
||||
VERSION = vlc.libvlc_get_version().decode('UTF-8')
|
||||
except:
|
||||
VERSION = u'0.0.0'
|
||||
if LooseVersion(VERSION) < LooseVersion('1.1.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)
|
||||
|
||||
|
@ -96,15 +98,14 @@ VIDEO_EXT = [
|
|||
|
||||
class VlcPlayer(MediaPlayer):
|
||||
"""
|
||||
A specialised version of the MediaPlayer class, which provides a VLC
|
||||
display.
|
||||
A specialised version of the MediaPlayer class, which provides a VLC display.
|
||||
"""
|
||||
|
||||
def __init__(self, parent):
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
MediaPlayer.__init__(self, parent, u'vlc')
|
||||
super(VlcPlayer, self).__init__(parent, u'vlc')
|
||||
self.original_name = u'VLC'
|
||||
self.display_name = u'&VLC'
|
||||
self.parent = parent
|
||||
|
|
|
@ -213,7 +213,7 @@ class WebkitPlayer(MediaPlayer):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
MediaPlayer.__init__(self, parent, u'webkit')
|
||||
super(WebkitPlayer, self).__init__(parent, u'webkit')
|
||||
self.original_name = u'WebKit'
|
||||
self.display_name = u'&WebKit'
|
||||
self.parent = parent
|
||||
|
|
|
@ -48,7 +48,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(PluginForm, self).__init__(parent)
|
||||
self.activePlugin = None
|
||||
self.programaticChange = False
|
||||
self.setupUi(self)
|
||||
|
|
|
@ -118,7 +118,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, self.main_window)
|
||||
super(PrintServiceForm, self).__init__(Registry().get('main_window'))
|
||||
self.printer = QtGui.QPrinter()
|
||||
self.print_dialog = QtGui.QPrintDialog(self.printer, self)
|
||||
self.document = QtGui.QTextDocument()
|
||||
|
@ -183,7 +183,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
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')
|
||||
self.document.setHtml(html.tostring(html_data))
|
||||
self.document.setHtml(html.tostring(html_data).decode())
|
||||
self.preview_widget.updatePreview()
|
||||
|
||||
def _add_preview_item(self, body, item, index):
|
||||
|
|
|
@ -43,7 +43,7 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, self.main_window)
|
||||
super(ServiceItemEditForm, self).__init__(Registry().get(u'main_window'))
|
||||
self.setupUi(self)
|
||||
self.item_list = []
|
||||
self.list_widget.currentRowChanged.connect(self.on_current_row_changed)
|
||||
|
|
|
@ -60,7 +60,7 @@ class ServiceManagerList(QtGui.QTreeWidget):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QTreeWidget.__init__(self, parent)
|
||||
super(ServiceManagerList, self).__init__(parent)
|
||||
self.serviceManager = serviceManager
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
|
@ -294,7 +294,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
"""
|
||||
Sets up the service manager, toolbars, list view, et al.
|
||||
"""
|
||||
QtGui.QWidget.__init__(self, parent)
|
||||
super(ServiceManager, self).__init__(parent)
|
||||
self.active = build_icon(u':/media/auto-start_active.png')
|
||||
self.inactive = build_icon(u':/media/auto-start_inactive.png')
|
||||
Registry().register(u'service_manager', self)
|
||||
|
@ -521,11 +521,11 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
self.main_window.increment_progress_bar()
|
||||
try:
|
||||
zip_file = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED, allow_zip_64)
|
||||
# First we add service contents. We save ALL file_names into ZIP using UTF-8.
|
||||
zip_file.writestr(service_file_name.encode(u'utf-8'), service_content)
|
||||
# First we add service contents..
|
||||
zip_file.writestr(service_file_name, service_content)
|
||||
# Finally add all the listed media files.
|
||||
for write_from in write_list:
|
||||
zip_file.write(write_from, write_from.encode(u'utf-8'))
|
||||
zip_file.write(write_from, write_from)
|
||||
for audio_from, audio_to in audio_files:
|
||||
if audio_from.startswith(u'audio'):
|
||||
# When items are saved, they get new unique_identifier. Let's copy the file to the new location.
|
||||
|
@ -536,7 +536,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
check_directory_exists(save_path)
|
||||
if not os.path.exists(save_file):
|
||||
shutil.copy(audio_from, save_file)
|
||||
zip_file.write(audio_from, audio_to.encode(u'utf-8'))
|
||||
zip_file.write(audio_from, audio_to)
|
||||
except IOError:
|
||||
log.exception(u'Failed to save service to disk: %s', temp_file_name)
|
||||
self.main_window.error_message(translate(u'OpenLP.ServiceManager', u'Error Saving File'),
|
||||
|
@ -593,7 +593,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
zip_file = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED,
|
||||
True)
|
||||
# First we add service contents.
|
||||
zip_file.writestr(service_file_name.encode(u'utf-8'), service_content)
|
||||
zip_file.writestr(service_file_name, service_content)
|
||||
except IOError:
|
||||
log.exception(u'Failed to save service to disk: %s', temp_file_name)
|
||||
self.main_window.error_message(translate(u'OpenLP.ServiceManager', u'Error Saving File'),
|
||||
|
@ -685,14 +685,13 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
zip_file = zipfile.ZipFile(file_name)
|
||||
for zip_info in zip_file.infolist():
|
||||
try:
|
||||
ucsfile = zip_info.filename.decode(u'utf-8')
|
||||
ucs_file = zip_info.filename
|
||||
except UnicodeDecodeError:
|
||||
log.exception(u'file_name "%s" is not valid UTF-8' %
|
||||
zip_info.file_name.decode(u'utf-8', u'replace'))
|
||||
log.exception(u'file_name "%s" is not valid UTF-8' % zip_info.file_name)
|
||||
critical_error_message_box(message=translate('OpenLP.ServiceManager',
|
||||
'File is not a valid service.\n The content encoding is not UTF-8.'))
|
||||
continue
|
||||
osfile = ucsfile.replace(u'/', os.path.sep)
|
||||
osfile = ucs_file.replace(u'/', os.path.sep)
|
||||
if not osfile.startswith(u'audio'):
|
||||
osfile = os.path.split(osfile)[1]
|
||||
log.debug(u'Extract file: %s', osfile)
|
||||
|
|
|
@ -43,7 +43,7 @@ class ServiceNoteForm(QtGui.QDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, self.main_window)
|
||||
super(ServiceNoteForm, self).__init__(Registry().get(u'main_window'))
|
||||
self.setupUi()
|
||||
self.retranslateUi()
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
|||
"""
|
||||
Registry().register(u'settings_form', self)
|
||||
Registry().register_function(u'bootstrap_post_set_up', self.post_set_up)
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(SettingsForm, self).__init__(parent)
|
||||
self.processes = []
|
||||
self.setupUi(self)
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class CaptureShortcutButton(QtGui.QPushButton):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QPushButton.__init__(self, *args)
|
||||
super(CaptureShortcutButton, self).__init__(*args)
|
||||
self.setCheckable(True)
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
|
|
|
@ -52,7 +52,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(ShortcutListForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.changedActions = {}
|
||||
self.action_list = ActionList.get_instance()
|
||||
|
|
|
@ -65,7 +65,7 @@ class DisplayController(QtGui.QWidget):
|
|||
"""
|
||||
Set up the general Controller.
|
||||
"""
|
||||
QtGui.QWidget.__init__(self, parent)
|
||||
super(DisplayController, self).__init__(parent)
|
||||
self.is_live = is_live
|
||||
self.display = None
|
||||
self.controller_type = DisplayControllerType.Plugin
|
||||
|
@ -90,7 +90,7 @@ class SlideController(DisplayController):
|
|||
"""
|
||||
Set up the Slide Controller.
|
||||
"""
|
||||
DisplayController.__init__(self, parent, is_live)
|
||||
super(SlideController, self).__init__(parent, is_live)
|
||||
Registry().register_function(u'bootstrap_post_set_up', self.screen_size_changed)
|
||||
self.screens = ScreenList()
|
||||
try:
|
||||
|
|
|
@ -41,7 +41,7 @@ class SplashScreen(QtGui.QSplashScreen):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QSplashScreen.__init__(self)
|
||||
super(SplashScreen, self).__init__()
|
||||
self.setupUi()
|
||||
|
||||
def setupUi(self):
|
||||
|
|
|
@ -45,7 +45,7 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, self.main_window)
|
||||
super(StartTimeForm, self).__init__(Registry().get(u'main_window'))
|
||||
self.setupUi(self)
|
||||
|
||||
def exec_(self):
|
||||
|
|
|
@ -58,7 +58,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
``parent``
|
||||
The QWidget-derived parent of the wizard.
|
||||
"""
|
||||
QtGui.QWizard.__init__(self, parent)
|
||||
super(ThemeForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.registerFields()
|
||||
self.updateThemeAllowed = True
|
||||
|
|
|
@ -42,7 +42,7 @@ class ThemeLayoutForm(QtGui.QDialog, Ui_ThemeLayoutDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(ThemeLayoutForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
def exec_(self, image):
|
||||
|
|
|
@ -57,7 +57,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QWidget.__init__(self, parent)
|
||||
super(ThemeManager, self).__init__(parent)
|
||||
Registry().register(u'theme_manager', self)
|
||||
Registry().register_function(u'bootstrap_initialise', self.load_first_time_themes)
|
||||
Registry().register_function(u'bootstrap_post_set_up', self._push_themes)
|
||||
|
@ -514,23 +514,17 @@ class ThemeManager(QtGui.QWidget):
|
|||
else:
|
||||
abort_import = False
|
||||
for name in theme_zip.namelist():
|
||||
try:
|
||||
uname = unicode(name, u'utf-8')
|
||||
except UnicodeDecodeError:
|
||||
log.exception(u'Theme file contains non utf-8 filename "%s"' %
|
||||
name.decode(u'utf-8', u'replace'))
|
||||
raise Exception(u'validation')
|
||||
uname = uname.replace(u'/', os.path.sep)
|
||||
split_name = uname.split(os.path.sep)
|
||||
name = name.replace(u'/', os.path.sep)
|
||||
split_name = name.split(os.path.sep)
|
||||
if split_name[-1] == u'' or len(split_name) == 1:
|
||||
# is directory or preview file
|
||||
continue
|
||||
full_name = os.path.join(directory, uname)
|
||||
full_name = os.path.join(directory, name)
|
||||
check_directory_exists(os.path.dirname(full_name))
|
||||
if os.path.splitext(uname)[1].lower() == u'.xml':
|
||||
if os.path.splitext(name)[1].lower() == u'.xml':
|
||||
file_xml = unicode(theme_zip.read(name), u'utf-8')
|
||||
out_file = open(full_name, u'w')
|
||||
out_file.write(file_xml.encode(u'utf-8'))
|
||||
out_file.write(file_xml)
|
||||
else:
|
||||
out_file = open(full_name, u'wb')
|
||||
out_file.write(theme_zip.read(name))
|
||||
|
@ -637,7 +631,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
out_file = None
|
||||
try:
|
||||
out_file = open(theme_file, u'w')
|
||||
out_file.write(theme_pretty_xml)
|
||||
out_file.write(theme_pretty_xml.decode('UTF-8'))
|
||||
except IOError:
|
||||
log.exception(u'Saving theme to file failed')
|
||||
finally:
|
||||
|
|
|
@ -48,14 +48,14 @@ class ThemesTab(SettingsTab):
|
|||
"""
|
||||
self.icon_path = u':/themes/theme_new.png'
|
||||
theme_translated = translate('OpenLP.ThemesTab', 'Themes')
|
||||
SettingsTab.__init__(self, parent, u'Themes', theme_translated)
|
||||
super(ThemesTab, self).__init__(parent, u'Themes', theme_translated)
|
||||
|
||||
def setupUi(self):
|
||||
"""
|
||||
Set up the UI
|
||||
"""
|
||||
self.setObjectName(u'ThemesTab')
|
||||
SettingsTab.setupUi(self)
|
||||
super(ThemesTab, self).setupUi()
|
||||
self.global_group_box = QtGui.QGroupBox(self.left_column)
|
||||
self.global_group_box.setObjectName(u'global_group_box')
|
||||
self.global_group_box_layout = QtGui.QVBoxLayout(self.global_group_box)
|
||||
|
|
|
@ -96,7 +96,7 @@ class OpenLPWizard(QtGui.QWizard):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QWizard.__init__(self, parent)
|
||||
super(OpenLPWizard, self).__init__(parent)
|
||||
self.plugin = plugin
|
||||
self.with_progress_page = add_progress_page
|
||||
self.setObjectName(name)
|
||||
|
|
|
@ -38,7 +38,6 @@ import re
|
|||
from subprocess import Popen, PIPE
|
||||
import sys
|
||||
import urllib2
|
||||
import icu
|
||||
|
||||
from PyQt4 import QtGui, QtCore
|
||||
|
||||
|
@ -107,6 +106,7 @@ def get_application_version():
|
|||
# Get the revision of this tree.
|
||||
bzr = Popen((u'bzr', u'revno'), stdout=PIPE)
|
||||
tree_revision, error = bzr.communicate()
|
||||
tree_revision = tree_revision.decode()
|
||||
code = bzr.wait()
|
||||
if code != 0:
|
||||
raise Exception(u'Error running bzr log')
|
||||
|
@ -117,7 +117,7 @@ def get_application_version():
|
|||
code = bzr.wait()
|
||||
if code != 0:
|
||||
raise Exception(u'Error running bzr tags')
|
||||
tags = output.splitlines()
|
||||
tags = map(bytes.decode, output.splitlines())
|
||||
if not tags:
|
||||
tag_version = u'0.0.0'
|
||||
tag_revision = u'0'
|
||||
|
@ -196,7 +196,7 @@ def check_latest_version(current_version):
|
|||
req.add_header(u'User-Agent', u'OpenLP/%s' % current_version[u'full'])
|
||||
remote_version = None
|
||||
try:
|
||||
remote_version = unicode(urllib2.urlopen(req, None).read()).strip()
|
||||
remote_version = unicode(urllib2.urlopen(req, None).read().decode()).strip()
|
||||
except IOError:
|
||||
log.exception(u'Failed to download the latest OpenLP version file')
|
||||
if remote_version:
|
||||
|
@ -239,7 +239,7 @@ def get_images_filter():
|
|||
global IMAGES_FILTER
|
||||
if not IMAGES_FILTER:
|
||||
log.debug(u'Generating images filter.')
|
||||
formats = map(unicode, QtGui.QImageReader.supportedImageFormats())
|
||||
formats = list(map(bytes.decode, map(bytes, QtGui.QImageReader.supportedImageFormats())))
|
||||
visible_formats = u'(*.%s)' % u'; *.'.join(formats)
|
||||
actual_formats = u'(*.%s)' % u' *.'.join(formats)
|
||||
IMAGES_FILTER = u'%s %s %s' % (translate('OpenLP', 'Image Files'), visible_formats, actual_formats)
|
||||
|
@ -393,16 +393,22 @@ def format_time(text, local_time):
|
|||
def get_locale_key(string):
|
||||
"""
|
||||
Creates a key for case insensitive, locale aware string sorting.
|
||||
|
||||
``string``
|
||||
The corresponding string.
|
||||
"""
|
||||
string = string.lower()
|
||||
# For Python 3 on platforms other than Windows ICU is not necessary. In those cases locale.strxfrm(str) can be used.
|
||||
global ICU_COLLATOR
|
||||
if ICU_COLLATOR is None:
|
||||
from languagemanager import LanguageManager
|
||||
locale = LanguageManager.get_language()
|
||||
icu_locale = icu.Locale(locale)
|
||||
ICU_COLLATOR = icu.Collator.createInstance(icu_locale)
|
||||
return ICU_COLLATOR.getSortKey(string)
|
||||
if os.name == 'nt':
|
||||
global ICU_COLLATOR
|
||||
if ICU_COLLATOR is None:
|
||||
import icu
|
||||
from languagemanager import LanguageManager
|
||||
language = LanguageManager.get_language()
|
||||
icu_locale = icu.Locale(language)
|
||||
ICU_COLLATOR = icu.Collator.createInstance(icu_locale)
|
||||
return ICU_COLLATOR.getSortKey(string)
|
||||
return locale.strxfrm(string).encode()
|
||||
|
||||
|
||||
def get_natural_key(string):
|
||||
|
@ -412,9 +418,10 @@ def get_natural_key(string):
|
|||
"""
|
||||
key = DIGITS_OR_NONDIGITS.findall(string)
|
||||
key = [int(part) if part.isdigit() else get_locale_key(part) for part in key]
|
||||
# Python 3 does not support comparision of different types anymore. So make sure, that we do not compare str and int.
|
||||
#if string[0].isdigit():
|
||||
# return [''] + key
|
||||
# Python 3 does not support comparision of different types anymore. So make sure, that we do not compare str
|
||||
# and int.
|
||||
if string[0].isdigit():
|
||||
return [b''] + key
|
||||
return key
|
||||
|
||||
|
||||
|
|
|
@ -103,12 +103,6 @@ class CategoryActionList(object):
|
|||
self.index += 1
|
||||
return self.actions[self.index - 1][1]
|
||||
|
||||
def next(self):
|
||||
"""
|
||||
Python 2 "next" method.
|
||||
"""
|
||||
return self.__next__()
|
||||
|
||||
def has_key(self, key):
|
||||
"""
|
||||
Implement the has_key() method to make this class a dictionary type
|
||||
|
@ -167,12 +161,6 @@ class CategoryList(object):
|
|||
return category
|
||||
raise KeyError(u'Category "%s" does not exist.' % key)
|
||||
|
||||
def __contains__(self, item):
|
||||
"""
|
||||
Implement the __contains__() method to make this class like a dictionary
|
||||
"""
|
||||
return self.has_key(item)
|
||||
|
||||
def __len__(self):
|
||||
"""
|
||||
Implement the __len__() method to make this class like a dictionary
|
||||
|
@ -196,12 +184,6 @@ class CategoryList(object):
|
|||
self.index += 1
|
||||
return self.categories[self.index - 1]
|
||||
|
||||
def next(self):
|
||||
"""
|
||||
Python 2 "next" method for iterator.
|
||||
"""
|
||||
return self.__next__()
|
||||
|
||||
def has_key(self, key):
|
||||
"""
|
||||
Implement the has_key() method to make this class like a dictionary
|
||||
|
|
|
@ -143,20 +143,19 @@ def _get_os_dir_path(dir_type):
|
|||
"""
|
||||
Return a path based on which OS and environment we are running in.
|
||||
"""
|
||||
encoding = sys.getfilesystemencoding()
|
||||
if sys.platform == u'win32':
|
||||
if dir_type == AppLocation.DataDir:
|
||||
return os.path.join(unicode(os.getenv(u'APPDATA'), encoding), u'openlp', u'data')
|
||||
return os.path.join(unicode(os.getenv(u'APPDATA')), u'openlp', u'data')
|
||||
elif dir_type == AppLocation.LanguageDir:
|
||||
return os.path.split(openlp.__file__)[0]
|
||||
return os.path.join(unicode(os.getenv(u'APPDATA'), encoding), u'openlp')
|
||||
return os.path.join(unicode(os.getenv(u'APPDATA')), u'openlp')
|
||||
elif sys.platform == u'darwin':
|
||||
if dir_type == AppLocation.DataDir:
|
||||
return os.path.join(unicode(os.getenv(u'HOME'), encoding),
|
||||
return os.path.join(unicode(os.getenv(u'HOME')),
|
||||
u'Library', u'Application Support', u'openlp', u'Data')
|
||||
elif dir_type == AppLocation.LanguageDir:
|
||||
return os.path.split(openlp.__file__)[0]
|
||||
return os.path.join(unicode(os.getenv(u'HOME'), encoding), u'Library', u'Application Support', u'openlp')
|
||||
return os.path.join(unicode(os.getenv(u'HOME')), u'Library', u'Application Support', u'openlp')
|
||||
else:
|
||||
if dir_type == AppLocation.LanguageDir:
|
||||
for prefix in [u'/usr/local', u'/usr']:
|
||||
|
@ -166,10 +165,10 @@ def _get_os_dir_path(dir_type):
|
|||
return os.path.join(u'/usr', u'share', u'openlp')
|
||||
if XDG_BASE_AVAILABLE:
|
||||
if dir_type == AppLocation.DataDir:
|
||||
return os.path.join(unicode(BaseDirectory.xdg_data_home, encoding), u'openlp')
|
||||
return os.path.join(unicode(BaseDirectory.xdg_data_home), u'openlp')
|
||||
elif dir_type == AppLocation.CacheDir:
|
||||
return os.path.join(unicode(BaseDirectory.xdg_cache_home, encoding), u'openlp')
|
||||
return os.path.join(unicode(BaseDirectory.xdg_cache_home), u'openlp')
|
||||
if dir_type == AppLocation.DataDir:
|
||||
return os.path.join(unicode(os.getenv(u'HOME'), encoding), u'.openlp', u'data')
|
||||
return os.path.join(unicode(os.getenv(u'HOME'), encoding), u'.openlp')
|
||||
return os.path.join(unicode(os.getenv(u'HOME')), u'.openlp', u'data')
|
||||
return os.path.join(unicode(os.getenv(u'HOME')), u'.openlp')
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ class AlertsPlugin(Plugin):
|
|||
log.info(u'Alerts Plugin loaded')
|
||||
|
||||
def __init__(self):
|
||||
Plugin.__init__(self, u'alerts', __default_settings__, settings_tab_class=AlertsTab)
|
||||
super(AlertsPlugin, self).__init__(u'alerts', __default_settings__, settings_tab_class=AlertsTab)
|
||||
self.weight = -3
|
||||
self.icon_path = u':/plugins/plugin_alerts.png'
|
||||
self.icon = build_icon(self.icon_path)
|
||||
|
@ -153,7 +153,7 @@ class AlertsPlugin(Plugin):
|
|||
|
||||
def initialise(self):
|
||||
log.info(u'Alerts Initialising')
|
||||
Plugin.initialise(self)
|
||||
super(AlertsPlugin, self).initialise()
|
||||
self.tools_alert_item.setVisible(True)
|
||||
action_list = ActionList.get_instance()
|
||||
action_list.add_action(self.tools_alert_item, UiStrings().Tools)
|
||||
|
@ -164,7 +164,7 @@ class AlertsPlugin(Plugin):
|
|||
"""
|
||||
log.info(u'Alerts Finalising')
|
||||
self.manager.finalise()
|
||||
Plugin.finalise(self)
|
||||
super(AlertsPlugin, self).finalise()
|
||||
self.tools_alert_item.setVisible(False)
|
||||
action_list = ActionList.get_instance()
|
||||
action_list.remove_action(self.tools_alert_item, u'Tools')
|
||||
|
|
|
@ -41,7 +41,7 @@ above, like so::
|
|||
class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(AuthorsForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
This allows OpenLP to use ``self.object`` for all the GUI elements while keeping them separate from the functionality,
|
||||
|
|
|
@ -46,6 +46,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||
self.manager = plugin.manager
|
||||
self.plugin = plugin
|
||||
self.item_id = None
|
||||
# TODO: Use Registry()
|
||||
super(AlertForm, self).__init__(self.plugin.main_window)
|
||||
self.setupUi(self)
|
||||
self.display_button.clicked.connect(self.on_display_clicked)
|
||||
|
|
|
@ -48,7 +48,7 @@ class AlertsManager(QtCore.QObject):
|
|||
log.info(u'Alert Manager loaded')
|
||||
|
||||
def __init__(self, parent):
|
||||
QtCore.QObject.__init__(self, parent)
|
||||
super(AlertsManager, self).__init__(parent)
|
||||
Registry().register(u'alerts_manager', self)
|
||||
self.timer_id = 0
|
||||
self.alert_list = []
|
||||
|
|
|
@ -38,11 +38,11 @@ class AlertsTab(SettingsTab):
|
|||
AlertsTab is the alerts settings tab in the settings dialog.
|
||||
"""
|
||||
def __init__(self, parent, name, visible_title, icon_path):
|
||||
SettingsTab.__init__(self, parent, name, visible_title, icon_path)
|
||||
super(AlertsTab, self).__init__(parent, name, visible_title, icon_path)
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'AlertsTab')
|
||||
SettingsTab.setupUi(self)
|
||||
super(AlertsTab, self).setupUi()
|
||||
self.font_group_box = QtGui.QGroupBox(self.left_column)
|
||||
self.font_group_box.setObjectName(u'font_group_box')
|
||||
self.font_layout = QtGui.QFormLayout(self.font_group_box)
|
||||
|
|
|
@ -69,7 +69,7 @@ class BiblePlugin(Plugin):
|
|||
log.info(u'Bible Plugin loaded')
|
||||
|
||||
def __init__(self):
|
||||
Plugin.__init__(self, u'bibles', __default_settings__, BibleMediaItem, BiblesTab)
|
||||
super(BiblePlugin, self).__init__(u'bibles', __default_settings__, BibleMediaItem, BiblesTab)
|
||||
self.weight = -9
|
||||
self.icon_path = u':/plugins/plugin_bibles.png'
|
||||
self.icon = build_icon(self.icon_path)
|
||||
|
|
|
@ -42,7 +42,7 @@ above, like so::
|
|||
class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
|
||||
def __init__(self, parent, manager, bible_plugin):
|
||||
QtGui.QWizard.__init__(self, parent)
|
||||
super(BibleImportForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
This allows OpenLP to use ``self.object`` for all the GUI elements while keeping them separate from the functionality,
|
||||
|
|
|
@ -78,13 +78,14 @@ class BibleImportForm(OpenLPWizard):
|
|||
"""
|
||||
self.manager = manager
|
||||
self.web_bible_list = {}
|
||||
OpenLPWizard.__init__(self, parent, bible_plugin, u'bibleImportWizard', u':/wizards/wizard_importbible.bmp')
|
||||
super(BibleImportForm, self).__init__(
|
||||
parent, bible_plugin, u'bibleImportWizard', u':/wizards/wizard_importbible.bmp')
|
||||
|
||||
def setupUi(self, image):
|
||||
"""
|
||||
Set up the UI for the bible wizard.
|
||||
"""
|
||||
OpenLPWizard.setupUi(self, image)
|
||||
super(BibleImportForm, self).setupUi(image)
|
||||
self.formatComboBox.currentIndexChanged.connect(self.onCurrentIndexChanged)
|
||||
|
||||
def onCurrentIndexChanged(self, index):
|
||||
|
@ -515,7 +516,7 @@ class BibleImportForm(OpenLPWizard):
|
|||
"""
|
||||
Prepare the UI for the import.
|
||||
"""
|
||||
OpenLPWizard.pre_wizard(self)
|
||||
super(BibleImportForm, self).pre_wizard()
|
||||
bible_type = self.field(u'source_format')
|
||||
if bible_type == BibleFormat.WebDownload:
|
||||
self.progress_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Registering Bible...'))
|
||||
|
|
|
@ -39,7 +39,7 @@ from PyQt4 import QtCore, QtGui
|
|||
from openlp.core.lib import Registry, Settings, UiStrings, translate, check_directory_exists
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||
from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding
|
||||
from openlp.core.utils import AppLocation, delete_file
|
||||
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, BiblesResourcesDB
|
||||
from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract
|
||||
|
||||
|
@ -71,17 +71,18 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
self.suffix = u'.sqlite'
|
||||
self.settings_section = u'bibles'
|
||||
self.path = AppLocation.get_section_data_path(self.settings_section)
|
||||
self.temp_dir = os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp')
|
||||
self.temp_dir = os.path.join(gettempdir(), u'openlp')
|
||||
self.files = self.manager.old_bible_databases
|
||||
self.success = {}
|
||||
self.new_bibles = {}
|
||||
OpenLPWizard.__init__(self, parent, bible_plugin, u'bibleUpgradeWizard', u':/wizards/wizard_importbible.bmp')
|
||||
super(BibleUpgradeForm, self).__init__(
|
||||
parent, bible_plugin, u'bibleUpgradeWizard', u':/wizards/wizard_importbible.bmp')
|
||||
|
||||
def setupUi(self, image):
|
||||
"""
|
||||
Set up the UI for the bible wizard.
|
||||
"""
|
||||
OpenLPWizard.setupUi(self, image)
|
||||
super(BibleUpgradeForm, self).setupUi(image)
|
||||
Registry().execute(u'openlp_stop_wizard', self.stop_import)
|
||||
|
||||
def stop_import(self):
|
||||
|
@ -333,7 +334,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
"""
|
||||
Prepare the UI for the upgrade.
|
||||
"""
|
||||
OpenLPWizard.pre_wizard(self)
|
||||
super(BibleUpgradeForm, self).pre_wizard()
|
||||
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Starting upgrade...'))
|
||||
self.application.process_events()
|
||||
|
||||
|
@ -559,4 +560,4 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrade failed.'))
|
||||
# Remove temp directory.
|
||||
shutil.rmtree(self.temp_dir, True)
|
||||
OpenLPWizard.post_wizard(self)
|
||||
super(BibleUpgradeForm, self).post_wizard()
|
||||
|
|
|
@ -56,7 +56,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QDialog.__init__(self, parent)
|
||||
super(BookNameForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.custom_signals()
|
||||
self.book_names = BibleStrings().BookNames
|
||||
|
|
|
@ -51,7 +51,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(EditBibleForm, self).__init__(parent)
|
||||
self.media_item = media_item
|
||||
self.book_names = BibleStrings().BookNames
|
||||
self.setupUi(self)
|
||||
|
|
|
@ -54,7 +54,7 @@ class LanguageForm(QDialog, Ui_LanguageDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QDialog.__init__(self, parent)
|
||||
super(LanguageForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
def exec_(self, bible_name):
|
||||
|
|
|
@ -49,11 +49,11 @@ class BiblesTab(SettingsTab):
|
|||
self.paragraph_style = True
|
||||
self.show_new_chapters = False
|
||||
self.display_style = 0
|
||||
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
|
||||
super(BiblesTab, self).__init__(parent, title, visible_title, icon_path)
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'BiblesTab')
|
||||
SettingsTab.setupUi(self)
|
||||
super(BiblesTab, self).setupUi()
|
||||
self.verse_display_group_box = QtGui.QGroupBox(self.left_column)
|
||||
self.verse_display_group_box.setObjectName(u'verse_display_group_box')
|
||||
self.verse_display_layout = QtGui.QFormLayout(self.verse_display_group_box)
|
||||
|
|
|
@ -61,7 +61,7 @@ class CustomPlugin(Plugin):
|
|||
log.info(u'Custom Plugin loaded')
|
||||
|
||||
def __init__(self):
|
||||
Plugin.__init__(self, u'custom', __default_settings__, CustomMediaItem, CustomTab)
|
||||
super(CustomPlugin, self).__init__(u'custom', __default_settings__, CustomMediaItem, CustomTab)
|
||||
self.weight = -5
|
||||
self.manager = Manager(u'custom', init_schema)
|
||||
self.icon_path = u':/plugins/plugin_custom.png'
|
||||
|
|
|
@ -41,11 +41,11 @@ class CustomTab(SettingsTab):
|
|||
CustomTab is the Custom settings tab in the settings dialog.
|
||||
"""
|
||||
def __init__(self, parent, title, visible_title, icon_path):
|
||||
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
|
||||
super(CustomTab, self).__init__(parent, title, visible_title, icon_path)
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'CustomTab')
|
||||
SettingsTab.setupUi(self)
|
||||
super(CustomTab, self).setupUi()
|
||||
self.custom_mode_group_box = QtGui.QGroupBox(self.left_column)
|
||||
self.custom_mode_group_box.setObjectName(u'custom_mode_group_box')
|
||||
self.custom_mode_layout = QtGui.QFormLayout(self.custom_mode_group_box)
|
||||
|
@ -97,4 +97,4 @@ class CustomTab(SettingsTab):
|
|||
settings.endGroup()
|
||||
if self.tab_visited:
|
||||
self.settings_form.register_post_process(u'custom_config_updated')
|
||||
self.tab_visited = False
|
||||
self.tab_visited = False
|
||||
|
|
|
@ -57,7 +57,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||
|
||||
def __init__(self, parent, plugin):
|
||||
self.icon_path = u'custom/custom'
|
||||
MediaManagerItem.__init__(self, parent, plugin)
|
||||
super(CustomMediaItem, self).__init__(parent, plugin)
|
||||
self.edit_custom_form = EditCustomForm(self, self.main_window, self.plugin.manager)
|
||||
self.single_service_item = False
|
||||
self.quick_preview_allowed = True
|
||||
|
|
|
@ -41,7 +41,7 @@ above, like so::
|
|||
class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(AuthorsForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
This allows OpenLP to use ``self.object`` for all the GUI elements while keeping them separate from the functionality,
|
||||
|
|
|
@ -42,7 +42,7 @@ class AddGroupForm(QtGui.QDialog, Ui_AddGroupDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(AddGroupForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
def exec_(self, clear=True, show_top_level_group=False, selected_group=None):
|
||||
|
|
|
@ -40,7 +40,7 @@ class ChooseGroupForm(QtGui.QDialog, Ui_ChooseGroupDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(ChooseGroupForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
def exec_(self, selected_group=None):
|
||||
|
|
|
@ -48,7 +48,7 @@ class ImagePlugin(Plugin):
|
|||
log.info(u'Image Plugin loaded')
|
||||
|
||||
def __init__(self):
|
||||
Plugin.__init__(self, u'images', __default_settings__, ImageMediaItem, ImageTab)
|
||||
super(ImagePlugin, self).__init__(u'images', __default_settings__, ImageMediaItem, ImageTab)
|
||||
self.manager = Manager(u'images', init_schema)
|
||||
self.weight = -7
|
||||
self.icon_path = u':/plugins/plugin_images.png'
|
||||
|
|
|
@ -37,11 +37,11 @@ class ImageTab(SettingsTab):
|
|||
ImageTab is the images settings tab in the settings dialog.
|
||||
"""
|
||||
def __init__(self, parent, name, visible_title, icon_path):
|
||||
SettingsTab.__init__(self, parent, name, visible_title, icon_path)
|
||||
super(ImageTab, self).__init__(parent, name, visible_title, icon_path)
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'ImagesTab')
|
||||
SettingsTab.setupUi(self)
|
||||
super(ImageTab, self).setupUi()
|
||||
self.background_color_group_box = QtGui.QGroupBox(self.left_column)
|
||||
self.background_color_group_box.setObjectName(u'background_color_group_box')
|
||||
self.form_layout = QtGui.QFormLayout(self.background_color_group_box)
|
||||
|
|
|
@ -52,7 +52,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||
|
||||
def __init__(self, parent, plugin):
|
||||
self.icon_path = u'images/image'
|
||||
MediaManagerItem.__init__(self, parent, plugin)
|
||||
super(ImageMediaItem, self).__init__(parent, plugin)
|
||||
self.quick_preview_allowed = True
|
||||
self.has_search = True
|
||||
self.manager = plugin.manager
|
||||
|
|
|
@ -60,7 +60,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||
self.icon_path = u'images/image'
|
||||
self.background = False
|
||||
self.automatic = u''
|
||||
MediaManagerItem.__init__(self, parent, plugin)
|
||||
super(MediaMediaItem, self).__init__(parent, plugin)
|
||||
self.single_service_item = False
|
||||
self.has_search = True
|
||||
self.media_object = None
|
||||
|
|
|
@ -46,11 +46,11 @@ class MediaTab(SettingsTab):
|
|||
"""
|
||||
def __init__(self, parent, title, visible_title, icon_path):
|
||||
self.parent = parent
|
||||
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
|
||||
super(MediaTab, self).__init__(parent, title, visible_title, icon_path)
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'MediaTab')
|
||||
SettingsTab.setupUi(self)
|
||||
super(MediaTab, self).setupUi()
|
||||
self.advanced_group_box = QtGui.QGroupBox(self.left_column)
|
||||
self.advanced_group_box.setObjectName(u'advanced_group_box')
|
||||
self.advanced_layout = QtGui.QVBoxLayout(self.advanced_group_box)
|
||||
|
|
|
@ -49,7 +49,7 @@ class MediaPlugin(Plugin):
|
|||
log.info(u'%s MediaPlugin loaded', __name__)
|
||||
|
||||
def __init__(self):
|
||||
Plugin.__init__(self, u'media', __default_settings__, MediaMediaItem)
|
||||
super(MediaPlugin, self).__init__(u'media', __default_settings__, MediaMediaItem)
|
||||
self.weight = -6
|
||||
self.icon_path = u':/plugins/plugin_media.png'
|
||||
self.icon = build_icon(self.icon_path)
|
||||
|
|
|
@ -78,7 +78,7 @@ class ImpressController(PresentationController):
|
|||
Initialise the class
|
||||
"""
|
||||
log.debug(u'Initialising')
|
||||
PresentationController.__init__(self, plugin, u'Impress', ImpressDocument)
|
||||
super(ImpressController, self).__init__(plugin, u'Impress', ImpressDocument)
|
||||
self.supports = [u'odp']
|
||||
self.also_supports = [u'ppt', u'pps', u'pptx', u'ppsx']
|
||||
self.process = None
|
||||
|
@ -208,7 +208,7 @@ class ImpressDocument(PresentationDocument):
|
|||
Constructor, store information about the file and initialise.
|
||||
"""
|
||||
log.debug(u'Init Presentation OpenOffice')
|
||||
PresentationDocument.__init__(self, controller, presentation)
|
||||
super(ImpressDocument, self).__init__(controller, presentation)
|
||||
self.document = None
|
||||
self.presentation = None
|
||||
self.control = None
|
||||
|
|
|
@ -58,7 +58,7 @@ class PowerpointController(PresentationController):
|
|||
Initialise the class
|
||||
"""
|
||||
log.debug(u'Initialising')
|
||||
PresentationController.__init__(self, plugin, u'Powerpoint', PowerpointDocument)
|
||||
super(PowerpointController, self).__init__(plugin, u'Powerpoint', PowerpointDocument)
|
||||
self.supports = [u'ppt', u'pps', u'pptx', u'ppsx']
|
||||
self.process = None
|
||||
|
||||
|
@ -114,7 +114,7 @@ class PowerpointDocument(PresentationDocument):
|
|||
Constructor, store information about the file and initialise.
|
||||
"""
|
||||
log.debug(u'Init Presentation Powerpoint')
|
||||
PresentationDocument.__init__(self, controller, presentation)
|
||||
super(PowerpointDocument, self).__init__(controller, presentation)
|
||||
self.presentation = None
|
||||
|
||||
def load_presentation(self):
|
||||
|
|
|
@ -54,7 +54,7 @@ class PptviewController(PresentationController):
|
|||
"""
|
||||
log.debug(u'Initialising')
|
||||
self.process = None
|
||||
PresentationController.__init__(self, plugin, u'Powerpoint Viewer', PptviewDocument)
|
||||
super(PptviewController, self).__init__(plugin, u'Powerpoint Viewer', PptviewDocument)
|
||||
self.supports = [u'ppt', u'pps', u'pptx', u'ppsx']
|
||||
|
||||
def check_available(self):
|
||||
|
@ -109,7 +109,7 @@ class PptviewDocument(PresentationDocument):
|
|||
Constructor, store information about the file and initialise.
|
||||
"""
|
||||
log.debug(u'Init Presentation PowerPoint')
|
||||
PresentationDocument.__init__(self, controller, presentation)
|
||||
super(PptviewDocument, self).__init__(controller, presentation)
|
||||
self.presentation = None
|
||||
self.ppt_id = None
|
||||
self.blanked = False
|
||||
|
|
|
@ -37,7 +37,7 @@ class PPTViewer(QtGui.QWidget):
|
|||
Standalone Test Harness for the pptviewlib library
|
||||
"""
|
||||
def __init__(self, parent=None):
|
||||
QtGui.QWidget.__init__(self, parent)
|
||||
super(PPTViewer, self).__init__(parent)
|
||||
self.pptid = -1
|
||||
self.setWindowTitle(u'PowerPoint Viewer Test')
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class PresentationTab(SettingsTab):
|
|||
"""
|
||||
self.parent = parent
|
||||
self.controllers = controllers
|
||||
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
|
||||
super(PresentationTab, self).__init__(parent, title, visible_title, icon_path)
|
||||
self.activated = False
|
||||
|
||||
def setupUi(self):
|
||||
|
@ -50,7 +50,7 @@ class PresentationTab(SettingsTab):
|
|||
Create the controls for the settings tab
|
||||
"""
|
||||
self.setObjectName(u'PresentationTab')
|
||||
SettingsTab.setupUi(self)
|
||||
super(PresentationTab, self).setupUi()
|
||||
self.controllers_group_box = QtGui.QGroupBox(self.left_column)
|
||||
self.controllers_group_box.setObjectName(u'controllers_group_box')
|
||||
self.controllers_layout = QtGui.QVBoxLayout(self.controllers_group_box)
|
||||
|
|
|
@ -82,7 +82,7 @@ class PresentationPlugin(Plugin):
|
|||
Initialise the plugin. Determine which controllers are enabled are start their processes.
|
||||
"""
|
||||
log.info(u'Presentations Initialising')
|
||||
Plugin.initialise(self)
|
||||
super(PresentationPlugin, self).initialise()
|
||||
for controller in self.controllers:
|
||||
if self.controllers[controller].enabled():
|
||||
try:
|
||||
|
@ -103,7 +103,7 @@ class PresentationPlugin(Plugin):
|
|||
controller = self.controllers[key]
|
||||
if controller.enabled():
|
||||
controller.kill()
|
||||
Plugin.finalise(self)
|
||||
super(PresentationPlugin, self).finalise()
|
||||
|
||||
def create_media_manager_item(self):
|
||||
"""
|
||||
|
|
|
@ -127,7 +127,7 @@ from PyQt4 import QtCore
|
|||
from openlp.core.lib import Registry, Settings, PluginStatus, StringContent, image_to_byte
|
||||
from openlp.core.utils import AppLocation, translate
|
||||
|
||||
from cherrypy._cpcompat import sha, ntob
|
||||
from hashlib import sha1
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -137,7 +137,7 @@ def make_sha_hash(password):
|
|||
Create an encrypted password for the given password.
|
||||
"""
|
||||
log.debug("make_sha_hash")
|
||||
return sha(ntob(password)).hexdigest()
|
||||
return sha1(password.encode()).hexdigest()
|
||||
|
||||
|
||||
def fetch_password(username):
|
||||
|
@ -445,7 +445,7 @@ class HttpRouter(object):
|
|||
u'display': self.live_controller.desktop_screen.isChecked()
|
||||
}
|
||||
cherrypy.response.headers['Content-Type'] = u'application/json'
|
||||
return json.dumps({u'results': result})
|
||||
return json.dumps({u'results': result}).encode()
|
||||
|
||||
def main_poll(self):
|
||||
"""
|
||||
|
@ -455,7 +455,7 @@ class HttpRouter(object):
|
|||
u'slide_count': self.live_controller.slide_count
|
||||
}
|
||||
cherrypy.response.headers['Content-Type'] = u'application/json'
|
||||
return json.dumps({u'results': result})
|
||||
return json.dumps({u'results': result}).encode()
|
||||
|
||||
def main_image(self):
|
||||
"""
|
||||
|
@ -465,7 +465,7 @@ class HttpRouter(object):
|
|||
u'slide_image': u'data:image/png;base64,' + str(image_to_byte(self.live_controller.slide_image))
|
||||
}
|
||||
cherrypy.response.headers['Content-Type'] = u'application/json'
|
||||
return json.dumps({u'results': result})
|
||||
return json.dumps({u'results': result}).encode()
|
||||
|
||||
def display(self, action):
|
||||
"""
|
||||
|
@ -477,7 +477,7 @@ class HttpRouter(object):
|
|||
"""
|
||||
self.live_controller.emit(QtCore.SIGNAL(u'slidecontroller_toggle_display'), action)
|
||||
cherrypy.response.headers['Content-Type'] = u'application/json'
|
||||
return json.dumps({u'results': {u'success': True}})
|
||||
return json.dumps({u'results': {u'success': True}}).encode()
|
||||
|
||||
def alert(self):
|
||||
"""
|
||||
|
@ -495,7 +495,7 @@ class HttpRouter(object):
|
|||
else:
|
||||
success = False
|
||||
cherrypy.response.headers['Content-Type'] = u'application/json'
|
||||
return json.dumps({u'results': {u'success': success}})
|
||||
return json.dumps({u'results': {u'success': success}}).encode()
|
||||
|
||||
def controller(self, display_type, action):
|
||||
"""
|
||||
|
@ -543,7 +543,7 @@ class HttpRouter(object):
|
|||
self.live_controller.emit(QtCore.SIGNAL(event))
|
||||
json_data = {u'results': {u'success': True}}
|
||||
cherrypy.response.headers['Content-Type'] = u'application/json'
|
||||
return json.dumps(json_data)
|
||||
return json.dumps(json_data).encode()
|
||||
|
||||
def service(self, action):
|
||||
"""
|
||||
|
@ -555,7 +555,7 @@ class HttpRouter(object):
|
|||
event = u'servicemanager_%s' % action
|
||||
if action == u'list':
|
||||
cherrypy.response.headers['Content-Type'] = u'application/json'
|
||||
return json.dumps({u'results': {u'items': self._get_service_items()}})
|
||||
return json.dumps({u'results': {u'items': self._get_service_items()}}).encode()
|
||||
event += u'_item'
|
||||
if self.request_data:
|
||||
try:
|
||||
|
@ -566,7 +566,7 @@ class HttpRouter(object):
|
|||
else:
|
||||
Registry().execute(event)
|
||||
cherrypy.response.headers['Content-Type'] = u'application/json'
|
||||
return json.dumps({u'results': {u'success': True}})
|
||||
return json.dumps({u'results': {u'success': True}}).encode()
|
||||
|
||||
def plugin_info(self, action):
|
||||
"""
|
||||
|
@ -582,7 +582,7 @@ class HttpRouter(object):
|
|||
if plugin.status == PluginStatus.Active and plugin.media_item and plugin.media_item.has_search:
|
||||
searches.append([plugin.name, unicode(plugin.text_strings[StringContent.Name][u'plural'])])
|
||||
cherrypy.response.headers['Content-Type'] = u'application/json'
|
||||
return json.dumps({u'results': {u'items': searches}})
|
||||
return json.dumps({u'results': {u'items': searches}}).encode()
|
||||
|
||||
def search(self, plugin_name):
|
||||
"""
|
||||
|
@ -602,7 +602,7 @@ class HttpRouter(object):
|
|||
else:
|
||||
results = []
|
||||
cherrypy.response.headers['Content-Type'] = u'application/json'
|
||||
return json.dumps({u'results': {u'items': results}})
|
||||
return json.dumps({u'results': {u'items': results}}).encode()
|
||||
|
||||
def go_live(self, plugin_name):
|
||||
"""
|
||||
|
@ -648,7 +648,7 @@ class HttpRouter(object):
|
|||
Set the HTTP not found return code.
|
||||
"""
|
||||
cherrypy.response.status = 404
|
||||
cherrypy.response.body = ["<html><body>Sorry, an error occurred </body></html>"]
|
||||
cherrypy.response.body = [b'<html><body>Sorry, an error occurred </body></html>']
|
||||
|
||||
def _get_service_manager(self):
|
||||
"""
|
||||
|
|
|
@ -43,11 +43,11 @@ class RemoteTab(SettingsTab):
|
|||
RemoteTab is the Remotes settings tab in the settings dialog.
|
||||
"""
|
||||
def __init__(self, parent, title, visible_title, icon_path):
|
||||
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
|
||||
super(RemoteTab, self).__init__(parent, title, visible_title, icon_path)
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'RemoteTab')
|
||||
SettingsTab.setupUi(self)
|
||||
super(RemoteTab, self).setupUi()
|
||||
self.server_settings_group_box = QtGui.QGroupBox(self.left_column)
|
||||
self.server_settings_group_box.setObjectName(u'server_settings_group_box')
|
||||
self.server_settings_layout = QtGui.QFormLayout(self.server_settings_group_box)
|
||||
|
|
|
@ -55,7 +55,7 @@ class RemotesPlugin(Plugin):
|
|||
"""
|
||||
remotes constructor
|
||||
"""
|
||||
Plugin.__init__(self, u'remotes', __default_settings__, settings_tab_class=RemoteTab)
|
||||
super(RemotesPlugin, self).__init__(u'remotes', __default_settings__, settings_tab_class=RemoteTab)
|
||||
self.icon_path = u':/plugins/plugin_remote.png'
|
||||
self.icon = build_icon(self.icon_path)
|
||||
self.weight = -1
|
||||
|
@ -66,7 +66,7 @@ class RemotesPlugin(Plugin):
|
|||
Initialise the remotes plugin, and start the http server
|
||||
"""
|
||||
log.debug(u'initialise')
|
||||
Plugin.initialise(self)
|
||||
super(RemotesPlugin, self).initialise()
|
||||
self.server = HttpServer()
|
||||
self.server.start_server()
|
||||
|
||||
|
@ -75,7 +75,7 @@ class RemotesPlugin(Plugin):
|
|||
Tidy up and close down the http server
|
||||
"""
|
||||
log.debug(u'finalise')
|
||||
Plugin.finalise(self)
|
||||
super(RemotesPlugin, self).finalise()
|
||||
if self.server:
|
||||
self.server.close()
|
||||
self.server = None
|
||||
|
|
|
@ -45,7 +45,7 @@ mentioned above, like so::
|
|||
class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(AuthorsForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
This allows OpenLP to use ``self.object`` for all the GUI elements while keeping
|
||||
|
|
|
@ -42,7 +42,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
|||
"""
|
||||
Set up the screen and common data
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(AuthorsForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.auto_display_name = False
|
||||
self.first_name_edit.textEdited.connect(self.on_first_name_edited)
|
||||
|
|
|
@ -67,8 +67,8 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||
self.review_total_count = 0
|
||||
# Used to interrupt ongoing searches when cancel is clicked.
|
||||
self.break_search = False
|
||||
OpenLPWizard.__init__(self, self.main_window, plugin, u'duplicateSongRemovalWizard',
|
||||
u':/wizards/wizard_duplicateremoval.bmp', False)
|
||||
super(DuplicateSongRemovalForm, self).__init__(Registry().get('main_window'),
|
||||
plugin, u'duplicateSongRemovalWizard', u':/wizards/wizard_duplicateremoval.bmp', False)
|
||||
self.setMinimumWidth(730)
|
||||
|
||||
def custom_signals(self):
|
||||
|
@ -269,7 +269,7 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||
else:
|
||||
self.proceed_to_next_review()
|
||||
return False
|
||||
return OpenLPWizard.validateCurrentPage(self)
|
||||
return super(DuplicateSongRemovalForm, self).validateCurrentPage()
|
||||
|
||||
def remove_button_clicked(self, song_review_widget):
|
||||
"""
|
||||
|
@ -312,7 +312,7 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||
self.review_scroll_area_layout.removeItem(item)
|
||||
# Process next set of duplicates.
|
||||
self.process_current_duplicate_entry()
|
||||
|
||||
|
||||
def process_current_duplicate_entry(self):
|
||||
"""
|
||||
Update the review counter in the wizard header, add song widgets for
|
||||
|
@ -359,4 +359,5 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||
self._application = Registry().get(u'application')
|
||||
return self._application
|
||||
|
||||
application = property(_get_application)
|
||||
application = property(_get_application)
|
||||
|
||||
|
|
|
@ -355,7 +355,7 @@ class SingleColumnTableWidget(QtGui.QTableWidget):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QTableWidget.__init__(self, parent)
|
||||
super(SingleColumnTableWidget, self).__init__(parent)
|
||||
self.horizontalHeader().setVisible(False)
|
||||
self.setColumnCount(1)
|
||||
|
||||
|
|
|
@ -395,9 +395,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||
# lazy xml migration for now
|
||||
self.verse_list_widget.clear()
|
||||
self.verse_list_widget.setRowCount(0)
|
||||
# This is just because occasionally the lyrics come back as a "buffer"
|
||||
if isinstance(self.song.lyrics, buffer):
|
||||
self.song.lyrics = unicode(self.song.lyrics)
|
||||
verse_tags_translated = False
|
||||
if self.song.lyrics.startswith(u'<?xml version='):
|
||||
songXML = SongXML()
|
||||
|
|
|
@ -48,7 +48,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super(EditVerseForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.verse_text_edit.customContextMenuRequested.connect(self.context_menu)
|
||||
self.insert_button.clicked.connect(self.on_insert_button_clicked)
|
||||
|
|
|
@ -44,7 +44,7 @@ class MediaFilesForm(QtGui.QDialog, Ui_MediaFilesDialog):
|
|||
log.info(u'%s MediaFilesForm loaded', __name__)
|
||||
|
||||
def __init__(self, parent):
|
||||
QtGui.QDialog.__init__(self)
|
||||
super(MediaFilesForm, self).__init__()
|
||||
self.setupUi(self)
|
||||
|
||||
def populateFiles(self, files):
|
||||
|
|
|
@ -60,7 +60,7 @@ class SongExportForm(OpenLPWizard):
|
|||
``plugin``
|
||||
The songs plugin.
|
||||
"""
|
||||
OpenLPWizard.__init__(self, parent, plugin, u'song_export_wizard', u':/wizards/wizard_exportsong.bmp')
|
||||
super(SongExportForm, self).__init__(parent, plugin, u'song_export_wizard', u':/wizards/wizard_exportsong.bmp')
|
||||
self.stop_export_flag = False
|
||||
Registry().register_function(u'openlp_stop_wizard', self.stop_export)
|
||||
|
||||
|
@ -75,7 +75,7 @@ class SongExportForm(OpenLPWizard):
|
|||
"""
|
||||
Set up the song wizard UI.
|
||||
"""
|
||||
OpenLPWizard.setupUi(self, image)
|
||||
super(SongExportForm, self).setupUi(image)
|
||||
|
||||
def custom_signals(self):
|
||||
"""
|
||||
|
@ -239,7 +239,7 @@ class SongExportForm(OpenLPWizard):
|
|||
"""
|
||||
Perform pre export tasks.
|
||||
"""
|
||||
OpenLPWizard.pre_wizard(self)
|
||||
super(SongExportForm, self).pre_wizard()
|
||||
self.progress_label.setText(translate('SongsPlugin.ExportWizardForm', 'Starting export...'))
|
||||
self.application.process_events()
|
||||
|
||||
|
|
|
@ -60,15 +60,15 @@ class SongImportForm(OpenLPWizard):
|
|||
``plugin``
|
||||
The songs plugin.
|
||||
"""
|
||||
super(SongImportForm, self).__init__(parent, plugin, u'songImportWizard', u':/wizards/wizard_importsong.bmp')
|
||||
self.clipboard = self.main_window.clipboard
|
||||
OpenLPWizard.__init__(self, parent, plugin, u'songImportWizard', u':/wizards/wizard_importsong.bmp')
|
||||
|
||||
def setupUi(self, image):
|
||||
"""
|
||||
Set up the song wizard UI.
|
||||
"""
|
||||
self.format_widgets = dict([(song_format, {}) for song_format in SongFormat.get_format_list()])
|
||||
OpenLPWizard.setupUi(self, image)
|
||||
super(SongImportForm, self).setupUi(image)
|
||||
self.current_format = SongFormat.OpenLyrics
|
||||
self.format_stack.setCurrentIndex(self.current_format)
|
||||
self.format_combo_box.currentIndexChanged.connect(self.onCurrentIndexChanged)
|
||||
|
@ -329,7 +329,7 @@ class SongImportForm(OpenLPWizard):
|
|||
"""
|
||||
Perform pre import tasks
|
||||
"""
|
||||
OpenLPWizard.pre_wizard(self)
|
||||
super(SongImportForm, self).pre_wizard()
|
||||
self.progress_label.setText(WizardStrings.StartingImport)
|
||||
self.application.process_events()
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class SongReviewWidget(QtGui.QWidget):
|
|||
``song``
|
||||
The Song which this SongReviewWidget should represent.
|
||||
"""
|
||||
QtGui.QWidget.__init__(self, parent)
|
||||
super(SongReviewWidget, self).__init__(parent)
|
||||
self.song = song
|
||||
self.setupUi()
|
||||
self.retranslateUi()
|
||||
|
|
|
@ -395,12 +395,6 @@ def clean_song(manager, song):
|
|||
"""
|
||||
from xml import SongXML
|
||||
|
||||
if isinstance(song.title, buffer):
|
||||
song.title = unicode(song.title)
|
||||
if isinstance(song.alternate_title, buffer):
|
||||
song.alternate_title = unicode(song.alternate_title)
|
||||
if isinstance(song.lyrics, buffer):
|
||||
song.lyrics = unicode(song.lyrics)
|
||||
if song.title:
|
||||
song.title = clean_title(song.title)
|
||||
else:
|
||||
|
|
|
@ -68,7 +68,7 @@ class Song(BaseModel):
|
|||
Song model
|
||||
"""
|
||||
def __init__(self):
|
||||
self.sort_key = ()
|
||||
self.sort_key = []
|
||||
|
||||
@reconstructor
|
||||
def init_on_load(self):
|
||||
|
|
|
@ -100,12 +100,11 @@ class DreamBeamImport(SongImport):
|
|||
log.exception(u'XML syntax error in file %s' % file)
|
||||
self.logError(file, SongStrings.XMLSyntaxError)
|
||||
continue
|
||||
xml = unicode(etree.tostring(parsed_file))
|
||||
xml = etree.tostring(parsed_file).decode()
|
||||
song_xml = objectify.fromstring(xml)
|
||||
if song_xml.tag != u'DreamSong':
|
||||
self.logError(file, unicode(
|
||||
translate('SongsPlugin.DreamBeamImport',
|
||||
('Invalid DreamBeam song file. Missing DreamSong tag.'))))
|
||||
self.logError(file,
|
||||
translate('SongsPlugin.DreamBeamImport', 'Invalid DreamBeam song file. Missing DreamSong tag.'))
|
||||
continue
|
||||
if hasattr(song_xml, u'Version'):
|
||||
self.version = float(song_xml.Version.text)
|
||||
|
|
|
@ -54,7 +54,7 @@ class EasySlidesImport(SongImport):
|
|||
log.info(u'Importing EasySlides XML file %s', self.import_source)
|
||||
parser = etree.XMLParser(remove_blank_text=True)
|
||||
parsed_file = etree.parse(self.import_source, parser)
|
||||
xml = unicode(etree.tostring(parsed_file))
|
||||
xml = etree.tostring(parsed_file).decode()
|
||||
song_xml = objectify.fromstring(xml)
|
||||
self.import_wizard.progress_bar.setMaximum(len(song_xml.Item))
|
||||
for song in song_xml.Item:
|
||||
|
|
|
@ -274,7 +274,7 @@ class EasyWorshipSongImport(SongImport):
|
|||
return None
|
||||
# Format the field depending on the field type
|
||||
if field_desc.field_type == FieldType.String:
|
||||
return field.rstrip('\0').decode(self.encoding)
|
||||
return field.rstrip('\0')
|
||||
elif field_desc.field_type == FieldType.Int16:
|
||||
return field ^ 0x8000
|
||||
elif field_desc.field_type == FieldType.Int32:
|
||||
|
|
|
@ -127,11 +127,10 @@ class FoilPresenterImport(SongImport):
|
|||
for file_path in self.import_source:
|
||||
if self.stop_import_flag:
|
||||
return
|
||||
self.import_wizard.increment_progress_bar(
|
||||
WizardStrings.ImportingType % os.path.basename(file_path))
|
||||
self.import_wizard.increment_progress_bar(WizardStrings.ImportingType % os.path.basename(file_path))
|
||||
try:
|
||||
parsed_file = etree.parse(file_path, parser)
|
||||
xml = unicode(etree.tostring(parsed_file))
|
||||
xml = etree.tostring(parsed_file).decode()
|
||||
self.FoilPresenter.xml_to_song(xml)
|
||||
except etree.XMLSyntaxError:
|
||||
self.logError(file_path, SongStrings.XMLSyntaxError)
|
||||
|
|
|
@ -71,7 +71,7 @@ class SongMediaItem(MediaManagerItem):
|
|||
|
||||
def __init__(self, parent, plugin):
|
||||
self.icon_path = u'songs/song'
|
||||
MediaManagerItem.__init__(self, parent, plugin)
|
||||
super(SongMediaItem, self).__init__(parent, plugin)
|
||||
self.single_service_item = False
|
||||
# Holds information about whether the edit is remotely triggered and which Song is required.
|
||||
self.remote_song = -1
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue