Migrate to PyQt5

This commit is contained in:
Jonathan Springer 2015-11-06 19:49:40 -05:00
parent 7c5add7fac
commit 7af1ca1d49
220 changed files with 2842 additions and 2904 deletions

View File

@ -29,7 +29,7 @@ Ignore the version file and pull the version directly
from Bazaar
.TP
\fB\-s\fR STYLE, \fB\-\-style\fR=\fISTYLE\fR
Set the Qt4 style (passed directly to Qt4).
Set the Qt5 style (passed directly to Qt5).
.TP
\fB\-\-testing\fR
Run by testing framework

View File

@ -34,7 +34,7 @@ import argparse
from traceback import format_exception
import shutil
import time
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry, OpenLPMixin, AppLocation, Settings, UiStrings, check_directory_exists, \
is_macosx, is_win, translate
@ -76,7 +76,7 @@ QToolBar
"""
class OpenLP(OpenLPMixin, QtGui.QApplication):
class OpenLP(OpenLPMixin, QtWidgets.QApplication):
"""
The core application class. This class inherits from Qt's QApplication
class in order to provide the core of the application.
@ -84,12 +84,12 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
args = []
def exec_(self):
def exec(self):
"""
Override exec method to allow the shared memory to be released on exit
"""
self.is_event_loop_active = True
result = QtGui.QApplication.exec_()
result = QtWidgets.QApplication.exec()
self.shared_memory.detach()
return result
@ -113,7 +113,7 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
if not has_run_wizard:
ftw = FirstTimeForm()
ftw.initialize(screens)
if ftw.exec_() == QtGui.QDialog.Accepted:
if ftw.exec() == QtWidgets.QDialog.Accepted:
Settings().setValue('core/has run wizard', True)
elif ftw.was_cancelled:
QtCore.QCoreApplication.exit()
@ -159,7 +159,7 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
version.start()
self.main_window.is_display_blank()
self.main_window.app_startup()
return self.exec_()
return self.exec()
def is_already_running(self):
"""
@ -167,10 +167,10 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
"""
self.shared_memory = QtCore.QSharedMemory('OpenLP')
if self.shared_memory.attach():
status = QtGui.QMessageBox.critical(None, UiStrings().Error, UiStrings().OpenLPStart,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No))
if status == QtGui.QMessageBox.No:
status = QtWidgets.QMessageBox.critical(None, UiStrings().Error, UiStrings().OpenLPStart,
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.No))
if status == QtWidgets.QMessageBox.No:
return True
return False
else:
@ -192,7 +192,7 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
self.exception_form = ExceptionForm()
self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback)))
self.set_normal_cursor()
self.exception_form.exec_()
self.exception_form.exec()
def backup_on_upgrade(self, has_run_wizard):
"""
@ -207,11 +207,11 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
Settings().setValue('core/application version', openlp_version)
# If data_version is different from the current version ask if we should backup the data folder
elif data_version != openlp_version:
if QtGui.QMessageBox.question(None, translate('OpenLP', 'Backup'),
translate('OpenLP', 'OpenLP has been upgraded, '
'do you want to create a backup of OpenLPs data folder?'),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'),
translate('OpenLP', 'OpenLP has been upgraded, do you want to create '
'a backup of OpenLPs data folder?'),
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.Yes:
# Create copy of data folder
data_folder_path = AppLocation.get_data_path()
timestamp = time.strftime("%Y%m%d-%H%M%S")
@ -219,12 +219,13 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
try:
shutil.copytree(data_folder_path, data_folder_backup_path)
except OSError:
QtGui.QMessageBox.warning(None, translate('OpenLP', 'Backup'),
translate('OpenLP', 'Backup of the data folder failed!'))
QtWidgets.QMessageBox.warning(None, translate('OpenLP', 'Backup'),
translate('OpenLP', 'Backup of the data folder failed!'))
return
QtGui.QMessageBox.information(None, translate('OpenLP', 'Backup'),
translate('OpenLP', 'A backup of the data folder has been created at %s')
% data_folder_backup_path)
QtWidgets.QMessageBox.information(None, translate('OpenLP', 'Backup'),
translate('OpenLP',
'A backup of the data folder has been created at %s')
% data_folder_backup_path)
# Update the version in the settings
Settings().setValue('core/application version', openlp_version)
@ -271,7 +272,7 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
self.main_window.setWindowState(self.main_window.windowState() & ~QtCore.Qt.WindowMinimized |
QtCore.Qt.WindowActive)
return True
return QtGui.QApplication.event(self, event)
return QtWidgets.QApplication.event(self, event)
def parse_options(args):
@ -292,7 +293,7 @@ def parse_options(args):
'off a USB flash drive (not implemented).')
parser.add_argument('-d', '--dev-version', dest='dev_version', action='store_true',
help='Ignore the version file and pull the version directly from Bazaar')
parser.add_argument('-s', '--style', dest='style', help='Set the Qt4 style (passed directly to Qt4).')
parser.add_argument('-s', '--style', dest='style', help='Set the Qt5 style (passed directly to Qt5).')
parser.add_argument('rargs', nargs='?', default=[])
# Parse command line options and deal with them. Use args supplied pragmatically if possible.
return parser.parse_args(args) if args else parser.parse_args()
@ -372,7 +373,7 @@ def main(args=None):
Settings().remove_obsolete_settings()
# First time checks in settings
if not Settings().value('core/has run wizard'):
if not FirstTimeLanguageForm().exec_():
if not FirstTimeLanguageForm().exec():
# if cancel then stop processing
sys.exit()
# i18n Set Language

View File

@ -32,8 +32,8 @@ import traceback
from ipaddress import IPv4Address, IPv6Address, AddressValueError
from codecs import decode, encode
from PyQt4 import QtCore
from PyQt4.QtCore import QCryptographicHash as QHash
from PyQt5 import QtCore
from PyQt5.QtCore import QCryptographicHash as QHash
log = logging.getLogger(__name__ + '.__init__')
@ -92,20 +92,17 @@ class ThemeLevel(object):
Song = 3
def translate(context, text, comment=None, encoding=QtCore.QCoreApplication.CodecForTr, n=-1,
qt_translate=QtCore.QCoreApplication.translate):
def translate(context, text, comment=None, qt_translate=QtCore.QCoreApplication.translate):
"""
A special shortcut method to wrap around the Qt4 translation functions. This abstracts the translation procedure so
A special shortcut method to wrap around the Qt5 translation functions. This abstracts the translation procedure so
that we can change it if at a later date if necessary, without having to redo the whole of OpenLP.
:param context: The translation context, used to give each string a context or a namespace.
:param text: The text to put into the translation tables for translation.
:param comment: An identifying string for when the same text is used in different roles within the same context.
:param encoding:
:param n:
:param qt_translate:
"""
return qt_translate(context, text, comment, encoding, n)
return qt_translate(context, text, comment)
class SlideLimits(object):
@ -213,7 +210,7 @@ def md5_hash(salt, data=None):
def qmd5_hash(salt, data=None):
"""
Returns the hashed output of MD5Sum on salt, data
using PyQt4.QCryptographicHash.
using PyQt5.QCryptographicHash.
:param salt: Initial salt
:param data: OPTIONAL Data to hash

View File

@ -23,10 +23,10 @@
The :mod:`~openlp.core.common.historycombobox` module contains the HistoryComboBox widget
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
class HistoryComboBox(QtGui.QComboBox):
class HistoryComboBox(QtWidgets.QComboBox):
"""
The :class:`~openlp.core.common.historycombobox.HistoryComboBox` widget emulates the QLineEdit ``returnPressed``
signal for when the :kbd:`Enter` or :kbd:`Return` keys are pressed, and saves anything that is typed into the edit
@ -43,8 +43,8 @@ class HistoryComboBox(QtGui.QComboBox):
super().__init__(parent)
self.setDuplicatesEnabled(False)
self.setEditable(True)
self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.setInsertPolicy(QtGui.QComboBox.InsertAtTop)
self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
self.setInsertPolicy(QtWidgets.QComboBox.InsertAtTop)
def keyPressEvent(self, event):
"""

View File

@ -26,7 +26,7 @@ import datetime
import logging
import os
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui
from openlp.core.common import ThemeLevel, SlideLimits, UiStrings, is_win, is_linux
@ -425,10 +425,6 @@ class Settings(QtCore.QSettings):
**Note**, this method only converts a few types and might need to be extended if a certain type is missing!
"""
# On OS X (and probably on other platforms too) empty value from QSettings is represented as type
# PyQt4.QtCore.QPyNullVariant. This type has to be converted to proper 'None' Python type.
if isinstance(setting, QtCore.QPyNullVariant) and setting.isNull():
setting = None
# Handle 'None' type (empty value) properly.
if setting is None:
# An empty string saved to the settings results in a None type being returned.

View File

@ -28,7 +28,8 @@ from distutils.version import LooseVersion
import logging
import os
from PyQt4 import QtCore, QtGui, Qt
from PyQt5 import QtCore, QtGui, Qt, QtWidgets
from openlp.core.common import translate
@ -251,8 +252,8 @@ def check_item_selected(list_widget, message):
:param message: The message to give the user if no item is selected
"""
if not list_widget.selectedIndexes():
QtGui.QMessageBox.information(list_widget.parent(),
translate('OpenLP.MediaManagerItem', 'No Items Selected'), message)
QtWidgets.QMessageBox.information(list_widget.parent(),
translate('OpenLP.MediaManagerItem', 'No Items Selected'), message)
return False
return True

View File

@ -23,12 +23,12 @@
"""
Provide a custom widget based on QPushButton for the selection of colors
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import translate
class ColorButton(QtGui.QPushButton):
class ColorButton(QtWidgets.QPushButton):
"""
Subclasses QPushbutton to create a "Color Chooser" button
"""
@ -76,7 +76,7 @@ class ColorButton(QtGui.QPushButton):
"""
Handle the PushButton clicked signal, showing the ColorDialog and validating the input
"""
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self._color), self.parent)
new_color = QtWidgets.QColorDialog.getColor(QtGui.QColor(self._color), self.parent)
if new_color.isValid() and self._color != new_color.name():
self.change_color(new_color.name())
self.colorChanged.emit(new_color.name())

View File

@ -26,14 +26,14 @@ Provide additional functionality required by OpenLP from the inherited QDockWidg
import logging
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.lib import ScreenList, build_icon
log = logging.getLogger(__name__)
class OpenLPDockWidget(QtGui.QDockWidget):
class OpenLPDockWidget(QtWidgets.QDockWidget):
"""
Custom DockWidget class to handle events
"""

View File

@ -26,14 +26,14 @@ import logging
import os
from urllib import parse
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import UiStrings
log = logging.getLogger(__name__)
class FileDialog(QtGui.QFileDialog):
class FileDialog(QtWidgets.QFileDialog):
"""
Subclass QFileDialog to work round a bug
"""
@ -43,7 +43,7 @@ class FileDialog(QtGui.QFileDialog):
Reimplement getOpenFileNames to fix the way it returns some file names that url encoded when selecting multiple
files
"""
files = QtGui.QFileDialog.getOpenFileNames(parent, *args, **kwargs)
files, filter_used = QtWidgets.QFileDialog.getOpenFileNames(parent, *args, **kwargs)
file_list = []
for file in files:
if not os.path.exists(file):
@ -51,8 +51,8 @@ class FileDialog(QtGui.QFileDialog):
file = parse.unquote(file)
if not os.path.exists(file):
log.error('File %s not found.' % file)
QtGui.QMessageBox.information(parent, UiStrings().FileNotFound,
UiStrings().FileNotFoundMessage % file)
QtWidgets.QMessageBox.information(parent, UiStrings().FileNotFound,
UiStrings().FileNotFoundMessage % file)
continue
file_list.append(file)
return file_list

View File

@ -389,7 +389,7 @@ is the function which has to be called from outside. The generated and returned
"""
import logging
from PyQt4 import QtWebKit
from PyQt5 import QtWebKit
from openlp.core.common import Settings
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, VerticalType, HorizontalType

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
@ -30,7 +29,7 @@ import os
import time
import queue
from PyQt4 import QtCore
from PyQt5 import QtCore
from openlp.core.common import Registry
from openlp.core.lib import ScreenList, resize_image, image_to_byte

View File

@ -24,12 +24,12 @@ Extend QListWidget to handle drag and drop functionality
"""
import os
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry
class ListWidgetWithDnD(QtGui.QListWidget):
class ListWidgetWithDnD(QtWidgets.QListWidget):
"""
Provide a list widget to store objects and handle drag and drop events
"""
@ -45,7 +45,7 @@ class ListWidgetWithDnD(QtGui.QListWidget):
Activate DnD of widget
"""
self.setAcceptDrops(True)
self.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
self.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop)
Registry().register_function(('%s_dnd' % self.mime_data_text), self.parent().load_file)
def mouseMoveEvent(self, event):
@ -63,7 +63,7 @@ class ListWidgetWithDnD(QtGui.QListWidget):
mime_data = QtCore.QMimeData()
drag.setMimeData(mime_data)
mime_data.setText(self.mime_data_text)
drag.start(QtCore.Qt.CopyAction)
drag.exec(QtCore.Qt.CopyAction)
def dragEnterEvent(self, event):
"""

View File

@ -26,7 +26,7 @@ import logging
import os
import re
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings, translate
from openlp.core.lib import FileDialog, OpenLPToolbar, ServiceItem, StringContent, ListWidgetWithDnD, \
@ -37,7 +37,7 @@ from openlp.core.lib.ui import create_widget_action, critical_error_message_box
log = logging.getLogger(__name__)
class MediaManagerItem(QtGui.QWidget, RegistryProperties):
class MediaManagerItem(QtWidgets.QWidget, RegistryProperties):
"""
MediaManagerItem is a helper widget for plugins.
@ -96,16 +96,13 @@ class MediaManagerItem(QtGui.QWidget, RegistryProperties):
self.single_service_item = True
self.quick_preview_allowed = False
self.has_search = False
self.page_layout = QtGui.QVBoxLayout(self)
self.page_layout = QtWidgets.QVBoxLayout(self)
self.page_layout.setSpacing(0)
self.page_layout.setMargin(0)
self.page_layout.setContentsMargins(0, 0, 0, 0)
self.required_icons()
self.setupUi()
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('%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 setup_item(self):
"""
@ -200,7 +197,7 @@ class MediaManagerItem(QtGui.QWidget, RegistryProperties):
# Add the List widget
self.list_view = ListWidgetWithDnD(self, self.plugin.name)
self.list_view.setSpacing(1)
self.list_view.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.list_view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
self.list_view.setAlternatingRowColors(True)
self.list_view.setObjectName('%sListView' % self.plugin.name)
# Add to page_layout
@ -246,7 +243,7 @@ class MediaManagerItem(QtGui.QWidget, RegistryProperties):
triggers=self.on_add_edit_click)
self.add_custom_context_actions()
# Create the context menu and add all actions from the list_view.
self.menu = QtGui.QMenu()
self.menu = QtWidgets.QMenu()
self.menu.addActions(self.list_view.actions())
self.list_view.doubleClicked.connect(self.on_double_clicked)
self.list_view.itemSelectionChanged.connect(self.on_selection_change)
@ -256,23 +253,23 @@ class MediaManagerItem(QtGui.QWidget, RegistryProperties):
"""
Creates a search field with button and related signal handling.
"""
self.search_widget = QtGui.QWidget(self)
self.search_widget = QtWidgets.QWidget(self)
self.search_widget.setObjectName('search_widget')
self.search_layout = QtGui.QVBoxLayout(self.search_widget)
self.search_layout = QtWidgets.QVBoxLayout(self.search_widget)
self.search_layout.setObjectName('search_layout')
self.search_text_layout = QtGui.QFormLayout()
self.search_text_layout = QtWidgets.QFormLayout()
self.search_text_layout.setObjectName('search_text_layout')
self.search_text_label = QtGui.QLabel(self.search_widget)
self.search_text_label = QtWidgets.QLabel(self.search_widget)
self.search_text_label.setObjectName('search_text_label')
self.search_text_edit = SearchEdit(self.search_widget)
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 = QtWidgets.QHBoxLayout()
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 = QtWidgets.QPushButton(self.search_widget)
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)
@ -395,7 +392,7 @@ class MediaManagerItem(QtGui.QWidget, RegistryProperties):
return
if not item.flags() & QtCore.Qt.ItemIsSelectable:
return
self.menu.exec_(self.list_view.mapToGlobal(point))
self.menu.exec(self.list_view.mapToGlobal(point))
def get_file_list(self):
"""
@ -479,9 +476,9 @@ class MediaManagerItem(QtGui.QWidget, RegistryProperties):
:param keep_focus: Do we keep focus (False)
"""
if not self.list_view.selectedIndexes() and not self.remote_triggered:
QtGui.QMessageBox.information(self, UiStrings().NISp,
translate('OpenLP.MediaManagerItem',
'You must select one or more items to preview.'))
QtWidgets.QMessageBox.information(self, UiStrings().NISp,
translate('OpenLP.MediaManagerItem',
'You must select one or more items to preview.'))
else:
log.debug('%s Preview requested' % self.plugin.name)
service_item = self.build_service_item()
@ -496,9 +493,9 @@ class MediaManagerItem(QtGui.QWidget, RegistryProperties):
Send an item live by building a service item then adding that service item to the live slide controller.
"""
if not self.list_view.selectedIndexes():
QtGui.QMessageBox.information(self, UiStrings().NISp,
translate('OpenLP.MediaManagerItem',
'You must select one or more items to send live.'))
QtWidgets.QMessageBox.information(self, UiStrings().NISp,
translate('OpenLP.MediaManagerItem',
'You must select one or more items to send live.'))
else:
self.go_live()
@ -536,7 +533,7 @@ class MediaManagerItem(QtGui.QWidget, RegistryProperties):
:param item_id: Id to make live
"""
item = QtGui.QListWidgetItem()
item = QtWidgets.QListWidgetItem()
item.setData(QtCore.Qt.UserRole, item_id)
return item
@ -545,9 +542,9 @@ class MediaManagerItem(QtGui.QWidget, RegistryProperties):
Add a selected item to the current service
"""
if not self.list_view.selectedIndexes():
QtGui.QMessageBox.information(self, UiStrings().NISp,
translate('OpenLP.MediaManagerItem',
'You must select one or more items to add.'))
QtWidgets.QMessageBox.information(self, UiStrings().NISp,
translate('OpenLP.MediaManagerItem',
'You must select one or more items to add.'))
else:
# Is it possible to process multiple list items to generate
# multiple service items?
@ -589,23 +586,24 @@ class MediaManagerItem(QtGui.QWidget, RegistryProperties):
Add a selected item to an existing item in the current service.
"""
if not self.list_view.selectedIndexes() and not self.remote_triggered:
QtGui.QMessageBox.information(self, UiStrings().NISp,
translate('OpenLP.MediaManagerItem', 'You must select one or more items.'))
QtWidgets.QMessageBox.information(self, UiStrings().NISp,
translate('OpenLP.MediaManagerItem',
'You must select one or more items.'))
else:
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,
translate('OpenLP.MediaManagerItem',
'You must select an existing service item to add to.'))
QtWidgets.QMessageBox.information(self, UiStrings().NISs,
translate('OpenLP.MediaManagerItem',
'You must select an existing service item to add to.'))
elif self.plugin.name == service_item.name:
self.generate_slide_data(service_item)
self.service_manager.add_service_item(service_item, replace=True)
else:
# Turn off the remote edit update message indicator
QtGui.QMessageBox.information(self, translate('OpenLP.MediaManagerItem', 'Invalid Service Item'),
translate('OpenLP.MediaManagerItem',
'You must select a %s service item.') % self.title)
QtWidgets.QMessageBox.information(self, translate('OpenLP.MediaManagerItem', 'Invalid Service Item'),
translate('OpenLP.MediaManagerItem',
'You must select a %s service item.') % self.title)
def build_service_item(self, item=None, xml_version=False, remote=False, context=ServiceItemContext.Live):
"""
@ -638,7 +636,7 @@ class MediaManagerItem(QtGui.QWidget, RegistryProperties):
if self.list_view.count():
return
message = translate('OpenLP.MediaManagerItem', 'No Search Results')
item = QtGui.QListWidgetItem(message)
item = QtWidgets.QListWidgetItem(message)
item.setFlags(QtCore.Qt.NoItemFlags)
font = QtGui.QFont()
font.setItalic(True)

View File

@ -25,7 +25,7 @@ Provide the generic plugin functionality for OpenLP plugins.
import logging
from PyQt4 import QtCore
from PyQt5 import QtCore
from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings
from openlp.core.utils import get_application_version

View File

@ -46,8 +46,8 @@ __all__ = ['PJLink1']
from codecs import decode
from PyQt4.QtCore import pyqtSignal, pyqtSlot
from PyQt4.QtNetwork import QAbstractSocket, QTcpSocket
from PyQt5.QtCore import pyqtSignal, pyqtSlot
from PyQt5.QtNetwork import QAbstractSocket, QTcpSocket
from openlp.core.common import translate, qmd5_hash
from openlp.core.lib.projector.constants import *

View File

@ -21,7 +21,7 @@
###############################################################################
from PyQt4 import QtGui, QtCore, QtWebKit
from PyQt5 import QtGui, QtCore, QtWebKitWidgets
from openlp.core.common import Registry, RegistryProperties, OpenLPMixin, RegistryMixin, Settings
from openlp.core.lib import FormattingTags, ImageSource, ItemCapabilities, ScreenList, ServiceItem, expand_tags, \
@ -60,7 +60,7 @@ class Renderer(OpenLPMixin, RegistryMixin, RegistryProperties):
self.force_page = False
self._theme_dimensions = {}
self._calculate_default()
self.web = QtWebKit.QWebView()
self.web = QtWebKitWidgets.QWebView()
self.web.setVisible(False)
self.web_frame = self.web.page().mainFrame()
Registry().register_function('theme_update_global', self.set_global_theme)
@ -364,7 +364,7 @@ class Renderer(OpenLPMixin, RegistryMixin, RegistryProperties):
# For the life of my I don't know why we have to completely kill the QWebView in order for the display to work
# properly, but we do. See bug #1041366 for an example of what happens if we take this out.
self.web = None
self.web = QtWebKit.QWebView()
self.web = QtWebKitWidgets.QWebView()
self.web.setVisible(False)
self.web.resize(self.page_width, self.page_height)
self.web_frame = self.web.page().mainFrame()

View File

@ -27,7 +27,7 @@ displays.
import logging
import copy
from PyQt4 import QtCore
from PyQt5 import QtCore
from openlp.core.common import Registry, Settings, translate
@ -149,7 +149,7 @@ class ScreenList(object):
{
'primary': True,
'number': 0,
'size': PyQt4.QtCore.QRect(0, 0, 1024, 768)
'size': PyQt5.QtCore.QRect(0, 0, 1024, 768)
}
"""
log.info('Screen %d found with resolution %s' % (screen['number'], screen['size']))

View File

@ -22,7 +22,7 @@
import logging
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.lib import build_icon
from openlp.core.lib.ui import create_widget_action
@ -30,10 +30,12 @@ from openlp.core.lib.ui import create_widget_action
log = logging.getLogger(__name__)
class SearchEdit(QtGui.QLineEdit):
class SearchEdit(QtWidgets.QLineEdit):
"""
This is a specialised QLineEdit with a "clear" button inside for searches.
"""
searchTypeChanged = QtCore.pyqtSignal(QtCore.QVariant)
cleared = QtCore.pyqtSignal()
def __init__(self, parent):
"""
@ -41,7 +43,7 @@ class SearchEdit(QtGui.QLineEdit):
"""
super(SearchEdit, self).__init__(parent)
self._current_search_type = -1
self.clear_button = QtGui.QToolButton(self)
self.clear_button = QtWidgets.QToolButton(self)
self.clear_button.setIcon(build_icon(':/system/clear_shortcut.png'))
self.clear_button.setCursor(QtCore.Qt.ArrowCursor)
self.clear_button.setStyleSheet('QToolButton { border: none; padding: 0px; }')
@ -56,7 +58,7 @@ class SearchEdit(QtGui.QLineEdit):
"""
Internal method to update the stylesheet depending on which widgets are available and visible.
"""
frame_width = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
frame_width = self.style().pixelMetric(QtWidgets.QStyle.PM_DefaultFrameWidth)
right_padding = self.clear_button.width() + frame_width
if hasattr(self, 'menu_button'):
left_padding = self.menu_button.width()
@ -75,7 +77,7 @@ class SearchEdit(QtGui.QLineEdit):
:param event: The event that happened.
"""
size = self.clear_button.size()
frame_width = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
frame_width = self.style().pixelMetric(QtWidgets.QStyle.PM_DefaultFrameWidth)
self.clear_button.move(self.rect().right() - frame_width - size.width(),
(self.rect().bottom() + 1 - size.height()) // 2)
if hasattr(self, 'menu_button'):
@ -105,7 +107,7 @@ class SearchEdit(QtGui.QLineEdit):
pass
self.menu_button.setDefaultAction(action)
self._current_search_type = identifier
self.emit(QtCore.SIGNAL('searchTypeChanged(int)'), identifier)
self.searchTypeChanged.emit(identifier)
return True
def set_search_types(self, items):
@ -126,7 +128,7 @@ class SearchEdit(QtGui.QLineEdit):
(2, ":/songs/authors.png", "Authors", "Search Authors...")
"""
menu = QtGui.QMenu(self)
menu = QtWidgets.QMenu(self)
first = None
for identifier, icon, title, placeholder in items:
action = create_widget_action(
@ -136,10 +138,10 @@ class SearchEdit(QtGui.QLineEdit):
first = action
self._current_search_type = identifier
if not hasattr(self, 'menu_button'):
self.menu_button = QtGui.QToolButton(self)
self.menu_button = QtWidgets.QToolButton(self)
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.setPopupMode(QtWidgets.QToolButton.InstantPopup)
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)
@ -152,7 +154,7 @@ class SearchEdit(QtGui.QLineEdit):
Internally implemented slot to react to when the text in the line edit has changed so that we can show or hide
the clear button.
:param text: A :class:`~PyQt4.QtCore.QString` instance which represents the text in the line edit.
:param text: A :class:`~PyQt5.QtCore.QString` instance which represents the text in the line edit.
"""
self.clear_button.setVisible(bool(text))
@ -163,7 +165,7 @@ class SearchEdit(QtGui.QLineEdit):
line edit.
"""
self.clear()
self.emit(QtCore.SIGNAL('cleared()'))
self.cleared.emit()
def _on_menu_action_triggered(self):
"""

View File

@ -31,7 +31,7 @@ import os
import uuid
import ntpath
from PyQt4 import QtGui
from PyQt5 import QtGui
from openlp.core.common import RegistryProperties, Settings, translate, AppLocation, md5_hash
from openlp.core.lib import ImageSource, build_icon, clean_tags, expand_tags, create_thumb

View File

@ -25,13 +25,13 @@ own tab to the settings dialog.
"""
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import RegistryProperties
class SettingsTab(QtGui.QWidget, RegistryProperties):
class SettingsTab(QtWidgets.QWidget, RegistryProperties):
"""
SettingsTab is a helper widget for plugins to define Tabs for the settings dialog.
"""
@ -66,18 +66,18 @@ class SettingsTab(QtGui.QWidget, RegistryProperties):
"""
Setup the tab's interface.
"""
self.tab_layout = QtGui.QHBoxLayout(self)
self.tab_layout = QtWidgets.QHBoxLayout(self)
self.tab_layout.setObjectName('tab_layout')
self.left_column = QtGui.QWidget(self)
self.left_column = QtWidgets.QWidget(self)
self.left_column.setObjectName('left_column')
self.left_layout = QtGui.QVBoxLayout(self.left_column)
self.left_layout.setMargin(0)
self.left_layout = QtWidgets.QVBoxLayout(self.left_column)
self.left_layout.setContentsMargins(0, 0, 0, 0)
self.left_layout.setObjectName('left_layout')
self.tab_layout.addWidget(self.left_column)
self.right_column = QtGui.QWidget(self)
self.right_column = QtWidgets.QWidget(self)
self.right_column.setObjectName('right_column')
self.right_layout = QtGui.QVBoxLayout(self.right_column)
self.right_layout.setMargin(0)
self.right_layout = QtWidgets.QVBoxLayout(self.right_column)
self.right_layout.setContentsMargins(0, 0, 0, 0)
self.right_layout.setObjectName('right_layout')
self.tab_layout.addWidget(self.right_column)
@ -86,7 +86,7 @@ class SettingsTab(QtGui.QWidget, RegistryProperties):
Resize the sides in two equal halves if the layout allows this.
"""
if event:
QtGui.QWidget.resizeEvent(self, event)
QtWidgets.QWidget.resizeEvent(self, event)
width = self.width() - self.tab_layout.spacing() - \
self.tab_layout.contentsMargins().left() - self.tab_layout.contentsMargins().right()
left_width = min(width - self.right_column.minimumSizeHint().width(), width // 2)

View File

@ -36,7 +36,7 @@ except ImportError:
# based on code from http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.lib import translate, FormattingTags
from openlp.core.lib.ui import create_action
@ -44,7 +44,7 @@ from openlp.core.lib.ui import create_action
log = logging.getLogger(__name__)
class SpellTextEdit(QtGui.QPlainTextEdit):
class SpellTextEdit(QtWidgets.QPlainTextEdit):
"""
Spell checking widget based on QPlanTextEdit.
"""
@ -73,7 +73,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
# Rewrite the mouse event to a left button event so the cursor is moved to the location of the pointer.
event = QtGui.QMouseEvent(QtCore.QEvent.MouseButtonPress,
event.pos(), QtCore.Qt.LeftButton, QtCore.Qt.LeftButton, QtCore.Qt.NoModifier)
QtGui.QPlainTextEdit.mousePressEvent(self, event)
QtWidgets.QPlainTextEdit.mousePressEvent(self, event)
def contextMenuEvent(self, event):
"""
@ -88,7 +88,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
self.setTextCursor(cursor)
# Add menu with available languages.
if ENCHANT_AVAILABLE:
lang_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Language:'))
lang_menu = QtWidgets.QMenu(translate('OpenLP.SpellTextEdit', 'Language:'))
for lang in enchant.list_languages():
action = create_action(lang_menu, lang, text=lang, checked=lang == self.dictionary.tag)
lang_menu.addAction(action)
@ -99,7 +99,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
if ENCHANT_AVAILABLE and self.textCursor().hasSelection():
text = self.textCursor().selectedText()
if not self.dictionary.check(text):
spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Spelling Suggestions'))
spell_menu = QtWidgets.QMenu(translate('OpenLP.SpellTextEdit', 'Spelling Suggestions'))
for word in self.dictionary.suggest(text):
action = SpellAction(word, spell_menu)
action.correct.connect(self.correct_word)
@ -107,7 +107,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
# Only add the spelling suggests to the menu if there are suggestions.
if spell_menu.actions():
popup_menu.insertMenu(popup_menu.actions()[0], spell_menu)
tag_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Formatting Tags'))
tag_menu = QtWidgets.QMenu(translate('OpenLP.SpellTextEdit', 'Formatting Tags'))
if self.formatting_tags_allowed:
for html in FormattingTags.get_html_tags():
action = SpellAction(html['desc'], tag_menu)
@ -115,7 +115,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
tag_menu.addAction(action)
popup_menu.insertSeparator(popup_menu.actions()[0])
popup_menu.insertMenu(popup_menu.actions()[0], tag_menu)
popup_menu.exec_(event.globalPos())
popup_menu.exec(event.globalPos())
def set_language(self, action):
"""
@ -189,7 +189,7 @@ class Highlighter(QtGui.QSyntaxHighlighter):
self.setFormat(word_object.start(), word_object.end() - word_object.start(), char_format)
class SpellAction(QtGui.QAction):
class SpellAction(QtWidgets.QAction):
"""
A special QAction that returns the text in a signal.
"""

View File

@ -24,14 +24,14 @@ Provide common toolbar handling for OpenLP
"""
import logging
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.lib.ui import create_widget_action
log = logging.getLogger(__name__)
class OpenLPToolbar(QtGui.QToolBar):
class OpenLPToolbar(QtWidgets.QToolBar):
"""
Lots of toolbars around the place, so it makes sense to have a common way to manage them. This is the base toolbar
class.

View File

@ -24,12 +24,12 @@ Extend QTreeWidget to handle drag and drop functionality
"""
import os
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry
class TreeWidgetWithDnD(QtGui.QTreeWidget):
class TreeWidgetWithDnD(QtWidgets.QTreeWidget):
"""
Provide a tree widget to store objects and handle drag and drop events
"""
@ -50,7 +50,7 @@ class TreeWidgetWithDnD(QtGui.QTreeWidget):
Activate DnD of widget
"""
self.setAcceptDrops(True)
self.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
self.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop)
Registry().register_function(('%s_dnd' % self.mime_data_text), self.parent().load_file)
Registry().register_function(('%s_dnd_internal' % self.mime_data_text), self.parent().dnd_move_internal)
@ -71,7 +71,7 @@ class TreeWidgetWithDnD(QtGui.QTreeWidget):
mime_data = QtCore.QMimeData()
drag.setMimeData(mime_data)
mime_data.setText(self.mime_data_text)
drag.start(QtCore.Qt.CopyAction)
drag.exec(QtCore.Qt.CopyAction)
def dragEnterEvent(self, event):
"""
@ -92,7 +92,7 @@ class TreeWidgetWithDnD(QtGui.QTreeWidget):
:param event: The event that occurred
"""
QtGui.QTreeWidget.dragMoveEvent(self, event)
QtWidgets.QTreeWidget.dragMoveEvent(self, event)
if event.mimeData().hasUrls():
event.setDropAction(QtCore.Qt.CopyAction)
event.accept()

View File

@ -24,7 +24,7 @@ The :mod:`ui` module provides standard UI components for OpenLP.
"""
import logging
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry, UiStrings, translate, is_macosx
from openlp.core.lib import build_icon
@ -41,16 +41,16 @@ def add_welcome_page(parent, image):
:param parent: A ``QWizard`` object to add the welcome page to.
:param image: A splash image for the wizard.
"""
parent.welcome_page = QtGui.QWizardPage()
parent.welcome_page.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(image))
parent.welcome_page = QtWidgets.QWizardPage()
parent.welcome_page.setPixmap(QtWidgets.QWizard.WatermarkPixmap, QtGui.QPixmap(image))
parent.welcome_page.setObjectName('welcome_page')
parent.welcome_layout = QtGui.QVBoxLayout(parent.welcome_page)
parent.welcome_layout = QtWidgets.QVBoxLayout(parent.welcome_page)
parent.welcome_layout.setObjectName('WelcomeLayout')
parent.title_label = QtGui.QLabel(parent.welcome_page)
parent.title_label = QtWidgets.QLabel(parent.welcome_page)
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 = QtWidgets.QLabel(parent.welcome_page)
parent.information_label.setWordWrap(True)
parent.information_label.setObjectName('information_label')
parent.welcome_layout.addWidget(parent.information_label)
@ -67,30 +67,30 @@ def create_button_box(dialog, name, standard_buttons, custom_buttons=None):
:param name: A string which is set as object name.
:param standard_buttons: A list of strings for the used buttons. It might contain: ``ok``, ``save``, ``cancel``,
``close``, and ``defaults``.
:param custom_buttons: A list of additional buttons. If an item is an instance of QtGui.QAbstractButton it is added
with QDialogButtonBox.ActionRole. Otherwise the item has to be a tuple of a Button and a ButtonRole.
:param custom_buttons: A list of additional buttons. If an item is an instance of QtWidgets.QAbstractButton it is
added with QDialogButtonBox.ActionRole. Otherwise the item has to be a tuple of a Button and a ButtonRole.
"""
if custom_buttons is None:
custom_buttons = []
if standard_buttons is None:
standard_buttons = []
buttons = QtGui.QDialogButtonBox.NoButton
buttons = QtWidgets.QDialogButtonBox.NoButton
if 'ok' in standard_buttons:
buttons |= QtGui.QDialogButtonBox.Ok
buttons |= QtWidgets.QDialogButtonBox.Ok
if 'save' in standard_buttons:
buttons |= QtGui.QDialogButtonBox.Save
buttons |= QtWidgets.QDialogButtonBox.Save
if 'cancel' in standard_buttons:
buttons |= QtGui.QDialogButtonBox.Cancel
buttons |= QtWidgets.QDialogButtonBox.Cancel
if 'close' in standard_buttons:
buttons |= QtGui.QDialogButtonBox.Close
buttons |= QtWidgets.QDialogButtonBox.Close
if 'defaults' in standard_buttons:
buttons |= QtGui.QDialogButtonBox.RestoreDefaults
button_box = QtGui.QDialogButtonBox(dialog)
buttons |= QtWidgets.QDialogButtonBox.RestoreDefaults
button_box = QtWidgets.QDialogButtonBox(dialog)
button_box.setObjectName(name)
button_box.setStandardButtons(buttons)
for button in custom_buttons:
if isinstance(button, QtGui.QAbstractButton):
button_box.addButton(button, QtGui.QDialogButtonBox.ActionRole)
if isinstance(button, QtWidgets.QAbstractButton):
button_box.addButton(button, QtWidgets.QDialogButtonBox.ActionRole)
else:
button_box.addButton(*button)
button_box.accepted.connect(dialog.accept)
@ -108,9 +108,9 @@ def critical_error_message_box(title=None, message=None, parent=None, question=F
:param question: Should this message box question the user.
"""
if question:
return QtGui.QMessageBox.critical(parent, UiStrings().Error, message,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No))
return QtWidgets.QMessageBox.critical(parent, UiStrings().Error, message,
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.No))
return Registry().get('main_window').error_message(title if title else UiStrings().Error, message)
@ -121,10 +121,10 @@ def create_horizontal_adjusting_combo_box(parent, name):
:param parent: The parent widget.
:param name: A string set as object name for the combo box.
"""
combo = QtGui.QComboBox(parent)
combo = QtWidgets.QComboBox(parent)
combo.setObjectName(name)
combo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
combo.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToMinimumContentsLength)
combo.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
return combo
@ -167,9 +167,9 @@ def create_button(parent, name, **kwargs):
else:
log.warning('The role "%s" is not defined in create_push_button().', role)
if kwargs.pop('btn_class', '') == 'toolbutton':
button = QtGui.QToolButton(parent)
button = QtWidgets.QToolButton(parent)
else:
button = QtGui.QPushButton(parent)
button = QtWidgets.QPushButton(parent)
button.setObjectName(name)
if kwargs.get('text'):
button.setText(kwargs.pop('text'))
@ -238,7 +238,7 @@ def create_action(parent, name, **kwargs):
``triggers``
A slot which is connected to the actions ``triggered()`` slot.
"""
action = QtGui.QAction(parent)
action = QtWidgets.QAction(parent)
action.setObjectName(name)
if is_macosx():
action.setIconVisibleInMenu(False)
@ -292,7 +292,7 @@ def set_case_insensitive_completer(cache, widget):
:param cache: The list of items to use as suggestions.
:param widget: A widget to set the completer (QComboBox or QLineEdit instance)
"""
completer = QtGui.QCompleter(cache)
completer = QtWidgets.QCompleter(cache)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
widget.setCompleter(completer)
@ -303,9 +303,9 @@ def create_valign_selection_widgets(parent):
:param parent: The parent object. This should be a ``QWidget`` descendant.
"""
label = QtGui.QLabel(parent)
label = QtWidgets.QLabel(parent)
label.setText(translate('OpenLP.Ui', '&Vertical Align:'))
combo_box = QtGui.QComboBox(parent)
combo_box = QtWidgets.QComboBox(parent)
combo_box.addItems([UiStrings().Top, UiStrings().Middle, UiStrings().Bottom])
label.setBuddy(combo_box)
return label, combo_box

View File

@ -22,7 +22,7 @@
"""
The :mod:`ui` module provides the core user interface for OpenLP
"""
from PyQt4 import QtGui
from PyQt5 import QtWidgets
class HideMode(object):
@ -71,7 +71,7 @@ class DisplayControllerType(object):
Plugin = 2
class SingleColumnTableWidget(QtGui.QTableWidget):
class SingleColumnTableWidget(QtWidgets.QTableWidget):
"""
Class to for a single column table widget to use for the verse table widget.
"""
@ -88,7 +88,7 @@ class SingleColumnTableWidget(QtGui.QTableWidget):
"""
Resize the first column together with the widget.
"""
QtGui.QTableWidget.resizeEvent(self, event)
QtWidgets.QTableWidget.resizeEvent(self, event)
if self.columnCount():
self.setColumnWidth(0, event.size().width())
self.resizeRowsToContents()

View File

@ -20,7 +20,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtGui
from PyQt5 import QtGui, QtWidgets
from openlp.core.common import UiStrings, translate
from openlp.core.lib import build_icon
@ -40,37 +40,37 @@ class UiAboutDialog(object):
"""
about_dialog.setObjectName('about_dialog')
about_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
self.about_dialog_layout = QtGui.QVBoxLayout(about_dialog)
self.about_dialog_layout = QtWidgets.QVBoxLayout(about_dialog)
self.about_dialog_layout.setObjectName('about_dialog_layout')
self.logo_label = QtGui.QLabel(about_dialog)
self.logo_label = QtWidgets.QLabel(about_dialog)
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 = QtWidgets.QTabWidget(about_dialog)
self.about_notebook.setObjectName('about_notebook')
self.about_tab = QtGui.QWidget()
self.about_tab = QtWidgets.QWidget()
self.about_tab.setObjectName('about_tab')
self.about_tab_layout = QtGui.QVBoxLayout(self.about_tab)
self.about_tab_layout = QtWidgets.QVBoxLayout(self.about_tab)
self.about_tab_layout.setObjectName('about_tab_layout')
self.about_text_edit = QtGui.QPlainTextEdit(self.about_tab)
self.about_text_edit = QtWidgets.QPlainTextEdit(self.about_tab)
self.about_text_edit.setReadOnly(True)
self.about_text_edit.setObjectName('about_text_edit')
self.about_tab_layout.addWidget(self.about_text_edit)
self.about_notebook.addTab(self.about_tab, '')
self.credits_tab = QtGui.QWidget()
self.credits_tab = QtWidgets.QWidget()
self.credits_tab.setObjectName('credits_tab')
self.credits_tab_layout = QtGui.QVBoxLayout(self.credits_tab)
self.credits_tab_layout = QtWidgets.QVBoxLayout(self.credits_tab)
self.credits_tab_layout.setObjectName('credits_tab_layout')
self.credits_text_edit = QtGui.QPlainTextEdit(self.credits_tab)
self.credits_text_edit = QtWidgets.QPlainTextEdit(self.credits_tab)
self.credits_text_edit.setReadOnly(True)
self.credits_text_edit.setObjectName('credits_text_edit')
self.credits_tab_layout.addWidget(self.credits_text_edit)
self.about_notebook.addTab(self.credits_tab, '')
self.license_tab = QtGui.QWidget()
self.license_tab = QtWidgets.QWidget()
self.license_tab.setObjectName('license_tab')
self.license_tab_layout = QtGui.QVBoxLayout(self.license_tab)
self.license_tab_layout = QtWidgets.QVBoxLayout(self.license_tab)
self.license_tab_layout.setObjectName('license_tab_layout')
self.license_text_edit = QtGui.QPlainTextEdit(self.license_tab)
self.license_text_edit = QtWidgets.QPlainTextEdit(self.license_tab)
self.license_text_edit.setReadOnly(True)
self.license_text_edit.setObjectName('license_text_edit')
self.license_tab_layout.addWidget(self.license_text_edit)
@ -185,8 +185,8 @@ class UiAboutDialog(object):
documentation = translate('OpenLP.AboutForm', 'Documentation')
built_with = translate('OpenLP.AboutForm', 'Built With\n'
' Python: http://www.python.org/\n'
' Qt4: http://qt.io\n'
' PyQt4: http://www.riverbankcomputing.co.uk/software/pyqt/intro\n'
' Qt5: http://qt.io\n'
' PyQt5: http://www.riverbankcomputing.co.uk/software/pyqt/intro\n'
' Oxygen Icons: http://techbase.kde.org/Projects/Oxygen/\n'
' MuPDF: http://www.mupdf.com/\n')
final_credit = translate('OpenLP.AboutForm', 'Final Credit\n'

View File

@ -24,14 +24,14 @@ The About dialog.
"""
import webbrowser
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.lib import translate
from openlp.core.utils import get_application_version
from .aboutdialog import UiAboutDialog
class AboutForm(QtGui.QDialog, UiAboutDialog):
class AboutForm(QtWidgets.QDialog, UiAboutDialog):
"""
The About dialog
"""

View File

@ -27,7 +27,7 @@ import logging
import os
import sys
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import AppLocation, Settings, SlideLimits, UiStrings, translate
from openlp.core.lib import ColorButton, SettingsTab, build_icon
@ -58,108 +58,108 @@ class AdvancedTab(SettingsTab):
"""
self.setObjectName('AdvancedTab')
super(AdvancedTab, self).setupUi()
self.ui_group_box = QtGui.QGroupBox(self.left_column)
self.ui_group_box = QtWidgets.QGroupBox(self.left_column)
self.ui_group_box.setObjectName('ui_group_box')
self.ui_layout = QtGui.QFormLayout(self.ui_group_box)
self.ui_layout = QtWidgets.QFormLayout(self.ui_group_box)
self.ui_layout.setObjectName('ui_layout')
self.recent_label = QtGui.QLabel(self.ui_group_box)
self.recent_label = QtWidgets.QLabel(self.ui_group_box)
self.recent_label.setObjectName('recent_label')
self.recent_spin_box = QtGui.QSpinBox(self.ui_group_box)
self.recent_spin_box = QtWidgets.QSpinBox(self.ui_group_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 = QtWidgets.QCheckBox(self.ui_group_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 = QtWidgets.QCheckBox(self.ui_group_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 = QtWidgets.QCheckBox(self.ui_group_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 = QtWidgets.QCheckBox(self.ui_group_box)
self.expand_service_item_check_box.setObjectName('expand_service_item_check_box')
self.ui_layout.addRow(self.expand_service_item_check_box)
self.search_as_type_check_box = QtGui.QCheckBox(self.ui_group_box)
self.search_as_type_check_box = QtWidgets.QCheckBox(self.ui_group_box)
self.search_as_type_check_box.setObjectName('SearchAsType_check_box')
self.ui_layout.addRow(self.search_as_type_check_box)
self.enable_auto_close_check_box = QtGui.QCheckBox(self.ui_group_box)
self.enable_auto_close_check_box = QtWidgets.QCheckBox(self.ui_group_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 = QtWidgets.QGroupBox(self.left_column)
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_layout = QtWidgets.QFormLayout(self.service_name_group_box)
self.service_name_check_box = QtWidgets.QCheckBox(self.service_name_group_box)
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 = QtWidgets.QLabel(self.service_name_group_box)
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 = QtWidgets.QComboBox(self.service_name_group_box)
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 = QtWidgets.QTimeEdit(self.service_name_group_box)
self.service_name_time.setObjectName('service_name_time')
self.service_name_time_layout = QtGui.QHBoxLayout()
self.service_name_time_layout = QtWidgets.QHBoxLayout()
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 = QtWidgets.QLabel(self.service_name_group_box)
self.service_name_label.setObjectName('service_name_label')
self.service_name_edit = QtGui.QLineEdit(self.service_name_group_box)
self.service_name_edit = QtWidgets.QLineEdit(self.service_name_group_box)
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 = QtWidgets.QToolButton(self.service_name_group_box)
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 = QtWidgets.QHBoxLayout()
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 = QtWidgets.QLabel(self.service_name_group_box)
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 = QtWidgets.QLabel(self.service_name_group_box)
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 = QtWidgets.QGroupBox(self.left_column)
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 = QtWidgets.QFormLayout(self.data_directory_group_box)
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 = QtWidgets.QLabel(self.data_directory_group_box)
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 = QtWidgets.QLabel(self.data_directory_group_box)
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 = QtWidgets.QLabel(self.data_directory_group_box)
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 = QtWidgets.QLineEdit(self.data_directory_group_box)
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 = QtWidgets.QLabel(self.data_directory_group_box)
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 = QtWidgets.QToolButton(self.data_directory_group_box)
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 = QtWidgets.QToolButton(self.data_directory_group_box)
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 = QtWidgets.QToolButton(self.data_directory_group_box)
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 = QtWidgets.QHBoxLayout()
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 = QtWidgets.QHBoxLayout()
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 = QtWidgets.QCheckBox(self.data_directory_group_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()
@ -171,26 +171,26 @@ class AdvancedTab(SettingsTab):
self.left_layout.addWidget(self.data_directory_group_box)
self.left_layout.addStretch()
# Default Image
self.default_image_group_box = QtGui.QGroupBox(self.right_column)
self.default_image_group_box = QtWidgets.QGroupBox(self.right_column)
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 = QtWidgets.QFormLayout(self.default_image_group_box)
self.default_image_layout.setObjectName('default_image_layout')
self.default_color_label = QtGui.QLabel(self.default_image_group_box)
self.default_color_label = QtWidgets.QLabel(self.default_image_group_box)
self.default_color_label.setObjectName('default_color_label')
self.default_color_button = ColorButton(self.default_image_group_box)
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 = QtWidgets.QLabel(self.default_image_group_box)
self.default_file_label.setObjectName('default_file_label')
self.default_file_edit = QtGui.QLineEdit(self.default_image_group_box)
self.default_file_edit = QtWidgets.QLineEdit(self.default_image_group_box)
self.default_file_edit.setObjectName('default_file_edit')
self.default_browse_button = QtGui.QToolButton(self.default_image_group_box)
self.default_browse_button = QtWidgets.QToolButton(self.default_image_group_box)
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 = QtWidgets.QToolButton(self.default_image_group_box)
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 = QtWidgets.QHBoxLayout()
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)
@ -198,41 +198,41 @@ class AdvancedTab(SettingsTab):
self.default_image_layout.addRow(self.default_file_label, self.default_file_layout)
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 = QtWidgets.QGroupBox(self.right_column)
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 = QtWidgets.QVBoxLayout(self.hide_mouse_group_box)
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 = QtWidgets.QCheckBox(self.hide_mouse_group_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 = QtWidgets.QGroupBox(self.right_column)
self.slide_group_box.setObjectName('slide_group_box')
self.slide_layout = QtGui.QVBoxLayout(self.slide_group_box)
self.slide_layout = QtWidgets.QVBoxLayout(self.slide_group_box)
self.slide_layout.setObjectName('slide_layout')
self.slide_label = QtGui.QLabel(self.slide_group_box)
self.slide_label = QtWidgets.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 = QtWidgets.QRadioButton(self.slide_group_box)
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 = QtWidgets.QRadioButton(self.slide_group_box)
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 = QtWidgets.QRadioButton(self.slide_group_box)
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 = QtWidgets.QGroupBox(self.left_column)
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 = QtWidgets.QVBoxLayout(self.display_workaround_group_box)
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 = QtWidgets.QCheckBox(self.display_workaround_group_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 = QtWidgets.QCheckBox(self.display_workaround_group_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)
@ -374,7 +374,7 @@ class AdvancedTab(SettingsTab):
self.current_data_path = AppLocation.get_data_path()
if not os.path.exists(self.current_data_path):
log.error('Data path not found %s' % self.current_data_path)
answer = QtGui.QMessageBox.critical(
answer = QtWidgets.QMessageBox.critical(
self, translate('OpenLP.AdvancedTab', 'Data Directory Error'),
translate('OpenLP.AdvancedTab', 'OpenLP data directory was not found\n\n%s\n\n'
'This data directory was previously changed from the OpenLP '
@ -383,9 +383,9 @@ class AdvancedTab(SettingsTab):
'Click "No" to stop loading OpenLP. allowing you to fix the the problem.\n\n'
'Click "Yes" to reset the data directory to the default '
'location.').replace('%s', self.current_data_path),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.No)
if answer == QtWidgets.QMessageBox.No:
log.info('User requested termination')
self.main_window.clean_up()
sys.exit()
@ -514,8 +514,9 @@ class AdvancedTab(SettingsTab):
Select an image for the default display screen.
"""
file_filters = '%s;;%s (*.*)' % (get_images_filter(), UiStrings().AllFiles)
filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.AdvancedTab', 'Open File'), '',
file_filters)
filename, filter_used = QtWidgets.QFileDialog.getOpenFileName(self,
translate('OpenLP.AdvancedTab', 'Open File'), '',
file_filters)
if filename:
self.default_file_edit.setText(filename)
self.default_file_edit.setFocus()
@ -526,9 +527,10 @@ class AdvancedTab(SettingsTab):
"""
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, options=QtGui.QFileDialog.ShowDirsOnly)
new_data_path = QtWidgets.QFileDialog.getExistingDirectory(self, translate('OpenLP.AdvancedTab',
'Select Data Directory Location'),
old_root_path,
options=QtWidgets.QFileDialog.ShowDirsOnly)
# Set the new data path.
if new_data_path:
new_data_path = os.path.normpath(new_data_path)
@ -538,15 +540,15 @@ class AdvancedTab(SettingsTab):
else:
return
# Make sure they want to change the data.
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Confirm Data Directory Change'),
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the '
'location of the OpenLP data directory to:\n\n%s\n\nThe data '
'directory will be changed when OpenLP is closed.').
replace('%s', new_data_path),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer != QtGui.QMessageBox.Yes:
answer = QtWidgets.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Confirm Data Directory Change'),
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the '
'location of the OpenLP data directory to:\n\n%s\n\nThe data '
'directory will be changed when OpenLP is closed.').
replace('%s', new_data_path),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.No)
if answer != QtWidgets.QMessageBox.Yes:
return
# Check if data already exists here.
self.check_data_overwrite(new_data_path)
@ -563,15 +565,16 @@ class AdvancedTab(SettingsTab):
if self.current_data_path.lower() != new_data_path.lower():
# Make sure they want to change the data location back to the
# default.
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the '
'location of the OpenLP data directory to the default '
'location?\n\nThis location will be used after OpenLP is '
'closed.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer != QtGui.QMessageBox.Yes:
answer = QtWidgets.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
translate('OpenLP.AdvancedTab', 'Are you sure you want to change '
'the location of the OpenLP data '
'directory to the default location?'
'\n\nThis location will be used '
'after OpenLP is closed.'),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.No)
if answer != QtWidgets.QMessageBox.Yes:
return
self.check_data_overwrite(new_data_path)
# Save the new location.
@ -602,17 +605,17 @@ class AdvancedTab(SettingsTab):
if os.path.exists(test_path):
self.data_exists = True
# Check is they want to replace existing data.
answer = QtGui.QMessageBox.warning(self,
translate('OpenLP.AdvancedTab', 'Overwrite Existing Data'),
translate('OpenLP.AdvancedTab',
'WARNING: \n\nThe location you have selected \n\n%s\n\n'
'appears to contain OpenLP data files. Do you wish to '
'replace these files with the current data files?').
replace('%s', os.path.abspath(data_path,)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.Yes:
answer = QtWidgets.QMessageBox.warning(self,
translate('OpenLP.AdvancedTab', 'Overwrite Existing Data'),
translate('OpenLP.AdvancedTab',
'WARNING: \n\nThe location you have selected \n\n%s\n\n'
'appears to contain OpenLP data files. Do you wish to '
'replace these files with the current data files?').
replace('%s', os.path.abspath(data_path,)),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.No)
if answer == QtWidgets.QMessageBox.Yes:
self.data_directory_copy_check_box.setChecked(True)
self.new_data_directory_has_files_label.show()
else:
@ -648,9 +651,10 @@ class AdvancedTab(SettingsTab):
:param checked: The state of the check box (boolean).
"""
QtGui.QMessageBox.information(self, translate('OpenLP.AdvancedTab', 'Restart Required'),
translate('OpenLP.AdvancedTab', 'This change will only take effect once OpenLP '
'has been restarted.'))
QtWidgets.QMessageBox.information(self, translate('OpenLP.AdvancedTab', 'Restart Required'),
translate('OpenLP.AdvancedTab',
'This change will only take effect once OpenLP '
'has been restarted.'))
def on_end_slide_button_clicked(self):
"""

View File

@ -23,7 +23,7 @@
The GUI widgets of the exception dialog.
"""
from PyQt4 import QtGui
from PyQt5 import QtGui, QtWidgets
from openlp.core.lib import translate, build_icon
from openlp.core.lib.ui import create_button, create_button_box
@ -39,32 +39,32 @@ class Ui_ExceptionDialog(object):
"""
exception_dialog.setObjectName('exception_dialog')
exception_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
self.exception_layout = QtGui.QVBoxLayout(exception_dialog)
self.exception_layout = QtWidgets.QVBoxLayout(exception_dialog)
self.exception_layout.setObjectName('exception_layout')
self.message_layout = QtGui.QHBoxLayout()
self.message_layout = QtWidgets.QHBoxLayout()
self.message_layout.setObjectName('messageLayout')
self.message_layout.addSpacing(12)
self.bug_label = QtGui.QLabel(exception_dialog)
self.bug_label = QtWidgets.QLabel(exception_dialog)
self.bug_label.setPixmap(QtGui.QPixmap(':/graphics/exception.png'))
self.bug_label.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.bug_label.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
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 = QtWidgets.QLabel(exception_dialog)
self.message_label.setWordWrap(True)
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 = QtWidgets.QLabel(exception_dialog)
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 = QtWidgets.QPlainTextEdit(exception_dialog)
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 = QtWidgets.QLabel(exception_dialog)
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 = QtWidgets.QPlainTextEdit(exception_dialog)
self.exception_text_edit.setReadOnly(True)
self.exception_text_edit.setObjectName('exception_text_edit')
self.exception_layout.addWidget(self.exception_text_edit)

View File

@ -33,13 +33,8 @@ from lxml import etree
from openlp.core.common import RegistryProperties, is_linux
from PyQt4 import Qt, QtCore, QtGui, QtWebKit
from PyQt5 import Qt, QtCore, QtGui, QtWebKit, QtWidgets
try:
from PyQt4.phonon import Phonon
PHONON_VERSION = Phonon.phononVersion()
except ImportError:
PHONON_VERSION = '-'
try:
import migrate
MIGRATE_VERSION = getattr(migrate, '__version__', '< 0.7')
@ -86,7 +81,7 @@ from .exceptiondialog import Ui_ExceptionDialog
log = logging.getLogger(__name__)
class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
class ExceptionForm(QtWidgets.QDialog, Ui_ExceptionDialog, RegistryProperties):
"""
The exception dialog
"""
@ -98,14 +93,14 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
self.setupUi(self)
self.settings_section = 'crashreport'
def exec_(self):
def exec(self):
"""
Show the dialog.
"""
self.description_text_edit.setPlainText('')
self.on_description_updated()
self.file_attachment = None
return QtGui.QDialog.exec_(self)
return QtWidgets.QDialog.exec(self)
def _create_report(self):
"""
@ -116,9 +111,8 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
traceback = self.exception_text_edit.toPlainText()
system = translate('OpenLP.ExceptionForm', 'Platform: %s\n') % platform.platform()
libraries = 'Python: %s\n' % platform.python_version() + \
'Qt4: %s\n' % Qt.qVersion() + \
'Phonon: %s\n' % PHONON_VERSION + \
'PyQt4: %s\n' % Qt.PYQT_VERSION_STR + \
'Qt5: %s\n' % Qt.qVersion() + \
'PyQt5: %s\n' % Qt.PYQT_VERSION_STR + \
'QtWebkit: %s\n' % WEBKIT_VERSION + \
'SQLAlchemy: %s\n' % sqlalchemy.__version__ + \
'SQLAlchemy Migrate: %s\n' % MIGRATE_VERSION + \
@ -150,11 +144,11 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
'--- Exception Traceback ---\n%s\n'
'--- System information ---\n%s\n'
'--- Library Versions ---\n%s\n')
filename = QtGui.QFileDialog.getSaveFileName(
filename = QtWidgets.QFileDialog.getSaveFileName(
self,
translate('OpenLP.ExceptionForm', 'Save Crash Report'),
Settings().value(self.settings_section + '/last directory'),
translate('OpenLP.ExceptionForm', 'Text files (*.txt *.log *.text)'))
translate('OpenLP.ExceptionForm', 'Text files (*.txt *.log *.text)'))[0]
if filename:
filename = str(filename).replace('/', os.path.sep)
Settings().setValue(self.settings_section + '/last directory', os.path.dirname(filename))
@ -195,7 +189,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
if ':' in line:
exception = line.split('\n')[-1].split(':')[0]
subject = 'Bug report: %s in %s' % (exception, source)
mail_to_url = QtCore.QUrl('mailto:bugs@openlp.org')
mail_to_url = QtCore.QUrlQuery('mailto:bugs@openlp.org')
mail_to_url.addQueryItem('subject', subject)
mail_to_url.addQueryItem('body', body % content)
if self.file_attachment:
@ -219,9 +213,12 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
"""
Attache files to the bug report e-mail.
"""
files = QtGui.QFileDialog.getOpenFileName(self, translate('ImagePlugin.ExceptionDialog', 'Select Attachment'),
Settings().value(self.settings_section + '/last directory'),
'%s (*)' % UiStrings().AllFiles)
files, filter_used = QtWidgets.QFileDialog.getOpenFileName(self,
translate('ImagePlugin.ExceptionDialog',
'Select Attachment'),
Settings().value(self.settings_section +
'/last directory'),
'%s (*)' % UiStrings().AllFiles)
log.info('New files(s) %s', str(files))
if files:
self.file_attachment = str(files)

View File

@ -22,7 +22,7 @@
"""
The UI widgets for the rename dialog
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.lib import translate, build_icon
from openlp.core.lib.ui import create_button_box
@ -39,12 +39,12 @@ class Ui_FileRenameDialog(object):
file_rename_dialog.setObjectName('file_rename_dialog')
file_rename_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
file_rename_dialog.resize(300, 10)
self.dialog_layout = QtGui.QGridLayout(file_rename_dialog)
self.dialog_layout = QtWidgets.QGridLayout(file_rename_dialog)
self.dialog_layout.setObjectName('dialog_layout')
self.file_name_label = QtGui.QLabel(file_rename_dialog)
self.file_name_label = QtWidgets.QLabel(file_rename_dialog)
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 = QtWidgets.QLineEdit(file_rename_dialog)
self.file_name_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self))
self.file_name_edit.setObjectName('file_name_edit')
self.dialog_layout.addWidget(self.file_name_edit, 0, 1)

View File

@ -23,14 +23,14 @@
The file rename dialog.
"""
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from .filerenamedialog import Ui_FileRenameDialog
from openlp.core.common import Registry, RegistryProperties, translate
class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog, RegistryProperties):
class FileRenameForm(QtWidgets.QDialog, Ui_FileRenameDialog, RegistryProperties):
"""
The file rename dialog
"""
@ -47,7 +47,7 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog, RegistryProperties):
"""
self.setupUi(self)
def exec_(self, copy=False):
def exec(self, copy=False):
"""
Run the Dialog with correct heading.
"""
@ -56,4 +56,4 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog, RegistryProperties):
else:
self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Rename'))
self.file_name_edit.setFocus()
return QtGui.QDialog.exec_(self)
return QtWidgets.QDialog.exec(self)

View File

@ -33,7 +33,7 @@ import urllib.error
from tempfile import gettempdir
from configparser import ConfigParser, MissingSectionHeaderError, NoSectionError, NoOptionError
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, check_directory_exists, \
translate, clean_button_text, trace_error_handler
@ -91,7 +91,7 @@ class ThemeScreenshotWorker(QtCore.QObject):
self.was_download_cancelled = toggle
class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
"""
This is the Theme Import Wizard, which allows easy creation and editing of OpenLP themes.
"""
@ -151,12 +151,12 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
else:
return self.get_next_page_id()
def exec_(self):
def exec(self):
"""
Run the wizard.
"""
self.set_defaults()
return QtGui.QWizard.exec_(self)
return QtWidgets.QWizard.exec(self)
def initialize(self, screens):
"""
@ -182,14 +182,14 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
try:
web_config = get_web_page('%s%s' % (self.web, 'download.cfg'), header=('User-Agent', user_agent))
except (urllib.error.URLError, ConnectionError) as err:
msg = QtGui.QMessageBox()
msg = QtWidgets.QMessageBox()
title = translate('OpenLP.FirstTimeWizard', 'Network Error')
msg.setText('{} {}'.format(title, err.code if hasattr(err, 'code') else ''))
msg.setInformativeText(translate('OpenLP.FirstTimeWizard',
'There was a network error attempting to '
'connect to retrieve initial configuration information'))
msg.setStandardButtons(msg.Ok)
ans = msg.exec_()
ans = msg.exec()
web_config = False
if web_config:
files = web_config.read()
@ -226,7 +226,7 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
title = self.config.get('songs_%s' % song, 'title')
filename = self.config.get('songs_%s' % song, 'filename')
sha256 = self.config.get('songs_%s' % song, 'sha256', fallback='')
item = QtGui.QListWidgetItem(title, self.songs_list_widget)
item = QtWidgets.QListWidgetItem(title, self.songs_list_widget)
item.setData(QtCore.Qt.UserRole, (filename, sha256))
item.setCheckState(QtCore.Qt.Unchecked)
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
@ -235,7 +235,7 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
for lang in bible_languages:
self.application.process_events()
language = self.config.get('bibles_%s' % lang, 'title')
lang_item = QtGui.QTreeWidgetItem(self.bibles_tree_widget, [language])
lang_item = QtWidgets.QTreeWidgetItem(self.bibles_tree_widget, [language])
bibles = self.config.get('bibles_%s' % lang, 'translations')
bibles = bibles.split(',')
for bible in bibles:
@ -243,7 +243,7 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
title = self.config.get('bible_%s' % bible, 'title')
filename = self.config.get('bible_%s' % bible, 'filename')
sha256 = self.config.get('bible_%s' % bible, 'sha256', fallback='')
item = QtGui.QTreeWidgetItem(lang_item, [title])
item = QtWidgets.QTreeWidgetItem(lang_item, [title])
item.setData(0, QtCore.Qt.UserRole, (filename, sha256))
item.setCheckState(0, QtCore.Qt.Unchecked)
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
@ -370,7 +370,7 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
:param title: The title of the theme
:param filename: The filename of the theme
"""
item = QtGui.QListWidgetItem(title, self.themes_list_widget)
item = QtWidgets.QListWidgetItem(title, self.themes_list_widget)
item.setData(QtCore.Qt.UserRole, (filename, sha256))
item.setCheckState(QtCore.Qt.Unchecked)
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
@ -510,7 +510,7 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
size = self._get_file_size('%s%s' % (self.songs_url, filename))
self.max_progress += size
# Loop through the Bibles list and increase for each selected item
iterator = QtGui.QTreeWidgetItemIterator(self.bibles_tree_widget)
iterator = QtWidgets.QTreeWidgetItemIterator(self.bibles_tree_widget)
while iterator.value():
self.application.process_events()
item = iterator.value()
@ -562,20 +562,20 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
if self.has_run_wizard:
self.progress_label.setText(translate('OpenLP.FirstTimeWizard',
'Download complete. Click the %s button to return to OpenLP.') %
clean_button_text(self.buttonText(QtGui.QWizard.FinishButton)))
clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton)))
else:
self.progress_label.setText(translate('OpenLP.FirstTimeWizard',
'Download complete. Click the %s button to start OpenLP.') %
clean_button_text(self.buttonText(QtGui.QWizard.FinishButton)))
clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton)))
else:
if self.has_run_wizard:
self.progress_label.setText(translate('OpenLP.FirstTimeWizard',
'Click the %s button to return to OpenLP.') %
clean_button_text(self.buttonText(QtGui.QWizard.FinishButton)))
clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton)))
else:
self.progress_label.setText(translate('OpenLP.FirstTimeWizard',
'Click the %s button to start OpenLP.') %
clean_button_text(self.buttonText(QtGui.QWizard.FinishButton)))
clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton)))
self.finish_button.setVisible(True)
self.finish_button.setEnabled(True)
self.cancel_button.setVisible(False)
@ -631,7 +631,7 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
if not self.url_get_file('%s%s' % (self.songs_url, filename), destination, sha256):
missed_files.append('Song: {}'.format(filename))
# Download Bibles
bibles_iterator = QtGui.QTreeWidgetItemIterator(self.bibles_tree_widget)
bibles_iterator = QtWidgets.QTreeWidgetItemIterator(self.bibles_tree_widget)
while bibles_iterator.value():
item = bibles_iterator.value()
if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
@ -656,15 +656,15 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
file_list = ''
for entry in missed_files:
file_list += '{}<br \>'.format(entry)
msg = QtGui.QMessageBox()
msg.setIcon(QtGui.QMessageBox.Warning)
msg = QtWidgets.QMessageBox()
msg.setIcon(QtWidgets.QMessageBox.Warning)
msg.setWindowTitle(translate('OpenLP.FirstTimeWizard', 'Network Error'))
msg.setText(translate('OpenLP.FirstTimeWizard', 'Unable to download some files'))
msg.setInformativeText(translate('OpenLP.FirstTimeWizard',
'The following files were not able to be '
'downloaded:<br \>{}'.format(file_list)))
msg.setStandardButtons(msg.Ok)
ans = msg.exec_()
ans = msg.exec()
return True
def _set_plugin_status(self, field, tag):

View File

@ -22,7 +22,7 @@
"""
The UI widgets of the language selection dialog.
"""
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import translate
from openlp.core.lib import build_icon
@ -40,20 +40,20 @@ class Ui_FirstTimeLanguageDialog(object):
language_dialog.setObjectName('language_dialog')
language_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
language_dialog.resize(300, 50)
self.dialog_layout = QtGui.QVBoxLayout(language_dialog)
self.dialog_layout = QtWidgets.QVBoxLayout(language_dialog)
self.dialog_layout.setContentsMargins(8, 8, 8, 8)
self.dialog_layout.setSpacing(8)
self.dialog_layout.setObjectName('dialog_layout')
self.info_label = QtGui.QLabel(language_dialog)
self.info_label = QtWidgets.QLabel(language_dialog)
self.info_label.setObjectName('info_label')
self.dialog_layout.addWidget(self.info_label)
self.language_layout = QtGui.QHBoxLayout()
self.language_layout = QtWidgets.QHBoxLayout()
self.language_layout.setObjectName('language_layout')
self.language_label = QtGui.QLabel(language_dialog)
self.language_label = QtWidgets.QLabel(language_dialog)
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 = QtWidgets.QComboBox(language_dialog)
self.language_combo_box.setSizeAdjustPolicy(QtWidgets.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)

View File

@ -22,14 +22,14 @@
"""
The language selection dialog.
"""
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.lib.ui import create_action
from openlp.core.utils import LanguageManager
from .firsttimelanguagedialog import Ui_FirstTimeLanguageDialog
class FirstTimeLanguageForm(QtGui.QDialog, Ui_FirstTimeLanguageDialog):
class FirstTimeLanguageForm(QtWidgets.QDialog, Ui_FirstTimeLanguageDialog):
"""
The language selection dialog.
"""
@ -43,11 +43,11 @@ class FirstTimeLanguageForm(QtGui.QDialog, Ui_FirstTimeLanguageDialog):
self.language_combo_box.addItem('Autodetect')
self.language_combo_box.addItems(sorted(self.qm_list.keys()))
def exec_(self):
def exec(self):
"""
Run the Dialog with correct heading.
"""
return QtGui.QDialog.exec_(self)
return QtWidgets.QDialog.exec(self)
def accept(self):
"""
@ -61,7 +61,7 @@ class FirstTimeLanguageForm(QtGui.QDialog, Ui_FirstTimeLanguageDialog):
LanguageManager.auto_language = False
action = create_action(None, self.language_combo_box.currentText())
LanguageManager.set_language(action, False)
return QtGui.QDialog.accept(self)
return QtWidgets.QDialog.accept(self)
def reject(self):
"""
@ -69,4 +69,4 @@ class FirstTimeLanguageForm(QtGui.QDialog, Ui_FirstTimeLanguageDialog):
"""
LanguageManager.auto_language = True
LanguageManager.set_language(False, False)
return QtGui.QDialog.reject(self)
return QtWidgets.QDialog.reject(self)

View File

@ -22,7 +22,7 @@
"""
The UI widgets for the first time wizard.
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import translate, is_macosx, clean_button_text
from openlp.core.lib import build_icon
@ -58,118 +58,118 @@ class UiFirstTimeWizard(object):
first_time_wizard.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
first_time_wizard.resize(550, 386)
first_time_wizard.setModal(True)
first_time_wizard.setOptions(QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage |
QtGui.QWizard.NoBackButtonOnLastPage | QtGui.QWizard.HaveCustomButton1 |
QtGui.QWizard.HaveCustomButton2)
first_time_wizard.setOptions(QtWidgets.QWizard.IndependentPages | QtWidgets.QWizard.NoBackButtonOnStartPage |
QtWidgets.QWizard.NoBackButtonOnLastPage | QtWidgets.QWizard.HaveCustomButton1 |
QtWidgets.QWizard.HaveCustomButton2)
if is_macosx():
first_time_wizard.setPixmap(QtGui.QWizard.BackgroundPixmap,
first_time_wizard.setPixmap(QtWidgets.QWizard.BackgroundPixmap,
QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
first_time_wizard.resize(634, 386)
else:
first_time_wizard.setWizardStyle(QtGui.QWizard.ModernStyle)
self.finish_button = self.button(QtGui.QWizard.FinishButton)
self.no_internet_finish_button = self.button(QtGui.QWizard.CustomButton1)
self.cancel_button = self.button(QtGui.QWizard.CancelButton)
self.no_internet_cancel_button = self.button(QtGui.QWizard.CustomButton2)
self.next_button = self.button(QtGui.QWizard.NextButton)
self.back_button = self.button(QtGui.QWizard.BackButton)
first_time_wizard.setWizardStyle(QtWidgets.QWizard.ModernStyle)
self.finish_button = self.button(QtWidgets.QWizard.FinishButton)
self.no_internet_finish_button = self.button(QtWidgets.QWizard.CustomButton1)
self.cancel_button = self.button(QtWidgets.QWizard.CancelButton)
self.no_internet_cancel_button = self.button(QtWidgets.QWizard.CustomButton2)
self.next_button = self.button(QtWidgets.QWizard.NextButton)
self.back_button = self.button(QtWidgets.QWizard.BackButton)
add_welcome_page(first_time_wizard, ':/wizards/wizard_firsttime.bmp')
# The download page
self.download_page = QtGui.QWizardPage()
self.download_page = QtWidgets.QWizardPage()
self.download_page.setObjectName('download_page')
self.download_layout = QtGui.QVBoxLayout(self.download_page)
self.download_layout.setMargin(48)
self.download_layout = QtWidgets.QVBoxLayout(self.download_page)
self.download_layout.setContentsMargins(48, 48, 48, 48)
self.download_layout.setObjectName('download_layout')
self.download_label = QtGui.QLabel(self.download_page)
self.download_label = QtWidgets.QLabel(self.download_page)
self.download_label.setObjectName('download_label')
self.download_layout.addWidget(self.download_label)
first_time_wizard.setPage(FirstTimePage.Download, self.download_page)
# The "you don't have an internet connection" page.
self.no_internet_page = QtGui.QWizardPage()
self.no_internet_page = QtWidgets.QWizardPage()
self.no_internet_page.setObjectName('no_internet_page')
self.no_internet_layout = QtGui.QVBoxLayout(self.no_internet_page)
self.no_internet_layout = QtWidgets.QVBoxLayout(self.no_internet_page)
self.no_internet_layout.setContentsMargins(50, 30, 50, 40)
self.no_internet_layout.setObjectName('no_internet_layout')
self.no_internet_label = QtGui.QLabel(self.no_internet_page)
self.no_internet_label = QtWidgets.QLabel(self.no_internet_page)
self.no_internet_label.setWordWrap(True)
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 plugins page
self.plugin_page = QtGui.QWizardPage()
self.plugin_page = QtWidgets.QWizardPage()
self.plugin_page.setObjectName('plugin_page')
self.plugin_layout = QtGui.QVBoxLayout(self.plugin_page)
self.plugin_layout = QtWidgets.QVBoxLayout(self.plugin_page)
self.plugin_layout.setContentsMargins(40, 15, 40, 0)
self.plugin_layout.setObjectName('plugin_layout')
self.songs_check_box = QtGui.QCheckBox(self.plugin_page)
self.songs_check_box = QtWidgets.QCheckBox(self.plugin_page)
self.songs_check_box.setChecked(True)
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 = QtWidgets.QCheckBox(self.plugin_page)
self.custom_check_box.setChecked(True)
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 = QtWidgets.QCheckBox(self.plugin_page)
self.bible_check_box.setChecked(True)
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 = QtWidgets.QCheckBox(self.plugin_page)
self.image_check_box.setChecked(True)
self.image_check_box.setObjectName('image_check_box')
self.plugin_layout.addWidget(self.image_check_box)
self.presentation_check_box = QtGui.QCheckBox(self.plugin_page)
self.presentation_check_box = QtWidgets.QCheckBox(self.plugin_page)
self.presentation_check_box.setChecked(True)
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 = QtWidgets.QCheckBox(self.plugin_page)
self.media_check_box.setChecked(True)
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 = QtWidgets.QCheckBox(self.plugin_page)
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 = QtWidgets.QCheckBox(self.plugin_page)
self.song_usage_check_box.setChecked(True)
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 = QtWidgets.QCheckBox(self.plugin_page)
self.alert_check_box.setChecked(True)
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 song samples page
self.songs_page = QtGui.QWizardPage()
self.songs_page = QtWidgets.QWizardPage()
self.songs_page.setObjectName('songs_page')
self.songs_layout = QtGui.QVBoxLayout(self.songs_page)
self.songs_layout = QtWidgets.QVBoxLayout(self.songs_page)
self.songs_layout.setContentsMargins(50, 20, 50, 20)
self.songs_layout.setObjectName('songs_layout')
self.songs_list_widget = QtGui.QListWidget(self.songs_page)
self.songs_list_widget = QtWidgets.QListWidget(self.songs_page)
self.songs_list_widget.setAlternatingRowColors(True)
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 = QtWidgets.QWizardPage()
self.bibles_page.setObjectName('bibles_page')
self.bibles_layout = QtGui.QVBoxLayout(self.bibles_page)
self.bibles_layout = QtWidgets.QVBoxLayout(self.bibles_page)
self.bibles_layout.setContentsMargins(50, 20, 50, 20)
self.bibles_layout.setObjectName('bibles_layout')
self.bibles_tree_widget = QtGui.QTreeWidget(self.bibles_page)
self.bibles_tree_widget = QtWidgets.QTreeWidget(self.bibles_page)
self.bibles_tree_widget.setAlternatingRowColors(True)
self.bibles_tree_widget.header().setVisible(False)
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 = QtWidgets.QWizardPage()
self.themes_page.setObjectName('themes_page')
self.themes_layout = QtGui.QVBoxLayout(self.themes_page)
self.themes_layout = QtWidgets.QVBoxLayout(self.themes_page)
self.themes_layout.setContentsMargins(20, 50, 20, 60)
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)
self.themes_list_widget.setFlow(QtGui.QListView.LeftToRight)
self.themes_list_widget = QtWidgets.QListWidget(self.themes_page)
self.themes_list_widget.setViewMode(QtWidgets.QListView.IconMode)
self.themes_list_widget.setMovement(QtWidgets.QListView.Static)
self.themes_list_widget.setFlow(QtWidgets.QListView.LeftToRight)
self.themes_list_widget.setSpacing(4)
self.themes_list_widget.setUniformItemSizes(True)
self.themes_list_widget.setIconSize(QtCore.QSize(133, 100))
@ -178,37 +178,37 @@ class UiFirstTimeWizard(object):
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 = QtWidgets.QWizardPage()
self.defaults_page.setObjectName('defaults_page')
self.defaults_layout = QtGui.QFormLayout(self.defaults_page)
self.defaults_layout = QtWidgets.QFormLayout(self.defaults_page)
self.defaults_layout.setContentsMargins(50, 20, 50, 20)
self.defaults_layout.setObjectName('defaults_layout')
self.display_label = QtGui.QLabel(self.defaults_page)
self.display_label = QtWidgets.QLabel(self.defaults_page)
self.display_label.setObjectName('display_label')
self.display_combo_box = QtGui.QComboBox(self.defaults_page)
self.display_combo_box = QtWidgets.QComboBox(self.defaults_page)
self.display_combo_box.setEditable(False)
self.display_combo_box.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.display_combo_box.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
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 = QtWidgets.QLabel(self.defaults_page)
self.theme_label.setObjectName('theme_label')
self.theme_combo_box = QtGui.QComboBox(self.defaults_page)
self.theme_combo_box = QtWidgets.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.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
self.theme_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
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 = QtWidgets.QWizardPage()
self.progress_page.setObjectName('progress_page')
self.progress_layout = QtGui.QVBoxLayout(self.progress_page)
self.progress_layout.setMargin(48)
self.progress_layout = QtWidgets.QVBoxLayout(self.progress_page)
self.progress_layout.setContentsMargins(48, 48, 48, 48)
self.progress_layout.setObjectName('progress_layout')
self.progress_label = QtGui.QLabel(self.progress_page)
self.progress_label = QtWidgets.QLabel(self.progress_page)
self.progress_label.setObjectName('progress_label')
self.progress_layout.addWidget(self.progress_label)
self.progress_bar = QtGui.QProgressBar(self.progress_page)
self.progress_bar = QtWidgets.QProgressBar(self.progress_page)
self.progress_bar.setObjectName('progress_bar')
self.progress_layout.addWidget(self.progress_bar)
first_time_wizard.setPage(FirstTimePage.Progress, self.progress_page)
@ -226,7 +226,7 @@ class UiFirstTimeWizard(object):
first_time_wizard.information_label.setText(
translate('OpenLP.FirstTimeWizard', 'This wizard will help you to configure OpenLP for initial use. '
'Click the %s button below to start.') %
clean_button_text(first_time_wizard.buttonText(QtGui.QWizard.NextButton)))
clean_button_text(first_time_wizard.buttonText(QtWidgets.QWizard.NextButton)))
self.download_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Downloading Resource Index'))
self.download_page.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Please wait while the resource index is '
'downloaded.'))
@ -256,7 +256,7 @@ class UiFirstTimeWizard(object):
self.cancel_wizard_text = translate('OpenLP.FirstTimeWizard',
'\n\nTo cancel the First Time Wizard completely (and not start OpenLP), '
'click the %s button now.') % \
clean_button_text(first_time_wizard.buttonText(QtGui.QWizard.CancelButton))
clean_button_text(first_time_wizard.buttonText(QtWidgets.QWizard.CancelButton))
self.songs_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Songs'))
self.songs_page.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select and download public domain songs.'))
self.bibles_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Bibles'))
@ -272,5 +272,5 @@ class UiFirstTimeWizard(object):
self.progress_page.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Please wait while resources are downloaded '
'and OpenLP is configured.'))
self.progress_label.setText(translate('OpenLP.FirstTimeWizard', 'Starting configuration process...'))
first_time_wizard.setButtonText(QtGui.QWizard.CustomButton1, translate('OpenLP.FirstTimeWizard', 'Finish'))
first_time_wizard.setButtonText(QtGui.QWizard.CustomButton2, translate('OpenLP.FirstTimeWizard', 'Cancel'))
first_time_wizard.setButtonText(QtWidgets.QWizard.CustomButton1, translate('OpenLP.FirstTimeWizard', 'Finish'))
first_time_wizard.setButtonText(QtWidgets.QWizard.CustomButton2, translate('OpenLP.FirstTimeWizard', 'Cancel'))

View File

@ -22,7 +22,7 @@
"""
The UI widgets for the formatting tags window.
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import UiStrings, translate
from openlp.core.lib import build_icon
@ -40,66 +40,66 @@ class Ui_FormattingTagDialog(object):
formatting_tag_dialog.setObjectName('formatting_tag_dialog')
formatting_tag_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
formatting_tag_dialog.resize(725, 548)
self.list_data_grid_layout = QtGui.QVBoxLayout(formatting_tag_dialog)
self.list_data_grid_layout.setMargin(8)
self.list_data_grid_layout = QtWidgets.QVBoxLayout(formatting_tag_dialog)
self.list_data_grid_layout.setContentsMargins(8, 8, 8, 8)
self.list_data_grid_layout.setObjectName('list_data_grid_layout')
self.tag_table_widget_read_label = QtGui.QLabel()
self.tag_table_widget_read_label = QtWidgets.QLabel()
self.list_data_grid_layout.addWidget(self.tag_table_widget_read_label)
self.tag_table_widget_read = QtGui.QTableWidget(formatting_tag_dialog)
self.tag_table_widget_read = QtWidgets.QTableWidget(formatting_tag_dialog)
self.tag_table_widget_read.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.tag_table_widget_read.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.tag_table_widget_read.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
self.tag_table_widget_read.setAlternatingRowColors(True)
self.tag_table_widget_read.setCornerButtonEnabled(False)
self.tag_table_widget_read.setObjectName('tag_table_widget_read')
self.tag_table_widget_read.setColumnCount(4)
self.tag_table_widget_read.setRowCount(0)
self.tag_table_widget_read.horizontalHeader().setStretchLastSection(True)
item = QtGui.QTableWidgetItem()
item = QtWidgets.QTableWidgetItem()
self.tag_table_widget_read.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
item = QtWidgets.QTableWidgetItem()
self.tag_table_widget_read.setHorizontalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
item = QtWidgets.QTableWidgetItem()
self.tag_table_widget_read.setHorizontalHeaderItem(2, item)
item = QtGui.QTableWidgetItem()
item = QtWidgets.QTableWidgetItem()
self.tag_table_widget_read.setHorizontalHeaderItem(3, item)
self.list_data_grid_layout.addWidget(self.tag_table_widget_read)
self.tag_table_widget_label = QtGui.QLabel()
self.tag_table_widget_label = QtWidgets.QLabel()
self.list_data_grid_layout.addWidget(self.tag_table_widget_label)
self.tag_table_widget = QtGui.QTableWidget(formatting_tag_dialog)
self.tag_table_widget = QtWidgets.QTableWidget(formatting_tag_dialog)
self.tag_table_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.tag_table_widget.setEditTriggers(QtGui.QAbstractItemView.AllEditTriggers)
self.tag_table_widget.setEditTriggers(QtWidgets.QAbstractItemView.AllEditTriggers)
self.tag_table_widget.setAlternatingRowColors(True)
self.tag_table_widget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
self.tag_table_widget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
self.tag_table_widget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.tag_table_widget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.tag_table_widget.setCornerButtonEnabled(False)
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)
item = QtGui.QTableWidgetItem()
item = QtWidgets.QTableWidgetItem()
self.tag_table_widget.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
item = QtWidgets.QTableWidgetItem()
self.tag_table_widget.setHorizontalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
item = QtWidgets.QTableWidgetItem()
self.tag_table_widget.setHorizontalHeaderItem(2, item)
item = QtGui.QTableWidgetItem()
item = QtWidgets.QTableWidgetItem()
self.tag_table_widget.setHorizontalHeaderItem(3, item)
self.list_data_grid_layout.addWidget(self.tag_table_widget)
self.edit_button_layout = QtGui.QHBoxLayout()
self.new_button = QtGui.QPushButton(formatting_tag_dialog)
self.edit_button_layout = QtWidgets.QHBoxLayout()
self.new_button = QtWidgets.QPushButton(formatting_tag_dialog)
self.new_button.setIcon(build_icon(':/general/general_new.png'))
self.new_button.setObjectName('new_button')
self.edit_button_layout.addWidget(self.new_button)
self.delete_button = QtGui.QPushButton(formatting_tag_dialog)
self.delete_button = QtWidgets.QPushButton(formatting_tag_dialog)
self.delete_button.setIcon(build_icon(':/general/general_delete.png'))
self.delete_button.setObjectName('delete_button')
self.edit_button_layout.addWidget(self.delete_button)
self.edit_button_layout.addStretch()
self.list_data_grid_layout.addLayout(self.edit_button_layout)
self.button_box = create_button_box(formatting_tag_dialog, 'button_box', ['cancel', 'save', 'defaults'])
self.save_button = self.button_box.button(QtGui.QDialogButtonBox.Save)
self.save_button = self.button_box.button(QtWidgets.QDialogButtonBox.Save)
self.save_button.setObjectName('save_button')
self.restore_button = self.button_box.button(QtGui.QDialogButtonBox.RestoreDefaults)
self.restore_button = self.button_box.button(QtWidgets.QDialogButtonBox.RestoreDefaults)
self.restore_button.setIcon(build_icon(':/general/general_revert.png'))
self.restore_button.setObjectName('restore_button')
self.list_data_grid_layout.addWidget(self.button_box)

View File

@ -25,7 +25,7 @@ Custom tags can be defined and saved. The Custom Tag arrays are saved in a json
Base Tags cannot be changed.
"""
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import translate
from openlp.core.lib import FormattingTags
@ -43,7 +43,7 @@ class EditColumn(object):
EndHtml = 3
class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagController):
class FormattingTagForm(QtWidgets.QDialog, Ui_FormattingTagDialog, FormattingTagController):
"""
The :class:`FormattingTagForm` manages the settings tab .
"""
@ -70,13 +70,13 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
self.is_deleting = False
self.reloading = False
def exec_(self):
def exec(self):
"""
Load Display and set field state.
"""
# Create initial copy from master
self._reloadTable()
return QtGui.QDialog.exec_(self)
return QtWidgets.QDialog.exec(self)
def on_row_selected(self):
"""
@ -90,12 +90,12 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
"""
new_row = self.tag_table_widget.rowCount()
self.tag_table_widget.insertRow(new_row)
self.tag_table_widget.setItem(new_row, 0, QtGui.QTableWidgetItem(translate('OpenLP.FormattingTagForm',
'New Tag %d' % new_row)))
self.tag_table_widget.setItem(new_row, 1, QtGui.QTableWidgetItem('n%d' % new_row))
self.tag_table_widget.setItem(new_row, 0, QtWidgets.QTableWidgetItem(translate('OpenLP.FormattingTagForm',
'New Tag %d' % new_row)))
self.tag_table_widget.setItem(new_row, 1, QtWidgets.QTableWidgetItem('n%d' % new_row))
self.tag_table_widget.setItem(new_row, 2,
QtGui.QTableWidgetItem(translate('OpenLP.FormattingTagForm', '<HTML here>')))
self.tag_table_widget.setItem(new_row, 3, QtGui.QTableWidgetItem(''))
QtWidgets.QTableWidgetItem(translate('OpenLP.FormattingTagForm', '<HTML here>')))
self.tag_table_widget.setItem(new_row, 3, QtWidgets.QTableWidgetItem(''))
self.tag_table_widget.resizeRowsToContents()
self.tag_table_widget.scrollToBottom()
self.tag_table_widget.selectRow(new_row)
@ -121,13 +121,13 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
self.tag_table_widget.item(count, 2).text(),
self.tag_table_widget.item(count, 3).text())
if error:
QtGui.QMessageBox.warning(self, translate('OpenLP.FormattingTagForm', 'Validation Error'), error,
QtGui.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, translate('OpenLP.FormattingTagForm', 'Validation Error'), error,
QtWidgets.QMessageBox.Ok)
self.tag_table_widget.selectRow(count)
return
count += 1
self.services.save_tags()
QtGui.QDialog.accept(self)
QtWidgets.QDialog.accept(self)
def _reloadTable(self):
"""
@ -144,18 +144,18 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
if html['protected']:
line = self.tag_table_widget_read.rowCount()
self.tag_table_widget_read.setRowCount(line + 1)
self.tag_table_widget_read.setItem(line, 0, QtGui.QTableWidgetItem(html['desc']))
self.tag_table_widget_read.setItem(line, 1, QtGui.QTableWidgetItem(self._strip(html['start tag'])))
self.tag_table_widget_read.setItem(line, 2, QtGui.QTableWidgetItem(html['start html']))
self.tag_table_widget_read.setItem(line, 3, QtGui.QTableWidgetItem(html['end html']))
self.tag_table_widget_read.setItem(line, 0, QtWidgets.QTableWidgetItem(html['desc']))
self.tag_table_widget_read.setItem(line, 1, QtWidgets.QTableWidgetItem(self._strip(html['start tag'])))
self.tag_table_widget_read.setItem(line, 2, QtWidgets.QTableWidgetItem(html['start html']))
self.tag_table_widget_read.setItem(line, 3, QtWidgets.QTableWidgetItem(html['end html']))
self.tag_table_widget_read.resizeRowsToContents()
else:
line = self.tag_table_widget.rowCount()
self.tag_table_widget.setRowCount(line + 1)
self.tag_table_widget.setItem(line, 0, QtGui.QTableWidgetItem(html['desc']))
self.tag_table_widget.setItem(line, 1, QtGui.QTableWidgetItem(self._strip(html['start tag'])))
self.tag_table_widget.setItem(line, 2, QtGui.QTableWidgetItem(html['start html']))
self.tag_table_widget.setItem(line, 3, QtGui.QTableWidgetItem(html['end html']))
self.tag_table_widget.setItem(line, 0, QtWidgets.QTableWidgetItem(html['desc']))
self.tag_table_widget.setItem(line, 1, QtWidgets.QTableWidgetItem(self._strip(html['start tag'])))
self.tag_table_widget.setItem(line, 2, QtWidgets.QTableWidgetItem(html['start html']))
self.tag_table_widget.setItem(line, 3, QtWidgets.QTableWidgetItem(html['end html']))
self.tag_table_widget.resizeRowsToContents()
# Permanent (persistent) tags do not have this key
html['temporary'] = False
@ -187,7 +187,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
end_html = item.text()
errors, tag = self.services.start_tag_changed(text, end_html)
if tag:
self.tag_table_widget.setItem(pre_row, 3, QtGui.QTableWidgetItem(tag))
self.tag_table_widget.setItem(pre_row, 3, QtWidgets.QTableWidgetItem(tag))
self.tag_table_widget.resizeRowsToContents()
elif pre_col is EditColumn.EndHtml:
# HTML edited
@ -195,8 +195,8 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
start_html = item.text()
errors, tag = self.services.end_tag_changed(start_html, text)
if tag:
self.tag_table_widget.setItem(pre_row, 3, QtGui.QTableWidgetItem(tag))
self.tag_table_widget.setItem(pre_row, 3, QtWidgets.QTableWidgetItem(tag))
if errors:
QtGui.QMessageBox.warning(self, translate('OpenLP.FormattingTagForm', 'Validation Error'), errors,
QtGui.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, translate('OpenLP.FormattingTagForm', 'Validation Error'), errors,
QtWidgets.QMessageBox.Ok)
self.tag_table_widget.resizeRowsToContents()

View File

@ -24,7 +24,7 @@ The general tab of the configuration dialog.
"""
import logging
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry, Settings, UiStrings, translate
from openlp.core.lib import SettingsTab, ScreenList
@ -53,50 +53,50 @@ class GeneralTab(SettingsTab):
super(GeneralTab, self).setupUi()
self.tab_layout.setStretch(1, 1)
# Monitors
self.monitor_group_box = QtGui.QGroupBox(self.left_column)
self.monitor_group_box = QtWidgets.QGroupBox(self.left_column)
self.monitor_group_box.setObjectName('monitor_group_box')
self.monitor_layout = QtGui.QGridLayout(self.monitor_group_box)
self.monitor_layout = QtWidgets.QGridLayout(self.monitor_group_box)
self.monitor_layout.setObjectName('monitor_layout')
self.monitor_radio_button = QtGui.QRadioButton(self.monitor_group_box)
self.monitor_radio_button = QtWidgets.QRadioButton(self.monitor_group_box)
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 = QtWidgets.QComboBox(self.monitor_group_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 = QtWidgets.QRadioButton(self.monitor_group_box)
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 = QtWidgets.QLabel(self.monitor_group_box)
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 = QtWidgets.QSpinBox(self.monitor_group_box)
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 = QtWidgets.QLabel(self.monitor_group_box)
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 = QtWidgets.QSpinBox(self.monitor_group_box)
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 = QtWidgets.QLabel(self.monitor_group_box)
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 = QtWidgets.QSpinBox(self.monitor_group_box)
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 = QtWidgets.QLabel(self.monitor_group_box)
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 = QtWidgets.QSpinBox(self.monitor_group_box)
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 = QtWidgets.QCheckBox(self.monitor_group_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
@ -108,77 +108,77 @@ class GeneralTab(SettingsTab):
self.monitor_layout.setColumnStretch(4, 3)
self.left_layout.addWidget(self.monitor_group_box)
# CCLI Details
self.ccli_group_box = QtGui.QGroupBox(self.left_column)
self.ccli_group_box = QtWidgets.QGroupBox(self.left_column)
self.ccli_group_box.setObjectName('ccli_group_box')
self.ccli_layout = QtGui.QFormLayout(self.ccli_group_box)
self.ccli_layout = QtWidgets.QFormLayout(self.ccli_group_box)
self.ccli_layout.setObjectName('ccli_layout')
self.number_label = QtGui.QLabel(self.ccli_group_box)
self.number_label = QtWidgets.QLabel(self.ccli_group_box)
self.number_label.setObjectName('number_label')
self.number_edit = QtGui.QLineEdit(self.ccli_group_box)
self.number_edit = QtWidgets.QLineEdit(self.ccli_group_box)
self.number_edit.setValidator(QtGui.QIntValidator())
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 = QtWidgets.QLabel(self.ccli_group_box)
self.username_label.setObjectName('username_label')
self.username_edit = QtGui.QLineEdit(self.ccli_group_box)
self.username_edit = QtWidgets.QLineEdit(self.ccli_group_box)
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 = QtWidgets.QLabel(self.ccli_group_box)
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 = QtWidgets.QLineEdit(self.ccli_group_box)
self.password_edit.setEchoMode(QtWidgets.QLineEdit.Password)
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 = QtWidgets.QGroupBox(self.left_column)
self.audio_group_box.setObjectName('audio_group_box')
self.audio_layout = QtGui.QVBoxLayout(self.audio_group_box)
self.audio_layout = QtWidgets.QVBoxLayout(self.audio_group_box)
self.audio_layout.setObjectName('audio_layout')
self.start_paused_check_box = QtGui.QCheckBox(self.audio_group_box)
self.start_paused_check_box = QtWidgets.QCheckBox(self.audio_group_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 = QtWidgets.QCheckBox(self.audio_group_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 = QtWidgets.QGroupBox(self.right_column)
self.startup_group_box.setObjectName('startup_group_box')
self.startup_layout = QtGui.QVBoxLayout(self.startup_group_box)
self.startup_layout = QtWidgets.QVBoxLayout(self.startup_group_box)
self.startup_layout.setObjectName('startup_layout')
self.warning_check_box = QtGui.QCheckBox(self.startup_group_box)
self.warning_check_box = QtWidgets.QCheckBox(self.startup_group_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 = QtWidgets.QCheckBox(self.startup_group_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 = QtWidgets.QCheckBox(self.startup_group_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 = QtWidgets.QCheckBox(self.startup_group_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 = QtWidgets.QGroupBox(self.right_column)
self.settings_group_box.setObjectName('settings_group_box')
self.settings_layout = QtGui.QFormLayout(self.settings_group_box)
self.settings_layout = QtWidgets.QFormLayout(self.settings_group_box)
self.settings_layout.setObjectName('settings_layout')
self.save_check_service_check_box = QtGui.QCheckBox(self.settings_group_box)
self.save_check_service_check_box = QtWidgets.QCheckBox(self.settings_group_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 = QtWidgets.QCheckBox(self.settings_group_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 = QtWidgets.QCheckBox(self.settings_group_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 = QtWidgets.QLabel(self.settings_group_box)
self.timeout_label.setObjectName('timeout_label')
self.timeout_spin_box = QtGui.QSpinBox(self.settings_group_box)
self.timeout_spin_box = QtWidgets.QSpinBox(self.settings_group_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)

View File

@ -24,13 +24,13 @@ The :mod:`listpreviewwidget` is a widget that lists the slides in the slide cont
It is based on a QTableWidget but represents its contents in list form.
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import RegistryProperties
from openlp.core.lib import ImageSource, ServiceItem
class ListPreviewWidget(QtGui.QTableWidget, RegistryProperties):
class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties):
"""
A special type of QTableWidget which lists the slides in the slide controller
@ -45,7 +45,7 @@ class ListPreviewWidget(QtGui.QTableWidget, RegistryProperties):
An empty ``ServiceItem`` is used by default. replace_service_manager_item() needs to be called to make this
widget display something.
"""
super(QtGui.QTableWidget, self).__init__(parent)
super(QtWidgets.QTableWidget, self).__init__(parent)
self._setup(screen_ratio)
def _setup(self, screen_ratio):
@ -55,9 +55,9 @@ class ListPreviewWidget(QtGui.QTableWidget, RegistryProperties):
self.setColumnCount(1)
self.horizontalHeader().setVisible(False)
self.setColumnWidth(0, self.parent().width())
self.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
self.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setAlternatingRowColors(True)
# Initialize variables.
@ -111,7 +111,7 @@ class ListPreviewWidget(QtGui.QTableWidget, RegistryProperties):
text = []
for frame_number, frame in enumerate(self.service_item.get_frames()):
self.setRowCount(self.slide_count() + 1)
item = QtGui.QTableWidgetItem()
item = QtWidgets.QTableWidgetItem()
slide_height = 0
if self.service_item.is_text():
if frame['verseTag']:
@ -124,8 +124,8 @@ class ListPreviewWidget(QtGui.QTableWidget, RegistryProperties):
row += 1
item.setText(frame['text'])
else:
label = QtGui.QLabel()
label.setMargin(4)
label = QtWidgets.QLabel()
label.setContentsMargins(4, 4, 4, 4)
if self.service_item.is_media():
label.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
else:

View File

@ -32,13 +32,7 @@ Some of the code for this form is based on the examples at:
import html
import logging
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
PHONON_AVAILABLE = True
try:
from PyQt4.phonon import Phonon
except ImportError:
PHONON_AVAILABLE = False
from PyQt5 import QtCore, QtWidgets, QtWebKit, QtWebKitWidgets, QtOpenGL, QtGui, QtMultimedia
from openlp.core.common import Registry, RegistryProperties, OpenLPMixin, Settings, translate, is_macosx
from openlp.core.lib import ServiceItem, ImageSource, ScreenList, build_html, expand_tags, image_to_byte
@ -68,7 +62,7 @@ QGraphicsView {
"""
class Display(QtGui.QGraphicsView):
class Display(QtWidgets.QGraphicsView):
"""
This is a general display screen class. Here the general display settings will done. It will be used as
specialized classes by Main Display and Preview display.
@ -97,7 +91,7 @@ class Display(QtGui.QGraphicsView):
Set up and build the screen base
"""
self.setGeometry(self.screen['size'])
self.web_view = QtWebKit.QWebView(self)
self.web_view = QtWebKitWidgets.QWebView(self)
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()
@ -144,7 +138,7 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties):
self.override = {}
self.retranslateUi()
self.media_object = None
if self.is_live and PHONON_AVAILABLE:
if self.is_live:
self.audio_player = AudioPlayer(self)
else:
self.audio_player = None
@ -397,7 +391,7 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties):
self.setVisible(True)
else:
self.setVisible(True)
return QtGui.QPixmap.grabWidget(self)
return self.grab()
def build_html(self, service_item, image_path=''):
"""
@ -511,6 +505,7 @@ class AudioPlayer(OpenLPMixin, QtCore.QObject):
"""
This Class will play audio only allowing components to work with a soundtrack independent of the user interface.
"""
position_changed = QtCore.pyqtSignal(int)
def __init__(self, parent):
"""
@ -519,78 +514,66 @@ class AudioPlayer(OpenLPMixin, QtCore.QObject):
:param parent: The parent widget.
"""
super(AudioPlayer, self).__init__(parent)
self.current_index = -1
self.playlist = []
self.repeat = False
self.media_object = Phonon.MediaObject()
self.media_object.setTickInterval(100)
self.audio_object = Phonon.AudioOutput(Phonon.VideoCategory)
Phonon.createPath(self.media_object, self.audio_object)
self.media_object.aboutToFinish.connect(self.on_about_to_finish)
self.media_object.finished.connect(self.on_finished)
self.player = QtMultimedia.QMediaPlayer()
self.playlist = QtMultimedia.QMediaPlaylist(self.player)
self.volume_slider = None
self.player.positionChanged.connect(self._on_position_changed)
def __del__(self):
"""
Shutting down so clean up connections
"""
self.stop()
for path in self.media_object.outputPaths():
path.disconnect()
def on_about_to_finish(self):
def _on_position_changed(self, position):
"""
Just before the audio player finishes the current track, queue the next
item in the playlist, if there is one.
Emit a signal when the position of the media player updates
"""
self.current_index += 1
if len(self.playlist) > self.current_index:
self.media_object.enqueue(self.playlist[self.current_index])
self.position_changed.emit(position)
def on_finished(self):
def set_volume_slider(self, slider):
"""
When the audio track finishes.
Connect the volume slider to the media player
:param slider:
"""
if self.repeat:
self.log_debug('Repeat is enabled... here we go again!')
self.media_object.clearQueue()
self.media_object.clear()
self.current_index = -1
self.play()
self.volume_slider = slider
self.volume_slider.setMinimum(0)
self.volume_slider.setMaximum(100)
self.volume_slider.setValue(self.player.volume())
self.volume_slider.valueChanged.connect(self.set_volume)
def connectVolumeSlider(self, slider):
def set_volume(self, volume):
"""
Connect the volume slider to the output channel.
Set the volume of the media player
:param volume:
"""
slider.setAudioOutput(self.audio_object)
self.player.setVolume(volume)
def reset(self):
"""
Reset the audio player, clearing the playlist and the queue.
"""
self.current_index = -1
self.playlist = []
self.stop()
self.media_object.clear()
self.playlist.clear()
def play(self):
"""
We want to play the file so start it
"""
if self.current_index == -1:
self.on_about_to_finish()
self.media_object.play()
self.player.play()
def pause(self):
"""
Pause the Audio
"""
self.media_object.pause()
self.player.pause()
def stop(self):
"""
Stop the Audio and clean up
"""
self.media_object.stop()
self.player.stop()
def add_to_playlist(self, file_names):
"""
@ -600,23 +583,14 @@ class AudioPlayer(OpenLPMixin, QtCore.QObject):
"""
if not isinstance(file_names, list):
file_names = [file_names]
self.playlist.extend(list(map(Phonon.MediaSource, file_names)))
for file_name in file_names:
self.playlist.addMedia(QtCore.QUrl(file_name))
def next(self):
"""
Skip forward to the next track in the list
"""
if not self.repeat and self.current_index + 1 >= len(self.playlist):
return
is_playing = self.media_object.state() == Phonon.PlayingState
self.current_index += 1
if self.repeat and self.current_index == len(self.playlist):
self.current_index = 0
self.media_object.clearQueue()
self.media_object.clear()
self.media_object.enqueue(self.playlist[self.current_index])
if is_playing:
self.media_object.play()
self.player.next()
def go_to(self, index):
"""
@ -624,19 +598,6 @@ class AudioPlayer(OpenLPMixin, QtCore.QObject):
:param index: The track to go to
"""
is_playing = self.media_object.state() == Phonon.PlayingState
self.media_object.clearQueue()
self.media_object.clear()
self.current_index = index
self.media_object.enqueue(self.playlist[self.current_index])
if is_playing:
self.media_object.play()
def connectSlot(self, signal, slot):
"""
Connect a slot to a signal on the media object. Used by slidecontroller to connect to audio object.
:param slot: The slot the signal is attached to.
:param signal: The signal to be fired
"""
QtCore.QObject.connect(self.media_object, signal, slot)
self.playlist.setCurrentIndex(index)
if self.player.state() == QtMultimedia.QMediaPlayer.PlayingState:
self.player.play()

View File

@ -32,7 +32,7 @@ from tempfile import gettempdir
import time
from datetime import datetime
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, check_directory_exists, translate, \
is_win, is_macosx
@ -89,14 +89,14 @@ class Ui_MainWindow(object):
if is_macosx():
main_window.setDocumentMode(True)
# Set up the main container, which contains all the other form widgets.
self.main_content = QtGui.QWidget(main_window)
self.main_content = QtWidgets.QWidget(main_window)
self.main_content.setObjectName('main_content')
self.main_content_layout = QtGui.QHBoxLayout(self.main_content)
self.main_content_layout = QtWidgets.QHBoxLayout(self.main_content)
self.main_content_layout.setSpacing(0)
self.main_content_layout.setMargin(0)
self.main_content_layout.setContentsMargins(0, 0, 0, 0)
self.main_content_layout.setObjectName('main_content_layout')
main_window.setCentralWidget(self.main_content)
self.control_splitter = QtGui.QSplitter(self.main_content)
self.control_splitter = QtWidgets.QSplitter(self.main_content)
self.control_splitter.setOrientation(QtCore.Qt.Horizontal)
self.control_splitter.setObjectName('control_splitter')
self.main_content_layout.addWidget(self.control_splitter)
@ -107,47 +107,47 @@ class Ui_MainWindow(object):
live_visible = Settings().value('user interface/live panel')
panel_locked = Settings().value('user interface/lock panel')
# Create menu
self.menu_bar = QtGui.QMenuBar(main_window)
self.menu_bar = QtWidgets.QMenuBar(main_window)
self.menu_bar.setObjectName('menu_bar')
self.file_menu = QtGui.QMenu(self.menu_bar)
self.file_menu = QtWidgets.QMenu(self.menu_bar)
self.file_menu.setObjectName('fileMenu')
self.recent_files_menu = QtGui.QMenu(self.file_menu)
self.recent_files_menu = QtWidgets.QMenu(self.file_menu)
self.recent_files_menu.setObjectName('recentFilesMenu')
self.file_import_menu = QtGui.QMenu(self.file_menu)
self.file_import_menu = QtWidgets.QMenu(self.file_menu)
if not is_macosx():
self.file_import_menu.setIcon(build_icon(u':/general/general_import.png'))
self.file_import_menu.setObjectName('file_import_menu')
self.file_export_menu = QtGui.QMenu(self.file_menu)
self.file_export_menu = QtWidgets.QMenu(self.file_menu)
if not is_macosx():
self.file_export_menu.setIcon(build_icon(u':/general/general_export.png'))
self.file_export_menu.setObjectName('file_export_menu')
# View Menu
self.view_menu = QtGui.QMenu(self.menu_bar)
self.view_menu = QtWidgets.QMenu(self.menu_bar)
self.view_menu.setObjectName('viewMenu')
self.view_mode_menu = QtGui.QMenu(self.view_menu)
self.view_mode_menu = QtWidgets.QMenu(self.view_menu)
self.view_mode_menu.setObjectName('viewModeMenu')
# Tools Menu
self.tools_menu = QtGui.QMenu(self.menu_bar)
self.tools_menu = QtWidgets.QMenu(self.menu_bar)
self.tools_menu.setObjectName('tools_menu')
# Settings Menu
self.settings_menu = QtGui.QMenu(self.menu_bar)
self.settings_menu = QtWidgets.QMenu(self.menu_bar)
self.settings_menu.setObjectName('settingsMenu')
self.settings_language_menu = QtGui.QMenu(self.settings_menu)
self.settings_language_menu = QtWidgets.QMenu(self.settings_menu)
self.settings_language_menu.setObjectName('settingsLanguageMenu')
# Help Menu
self.help_menu = QtGui.QMenu(self.menu_bar)
self.help_menu = QtWidgets.QMenu(self.menu_bar)
self.help_menu.setObjectName('helpMenu')
main_window.setMenuBar(self.menu_bar)
self.status_bar = QtGui.QStatusBar(main_window)
self.status_bar = QtWidgets.QStatusBar(main_window)
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 = QtWidgets.QProgressBar(self.status_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 = QtWidgets.QLabel(self.status_bar)
self.default_theme_label.setObjectName('default_theme_label')
self.status_bar.addPermanentWidget(self.default_theme_label)
# Create the MediaManager
@ -155,7 +155,7 @@ class Ui_MainWindow(object):
':/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 = QtWidgets.QToolBox(self.media_manager_dock)
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)
@ -202,7 +202,7 @@ class Ui_MainWindow(object):
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)
self.file_exit_item.setMenuRole(QtWidgets.QAction.QuitRole)
action_list.add_category(UiStrings().Import, CategoryOrder.standard_menu)
self.import_theme_item = create_action(main_window, 'importThemeItem', category=UiStrings().Import,
can_shortcuts=True)
@ -249,7 +249,7 @@ class Ui_MainWindow(object):
can_shortcuts=True)
self.mode_live_item = create_action(main_window, 'modeLiveItem', checked=True, category=UiStrings().ViewMode,
can_shortcuts=True)
self.mode_group = QtGui.QActionGroup(main_window)
self.mode_group = QtWidgets.QActionGroup(main_window)
self.mode_group.addAction(self.mode_default_item)
self.mode_group.addAction(self.mode_setup_item)
self.mode_group.addAction(self.mode_live_item)
@ -275,7 +275,7 @@ class Ui_MainWindow(object):
triggers=self.on_plugin_item_clicked)
# i18n Language Items
self.auto_language_item = create_action(main_window, 'autoLanguageItem', checked=LanguageManager.auto_language)
self.language_group = QtGui.QActionGroup(main_window)
self.language_group = QtWidgets.QActionGroup(main_window)
self.language_group.setExclusive(True)
self.language_group.setObjectName('languageGroup')
add_actions(self.language_group, [self.auto_language_item])
@ -295,7 +295,7 @@ class Ui_MainWindow(object):
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_configure_item.setMenuRole(QtWidgets.QAction.PreferencesRole)
self.settings_import_item = create_action(main_window, 'settingsImportItem',
category=UiStrings().Import, can_shortcuts=True)
self.settings_export_item = create_action(main_window, 'settingsExportItem',
@ -305,7 +305,7 @@ class Ui_MainWindow(object):
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)
self.about_item.setMenuRole(QtWidgets.QAction.AboutRole)
if is_win():
self.local_help_file = os.path.join(AppLocation.get_directory(AppLocation.AppDir), 'OpenLP.chm')
self.offline_help_item = create_action(main_window, 'offlineHelpItem',
@ -353,8 +353,8 @@ class Ui_MainWindow(object):
# menu. If we are running on Mac OS X the menu items whose title contains those keywords but don't belong in the
# main menu need to be marked as such with QAction.NoRole.
if is_macosx():
self.settings_shortcuts_item.setMenuRole(QtGui.QAction.NoRole)
self.formatting_tag_item.setMenuRole(QtGui.QAction.NoRole)
self.settings_shortcuts_item.setMenuRole(QtWidgets.QAction.NoRole)
self.formatting_tag_item.setMenuRole(QtWidgets.QAction.NoRole)
add_actions(self.settings_menu, (self.settings_plugin_list_item, self.settings_language_menu.menuAction(),
None, self.formatting_tag_item, self.settings_shortcuts_item, self.settings_configure_item))
add_actions(self.tools_menu, (self.tools_add_tool_item, None))
@ -492,10 +492,11 @@ class Ui_MainWindow(object):
self.mode_live_item.setStatusTip(translate('OpenLP.MainWindow', 'Set the view mode to Live.'))
class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties):
"""
The main window.
"""
openlp_version_check = QtCore.pyqtSignal(QtCore.QVariant)
log.info('MainWindow loaded')
def __init__(self):
@ -566,7 +567,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
self.application.set_busy_cursor()
# Simple message boxes
Registry().register_function('theme_update_global', self.default_theme_changed)
QtCore.QObject.connect(self, QtCore.SIGNAL('openlp_version_check'), self.version_notice)
self.openlp_version_check.connect(self.version_notice)
Registry().register_function('config_screen_changed', self.screen_changed)
Registry().register_function('bootstrap_post_set_up', self.bootstrap_post_set_up)
# Reset the cursor
@ -622,14 +623,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
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/.')
QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'OpenLP Version Updated'),
version_text % (version, get_application_version()[u'full']))
QtWidgets.QMessageBox.question(self, translate('OpenLP.MainWindow', 'OpenLP Version Updated'),
version_text % (version, get_application_version()[u'full']))
def show(self):
"""
Show the main form, as well as the display form
"""
QtGui.QWidget.show(self)
QtWidgets.QWidget.show(self)
if self.live_controller.display.isVisible():
self.live_controller.display.setFocus()
self.activateWindow()
@ -676,20 +677,21 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
themes are imported. The default theme is changed (if necessary). The plugins in pluginmanager are
set active/in-active to match the selection in the wizard.
"""
answer = QtGui.QMessageBox.warning(self,
translate('OpenLP.MainWindow', 'Re-run First Time Wizard?'),
translate('OpenLP.MainWindow', 'Are you sure you want to re-run the First '
'Time Wizard?\n\nRe-running this wizard may make changes to your '
'current OpenLP configuration and possibly add songs to your '
'existing songs list and change your default theme.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
answer = QtWidgets.QMessageBox.warning(self,
translate('OpenLP.MainWindow', 'Re-run First Time Wizard?'),
translate('OpenLP.MainWindow',
'Are you sure you want to re-run the First '
'Time Wizard?\n\nRe-running this wizard may make changes to '
'your current OpenLP configuration and possibly add songs to '
'your existing songs list and change your default theme.'),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.No)
if answer == QtWidgets.QMessageBox.No:
return
first_run_wizard = FirstTimeForm(self)
first_run_wizard.initialize(ScreenList())
first_run_wizard.exec_()
first_run_wizard.exec()
if first_run_wizard.was_cancelled:
return
self.application.set_busy_cursor()
@ -722,8 +724,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
self.live_controller.main_display_set_background()
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'))
QtWidgets.QMessageBox.question(self, translate('OpenLP.MainWindow', 'OpenLP Main Display Blanked'),
translate('OpenLP.MainWindow', 'The Main Display has been blanked out'))
def error_message(self, title, message):
"""
@ -734,7 +736,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
"""
if hasattr(self.application, 'splash'):
self.application.splash.close()
QtGui.QMessageBox.critical(self, title, message)
QtWidgets.QMessageBox.critical(self, title, message)
def warning_message(self, title, message):
"""
@ -745,7 +747,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
"""
if hasattr(self.application, 'splash'):
self.application.splash.close()
QtGui.QMessageBox.warning(self, title, message)
QtWidgets.QMessageBox.warning(self, title, message)
def information_message(self, title, message):
"""
@ -756,7 +758,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
"""
if hasattr(self.application, 'splash'):
self.application.splash.close()
QtGui.QMessageBox.information(self, title, message)
QtWidgets.QMessageBox.information(self, title, message)
def on_help_web_site_clicked(self):
"""
@ -782,14 +784,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
"""
Show the About form
"""
self.about_form.exec_()
self.about_form.exec()
def on_plugin_item_clicked(self):
"""
Show the Plugin form
"""
self.plugin_form.load()
self.plugin_form.exec_()
self.plugin_form.exec()
def on_tools_open_data_folder_clicked(self):
"""
@ -808,13 +810,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
"""
Show the Settings dialog
"""
self.formatting_tag_form.exec_()
self.formatting_tag_form.exec()
def on_settings_configure_iem_clicked(self):
"""
Show the Settings dialog
"""
self.settings_form.exec_()
self.settings_form.exec()
def paintEvent(self, event):
"""
@ -827,29 +829,31 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
"""
Show the shortcuts dialog
"""
if self.shortcut_form.exec_():
if self.shortcut_form.exec():
self.shortcut_form.save()
def on_settings_import_item_clicked(self):
"""
Import settings from an export INI file
"""
answer = QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'Import settings?'),
translate('OpenLP.MainWindow', 'Are you sure you want to import '
'settings?\n\n Importing settings will '
'make permanent changes to your current '
'OpenLP configuration.\n\n Importing '
'incorrect settings may cause erratic '
'behaviour or OpenLP to terminate '
'abnormally.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
answer = QtWidgets.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'Import settings?'),
translate('OpenLP.MainWindow', 'Are you sure you want to import '
'settings?\n\n Importing settings will '
'make permanent changes to your current '
'OpenLP configuration.\n\n Importing '
'incorrect settings may cause erratic '
'behaviour or OpenLP to terminate '
'abnormally.'),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.No)
if answer == QtWidgets.QMessageBox.No:
return
import_file_name = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.MainWindow', 'Open File'), '',
translate('OpenLP.MainWindow', 'OpenLP Export Settings '
'Files (*.conf)'))
import_file_name, filter_used = QtWidgets.QFileDialog.getOpenFileName(
self,
translate('OpenLP.MainWindow', 'Open File'),
'',
translate('OpenLP.MainWindow', 'OpenLP Export Settings Files (*.conf)'))
if not import_file_name:
return
setting_sections = []
@ -882,11 +886,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
# 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('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.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
QtWidgets.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\n'
'Processing has terminated and '
'no changes have been made.'),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok))
return
import_keys = import_settings.allKeys()
for section_key in import_keys:
@ -921,10 +926,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
settings.sync()
# We must do an immediate restart or current configuration will overwrite what was just imported when
# application terminates normally. We need to exit without saving configuration.
QtGui.QMessageBox.information(self, translate('OpenLP.MainWindow', 'Import settings'),
translate('OpenLP.MainWindow', 'OpenLP will now close. Imported settings will '
'be applied the next time you start OpenLP.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
QtWidgets.QMessageBox.information(self, translate('OpenLP.MainWindow', 'Import settings'),
translate('OpenLP.MainWindow',
'OpenLP will now close. Imported settings will '
'be applied the next time you start OpenLP.'),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok))
self.settings_imported = True
self.clean_up()
QtCore.QCoreApplication.exit()
@ -933,11 +939,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
"""
Export settings to a .conf file in INI format
"""
export_file_name = QtGui.QFileDialog.getSaveFileName(self,
translate('OpenLP.MainWindow', 'Export Settings File'),
'',
translate('OpenLP.MainWindow', 'OpenLP Export Settings '
'File (*.conf)'))
export_file_name, filter_used = QtWidgets.QFileDialog.getSaveFileName(
self,
translate('OpenLP.MainWindow', 'Export Settings File'),
'',
translate('OpenLP.MainWindow', 'OpenLP Export Settings File (*.conf)'))
if not export_file_name:
return
# Make sure it's a .conf file.
@ -987,10 +993,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
try:
key_value = settings.value(section_key)
except KeyError:
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'Export setting error'),
translate('OpenLP.MainWindow', 'The key "%s" does not have a default value '
'so it will be skipped in this export.') % section_key,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
QtWidgets.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'Export setting error'),
translate('OpenLP.MainWindow', 'The key "%s" does not have a default '
'value so it will be skipped in this '
'export.') % section_key,
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok))
key_value = None
if key_value is not None:
export_settings.setValue(section_key, key_value)
@ -1010,10 +1017,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
export_conf.close()
os.remove(temp_file)
except OSError as ose:
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'Export setting error'),
translate('OpenLP.MainWindow', 'An error occurred while exporting the '
'settings: %s') % ose.strerror,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
QtWidgets.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'Export setting error'),
translate('OpenLP.MainWindow', 'An error occurred while exporting the '
'settings: %s') % ose.strerror,
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok))
def on_mode_default_item_clicked(self):
"""
@ -1076,26 +1083,26 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
event.accept()
if self.service_manager_contents.is_modified():
ret = self.service_manager_contents.save_modified_service()
if ret == QtGui.QMessageBox.Save:
if ret == QtWidgets.QMessageBox.Save:
if self.service_manager_contents.decide_save_method():
self.clean_up()
event.accept()
else:
event.ignore()
elif ret == QtGui.QMessageBox.Discard:
elif ret == QtWidgets.QMessageBox.Discard:
self.clean_up()
event.accept()
else:
event.ignore()
else:
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),
QtGui.QMessageBox.Yes)
if ret == QtGui.QMessageBox.Yes:
ret = QtWidgets.QMessageBox.question(self, translate('OpenLP.MainWindow', 'Close OpenLP'),
translate('OpenLP.MainWindow', 'Are you sure you want to close '
'OpenLP?'),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.Yes)
if ret == QtWidgets.QMessageBox.Yes:
self.clean_up()
event.accept()
else:
@ -1203,10 +1210,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
Sets the ability to stop the toolbars being changed.
"""
if lock:
self.theme_manager_dock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
self.service_manager_dock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
self.media_manager_dock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
self.projector_manager_dock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
self.theme_manager_dock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
self.service_manager_dock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
self.media_manager_dock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
self.projector_manager_dock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
self.view_media_manager_item.setEnabled(False)
self.view_service_manager_item.setEnabled(False)
self.view_theme_manager_item.setEnabled(False)
@ -1214,10 +1221,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
self.view_preview_panel.setEnabled(False)
self.view_live_panel.setEnabled(False)
else:
self.theme_manager_dock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
self.service_manager_dock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
self.media_manager_dock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
self.projector_manager_dock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
self.theme_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures)
self.service_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures)
self.media_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures)
self.projector_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures)
self.view_media_manager_item.setEnabled(True)
self.view_service_manager_item.setEnabled(True)
self.view_theme_manager_item.setEnabled(True)
@ -1401,10 +1408,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
except (IOError, os.error, DistutilsFileError) as why:
self.application.set_normal_cursor()
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', str(why)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
QtWidgets.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'),
translate('OpenLP.MainWindow',
'OpenLP Data directory copy failed\n\n%s').
replace('%s', str(why)),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok))
return False
else:
log.info('No data copy requested')

View File

@ -26,7 +26,7 @@ import logging
from openlp.core.common import Settings
from PyQt4 import QtCore
from PyQt5 import QtCore
log = logging.getLogger(__name__ + '.__init__')

View File

@ -26,7 +26,7 @@ related to playing media, such as sliders.
import logging
import os
import datetime
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import OpenLPMixin, Registry, RegistryMixin, RegistryProperties, Settings, UiStrings, translate
from openlp.core.lib import OpenLPToolbar, ItemCapabilities
@ -40,7 +40,7 @@ from openlp.core.ui import DisplayControllerType
log = logging.getLogger(__name__)
class MediaSlider(QtGui.QSlider):
class MediaSlider(QtWidgets.QSlider):
"""
Allows the mouse events of a slider to be overridden and extra functionality added
"""
@ -56,22 +56,22 @@ class MediaSlider(QtGui.QSlider):
"""
Override event to allow hover time to be displayed.
"""
time_value = QtGui.QStyle.sliderValueFromPosition(self.minimum(), self.maximum(), event.x(), self.width())
time_value = QtWidgets.QStyle.sliderValueFromPosition(self.minimum(), self.maximum(), event.x(), self.width())
self.setToolTip('%s' % datetime.timedelta(seconds=int(time_value / 1000)))
QtGui.QSlider.mouseMoveEvent(self, event)
QtWidgets.QSlider.mouseMoveEvent(self, event)
def mousePressEvent(self, event):
"""
Mouse Press event no new functionality
"""
QtGui.QSlider.mousePressEvent(self, event)
QtWidgets.QSlider.mousePressEvent(self, event)
def mouseReleaseEvent(self, event):
"""
Set the slider position when the mouse is clicked and released on the slider.
"""
self.setValue(QtGui.QStyle.sliderValueFromPosition(self.minimum(), self.maximum(), event.x(), self.width()))
QtGui.QSlider.mouseReleaseEvent(self, event)
self.setValue(QtWidgets.QStyle.sliderValueFromPosition(self.minimum(), self.maximum(), event.x(), self.width()))
QtWidgets.QSlider.mouseReleaseEvent(self, event)
class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
@ -284,9 +284,9 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
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)
controller.volume_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
controller.volume_slider.setTickInterval(10)
controller.volume_slider.setTickPosition(QtGui.QSlider.TicksAbove)
controller.volume_slider.setTickPosition(QtWidgets.QSlider.TicksAbove)
controller.volume_slider.setMinimum(0)
controller.volume_slider.setMaximum(100)
controller.volume_slider.setTracking(True)
@ -419,7 +419,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
translate('MediaPlugin.MediaItem', 'Unsupported File'))
return False
self.set_controls_visible(controller, True)
log.debug('use %s controller' % self.current_media_players[controller.controller_type])
log.debug('use %s controller' % self.current_media_players[controller.controller_type].display_name)
return True
def media_length(self, service_item):
@ -526,6 +526,12 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
if not title:
continue
player = self.media_players[title]
if title == 'system':
self.resize(display, player)
if player.load(display):
self.current_media_players[controller.controller_type] = player
controller.media_info.media_type = MediaType.Video
return True
if suffix in player.video_extensions_list:
if not controller.media_info.is_background or controller.media_info.is_background and \
player.can_background:

View File

@ -22,7 +22,7 @@
"""
The :mod:`~openlp.core.ui.media.playertab` module holds the configuration tab for the media stuff.
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import Registry, Settings, UiStrings, translate
from openlp.core.lib import ColorButton, SettingsTab
@ -30,7 +30,7 @@ from openlp.core.lib.ui import create_button
from openlp.core.ui.media import get_media_players, set_media_players
class MediaQCheckBox(QtGui.QCheckBox):
class MediaQCheckBox(QtWidgets.QCheckBox):
"""
MediaQCheckBox adds an extra property, player_name to the QCheckBox class.
"""
@ -61,46 +61,46 @@ class PlayerTab(SettingsTab):
"""
self.setObjectName('MediaTab')
super(PlayerTab, self).setupUi()
self.background_color_group_box = QtGui.QGroupBox(self.left_column)
self.background_color_group_box = QtWidgets.QGroupBox(self.left_column)
self.background_color_group_box.setObjectName('background_color_group_box')
self.form_layout = QtGui.QFormLayout(self.background_color_group_box)
self.form_layout = QtWidgets.QFormLayout(self.background_color_group_box)
self.form_layout.setObjectName('form_layout')
self.color_layout = QtGui.QHBoxLayout()
self.background_color_label = QtGui.QLabel(self.background_color_group_box)
self.color_layout = QtWidgets.QHBoxLayout()
self.background_color_label = QtWidgets.QLabel(self.background_color_group_box)
self.background_color_label.setObjectName('background_color_label')
self.color_layout.addWidget(self.background_color_label)
self.background_color_button = ColorButton(self.background_color_group_box)
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 = QtWidgets.QLabel(self.background_color_group_box)
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)
self.right_column.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.media_player_group_box = QtGui.QGroupBox(self.left_column)
self.right_column.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
self.media_player_group_box = QtWidgets.QGroupBox(self.left_column)
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 = QtWidgets.QVBoxLayout(self.media_player_group_box)
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 = QtWidgets.QGroupBox(self.left_column)
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 = QtWidgets.QHBoxLayout(self.player_order_group_box)
self.player_order_layout.setObjectName('player_order_layout')
self.player_order_list_widget = QtGui.QListWidget(self.player_order_group_box)
size_policy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.player_order_list_widget = QtWidgets.QListWidget(self.player_order_group_box)
size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
size_policy.setHorizontalStretch(0)
size_policy.setVerticalStretch(0)
size_policy.setHeightForWidth(self.player_order_list_widget.sizePolicy().hasHeightForWidth())
self.player_order_list_widget.setSizePolicy(size_policy)
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.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
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 = QtWidgets.QVBoxLayout()
self.ordering_button_layout.setObjectName('ordering_button_layout')
self.ordering_button_layout.addStretch(1)
self.ordering_up_button = create_button(self, 'ordering_up_button', role='up',

View File

@ -4,7 +4,14 @@
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2015 OpenLP Developers #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
@ -20,19 +27,16 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`~openlp.core.ui.media.phononplayer` contains the Phonon player component.
The :mod:`~openlp.core.ui.media.systemplayer` contains the system (aka QtMultimedia) player component.
"""
import logging
import mimetypes
from datetime import datetime
from PyQt4.phonon import Phonon
from PyQt5 import QtCore, QtMultimedia, QtMultimediaWidgets
from openlp.core.lib import translate
from openlp.core.ui.media import MediaState
from openlp.core.ui.media.mediaplayer import MediaPlayer
from openlp.core.common import is_macosx
log = logging.getLogger(__name__)
@ -56,26 +60,39 @@ ADDITIONAL_EXT = {
}
class PhononPlayer(MediaPlayer):
class SystemPlayer(MediaPlayer):
"""
A specialised version of the MediaPlayer class, which provides a Phonon display.
A specialised version of the MediaPlayer class, which provides a QtMultimedia display.
"""
def __init__(self, parent):
"""
Constructor
"""
super(PhononPlayer, self).__init__(parent, 'phonon')
self.original_name = 'Phonon'
self.display_name = '&Phonon'
super(SystemPlayer, self).__init__(parent, 'system')
self.original_name = 'System'
self.display_name = '&System'
self.parent = parent
self.additional_extensions = ADDITIONAL_EXT
self.media_player = QtMultimedia.QMediaPlayer(None, QtMultimedia.QMediaPlayer.VideoSurface)
mimetypes.init()
for mime_type in Phonon.BackendCapabilities.availableMimeTypes():
mime_type = str(mime_type)
if mime_type.startswith('audio/'):
self._add_to_list(self.audio_extensions_list, mime_type)
elif mime_type.startswith('video/'):
self._add_to_list(self.video_extensions_list, mime_type)
media_service = self.media_player.service()
log.info(media_service.__class__.__name__)
container_control = media_service.requestControl('org.qt-project.qt.mediacontainercontrol/5.0')
if container_control is not None:
supported_codecs = container_control.supportedContainers()
self.media_player.service().releaseControl(container_control)
for mime_type in supported_codecs:
# mime_type = str(mime_type)
# if mime_type.startswith('audio/'):
log.info(mime_type)
# self._add_to_list(self.audio_extensions_list, mime_type)
# video_device_info = QtMultimedia.QVideoDeviceInfo(QtMultimedia.QAudioDeviceInfo.defaultOutputDevice())
# log.info('Supported audio codecs: %s', device_info.supportedCodecs())
# for mime_type in device_info.supportedCodecs():
# elif mime_type.startswith('video/'):
# self._add_to_list(self.video_extensions_list, mime_type)
self._add_to_list(self.audio_extensions_list, 'audio/pcm')
def _add_to_list(self, mime_type_list, mimetype):
"""
@ -102,97 +119,76 @@ class PhononPlayer(MediaPlayer):
def setup(self, display):
"""
Set up the player widgets
:param display:
"""
display.phonon_widget = Phonon.VideoWidget(display)
display.phonon_widget.resize(display.size())
display.media_object = Phonon.MediaObject(display)
Phonon.createPath(display.media_object, display.phonon_widget)
if display.has_audio:
display.audio = Phonon.AudioOutput(Phonon.VideoCategory, display.media_object)
Phonon.createPath(display.media_object, display.audio)
display.phonon_widget.raise_()
display.phonon_widget.hide()
display.video_widget = QtMultimediaWidgets.QVideoWidget(display)
display.video_widget.resize(display.size())
display.media_player = QtMultimedia.QMediaPlayer(display)
display.media_player.setVideoOutput(display.video_widget)
display.video_widget.raise_()
display.video_widget.hide()
self.has_own_widget = True
def check_available(self):
"""
Check if the player is available
"""
# At the moment we don't have support for phononplayer on Mac OS X
if is_macosx():
return False
else:
return True
return True
def load(self, display):
"""
Load a video into the display
:param display:
"""
log.debug('load vid in Phonon Controller')
controller = display.controller
volume = controller.media_info.volume
path = controller.media_info.file_info.absoluteFilePath()
display.media_object.setCurrentSource(Phonon.MediaSource(path))
if not self.media_state_wait(display, Phonon.StoppedState):
return False
display.media_player.setMedia(QtMultimedia.QMediaContent(QtCore.QUrl.fromLocalFile(path)))
self.volume(display, volume)
return True
def media_state_wait(self, display, media_state):
"""
Wait for the video to change its state
Wait no longer than 5 seconds.
"""
start = datetime.now()
current_state = display.media_object.state()
while current_state != media_state:
current_state = display.media_object.state()
if current_state == Phonon.ErrorState:
return False
self.application.process_events()
if (datetime.now() - start).seconds > 5:
return False
return True
def resize(self, display):
"""
Resize the display
:param display:
"""
display.phonon_widget.resize(display.size())
display.video_widget.resize(display.size())
def play(self, display):
"""
Play the current media item
:param display:
"""
log.info('Play the current item')
controller = display.controller
start_time = 0
if display.media_object.state() != Phonon.PausedState and controller.media_info.start_time > 0:
if display.media_player.state() != QtMultimedia.QMediaPlayer.PausedState and \
controller.media_info.start_time > 0:
start_time = controller.media_info.start_time
display.media_object.play()
if not self.media_state_wait(display, Phonon.PlayingState):
return False
display.media_player.play()
if start_time > 0:
self.seek(display, controller.media_info.start_time * 1000)
self.volume(display, controller.media_info.volume)
controller.media_info.length = int(display.media_object.totalTime() / 1000)
controller.media_info.length = int(display.media_player.duration() / 1000)
controller.seek_slider.setMaximum(controller.media_info.length * 1000)
self.state = MediaState.Playing
display.phonon_widget.raise_()
display.video_widget.raise_()
return True
def pause(self, display):
"""
Pause the current media item
"""
display.media_object.pause()
if self.media_state_wait(display, Phonon.PausedState):
display.media_player.pause()
if display.media_player.state() == QtMultimedia.QMediaPlayer.PausedState:
self.state = MediaState.Paused
def stop(self, display):
"""
Stop the current media item
"""
display.media_object.stop()
display.media_player.stop()
self.set_visible(display, False)
self.state = MediaState.Stopped
@ -203,22 +199,22 @@ class PhononPlayer(MediaPlayer):
# 1.0 is the highest value
if display.has_audio:
vol = float(vol) / float(100)
display.audio.setVolume(vol)
display.media_player.setVolume(vol)
def seek(self, display, seek_value):
"""
Go to a particular point in the current media item
"""
display.media_object.seek(seek_value)
display.media_player.setPosition(seek_value)
def reset(self, display):
"""
Reset the media player
"""
display.media_object.stop()
display.media_object.clearQueue()
display.media_player.stop()
display.media_player.setMedia(QtMultimedia.QMediaContent())
self.set_visible(display, False)
display.phonon_widget.setVisible(False)
display.video_widget.setVisible(False)
self.state = MediaState.Off
def set_visible(self, display, status):
@ -226,22 +222,22 @@ class PhononPlayer(MediaPlayer):
Set the visibility of the widget
"""
if self.has_own_widget:
display.phonon_widget.setVisible(status)
display.video_widget.setVisible(status)
def update_ui(self, display):
"""
Update the UI
"""
if display.media_object.state() == Phonon.PausedState and self.state != MediaState.Paused:
if display.media_player.state() == QtMultimedia.QMediaPlayer.PausedState and self.state != MediaState.Paused:
self.stop(display)
controller = display.controller
if controller.media_info.end_time > 0:
if display.media_object.currentTime() > controller.media_info.end_time * 1000:
if display.media_player.position() > controller.media_info.end_time * 1000:
self.stop(display)
self.set_visible(display, False)
if not controller.seek_slider.isSliderDown():
controller.seek_slider.blockSignals(True)
controller.seek_slider.setSliderPosition(display.media_object.currentTime())
controller.seek_slider.setSliderPosition(display.media_player.position())
controller.seek_slider.blockSignals(False)
def get_media_display_css(self):
@ -254,9 +250,12 @@ class PhononPlayer(MediaPlayer):
"""
Return some info about this player
"""
return(translate('Media.player', 'Phonon is a media player which '
'interacts with the operating system to provide media capabilities.') +
'<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/>')
return (translate('Media.player', 'This media player uses your operating system '
'to provide media capabilities.') +
'<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/>')

View File

@ -29,7 +29,7 @@ import os
import threading
import sys
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import Settings, is_win, is_macosx, is_linux
from openlp.core.lib import translate
@ -136,8 +136,8 @@ class VlcPlayer(MediaPlayer):
Set up the media player
"""
vlc = get_vlc()
display.vlc_widget = QtGui.QFrame(display)
display.vlc_widget.setFrameStyle(QtGui.QFrame.NoFrame)
display.vlc_widget = QtWidgets.QFrame(display)
display.vlc_widget.setFrameStyle(QtWidgets.QFrame.NoFrame)
# creating a basic vlc instance
command_line_options = '--no-video-title-show'
if not display.has_audio:
@ -159,7 +159,7 @@ class VlcPlayer(MediaPlayer):
if is_win():
display.vlc_media_player.set_hwnd(win_id)
elif is_macosx():
# We have to use 'set_nsobject' since Qt4 on OSX uses Cocoa
# We have to use 'set_nsobject' since Qt5 on OSX uses Cocoa
# framework and not the old Carbon.
display.vlc_media_player.set_nsobject(win_id)
else:

View File

@ -22,7 +22,7 @@
"""
The :mod:`~openlp.core.ui.media.webkit` module contains our WebKit video player
"""
from PyQt4 import QtGui, QtWebKit
from PyQt5 import QtGui, QtWebKitWidgets
import logging
@ -226,7 +226,7 @@ class WebkitPlayer(MediaPlayer):
:return: boolean. True if available
"""
web = QtWebKit.QWebPage()
web = QtWebKitWidgets.QWebPage()
# This script should return '[object HTMLVideoElement]' if the html5 video is available in webkit. Otherwise it
# should return '[object HTMLUnknownElement]'
return web.mainFrame().evaluateJavaScript(

View File

@ -22,7 +22,7 @@
"""
The UI widgets of the plugin view dialog
#"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import UiStrings, translate
from openlp.core.lib import build_icon
@ -40,31 +40,31 @@ class Ui_PluginViewDialog(object):
plugin_view_dialog.setObjectName('plugin_view_dialog')
plugin_view_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
plugin_view_dialog.setWindowModality(QtCore.Qt.ApplicationModal)
self.plugin_layout = QtGui.QVBoxLayout(plugin_view_dialog)
self.plugin_layout = QtWidgets.QVBoxLayout(plugin_view_dialog)
self.plugin_layout.setObjectName('plugin_layout')
self.list_layout = QtGui.QHBoxLayout()
self.list_layout = QtWidgets.QHBoxLayout()
self.list_layout.setObjectName('list_layout')
self.plugin_list_widget = QtGui.QListWidget(plugin_view_dialog)
self.plugin_list_widget = QtWidgets.QListWidget(plugin_view_dialog)
self.plugin_list_widget.setObjectName('plugin_list_widget')
self.list_layout.addWidget(self.plugin_list_widget)
self.plugin_info_group_box = QtGui.QGroupBox(plugin_view_dialog)
self.plugin_info_group_box = QtWidgets.QGroupBox(plugin_view_dialog)
self.plugin_info_group_box.setObjectName('plugin_info_group_box')
self.plugin_info_layout = QtGui.QFormLayout(self.plugin_info_group_box)
self.plugin_info_layout = QtWidgets.QFormLayout(self.plugin_info_group_box)
self.plugin_info_layout.setObjectName('plugin_info_layout')
self.status_label = QtGui.QLabel(self.plugin_info_group_box)
self.status_label = QtWidgets.QLabel(self.plugin_info_group_box)
self.status_label.setObjectName('status_label')
self.status_combo_box = QtGui.QComboBox(self.plugin_info_group_box)
self.status_combo_box = QtWidgets.QComboBox(self.plugin_info_group_box)
self.status_combo_box.addItems(('', ''))
self.status_combo_box.setObjectName('status_combo_box')
self.plugin_info_layout.addRow(self.status_label, self.status_combo_box)
self.version_label = QtGui.QLabel(self.plugin_info_group_box)
self.version_label = QtWidgets.QLabel(self.plugin_info_group_box)
self.version_label.setObjectName('version_label')
self.version_number_label = QtGui.QLabel(self.plugin_info_group_box)
self.version_number_label = QtWidgets.QLabel(self.plugin_info_group_box)
self.version_number_label.setObjectName('version_number_label')
self.plugin_info_layout.addRow(self.version_label, self.version_number_label)
self.about_label = QtGui.QLabel(self.plugin_info_group_box)
self.about_label = QtWidgets.QLabel(self.plugin_info_group_box)
self.about_label.setObjectName('about_label')
self.about_text_browser = QtGui.QTextBrowser(self.plugin_info_group_box)
self.about_text_browser = QtWidgets.QTextBrowser(self.plugin_info_group_box)
self.about_text_browser.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse)
self.about_text_browser.setObjectName('aboutTextBrowser')
self.plugin_info_layout.addRow(self.about_label, self.about_text_browser)

View File

@ -24,7 +24,7 @@ The actual plugin view form
"""
import logging
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import RegistryProperties, translate
from openlp.core.lib import PluginStatus
@ -33,7 +33,7 @@ from .plugindialog import Ui_PluginViewDialog
log = logging.getLogger(__name__)
class PluginForm(QtGui.QDialog, Ui_PluginViewDialog, RegistryProperties):
class PluginForm(QtWidgets.QDialog, Ui_PluginViewDialog, RegistryProperties):
"""
The plugin form provides user control over the plugins OpenLP uses.
"""
@ -61,7 +61,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog, RegistryProperties):
self.programatic_change = True
plugin_list_width = 0
for plugin in self.plugin_manager.plugins:
item = QtGui.QListWidgetItem(self.plugin_list_widget)
item = QtWidgets.QListWidgetItem(self.plugin_list_widget)
# We do this just to make 100% sure the status is an integer as
# sometimes when it's loaded from the config, it isn't cast to int.
plugin.status = int(plugin.status)

View File

@ -22,7 +22,7 @@
"""
The UI widgets of the print service dialog.
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets, QtPrintSupport
from openlp.core.common import UiStrings, translate
from openlp.core.lib import SpellTextEdit, build_icon
@ -51,16 +51,16 @@ class Ui_PrintServiceDialog(object):
print_service_dialog.setObjectName('print_service_dialog')
print_service_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
print_service_dialog.resize(664, 594)
self.main_layout = QtGui.QVBoxLayout(print_service_dialog)
self.main_layout = QtWidgets.QVBoxLayout(print_service_dialog)
self.main_layout.setSpacing(0)
self.main_layout.setMargin(0)
self.main_layout.setContentsMargins(0, 0, 0, 0)
self.main_layout.setObjectName('main_layout')
self.toolbar = QtGui.QToolBar(print_service_dialog)
self.toolbar = QtWidgets.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(':/general/general_print.png'),
translate('OpenLP.PrintServiceForm', 'Print'))
self.options_button = QtGui.QToolButton(self.toolbar)
self.options_button = QtWidgets.QToolButton(self.toolbar)
self.options_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
self.options_button.setIcon(build_icon(':/system/system_configure.png'))
self.options_button.setCheckable(True)
@ -71,54 +71,54 @@ class Ui_PrintServiceDialog(object):
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 = QtWidgets.QToolButton(self.toolbar)
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 = QtWidgets.QToolButton(self.toolbar)
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 = QtWidgets.QToolButton(self.toolbar)
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 = QtWidgets.QComboBox(print_service_dialog)
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)
self.preview_widget = QtPrintSupport.QPrintPreviewWidget(print_service_dialog)
self.main_layout.addWidget(self.preview_widget)
self.options_widget = QtGui.QWidget(print_service_dialog)
self.options_widget = QtWidgets.QWidget(print_service_dialog)
self.options_widget.hide()
self.options_widget.resize(400, 300)
self.options_widget.setAutoFillBackground(True)
self.options_layout = QtGui.QVBoxLayout(self.options_widget)
self.options_layout = QtWidgets.QVBoxLayout(self.options_widget)
self.options_layout.setContentsMargins(8, 8, 8, 8)
self.title_label = QtGui.QLabel(self.options_widget)
self.title_label = QtWidgets.QLabel(self.options_widget)
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 = QtWidgets.QLineEdit(self.options_widget)
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 = QtWidgets.QLabel(self.options_widget)
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('footer_text_edit')
self.options_layout.addWidget(self.footer_text_edit)
self.options_group_box = QtGui.QGroupBox()
self.group_layout = QtGui.QVBoxLayout()
self.slide_text_check_box = QtGui.QCheckBox()
self.options_group_box = QtWidgets.QGroupBox()
self.group_layout = QtWidgets.QVBoxLayout()
self.slide_text_check_box = QtWidgets.QCheckBox()
self.group_layout.addWidget(self.slide_text_check_box)
self.page_break_after_text = QtGui.QCheckBox()
self.page_break_after_text = QtWidgets.QCheckBox()
self.group_layout.addWidget(self.page_break_after_text)
self.notes_check_box = QtGui.QCheckBox()
self.notes_check_box = QtWidgets.QCheckBox()
self.group_layout.addWidget(self.notes_check_box)
self.meta_data_check_box = QtGui.QCheckBox()
self.meta_data_check_box = QtWidgets.QCheckBox()
self.group_layout.addWidget(self.meta_data_check_box)
self.group_layout.addStretch(1)
self.options_group_box.setLayout(self.group_layout)

View File

@ -27,7 +27,7 @@ import os
import html
import lxml.html
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets, QtPrintSupport
from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings, translate
from openlp.core.lib import get_text_file_string
@ -104,7 +104,7 @@ http://doc.trolltech.com/4.7/richtext-html-subset.html#css-properties
"""
class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog, RegistryProperties):
class PrintServiceForm(QtWidgets.QDialog, Ui_PrintServiceDialog, RegistryProperties):
"""
The :class:`~openlp.core.ui.printserviceform.PrintServiceForm` class displays a dialog for printing the service.
"""
@ -113,8 +113,8 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog, RegistryProperties)
Constructor
"""
super(PrintServiceForm, self).__init__(Registry().get('main_window'))
self.printer = QtGui.QPrinter()
self.print_dialog = QtGui.QPrintDialog(self.printer, self)
self.printer = QtPrintSupport.QPrinter()
self.print_dialog = QtPrintSupport.QPrintDialog(self.printer, self)
self.document = QtGui.QTextDocument()
self.zoom = 0
self.setupUi(self)
@ -324,7 +324,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog, RegistryProperties)
"""
Called, when the *print_button* is clicked. Opens the *print_dialog*.
"""
if not self.print_dialog.exec_():
if not self.print_dialog.exec():
return
self.update_song_usage()
# Print the document.

View File

@ -29,9 +29,9 @@ import logging
log = logging.getLogger(__name__)
log.debug('editform loaded')
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import pyqtSlot, pyqtSignal
from PyQt4.QtGui import QDialog, QPlainTextEdit, QLineEdit, QDialogButtonBox, QLabel, QGridLayout
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtCore import pyqtSlot, pyqtSignal
from PyQt5.QtWidgets import QDialog, QPlainTextEdit, QLineEdit, QDialogButtonBox, QLabel, QGridLayout
from openlp.core.common import translate, verify_ip_address
from openlp.core.lib import build_icon
@ -151,7 +151,7 @@ class ProjectorEditForm(QDialog, Ui_ProjectorEditForm):
self.button_box.helpRequested.connect(self.help_me)
self.button_box.rejected.connect(self.cancel_me)
def exec_(self, projector=None):
def exec(self, projector=None):
if projector is None:
self.projector = Projector()
self.new_projector = True
@ -159,7 +159,7 @@ class ProjectorEditForm(QDialog, Ui_ProjectorEditForm):
self.projector = projector
self.new_projector = False
self.retranslateUi(self)
reply = QDialog.exec_(self)
reply = QDialog.exec(self)
return reply
@pyqtSlot()
@ -169,22 +169,22 @@ class ProjectorEditForm(QDialog, Ui_ProjectorEditForm):
"""
log.debug('accept_me() signal received')
if len(self.name_text.text().strip()) < 1:
QtGui.QMessageBox.warning(self,
translate('OpenLP.ProjectorEdit', 'Name Not Set'),
translate('OpenLP.ProjectorEdit',
'You must enter a name for this entry.<br />'
'Please enter a new name for this entry.'))
QtWidgets.QMessageBox.warning(self,
translate('OpenLP.ProjectorEdit', 'Name Not Set'),
translate('OpenLP.ProjectorEdit',
'You must enter a name for this entry.<br />'
'Please enter a new name for this entry.'))
valid = False
return
name = self.name_text.text().strip()
record = self.projectordb.get_projector_by_name(name)
if record is not None and record.id != self.projector.id:
QtGui.QMessageBox.warning(self,
translate('OpenLP.ProjectorEdit', 'Duplicate Name'),
translate('OpenLP.ProjectorEdit',
'There is already an entry with name "%s" in '
'the database as ID "%s". <br />'
'Please enter a different name.' % (name, record.id)))
QtWidgets.QMessageBox.warning(self,
translate('OpenLP.ProjectorEdit', 'Duplicate Name'),
translate('OpenLP.ProjectorEdit',
'There is already an entry with name "%s" in '
'the database as ID "%s". <br />'
'Please enter a different name.' % (name, record.id)))
valid = False
return
adx = self.ip_text.text()
@ -195,31 +195,32 @@ class ProjectorEditForm(QDialog, Ui_ProjectorEditForm):
valid = True
self.new_projector = True
elif ip.id != self.projector.id:
QtGui.QMessageBox.warning(self,
translate('OpenLP.ProjectorWizard', 'Duplicate IP Address'),
translate('OpenLP.ProjectorWizard',
'IP address "%s"<br />is already in the database as ID %s.'
'<br /><br />Please Enter a different IP address.' % (adx, ip.id)))
QtWidgets.QMessageBox.warning(self,
translate('OpenLP.ProjectorWizard', 'Duplicate IP Address'),
translate('OpenLP.ProjectorWizard',
'IP address "%s"<br />is already in the database as ID %s.'
'<br /><br />Please Enter a different IP address.' %
(adx, ip.id)))
valid = False
return
else:
QtGui.QMessageBox.warning(self,
translate('OpenLP.ProjectorWizard', 'Invalid IP Address'),
translate('OpenLP.ProjectorWizard',
'IP address "%s"<br>is not a valid IP address.'
'<br /><br />Please enter a valid IP address.' % adx))
QtWidgets.QMessageBox.warning(self,
translate('OpenLP.ProjectorWizard', 'Invalid IP Address'),
translate('OpenLP.ProjectorWizard',
'IP address "%s"<br>is not a valid IP address.'
'<br /><br />Please enter a valid IP address.' % adx))
valid = False
return
port = int(self.port_text.text())
if port < 1000 or port > 32767:
QtGui.QMessageBox.warning(self,
translate('OpenLP.ProjectorWizard', 'Invalid Port Number'),
translate('OpenLP.ProjectorWizard',
'Port numbers below 1000 are reserved for admin use only, '
'<br />and port numbers above 32767 are not currently usable.'
'<br /><br />Please enter a valid port number between '
' 1000 and 32767.'
'<br /><br />Default PJLink port is %s' % PJLINK_PORT))
QtWidgets.QMessageBox.warning(self,
translate('OpenLP.ProjectorWizard', 'Invalid Port Number'),
translate('OpenLP.ProjectorWizard',
'Port numbers below 1000 are reserved for admin use only, '
'<br />and port numbers above 32767 are not currently usable.'
'<br /><br />Please enter a valid port number between '
' 1000 and 32767.'
'<br /><br />Default PJLink port is %s' % PJLINK_PORT))
valid = False
if valid:
self.projector.ip = self.ip_text.text()
@ -233,11 +234,11 @@ class ProjectorEditForm(QDialog, Ui_ProjectorEditForm):
else:
saved = self.projectordb.update_projector(self.projector)
if not saved:
QtGui.QMessageBox.warning(self,
translate('OpenLP.ProjectorEditForm', 'Database Error'),
translate('OpenLP.ProjectorEditForm',
'There was an error saving projector '
'information. See the log for the error'))
QtWidgets.QMessageBox.warning(self,
translate('OpenLP.ProjectorEditForm', 'Database Error'),
translate('OpenLP.ProjectorEditForm',
'There was an error saving projector '
'information. See the log for the error'))
return saved
if self.new_projector:
self.newProjector.emit(adx)

View File

@ -29,9 +29,9 @@ import logging
log = logging.getLogger(__name__)
log.debug('projectormanager loaded')
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import QObject, QThread, pyqtSlot
from PyQt4.QtGui import QWidget
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import QObject, QThread, pyqtSlot
from PyQt5.QtWidgets import QWidget
from openlp.core.common import RegistryProperties, Settings, OpenLPMixin, \
RegistryMixin, translate
@ -74,9 +74,9 @@ class Ui_ProjectorManager(object):
"""
log.debug('setup_ui()')
# Create ProjectorManager box
self.layout = QtGui.QVBoxLayout(widget)
self.layout = QtWidgets.QVBoxLayout(widget)
self.layout.setSpacing(0)
self.layout.setMargin(0)
self.layout.setContentsMargins(0, 0, 0, 0)
self.layout.setObjectName('layout')
# Add one selection toolbar
self.one_toolbar = OpenLPToolbar(widget)
@ -195,11 +195,11 @@ class Ui_ProjectorManager(object):
'Show selected projector screen'),
triggers=self.on_show_projector)
self.layout.addWidget(self.one_toolbar)
self.projector_one_widget = QtGui.QWidgetAction(self.one_toolbar)
self.projector_one_widget = QtWidgets.QWidgetAction(self.one_toolbar)
self.projector_one_widget.setObjectName('projector_one_toolbar_widget')
# Create projector manager list
self.projector_list_widget = QtGui.QListWidget(widget)
self.projector_list_widget.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.projector_list_widget = QtWidgets.QListWidget(widget)
self.projector_list_widget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
self.projector_list_widget.setAlternatingRowColors(True)
self.projector_list_widget.setIconSize(QtCore.QSize(90, 50))
self.projector_list_widget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
@ -208,7 +208,7 @@ class Ui_ProjectorManager(object):
self.projector_list_widget.customContextMenuRequested.connect(self.context_menu)
self.projector_list_widget.itemDoubleClicked.connect(self.on_doubleclick_item)
# Build the context menu
self.menu = QtGui.QMenu()
self.menu = QtWidgets.QMenu()
self.status_action = create_widget_action(self.menu,
text=translate('OpenLP.ProjectorManager',
'&View Projector Information'),
@ -367,7 +367,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
self.blank_action.setVisible(False)
self.show_action.setVisible(False)
self.menu.projector = real_projector
self.menu.exec_(self.projector_list_widget.mapToGlobal(point))
self.menu.exec(self.projector_list_widget.mapToGlobal(point))
def on_edit_input(self, opt=None):
self.on_select_input(opt=opt, edit=True)
@ -377,7 +377,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
Builds menu for 'Select Input' option, then calls the selected projector
item to change input source.
:param opt: Needed by PyQt4
:param opt: Needed by PyQt5
"""
self.get_settings() # In case the dialog interface setting was changed
list_item = self.projector_list_widget.item(self.projector_list_widget.currentRow())
@ -393,7 +393,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
source_select_form = SourceSelectSingle(parent=self,
projectordb=self.projectordb,
edit=edit)
source = source_select_form.exec_(projector.link)
source = source_select_form.exec(projector.link)
log.debug('(%s) source_select_form() returned %s' % (projector.link.ip, source))
if source is not None and source > 0:
projector.link.set_input_source(str(source))
@ -403,15 +403,15 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
"""
Calls edit dialog to add a new projector to the database
:param opt: Needed by PyQt4
:param opt: Needed by PyQt5
"""
self.projector_form.exec_()
self.projector_form.exec()
def on_blank_projector(self, opt=None):
"""
Calls projector thread to send blank screen command
:param opt: Needed by PyQt4
:param opt: Needed by PyQt5
"""
try:
ip = opt.link.ip
@ -432,7 +432,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
When item is doubleclicked, will connect to projector.
:param item: List widget item for connection.
:param opt: Needed by PyQt4
:param opt: Needed by PyQt5
"""
projector = item.data(QtCore.Qt.UserRole)
if projector.link.state() != projector.link.ConnectedState:
@ -446,7 +446,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
"""
Calls projector thread to connect to projector
:param opt: Needed by PyQt4
:param opt: Needed by PyQt5
"""
try:
ip = opt.link.ip
@ -466,19 +466,19 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
"""
Deletes a projector from the list and the database
:param opt: Needed by PyQt4
:param opt: Needed by PyQt5
"""
list_item = self.projector_list_widget.item(self.projector_list_widget.currentRow())
if list_item is None:
return
projector = list_item.data(QtCore.Qt.UserRole)
msg = QtGui.QMessageBox()
msg = QtWidgets.QMessageBox()
msg.setText(translate('OpenLP.ProjectorManager', 'Delete projector (%s) %s?') % (projector.link.ip,
projector.link.name))
msg.setInformativeText(translate('OpenLP.ProjectorManager', 'Are you sure you want to delete this projector?'))
msg.setStandardButtons(msg.Cancel | msg.Ok)
msg.setDefaultButton(msg.Cancel)
ans = msg.exec_()
ans = msg.exec()
if ans == msg.Cancel:
return
try:
@ -528,7 +528,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
"""
Calls projector thread to disconnect from projector
:param opt: Needed by PyQt4
:param opt: Needed by PyQt5
"""
try:
ip = opt.link.ip
@ -548,7 +548,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
"""
Calls edit dialog with selected projector to edit information
:param opt: Needed by PyQt4
:param opt: Needed by PyQt5
"""
list_item = self.projector_list_widget.item(self.projector_list_widget.currentRow())
projector = list_item.data(QtCore.Qt.UserRole)
@ -556,14 +556,14 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
return
self.old_projector = projector
projector.link.disconnect_from_host()
self.projector_form.exec_(projector.db_item)
self.projector_form.exec(projector.db_item)
projector.db_item = self.projectordb.get_projector_by_id(self.old_projector.db_item.id)
def on_poweroff_projector(self, opt=None):
"""
Calls projector link to send Power Off command
:param opt: Needed by PyQt4
:param opt: Needed by PyQt5
"""
try:
ip = opt.link.ip
@ -583,7 +583,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
"""
Calls projector link to send Power On command
:param opt: Needed by PyQt4
:param opt: Needed by PyQt5
"""
try:
ip = opt.link.ip
@ -603,7 +603,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
"""
Calls projector thread to send open shutter command
:param opt: Needed by PyQt4
:param opt: Needed by PyQt5
"""
try:
ip = opt.link.ip
@ -623,7 +623,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
"""
Builds message box with projector status information
:param opt: Needed by PyQt4
:param opt: Needed by PyQt5
"""
lwi = self.projector_list_widget.item(self.projector_list_widget.currentRow())
projector = lwi.data(QtCore.Qt.UserRole)
@ -674,7 +674,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
message = '%s<b>%s</b>' % (message, translate('OpenLP.ProjectorManager', 'Current errors/warnings'))
for (key, val) in projector.link.projector_errors.items():
message = '%s<b>%s</b>: %s<br />' % (message, key, ERROR_MSG[val])
QtGui.QMessageBox.information(self, translate('OpenLP.ProjectorManager', 'Projector Information'), message)
QtWidgets.QMessageBox.information(self, translate('OpenLP.ProjectorManager', 'Projector Information'), message)
def _add_projector(self, projector):
"""
@ -707,10 +707,10 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
item.db_item = projector
icon = QtGui.QIcon(QtGui.QPixmap(STATUS_ICONS[S_NOT_CONNECTED]))
item.icon = icon
widget = QtGui.QListWidgetItem(icon,
item.link.name,
self.projector_list_widget
)
widget = QtWidgets.QListWidgetItem(icon,
item.link.name,
self.projector_list_widget
)
widget.setData(QtCore.Qt.UserRole, item)
item.link.db_item = item.db_item
item.widget = widget
@ -751,7 +751,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
Add a projector from the edit dialog
:param ip: IP address of new record item to find
:param opts: Needed by PyQt4
:param opts: Needed by PyQt5
"""
log.debug('add_projector_from_wizard(ip=%s)' % ip)
item = self.projectordb.get_projector_by_ip(ip)
@ -831,7 +831,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
self.update_icons()
def get_toolbar_item(self, name, enabled=False, hidden=False):
item = self.one_toolbar.findChild(QtGui.QAction, name)
item = self.one_toolbar.findChild(QtWidgets.QAction, name)
if item == 0:
log.debug('No item found with name "%s"' % name)
return
@ -918,11 +918,11 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
:param name: Name from QListWidgetItem
"""
QtGui.QMessageBox.warning(self, translate('OpenLP.ProjectorManager',
'"%s" Authentication Error' % name),
'<br />There was an authentication error while trying to connect.'
'<br /><br />Please verify your PIN setting '
'for projector item "%s"' % name)
QtWidgets.QMessageBox.warning(self, translate('OpenLP.ProjectorManager',
'"%s" Authentication Error' % name),
'<br />There was an authentication error while trying to connect.'
'<br /><br />Please verify your PIN setting '
'for projector item "%s"' % name)
@pyqtSlot(str)
def no_authentication_error(self, name):
@ -932,11 +932,11 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
:param name: Name from QListWidgetItem
"""
QtGui.QMessageBox.warning(self, translate('OpenLP.ProjectorManager',
'"%s" No Authentication Error' % name),
'<br />PIN is set and projector does not require authentication.'
'<br /><br />Please verify your PIN setting '
'for projector item "%s"' % name)
QtWidgets.QMessageBox.warning(self, translate('OpenLP.ProjectorManager',
'"%s" No Authentication Error' % name),
'<br />PIN is set and projector does not require authentication.'
'<br /><br />Please verify your PIN setting '
'for projector item "%s"' % name)
class ProjectorItem(QObject):
@ -969,8 +969,8 @@ def not_implemented(function):
:param func: Function name
"""
QtGui.QMessageBox.information(None,
translate('OpenLP.ProjectorManager', 'Not Implemented Yet'),
translate('OpenLP.ProjectorManager',
'Function "%s"<br />has not been implemented yet.'
'<br />Please check back again later.' % function))
QtWidgets.QMessageBox.information(None,
translate('OpenLP.ProjectorManager', 'Not Implemented Yet'),
translate('OpenLP.ProjectorManager',
'Function "%s"<br />has not been implemented yet.'
'<br />Please check back again later.' % function))

View File

@ -28,9 +28,9 @@ import logging
log = logging.getLogger(__name__)
log.debug('editform loaded')
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import pyqtSlot, QSize
from PyQt4.QtGui import QDialog, QButtonGroup, QDialogButtonBox, QFormLayout, QLineEdit, QRadioButton, \
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtCore import pyqtSlot, QSize
from PyQt5.QtWidgets import QDialog, QButtonGroup, QDialogButtonBox, QFormLayout, QLineEdit, QRadioButton, \
QStyle, QStylePainter, QStyleOptionTab, QTabBar, QTabWidget, QVBoxLayout, QWidget
from openlp.core.common import translate, is_macosx
@ -263,7 +263,7 @@ class SourceSelectTabs(QDialog):
self.layout.addWidget(self.tabwidget)
self.setLayout(self.layout)
def exec_(self, projector):
def exec(self, projector):
"""
Override initial method so we can build the tabs.
@ -287,10 +287,10 @@ class SourceSelectTabs(QDialog):
thistab = self.tabwidget.addTab(tab, PJLINK_DEFAULT_SOURCES[key])
if buttonchecked:
self.tabwidget.setCurrentIndex(thistab)
self.button_box = QDialogButtonBox(QtGui.QDialogButtonBox.Reset |
QtGui.QDialogButtonBox.Discard |
QtGui.QDialogButtonBox.Ok |
QtGui.QDialogButtonBox.Cancel)
self.button_box = QDialogButtonBox(QtWidgets.QDialogButtonBox.Reset |
QtWidgets.QDialogButtonBox.Discard |
QtWidgets.QDialogButtonBox.Ok |
QtWidgets.QDialogButtonBox.Cancel)
else:
for key in keys:
(tab, button_count, buttonchecked) = Build_Tab(group=self.button_group,
@ -302,12 +302,12 @@ class SourceSelectTabs(QDialog):
thistab = self.tabwidget.addTab(tab, PJLINK_DEFAULT_SOURCES[key])
if buttonchecked:
self.tabwidget.setCurrentIndex(thistab)
self.button_box = QDialogButtonBox(QtGui.QDialogButtonBox.Ok |
QtGui.QDialogButtonBox.Cancel)
self.button_box = QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok |
QtWidgets.QDialogButtonBox.Cancel)
self.button_box.clicked.connect(self.button_clicked)
self.layout.addWidget(self.button_box)
set_button_tooltip(self.button_box)
selected = super(SourceSelectTabs, self).exec_()
selected = super(SourceSelectTabs, self).exec()
return selected
@pyqtSlot(object)
@ -333,14 +333,14 @@ class SourceSelectTabs(QDialog):
return 100
def delete_sources(self):
msg = QtGui.QMessageBox()
msg = QtWidgets.QMessageBox()
msg.setText(translate('OpenLP.SourceSelectForm', 'Delete entries for this projector'))
msg.setInformativeText(translate('OpenLP.SourceSelectForm',
'Are you sure you want to delete ALL user-defined '
'source input text for this projector?'))
msg.setStandardButtons(msg.Cancel | msg.Ok)
msg.setDefaultButton(msg.Cancel)
ans = msg.exec_()
ans = msg.exec()
if ans == msg.Cancel:
return
self.projectordb.delete_all_objects(ProjectorSource, ProjectorSource.projector_id == self.projector.db_item.id)
@ -396,7 +396,7 @@ class SourceSelectSingle(QDialog):
self.setModal(True)
self.edit = edit
def exec_(self, projector, edit=False):
def exec(self, projector, edit=False):
"""
Override initial method so we can build the tabs.
@ -426,26 +426,26 @@ class SourceSelectSingle(QDialog):
item.setText(source_item.text)
self.layout.addRow(PJLINK_DEFAULT_CODES[key], item)
self.button_group.append(item)
self.button_box = QDialogButtonBox(QtGui.QDialogButtonBox.Reset |
QtGui.QDialogButtonBox.Discard |
QtGui.QDialogButtonBox.Ok |
QtGui.QDialogButtonBox.Cancel)
self.button_box = QDialogButtonBox(QtWidgets.QDialogButtonBox.Reset |
QtWidgets.QDialogButtonBox.Discard |
QtWidgets.QDialogButtonBox.Ok |
QtWidgets.QDialogButtonBox.Cancel)
else:
for key in keys:
source_text = self.projectordb.get_source_by_code(code=key, projector_id=self.projector.db_item.id)
text = self.source_text[key] if source_text is None else source_text.text
button = QtGui.QRadioButton(text)
button = QtWidgets.QRadioButton(text)
button.setChecked(True if key == projector.source else False)
self.layout.addWidget(button)
self.button_group.addButton(button, int(key))
button_list.append(key)
self.button_box = QDialogButtonBox(QtGui.QDialogButtonBox.Ok |
QtGui.QDialogButtonBox.Cancel)
self.button_box = QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok |
QtWidgets.QDialogButtonBox.Cancel)
self.button_box.clicked.connect(self.button_clicked)
self.layout.addWidget(self.button_box)
self.setMinimumHeight(key_count*25)
set_button_tooltip(self.button_box)
selected = super(SourceSelectSingle, self).exec_()
selected = super(SourceSelectSingle, self).exec()
return selected
@pyqtSlot(object)
@ -471,14 +471,14 @@ class SourceSelectSingle(QDialog):
return 100
def delete_sources(self):
msg = QtGui.QMessageBox()
msg = QtWidgets.QMessageBox()
msg.setText(translate('OpenLP.SourceSelectForm', 'Delete entries for this projector'))
msg.setInformativeText(translate('OpenLP.SourceSelectForm',
'Are you sure you want to delete ALL user-defined '
'source input text for this projector?'))
msg.setStandardButtons(msg.Cancel | msg.Ok)
msg.setDefaultButton(msg.Cancel)
ans = msg.exec_()
ans = msg.exec()
if ans == msg.Cancel:
return
self.projectordb.delete_all_objects(ProjectorSource, ProjectorSource.projector_id == self.projector.db_item.id)

View File

@ -29,7 +29,7 @@ import logging
log = logging.getLogger(__name__)
log.debug('projectortab module loaded')
from PyQt4 import QtCore, QtGui
from PyQt5 import QtWidgets
from openlp.core.common import Settings, UiStrings, translate
from openlp.core.lib import SettingsTab
@ -56,35 +56,35 @@ class ProjectorTab(SettingsTab):
"""
self.setObjectName('ProjectorTab')
super(ProjectorTab, self).setupUi()
self.connect_box = QtGui.QGroupBox(self.left_column)
self.connect_box = QtWidgets.QGroupBox(self.left_column)
self.connect_box.setObjectName('connect_box')
self.connect_box_layout = QtGui.QFormLayout(self.connect_box)
self.connect_box_layout = QtWidgets.QFormLayout(self.connect_box)
self.connect_box_layout.setObjectName('connect_box_layout')
# Start comms with projectors on startup
self.connect_on_startup = QtGui.QCheckBox(self.connect_box)
self.connect_on_startup = QtWidgets.QCheckBox(self.connect_box)
self.connect_on_startup.setObjectName('connect_on_startup')
self.connect_box_layout.addRow(self.connect_on_startup)
# Socket timeout
self.socket_timeout_label = QtGui.QLabel(self.connect_box)
self.socket_timeout_label = QtWidgets.QLabel(self.connect_box)
self.socket_timeout_label.setObjectName('socket_timeout_label')
self.socket_timeout_spin_box = QtGui.QSpinBox(self.connect_box)
self.socket_timeout_spin_box = QtWidgets.QSpinBox(self.connect_box)
self.socket_timeout_spin_box.setObjectName('socket_timeout_spin_box')
self.socket_timeout_spin_box.setMinimum(2)
self.socket_timeout_spin_box.setMaximum(10)
self.connect_box_layout.addRow(self.socket_timeout_label, self.socket_timeout_spin_box)
# Poll interval
self.socket_poll_label = QtGui.QLabel(self.connect_box)
self.socket_poll_label = QtWidgets.QLabel(self.connect_box)
self.socket_poll_label.setObjectName('socket_poll_label')
self.socket_poll_spin_box = QtGui.QSpinBox(self.connect_box)
self.socket_poll_spin_box = QtWidgets.QSpinBox(self.connect_box)
self.socket_poll_spin_box.setObjectName('socket_timeout_spin_box')
self.socket_poll_spin_box.setMinimum(5)
self.socket_poll_spin_box.setMaximum(60)
self.connect_box_layout.addRow(self.socket_poll_label, self.socket_poll_spin_box)
self.left_layout.addWidget(self.connect_box)
# Source input select dialog box type
self.dialog_type_label = QtGui.QLabel(self.connect_box)
self.dialog_type_label = QtWidgets.QLabel(self.connect_box)
self.dialog_type_label.setObjectName('dialog_type_label')
self.dialog_type_combo_box = QtGui.QComboBox(self.connect_box)
self.dialog_type_combo_box = QtWidgets.QComboBox(self.connect_box)
self.dialog_type_combo_box.setObjectName('dialog_type_combo_box')
self.dialog_type_combo_box.addItems(['', ''])
self.connect_box_layout.addRow(self.dialog_type_label, self.dialog_type_combo_box)

View File

@ -22,7 +22,7 @@
"""
The UI widgets for the service item edit dialog
"""
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import translate
from openlp.core.lib import build_icon
@ -39,15 +39,15 @@ class Ui_ServiceItemEditDialog(object):
"""
serviceItemEditDialog.setObjectName('serviceItemEditDialog')
serviceItemEditDialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
self.dialog_layout = QtGui.QGridLayout(serviceItemEditDialog)
self.dialog_layout = QtWidgets.QGridLayout(serviceItemEditDialog)
self.dialog_layout.setContentsMargins(8, 8, 8, 8)
self.dialog_layout.setSpacing(8)
self.dialog_layout.setObjectName('dialog_layout')
self.list_widget = QtGui.QListWidget(serviceItemEditDialog)
self.list_widget = QtWidgets.QListWidget(serviceItemEditDialog)
self.list_widget.setAlternatingRowColors(True)
self.list_widget.setObjectName('list_widget')
self.dialog_layout.addWidget(self.list_widget, 0, 0)
self.button_layout = QtGui.QVBoxLayout()
self.button_layout = QtWidgets.QVBoxLayout()
self.button_layout.setObjectName('button_layout')
self.delete_button = create_button(serviceItemEditDialog, 'deleteButton', role='delete',
click=serviceItemEditDialog.on_delete_button_clicked)

View File

@ -22,13 +22,14 @@
"""
The service item edit dialog
"""
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import Registry, RegistryProperties
from .serviceitemeditdialog import Ui_ServiceItemEditDialog
class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog, RegistryProperties):
class ServiceItemEditForm(QtWidgets.QDialog, Ui_ServiceItemEditDialog, RegistryProperties):
"""
This is the form that is used to edit the verses of the song.
"""
@ -71,7 +72,7 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog, RegistryPrope
"""
self.list_widget.clear()
for frame in self.item_list:
item_name = QtGui.QListWidgetItem(frame['title'])
item_name = QtWidgets.QListWidgetItem(frame['title'])
self.list_widget.addItem(item_name)
def on_delete_button_clicked(self):

View File

@ -30,7 +30,7 @@ import json
from tempfile import mkstemp
from datetime import datetime, timedelta
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, ThemeLevel, OpenLPMixin, \
RegistryMixin, check_directory_exists, UiStrings, translate
@ -42,7 +42,7 @@ from openlp.core.utils import delete_file, split_filename, format_time
from openlp.core.utils.actions import ActionList, CategoryOrder
class ServiceManagerList(QtGui.QTreeWidget):
class ServiceManagerList(QtWidgets.QTreeWidget):
"""
Set up key bindings and mouse behaviour for the service list
"""
@ -89,7 +89,7 @@ class ServiceManagerList(QtGui.QTreeWidget):
mime_data = QtCore.QMimeData()
drag.setMimeData(mime_data)
mime_data.setText('ServiceManager')
drag.start(QtCore.Qt.CopyAction)
drag.exec(QtCore.Qt.CopyAction)
class Ui_ServiceManager(object):
@ -102,9 +102,9 @@ class Ui_ServiceManager(object):
:param widget:
"""
# start with the layout
self.layout = QtGui.QVBoxLayout(widget)
self.layout = QtWidgets.QVBoxLayout(widget)
self.layout.setSpacing(0)
self.layout.setMargin(0)
self.layout.setContentsMargins(0, 0, 0, 0)
# Create the top toolbar
self.toolbar = OpenLPToolbar(widget)
self.toolbar.add_toolbar_action('newService', text=UiStrings().NewService, icon=':/general/general_new.png',
@ -118,14 +118,14 @@ class Ui_ServiceManager(object):
tooltip=translate('OpenLP.ServiceManager', 'Save this service.'),
triggers=self.decide_save_method)
self.toolbar.addSeparator()
self.theme_label = QtGui.QLabel('%s:' % UiStrings().Theme, widget)
self.theme_label.setMargin(3)
self.theme_label = QtWidgets.QLabel('%s:' % UiStrings().Theme, widget)
self.theme_label.setContentsMargins(3, 3, 3, 3)
self.theme_label.setObjectName('theme_label')
self.toolbar.add_toolbar_widget(self.theme_label)
self.theme_combo_box = QtGui.QComboBox(self.toolbar)
self.theme_combo_box = QtWidgets.QComboBox(self.toolbar)
self.theme_combo_box.setToolTip(translate('OpenLP.ServiceManager', 'Select a theme for the service.'))
self.theme_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
self.theme_combo_box.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.theme_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToMinimumContentsLength)
self.theme_combo_box.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
self.theme_combo_box.setObjectName('theme_combo_box')
self.toolbar.add_toolbar_widget(self.theme_combo_box)
self.toolbar.setObjectName('toolbar')
@ -133,10 +133,10 @@ class Ui_ServiceManager(object):
# Create the service manager list
self.service_manager_list = ServiceManagerList(widget)
self.service_manager_list.setEditTriggers(
QtGui.QAbstractItemView.CurrentChanged |
QtGui.QAbstractItemView.DoubleClicked |
QtGui.QAbstractItemView.EditKeyPressed)
self.service_manager_list.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
QtWidgets.QAbstractItemView.CurrentChanged |
QtWidgets.QAbstractItemView.DoubleClicked |
QtWidgets.QAbstractItemView.EditKeyPressed)
self.service_manager_list.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop)
self.service_manager_list.setAlternatingRowColors(True)
self.service_manager_list.setHeaderHidden(True)
self.service_manager_list.setExpandsOnDoubleClick(False)
@ -218,13 +218,13 @@ class Ui_ServiceManager(object):
self.service_theme = Settings().value(self.main_window.service_manager_settings_section + '/service theme')
self.service_path = AppLocation.get_section_data_path('servicemanager')
# build the drag and drop context menu
self.dnd_menu = QtGui.QMenu()
self.dnd_menu = QtWidgets.QMenu()
self.new_action = self.dnd_menu.addAction(translate('OpenLP.ServiceManager', '&Add New Item'))
self.new_action.setIcon(build_icon(':/general/general_edit.png'))
self.add_to_action = self.dnd_menu.addAction(translate('OpenLP.ServiceManager', '&Add to Selected Item'))
self.add_to_action.setIcon(build_icon(':/general/general_edit.png'))
# build the context menu
self.menu = QtGui.QMenu()
self.menu = QtWidgets.QMenu()
self.edit_action = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Edit Item'),
icon=':/general/general_edit.png', triggers=self.remote_edit)
self.rename_action = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Rename...'),
@ -250,9 +250,9 @@ class Ui_ServiceManager(object):
triggers=self.create_custom)
self.menu.addSeparator()
# Add AutoPlay menu actions
self.auto_play_slides_menu = QtGui.QMenu(translate('OpenLP.ServiceManager', '&Auto play slides'))
self.auto_play_slides_menu = QtWidgets.QMenu(translate('OpenLP.ServiceManager', '&Auto play slides'))
self.menu.addMenu(self.auto_play_slides_menu)
auto_play_slides_group = QtGui.QActionGroup(self.auto_play_slides_menu)
auto_play_slides_group = QtWidgets.QActionGroup(self.auto_play_slides_menu)
auto_play_slides_group.setExclusive(True)
self.auto_play_slides_loop = create_widget_action(self.auto_play_slides_menu,
text=translate('OpenLP.ServiceManager', 'Auto play slides '
@ -275,7 +275,7 @@ class Ui_ServiceManager(object):
# Add already existing make live action to the menu.
self.menu.addAction(self.service_manager_list.make_live)
self.menu.addSeparator()
self.theme_menu = QtGui.QMenu(translate('OpenLP.ServiceManager', '&Change Item Theme'))
self.theme_menu = QtWidgets.QMenu(translate('OpenLP.ServiceManager', '&Change Item Theme'))
self.menu.addMenu(self.theme_menu)
self.service_manager_list.addActions(
[self.service_manager_list.move_down,
@ -302,12 +302,16 @@ class Ui_ServiceManager(object):
event.accept()
class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManager, RegistryProperties):
class ServiceManager(OpenLPMixin, RegistryMixin, QtWidgets.QWidget, Ui_ServiceManager, RegistryProperties):
"""
Manages the services. This involves taking text strings from plugins and adding them to the service. This service
can then be zipped up with all the resources used into one OSZ or oszl file for use on any OpenLP v2 installation.
Also handles the UI tasks of moving things up and down etc.
"""
servicemanager_set_item = QtCore.pyqtSignal(int)
servicemanager_next_item = QtCore.pyqtSignal()
servicemanager_previous_item = QtCore.pyqtSignal()
def __init__(self, parent=None):
"""
Sets up the service manager, toolbars, list view, et al.
@ -330,9 +334,9 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
"""
self.setup_ui(self)
# Need to use event as called across threads and UI is updated
QtCore.QObject.connect(self, QtCore.SIGNAL('servicemanager_set_item'), self.on_set_item)
QtCore.QObject.connect(self, QtCore.SIGNAL('servicemanager_next_item'), self.next_item)
QtCore.QObject.connect(self, QtCore.SIGNAL('servicemanager_previous_item'), self.previous_item)
self.servicemanager_set_item.connect(self.on_set_item)
self.servicemanager_next_item.connect(self.next_item)
self.servicemanager_previous_item.connect(self.previous_item)
def bootstrap_post_set_up(self):
"""
@ -410,9 +414,9 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
"""
if self.is_modified():
result = self.save_modified_service()
if result == QtGui.QMessageBox.Cancel:
if result == QtWidgets.QMessageBox.Cancel:
return False
elif result == QtGui.QMessageBox.Save:
elif result == QtWidgets.QMessageBox.Save:
if not self.decide_save_method():
return False
self.new_file()
@ -425,17 +429,16 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
"""
if self.is_modified():
result = self.save_modified_service()
if result == QtGui.QMessageBox.Cancel:
if result == QtWidgets.QMessageBox.Cancel:
return False
elif result == QtGui.QMessageBox.Save:
elif result == QtWidgets.QMessageBox.Save:
self.decide_save_method()
if not load_file:
file_name = QtGui.QFileDialog.getOpenFileName(
file_name, filter_used = QtWidgets.QFileDialog.getOpenFileName(
self.main_window,
translate('OpenLP.ServiceManager', 'Open File'),
Settings().value(self.main_window.service_manager_settings_section + '/last directory'),
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz *.oszl)')
)
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz *.oszl)'))
if not file_name:
return False
else:
@ -448,13 +451,13 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
"""
Check to see if a service needs to be saved.
"""
return QtGui.QMessageBox.question(self.main_window,
translate('OpenLP.ServiceManager', 'Modified Service'),
translate('OpenLP.ServiceManager',
'The current service has been modified. Would you like to save '
'this service?'),
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard |
QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
return QtWidgets.QMessageBox.question(self.main_window,
translate('OpenLP.ServiceManager', 'Modified Service'),
translate('OpenLP.ServiceManager',
'The current service has been modified. Would you like to save '
'this service?'),
QtWidgets.QMessageBox.Save | QtWidgets.QMessageBox.Discard |
QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Save)
def on_recent_service_clicked(self, field=None):
"""
@ -535,10 +538,10 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
message = translate('OpenLP.ServiceManager',
'The following file(s) in the service are missing: %s\n\n'
'These files will be removed if you continue to save.') % "\n\t".join(missing_list)
answer = QtGui.QMessageBox.critical(self, title, message,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok |
QtGui.QMessageBox.Cancel))
if answer == QtGui.QMessageBox.Cancel:
answer = QtWidgets.QMessageBox.critical(self, title, message,
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok |
QtWidgets.QMessageBox.Cancel))
if answer == QtWidgets.QMessageBox.Cancel:
self.main_window.finished_progress_bar()
return False
# Check if item contains a missing file.
@ -602,10 +605,10 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
except shutil.Error:
return self.save_file_as()
except OSError as ose:
QtGui.QMessageBox.critical(self, translate('OpenLP.ServiceManager', 'Error Saving File'),
translate('OpenLP.ServiceManager', 'An error occurred while writing the '
'service file: %s') % ose.strerror,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
QtWidgets.QMessageBox.critical(self, translate('OpenLP.ServiceManager', 'Error Saving File'),
translate('OpenLP.ServiceManager', 'An error occurred while writing the '
'service file: %s') % ose.strerror,
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok))
success = False
self.main_window.add_recent_file(path_file_name)
self.set_modified(False)
@ -694,14 +697,14 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
# SaveAs from osz to oszl is not valid as the files will be deleted on exit which is not sensible or usable in
# the long term.
if self._file_name.endswith('oszl') or self.service_has_all_original_files:
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz);; OpenLP Service '
'Files - lite (*.oszl)'))
file_name, filter_used = QtWidgets.QFileDialog.getSaveFileName(
self.main_window, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz);; OpenLP Service Files - lite (*.oszl)'))
else:
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz);;'))
file_name, filter_uesd = QtWidgets.QFileDialog.getSaveFileName(
self.main_window, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz);;'))
if not file_name:
return False
if os.path.splitext(file_name)[1] == '':
@ -783,15 +786,16 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
except zipfile.BadZipfile:
if os.path.getsize(file_name) == 0:
self.log_exception('Service file is zero sized: %s' % file_name)
QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Empty File'),
translate('OpenLP.ServiceManager', 'This service file does not contain '
'any data.'))
QtWidgets.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Empty File'),
translate('OpenLP.ServiceManager',
'This service file does not contain '
'any data.'))
else:
self.log_exception('Service file is cannot be extracted as zip: %s' % file_name)
QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'),
translate('OpenLP.ServiceManager',
'This file is either corrupt or it is not an OpenLP 2 service '
'file.'))
QtWidgets.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'),
translate('OpenLP.ServiceManager',
'This file is either corrupt or it is not an OpenLP 2 '
'service file.'))
self.application.set_normal_cursor()
return
finally:
@ -907,10 +911,10 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
if service_item['service_item'].theme is None:
theme_action = self.theme_menu.defaultAction()
else:
theme_action = self.theme_menu.findChild(QtGui.QAction, service_item['service_item'].theme)
theme_action = self.theme_menu.findChild(QtWidgets.QAction, service_item['service_item'].theme)
if theme_action is not None:
theme_action.setChecked(True)
self.menu.exec_(self.service_manager_list.mapToGlobal(point))
self.menu.exec(self.service_manager_list.mapToGlobal(point))
def on_service_item_note_form(self, field=None):
"""
@ -919,7 +923,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
"""
item = self.find_service_item()[0]
self.service_note_form.text_edit.setPlainText(self.service_items[item]['service_item'].notes)
if self.service_note_form.exec_():
if self.service_note_form.exec():
self.service_items[item]['service_item'].notes = self.service_note_form.text_edit.toPlainText()
self.repaint_service_list(item, -1)
self.set_modified()
@ -931,7 +935,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
"""
item = self.find_service_item()[0]
self.start_time_form.item = self.service_items[item]
if self.start_time_form.exec_():
if self.start_time_form.exec():
self.repaint_service_list(item, -1)
def toggle_auto_play_slides_once(self, field=None):
@ -979,7 +983,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
timed_slide_interval = Settings().value(self.main_window.general_settings_section + '/loop delay')
else:
timed_slide_interval = service_item.timed_slide_interval
timed_slide_interval, ok = QtGui.QInputDialog.getInteger(self, translate('OpenLP.ServiceManager',
timed_slide_interval, ok = QtWidgets.QInputDialog.getInt(self, translate('OpenLP.ServiceManager',
'Input delay'),
translate('OpenLP.ServiceManager',
'Delay between slides in seconds.'),
@ -1009,7 +1013,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
"""
item = self.find_service_item()[0]
self.service_item_edit_form.set_service_item(self.service_items[item]['service_item'])
if self.service_item_edit_form.exec_():
if self.service_item_edit_form.exec():
self.add_service_item(self.service_item_edit_form.get_service_item(),
replace=True, expand=self.service_items[item]['expanded'])
@ -1036,7 +1040,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
return
selected = self.service_manager_list.selectedItems()[0]
look_for = 0
service_iterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list)
service_iterator = QtWidgets.QTreeWidgetItemIterator(self.service_manager_list)
while service_iterator.value():
if look_for == 1 and service_iterator.value().parent() is None:
self.service_manager_list.setCurrentItem(service_iterator.value())
@ -1057,7 +1061,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
selected = self.service_manager_list.selectedItems()[0]
prev_item = None
prev_item_last_slide = None
service_iterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list)
service_iterator = QtWidgets.QTreeWidgetItemIterator(self.service_manager_list)
while service_iterator.value():
if service_iterator.value() == selected:
if last_slide and prev_item_last_slide:
@ -1239,7 +1243,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
self.service_manager_list.clearSelection()
for item_count, item in enumerate(self.service_items):
service_item_from_item = item['service_item']
tree_widget_item = QtGui.QTreeWidgetItem(self.service_manager_list)
tree_widget_item = QtWidgets.QTreeWidgetItem(self.service_manager_list)
if service_item_from_item.is_valid:
if service_item_from_item.notes:
icon = QtGui.QImage(service_item_from_item.icon)
@ -1281,7 +1285,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
tree_widget_item.setSelected(item['selected'])
# Add the children to their parent tree_widget_item.
for count, frame in enumerate(service_item_from_item.get_frames()):
child = QtGui.QTreeWidgetItem(tree_widget_item)
child = QtWidgets.QTreeWidgetItem(tree_widget_item)
# prefer to use a display_title
if service_item_from_item.is_capable(ItemCapabilities.HasDisplayTitle):
text = frame['display_title'].replace('\n', ' ')
@ -1337,7 +1341,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
if self.service_items:
for item in self.service_items:
item['selected'] = False
service_iterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list)
service_iterator = QtWidgets.QTreeWidgetItemIterator(self.service_manager_list)
selected_item = None
while service_iterator.value():
if service_iterator.value().isSelected():
@ -1511,9 +1515,9 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
if not self.service_items[item]['service_item'].is_capable(ItemCapabilities.CanEditTitle):
return
title = self.service_items[item]['service_item'].title
title, ok = QtGui.QInputDialog.getText(self, translate('OpenLP.ServiceManager', 'Rename item title'),
translate('OpenLP.ServiceManager', 'Title:'),
QtGui.QLineEdit.Normal, self.trUtf8(title))
title, ok = QtWidgets.QInputDialog.getText(self, translate('OpenLP.ServiceManager', 'Rename item title'),
translate('OpenLP.ServiceManager', 'Title:'),
QtWidgets.QLineEdit.Normal, self.tr(title))
if ok:
self.service_items[item]['service_item'].title = title
self.repaint_service_list(item, -1)
@ -1598,7 +1602,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
service_item = self.service_items[pos]
if (plugin == service_item['service_item'].name and
service_item['service_item'].is_capable(ItemCapabilities.CanAppend)):
action = self.dnd_menu.exec_(QtGui.QCursor.pos())
action = self.dnd_menu.exec(QtGui.QCursor.pos())
# New action required
if action == self.new_action:
self.drop_position = self._get_parent_item_data(item)
@ -1620,7 +1624,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
self.theme_combo_box.clear()
self.theme_menu.clear()
self.theme_combo_box.addItem('')
theme_group = QtGui.QActionGroup(self.theme_menu)
theme_group = QtWidgets.QActionGroup(self.theme_menu)
theme_group.setExclusive(True)
theme_group.setObjectName('theme_group')
# Create a "Default" theme, which allows the user to reset the item's theme to the service theme or global
@ -1669,7 +1673,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
Print a Service Order Sheet.
"""
setting_dialog = PrintServiceForm()
setting_dialog.exec_()
setting_dialog.exec()
def get_drop_position(self):
"""

View File

@ -22,14 +22,14 @@
"""
The :mod:`~openlp.core.ui.servicenoteform` module contains the `ServiceNoteForm` class.
"""
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import Registry, RegistryProperties, translate
from openlp.core.lib import SpellTextEdit
from openlp.core.lib.ui import create_button_box
class ServiceNoteForm(QtGui.QDialog, RegistryProperties):
class ServiceNoteForm(QtWidgets.QDialog, RegistryProperties):
"""
This is the form that is used to edit the verses of the song.
"""
@ -41,19 +41,19 @@ class ServiceNoteForm(QtGui.QDialog, RegistryProperties):
self.setupUi()
self.retranslateUi()
def exec_(self):
def exec(self):
"""
Execute the form and return the result.
"""
self.text_edit.setFocus()
return QtGui.QDialog.exec_(self)
return QtWidgets.QDialog.exec(self)
def setupUi(self):
"""
Set up the UI of the dialog
"""
self.setObjectName('serviceNoteEdit')
self.dialog_layout = QtGui.QVBoxLayout(self)
self.dialog_layout = QtWidgets.QVBoxLayout(self)
self.dialog_layout.setContentsMargins(8, 8, 8, 8)
self.dialog_layout.setSpacing(8)
self.dialog_layout.setObjectName('vertical_layout')

View File

@ -22,7 +22,7 @@
"""
The UI widgets of the settings dialog.
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import translate
from openlp.core.lib import build_icon
@ -40,16 +40,16 @@ class Ui_SettingsDialog(object):
settings_dialog.setObjectName('settings_dialog')
settings_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
settings_dialog.resize(800, 700)
self.dialog_layout = QtGui.QGridLayout(settings_dialog)
self.dialog_layout = QtWidgets.QGridLayout(settings_dialog)
self.dialog_layout.setObjectName('dialog_layout')
self.dialog_layout.setMargin(8)
self.setting_list_widget = QtGui.QListWidget(settings_dialog)
self.dialog_layout.setContentsMargins(8, 8, 8, 8)
self.setting_list_widget = QtWidgets.QListWidget(settings_dialog)
self.setting_list_widget.setUniformItemSizes(True)
self.setting_list_widget.setMinimumSize(QtCore.QSize(150, 0))
self.setting_list_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setting_list_widget.setObjectName('setting_list_widget')
self.dialog_layout.addWidget(self.setting_list_widget, 0, 0, 1, 1)
self.stacked_layout = QtGui.QStackedLayout()
self.stacked_layout = QtWidgets.QStackedLayout()
self.stacked_layout.setObjectName('stacked_layout')
self.dialog_layout.addLayout(self.stacked_layout, 0, 1, 1, 1)
self.button_box = create_button_box(settings_dialog, 'button_box', ['cancel', 'ok'])

View File

@ -24,7 +24,7 @@ The :mod:`settingsform` provides a user interface for the OpenLP settings
"""
import logging
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import Registry, RegistryProperties
from openlp.core.lib import build_icon
@ -36,7 +36,7 @@ from openlp.core.ui.projector.tab import ProjectorTab
log = logging.getLogger(__name__)
class SettingsForm(QtGui.QDialog, Ui_SettingsDialog, RegistryProperties):
class SettingsForm(QtWidgets.QDialog, Ui_SettingsDialog, RegistryProperties):
"""
Provide the form to manipulate the settings for OpenLP
"""
@ -56,7 +56,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog, RegistryProperties):
self.advanced_tab = None
self.player_tab = None
def exec_(self):
def exec(self):
"""
Execute the form
"""
@ -74,7 +74,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog, RegistryProperties):
if plugin.settings_tab:
self.insert_tab(plugin.settings_tab, plugin.is_active())
self.setting_list_widget.setCurrentRow(0)
return QtGui.QDialog.exec_(self)
return QtWidgets.QDialog.exec(self)
def insert_tab(self, tab_widget, is_visible=True):
"""
@ -87,7 +87,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog, RegistryProperties):
# add the tab to get it to display in the correct part of the screen
self.stacked_layout.addWidget(tab_widget)
if is_visible:
list_item = QtGui.QListWidgetItem(build_icon(tab_widget.icon_path), tab_widget.tab_title_visible)
list_item = QtWidgets.QListWidgetItem(build_icon(tab_widget.icon_path), tab_widget.tab_title_visible)
list_item.setData(QtCore.Qt.UserRole, tab_widget.tab_title)
self.setting_list_widget.addItem(list_item)
@ -116,7 +116,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog, RegistryProperties):
# Now lets process all the post save handlers
while self.processes:
Registry().execute(self.processes.pop(0))
return QtGui.QDialog.accept(self)
return QtWidgets.QDialog.accept(self)
def reject(self):
"""
@ -135,7 +135,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog, RegistryProperties):
tab_widget = self.stacked_layout.widget(tab_index)
if tab_widget.tab_title == plugin_name:
tab_widget.cancel()
return QtGui.QDialog.reject(self)
return QtWidgets.QDialog.reject(self)
def bootstrap_post_set_up(self):
"""

View File

@ -22,14 +22,14 @@
"""
The list of shortcuts within a dialog.
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import translate
from openlp.core.lib import build_icon
from openlp.core.lib.ui import create_button_box
class CaptureShortcutButton(QtGui.QPushButton):
class CaptureShortcutButton(QtWidgets.QPushButton):
"""
A class to encapsulate a ``QPushButton``.
"""
@ -61,56 +61,56 @@ class Ui_ShortcutListDialog(object):
shortcutListDialog.setObjectName('shortcutListDialog')
shortcutListDialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
shortcutListDialog.resize(500, 438)
self.shortcut_list_layout = QtGui.QVBoxLayout(shortcutListDialog)
self.shortcut_list_layout = QtWidgets.QVBoxLayout(shortcutListDialog)
self.shortcut_list_layout.setObjectName('shortcut_list_layout')
self.description_label = QtGui.QLabel(shortcutListDialog)
self.description_label = QtWidgets.QLabel(shortcutListDialog)
self.description_label.setObjectName('description_label')
self.description_label.setWordWrap(True)
self.shortcut_list_layout.addWidget(self.description_label)
self.tree_widget = QtGui.QTreeWidget(shortcutListDialog)
self.tree_widget = QtWidgets.QTreeWidget(shortcutListDialog)
self.tree_widget.setObjectName('tree_widget')
self.tree_widget.setAlternatingRowColors(True)
self.tree_widget.setColumnCount(3)
self.tree_widget.setColumnWidth(0, 250)
self.shortcut_list_layout.addWidget(self.tree_widget)
self.details_layout = QtGui.QGridLayout()
self.details_layout = QtWidgets.QGridLayout()
self.details_layout.setObjectName('details_layout')
self.details_layout.setContentsMargins(-1, 0, -1, -1)
self.default_radio_button = QtGui.QRadioButton(shortcutListDialog)
self.default_radio_button = QtWidgets.QRadioButton(shortcutListDialog)
self.default_radio_button.setObjectName('default_radio_button')
self.default_radio_button.setChecked(True)
self.details_layout.addWidget(self.default_radio_button, 0, 0, 1, 1)
self.custom_radio_button = QtGui.QRadioButton(shortcutListDialog)
self.custom_radio_button = QtWidgets.QRadioButton(shortcutListDialog)
self.custom_radio_button.setObjectName('custom_radio_button')
self.details_layout.addWidget(self.custom_radio_button, 1, 0, 1, 1)
self.primary_layout = QtGui.QHBoxLayout()
self.primary_layout = QtWidgets.QHBoxLayout()
self.primary_layout.setObjectName('primary_layout')
self.primary_push_button = CaptureShortcutButton(shortcutListDialog)
self.primary_push_button.setObjectName('primary_push_button')
self.primary_push_button.setMinimumSize(QtCore.QSize(84, 0))
self.primary_push_button.setIcon(build_icon(':/system/system_configure_shortcuts.png'))
self.primary_layout.addWidget(self.primary_push_button)
self.clear_primary_button = QtGui.QToolButton(shortcutListDialog)
self.clear_primary_button = QtWidgets.QToolButton(shortcutListDialog)
self.clear_primary_button.setObjectName('clear_primary_button')
self.clear_primary_button.setMinimumSize(QtCore.QSize(0, 16))
self.clear_primary_button.setIcon(build_icon(':/system/clear_shortcut.png'))
self.primary_layout.addWidget(self.clear_primary_button)
self.details_layout.addLayout(self.primary_layout, 1, 1, 1, 1)
self.alternate_layout = QtGui.QHBoxLayout()
self.alternate_layout = QtWidgets.QHBoxLayout()
self.alternate_layout.setObjectName('alternate_layout')
self.alternate_push_button = CaptureShortcutButton(shortcutListDialog)
self.alternate_push_button.setObjectName('alternate_push_button')
self.alternate_push_button.setIcon(build_icon(':/system/system_configure_shortcuts.png'))
self.alternate_layout.addWidget(self.alternate_push_button)
self.clear_alternate_button = QtGui.QToolButton(shortcutListDialog)
self.clear_alternate_button = QtWidgets.QToolButton(shortcutListDialog)
self.clear_alternate_button.setObjectName('clear_alternate_button')
self.clear_alternate_button.setIcon(build_icon(':/system/clear_shortcut.png'))
self.alternate_layout.addWidget(self.clear_alternate_button)
self.details_layout.addLayout(self.alternate_layout, 1, 2, 1, 1)
self.primary_label = QtGui.QLabel(shortcutListDialog)
self.primary_label = QtWidgets.QLabel(shortcutListDialog)
self.primary_label.setObjectName('primary_label')
self.details_layout.addWidget(self.primary_label, 0, 1, 1, 1)
self.alternate_label = QtGui.QLabel(shortcutListDialog)
self.alternate_label = QtWidgets.QLabel(shortcutListDialog)
self.alternate_label.setObjectName('alternate_label')
self.details_layout.addWidget(self.alternate_label, 0, 2, 1, 1)
self.shortcut_list_layout.addLayout(self.details_layout)

View File

@ -24,7 +24,7 @@ The :mod:`~openlp.core.ui.shortcutlistform` module contains the form class"""
import logging
import re
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import RegistryProperties, Settings, translate
from openlp.core.utils.actions import ActionList
@ -35,7 +35,7 @@ REMOVE_AMPERSAND = re.compile(r'&{1}')
log = logging.getLogger(__name__)
class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog, RegistryProperties):
class ShortcutListForm(QtWidgets.QDialog, Ui_ShortcutListDialog, RegistryProperties):
"""
The shortcut list dialog
"""
@ -100,7 +100,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog, RegistryProperties)
elif self.alternate_push_button.isChecked():
self._adjust_button(self.alternate_push_button, False, text=key_sequence.toString())
def exec_(self):
def exec(self):
"""
Execute the dialog
"""
@ -108,7 +108,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog, RegistryProperties)
self.reload_shortcut_list()
self._adjust_button(self.primary_push_button, False, False, '')
self._adjust_button(self.alternate_push_button, False, False, '')
return QtGui.QDialog.exec_(self)
return QtWidgets.QDialog.exec(self)
def reload_shortcut_list(self):
"""
@ -119,10 +119,10 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog, RegistryProperties)
# Check if the category is for internal use only.
if category.name is None:
continue
item = QtGui.QTreeWidgetItem([category.name])
item = QtWidgets.QTreeWidgetItem([category.name])
for action in category.actions:
action_text = REMOVE_AMPERSAND.sub('', action.text())
action_item = QtGui.QTreeWidgetItem([action_text])
action_item = QtWidgets.QTreeWidgetItem([action_text])
action_item.setIcon(0, action.icon())
action_item.setData(0, QtCore.Qt.UserRole, action)
tool_tip_text = action.toolTip()
@ -142,7 +142,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog, RegistryProperties)
This refreshes the item's shortcuts shown in the list. Note, this neither adds new actions nor removes old
actions.
"""
iterator = QtGui.QTreeWidgetItemIterator(self.tree_widget)
iterator = QtWidgets.QTreeWidgetItemIterator(self.tree_widget)
while iterator.value():
item = iterator.value()
iterator += 1
@ -273,13 +273,14 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog, RegistryProperties)
"""
Restores all default shortcuts.
"""
if self.button_box.buttonRole(button) != QtGui.QDialogButtonBox.ResetRole:
if self.button_box.buttonRole(button) != QtWidgets.QDialogButtonBox.ResetRole:
return
if QtGui.QMessageBox.question(self, translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),
translate('OpenLP.ShortcutListDialog', 'Do you want to restore all '
'shortcuts to their defaults?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No)) == QtGui.QMessageBox.No:
if QtWidgets.QMessageBox.question(self, translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),
translate('OpenLP.ShortcutListDialog', 'Do you want to restore all '
'shortcuts to their defaults?'),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.No)
) == QtWidgets.QMessageBox.No:
return
self._adjust_button(self.primary_push_button, False, text='')
self._adjust_button(self.alternate_push_button, False, text='')

View File

@ -28,7 +28,7 @@ import copy
from collections import deque
from threading import Lock
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry, RegistryProperties, Settings, SlideLimits, UiStrings, translate, \
RegistryMixin, OpenLPMixin
@ -73,7 +73,7 @@ NON_TEXT_MENU = [
]
class DisplayController(QtGui.QWidget):
class DisplayController(QtWidgets.QWidget):
"""
Controller is a general display controller widget.
"""
@ -98,7 +98,7 @@ class DisplayController(QtGui.QWidget):
Registry().execute('%s' % sender, [controller, args])
class InfoLabel(QtGui.QLabel):
class InfoLabel(QtWidgets.QLabel):
"""
InfoLabel is a subclassed QLabel. Created to provide the ablilty to add a ellipsis if the text is cut off. Original
source: https://stackoverflow.com/questions/11446478/pyside-pyqt-truncate-text-in-qlabel-based-on-minimumsize
@ -161,17 +161,17 @@ class SlideController(DisplayController, RegistryProperties):
self.service_item = None
self.slide_limits = None
self.update_slide_limits()
self.panel = QtGui.QWidget(self.main_window.control_splitter)
self.panel = QtWidgets.QWidget(self.main_window.control_splitter)
self.slide_list = {}
self.slide_count = 0
self.slide_image = None
self.controller_width = -1
# Layout for holding panel
self.panel_layout = QtGui.QVBoxLayout(self.panel)
self.panel_layout = QtWidgets.QVBoxLayout(self.panel)
self.panel_layout.setSpacing(0)
self.panel_layout.setMargin(0)
self.panel_layout.setContentsMargins(0, 0, 0, 0)
# Type label at the top of the slide controller
self.type_label = QtGui.QLabel(self.panel)
self.type_label = QtWidgets.QLabel(self.panel)
self.type_label.setStyleSheet('font-weight: bold; font-size: 12pt;')
self.type_label.setAlignment(QtCore.Qt.AlignCenter)
if self.is_live:
@ -181,25 +181,26 @@ class SlideController(DisplayController, RegistryProperties):
self.panel_layout.addWidget(self.type_label)
# Info label for the title of the current item, at the top of the slide controller
self.info_label = InfoLabel(self.panel)
self.info_label.setSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Preferred)
self.info_label.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Preferred)
self.panel_layout.addWidget(self.info_label)
# Splitter
self.splitter = QtGui.QSplitter(self.panel)
self.splitter = QtWidgets.QSplitter(self.panel)
self.splitter.setOrientation(QtCore.Qt.Vertical)
self.panel_layout.addWidget(self.splitter)
# Actual controller section
self.controller = QtGui.QWidget(self.splitter)
self.controller = QtWidgets.QWidget(self.splitter)
self.controller.setGeometry(QtCore.QRect(0, 0, 100, 536))
self.controller.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Maximum))
self.controller_layout = QtGui.QVBoxLayout(self.controller)
self.controller.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
QtWidgets.QSizePolicy.Maximum))
self.controller_layout = QtWidgets.QVBoxLayout(self.controller)
self.controller_layout.setSpacing(0)
self.controller_layout.setMargin(0)
self.controller_layout.setContentsMargins(0, 0, 0, 0)
# Controller list view
self.preview_widget = ListPreviewWidget(self, self.ratio)
self.controller_layout.addWidget(self.preview_widget)
# Build the full toolbar
self.toolbar = OpenLPToolbar(self)
size_toolbar_policy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
size_toolbar_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
size_toolbar_policy.setHorizontalStretch(0)
size_toolbar_policy.setVerticalStretch(0)
size_toolbar_policy.setHeightForWidth(self.toolbar.sizePolicy().hasHeightForWidth())
@ -223,11 +224,11 @@ class SlideController(DisplayController, RegistryProperties):
if self.is_live:
self.controller_type = DisplayControllerType.Live
# Hide Menu
self.hide_menu = QtGui.QToolButton(self.toolbar)
self.hide_menu = QtWidgets.QToolButton(self.toolbar)
self.hide_menu.setObjectName('hide_menu')
self.hide_menu.setText(translate('OpenLP.SlideController', 'Hide'))
self.hide_menu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
self.hide_menu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
self.hide_menu.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
self.hide_menu.setMenu(QtWidgets.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
self.toolbar.add_toolbar_widget(self.hide_menu)
self.blank_screen = create_action(self, 'blankScreen',
text=translate('OpenLP.SlideController', 'Blank Screen'),
@ -249,25 +250,26 @@ class SlideController(DisplayController, RegistryProperties):
self.hide_menu.menu().addAction(self.theme_screen)
self.hide_menu.menu().addAction(self.desktop_screen)
# Wide menu of display control buttons.
self.blank_screen_button = QtGui.QToolButton(self.toolbar)
self.blank_screen_button = QtWidgets.QToolButton(self.toolbar)
self.blank_screen_button.setObjectName('blank_screen_button')
self.toolbar.add_toolbar_widget(self.blank_screen_button)
self.blank_screen_button.setDefaultAction(self.blank_screen)
self.theme_screen_button = QtGui.QToolButton(self.toolbar)
self.theme_screen_button = QtWidgets.QToolButton(self.toolbar)
self.theme_screen_button.setObjectName('theme_screen_button')
self.toolbar.add_toolbar_widget(self.theme_screen_button)
self.theme_screen_button.setDefaultAction(self.theme_screen)
self.desktop_screen_button = QtGui.QToolButton(self.toolbar)
self.desktop_screen_button = QtWidgets.QToolButton(self.toolbar)
self.desktop_screen_button.setObjectName('desktop_screen_button')
self.toolbar.add_toolbar_widget(self.desktop_screen_button)
self.desktop_screen_button.setDefaultAction(self.desktop_screen)
self.toolbar.add_toolbar_action('loop_separator', separator=True)
# Play Slides Menu
self.play_slides_menu = QtGui.QToolButton(self.toolbar)
self.play_slides_menu = QtWidgets.QToolButton(self.toolbar)
self.play_slides_menu.setObjectName('play_slides_menu')
self.play_slides_menu.setText(translate('OpenLP.SlideController', 'Play Slides'))
self.play_slides_menu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
self.play_slides_menu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Play Slides'), self.toolbar))
self.play_slides_menu.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
self.play_slides_menu.setMenu(QtWidgets.QMenu(translate('OpenLP.SlideController', 'Play Slides'),
self.toolbar))
self.toolbar.add_toolbar_widget(self.play_slides_menu)
self.play_slides_loop = create_action(self, 'playSlidesLoop', text=UiStrings().PlaySlidesInLoop,
icon=':/media/media_time.png', checked=False, can_shortcuts=True,
@ -282,7 +284,7 @@ class SlideController(DisplayController, RegistryProperties):
self.play_slides_menu.menu().addAction(self.play_slides_loop)
self.play_slides_menu.menu().addAction(self.play_slides_once)
# Loop Delay Spinbox
self.delay_spin_box = QtGui.QSpinBox()
self.delay_spin_box = QtWidgets.QSpinBox()
self.delay_spin_box.setObjectName('delay_spin_box')
self.delay_spin_box.setRange(1, 180)
self.delay_spin_box.setSuffix(UiStrings().Seconds)
@ -306,11 +308,11 @@ class SlideController(DisplayController, RegistryProperties):
self.media_controller.register_controller(self)
if self.is_live:
# Build the Song Toolbar
self.song_menu = QtGui.QToolButton(self.toolbar)
self.song_menu = QtWidgets.QToolButton(self.toolbar)
self.song_menu.setObjectName('song_menu')
self.song_menu.setText(translate('OpenLP.SlideController', 'Go To'))
self.song_menu.setPopupMode(QtGui.QToolButton.InstantPopup)
self.song_menu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Go To'), self.toolbar))
self.song_menu.setPopupMode(QtWidgets.QToolButton.InstantPopup)
self.song_menu.setMenu(QtWidgets.QMenu(translate('OpenLP.SlideController', 'Go To'), self.toolbar))
self.toolbar.add_toolbar_widget(self.song_menu)
# Stuff for items with background audio.
# FIXME: object name should be changed. But this requires that we migrate the shortcut.
@ -320,10 +322,10 @@ class SlideController(DisplayController, RegistryProperties):
tooltip=translate('OpenLP.SlideController', 'Pause audio.'),
checked=False, visible=False, category=self.category, context=QtCore.Qt.WindowShortcut,
can_shortcuts=True, triggers=self.set_audio_pause_clicked)
self.audio_menu = QtGui.QMenu(translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
self.audio_menu = QtWidgets.QMenu(translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
self.audio_pause_item.setMenu(self.audio_menu)
self.audio_pause_item.setParent(self.toolbar)
self.toolbar.widgetForAction(self.audio_pause_item).setPopupMode(QtGui.QToolButton.MenuButtonPopup)
self.toolbar.widgetForAction(self.audio_pause_item).setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
self.next_track_item = create_action(self, 'nextTrackItem', text=UiStrings().NextTrack,
icon=':/slides/media_playback_next.png',
tooltip=translate('OpenLP.SlideController',
@ -333,7 +335,7 @@ class SlideController(DisplayController, RegistryProperties):
triggers=self.on_next_track_clicked)
self.audio_menu.addAction(self.next_track_item)
self.track_menu = self.audio_menu.addMenu(translate('OpenLP.SlideController', 'Tracks'))
self.audio_time_label = QtGui.QLabel(' 00:00 ', self.toolbar)
self.audio_time_label = QtWidgets.QLabel(' 00:00 ', self.toolbar)
self.audio_time_label.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignHCenter)
self.audio_time_label.setStyleSheet(AUDIO_TIME_LABEL_STYLESHEET)
self.audio_time_label.setObjectName('audio_time_label')
@ -341,33 +343,34 @@ class SlideController(DisplayController, RegistryProperties):
self.toolbar.set_widget_visible(AUDIO_LIST, False)
self.toolbar.set_widget_visible(['song_menu'], False)
# Screen preview area
self.preview_frame = QtGui.QFrame(self.splitter)
self.preview_frame = QtWidgets.QFrame(self.splitter)
self.preview_frame.setGeometry(QtCore.QRect(0, 0, 300, 300 * self.ratio))
self.preview_frame.setMinimumHeight(100)
self.preview_frame.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored,
QtGui.QSizePolicy.Label))
self.preview_frame.setFrameShape(QtGui.QFrame.StyledPanel)
self.preview_frame.setFrameShadow(QtGui.QFrame.Sunken)
self.preview_frame.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored,
QtWidgets.QSizePolicy.Ignored,
QtWidgets.QSizePolicy.Label))
self.preview_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.preview_frame.setFrameShadow(QtWidgets.QFrame.Sunken)
self.preview_frame.setObjectName('preview_frame')
self.grid = QtGui.QGridLayout(self.preview_frame)
self.grid.setMargin(8)
self.grid = QtWidgets.QGridLayout(self.preview_frame)
self.grid.setContentsMargins(8, 8, 8, 8)
self.grid.setObjectName('grid')
self.slide_layout = QtGui.QVBoxLayout()
self.slide_layout = QtWidgets.QVBoxLayout()
self.slide_layout.setSpacing(0)
self.slide_layout.setMargin(0)
self.slide_layout.setContentsMargins(0, 0, 0, 0)
self.slide_layout.setObjectName('SlideLayout')
self.preview_display = Display(self)
self.slide_layout.insertWidget(0, self.preview_display)
self.preview_display.hide()
# Actual preview screen
self.slide_preview = QtGui.QLabel(self)
size_policy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.slide_preview = QtWidgets.QLabel(self)
size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
size_policy.setHorizontalStretch(0)
size_policy.setVerticalStretch(0)
size_policy.setHeightForWidth(self.slide_preview.sizePolicy().hasHeightForWidth())
self.slide_preview.setSizePolicy(size_policy)
self.slide_preview.setFrameShape(QtGui.QFrame.Box)
self.slide_preview.setFrameShadow(QtGui.QFrame.Plain)
self.slide_preview.setFrameShape(QtWidgets.QFrame.Box)
self.slide_preview.setFrameShadow(QtWidgets.QFrame.Plain)
self.slide_preview.setLineWidth(1)
self.slide_preview.setScaledContents(True)
self.slide_preview.setObjectName('slide_preview')
@ -401,7 +404,7 @@ class SlideController(DisplayController, RegistryProperties):
self.preview_widget.verticalHeader().sectionClicked.connect(self.on_slide_selected)
if self.is_live:
# Need to use event as called across threads and UI is updated
QtCore.QObject.connect(self, QtCore.SIGNAL('slidecontroller_toggle_display'), self.toggle_display)
self.slidecontroller_toggle_display.connect(self.toggle_display)
Registry().register_function('slidecontroller_live_spin_delay', self.receive_spin_delay)
self.toolbar.set_widget_visible(LOOP_LIST, False)
self.toolbar.set_widget_visible(WIDE_MENU, False)
@ -416,12 +419,9 @@ class SlideController(DisplayController, RegistryProperties):
Registry().register_function('slidecontroller_%s_blank' % self.type_prefix, self.on_slide_blank)
Registry().register_function('slidecontroller_%s_unblank' % self.type_prefix, self.on_slide_unblank)
Registry().register_function('slidecontroller_update_slide_limits', self.update_slide_limits)
QtCore.QObject.connect(self, QtCore.SIGNAL('slidecontroller_%s_set' % self.type_prefix),
self.on_slide_selected_index)
QtCore.QObject.connect(self, QtCore.SIGNAL('slidecontroller_%s_next' % self.type_prefix),
self.on_slide_selected_next)
QtCore.QObject.connect(self, QtCore.SIGNAL('slidecontroller_%s_previous' % self.type_prefix),
self.on_slide_selected_previous)
getattr(self, 'slidecontroller_%s_set' % self.type_prefix).connect(self.on_slide_selected_index)
getattr(self, 'slidecontroller_%s_next' % self.type_prefix).connect(self.on_slide_selected_next)
getattr(self, 'slidecontroller_%s_previous' % self.type_prefix).connect(self.on_slide_selected_previous)
def _slide_shortcut_activated(self):
"""
@ -581,7 +581,7 @@ class SlideController(DisplayController, RegistryProperties):
if self.is_live:
self.__add_actions_to_widget(self.display)
if self.display.audio_player:
self.display.audio_player.connectSlot(QtCore.SIGNAL('tick(qint64)'), self.on_audio_time_remaining)
self.display.audio_player.position_changed.connect(self.on_audio_time_remaining)
# The SlidePreview's ratio.
try:
self.ratio = self.screens.current['size'].width() / self.screens.current['size'].height()
@ -616,13 +616,13 @@ class SlideController(DisplayController, RegistryProperties):
"""
if self.ratio < self.preview_frame.width() / self.preview_frame.height():
# We have to take the height as limit.
max_height = self.preview_frame.height() - self.grid.margin() * 2
max_height = self.preview_frame.height() - self.grid.contentsMargins().top() * 2
self.slide_preview.setFixedSize(QtCore.QSize(max_height * self.ratio, max_height))
self.preview_display.setFixedSize(QtCore.QSize(max_height * self.ratio, max_height))
self.preview_display.screen = {'size': self.preview_display.geometry()}
else:
# We have to take the width as limit.
max_width = self.preview_frame.width() - self.grid.margin() * 2
max_width = self.preview_frame.width() - self.grid.contentsMargins().top() * 2
self.slide_preview.setFixedSize(QtCore.QSize(max_width, max_width / self.ratio))
self.preview_display.setFixedSize(QtCore.QSize(max_width, max_width / self.ratio))
self.preview_display.screen = {'size': self.preview_display.geometry()}
@ -1136,9 +1136,9 @@ class SlideController(DisplayController, RegistryProperties):
"""
Creates an image of the current screen and updates the preview frame.
"""
win_id = QtGui.QApplication.desktop().winId()
win_id = QtWidgets.QApplication.desktop().winId()
rect = self.screens.current['size']
win_image = QtGui.QPixmap.grabWindow(win_id, rect.x(), rect.y(), rect.width(), rect.height())
win_image = QtGui.QScreen.grabWindow(win_id, rect.x(), rect.y(), rect.width(), rect.height())
self.slide_preview.setPixmap(win_image)
self.slide_image = win_image
@ -1435,6 +1435,10 @@ class PreviewController(RegistryMixin, OpenLPMixin, SlideController):
"""
Set up the Preview Controller.
"""
slidecontroller_preview_set = QtCore.pyqtSignal(list)
slidecontroller_preview_next = QtCore.pyqtSignal()
slidecontroller_preview_previous = QtCore.pyqtSignal()
def __init__(self, parent):
"""
Set up the base Controller as a preview.
@ -1455,6 +1459,11 @@ class LiveController(RegistryMixin, OpenLPMixin, SlideController):
"""
Set up the Live Controller.
"""
slidecontroller_live_set = QtCore.pyqtSignal(list)
slidecontroller_live_next = QtCore.pyqtSignal()
slidecontroller_live_previous = QtCore.pyqtSignal()
slidecontroller_toggle_display = QtCore.pyqtSignal(str)
def __init__(self, parent):
"""
Set up the base Controller as a live.

View File

@ -23,10 +23,10 @@
The splash screen
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
class SplashScreen(QtGui.QSplashScreen):
class SplashScreen(QtWidgets.QSplashScreen):
"""
The splash screen
"""

View File

@ -22,7 +22,7 @@
"""
The UI widgets for the time dialog
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import UiStrings, translate
from openlp.core.lib import build_icon
@ -40,67 +40,67 @@ class Ui_StartTimeDialog(object):
StartTimeDialog.setObjectName('StartTimeDialog')
StartTimeDialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
StartTimeDialog.resize(350, 10)
self.dialog_layout = QtGui.QGridLayout(StartTimeDialog)
self.dialog_layout = QtWidgets.QGridLayout(StartTimeDialog)
self.dialog_layout.setObjectName('dialog_layout')
self.start_label = QtGui.QLabel(StartTimeDialog)
self.start_label = QtWidgets.QLabel(StartTimeDialog)
self.start_label.setObjectName('start_label')
self.start_label.setAlignment(QtCore.Qt.AlignHCenter)
self.dialog_layout.addWidget(self.start_label, 0, 1, 1, 1)
self.finish_label = QtGui.QLabel(StartTimeDialog)
self.finish_label = QtWidgets.QLabel(StartTimeDialog)
self.finish_label.setObjectName('finish_label')
self.finish_label.setAlignment(QtCore.Qt.AlignHCenter)
self.dialog_layout.addWidget(self.finish_label, 0, 2, 1, 1)
self.length_label = QtGui.QLabel(StartTimeDialog)
self.length_label = QtWidgets.QLabel(StartTimeDialog)
self.length_label.setObjectName('start_label')
self.length_label.setAlignment(QtCore.Qt.AlignHCenter)
self.dialog_layout.addWidget(self.length_label, 0, 3, 1, 1)
self.hour_label = QtGui.QLabel(StartTimeDialog)
self.hour_label = QtWidgets.QLabel(StartTimeDialog)
self.hour_label.setObjectName('hour_label')
self.dialog_layout.addWidget(self.hour_label, 1, 0, 1, 1)
self.hour_spin_box = QtGui.QSpinBox(StartTimeDialog)
self.hour_spin_box = QtWidgets.QSpinBox(StartTimeDialog)
self.hour_spin_box.setObjectName('hour_spin_box')
self.hour_spin_box.setMinimum(0)
self.hour_spin_box.setMaximum(4)
self.dialog_layout.addWidget(self.hour_spin_box, 1, 1, 1, 1)
self.hour_finish_spin_box = QtGui.QSpinBox(StartTimeDialog)
self.hour_finish_spin_box = QtWidgets.QSpinBox(StartTimeDialog)
self.hour_finish_spin_box.setObjectName('hour_finish_spin_box')
self.hour_finish_spin_box.setMinimum(0)
self.hour_finish_spin_box.setMaximum(4)
self.dialog_layout.addWidget(self.hour_finish_spin_box, 1, 2, 1, 1)
self.hour_finish_label = QtGui.QLabel(StartTimeDialog)
self.hour_finish_label = QtWidgets.QLabel(StartTimeDialog)
self.hour_finish_label.setObjectName('hour_label')
self.hour_finish_label.setAlignment(QtCore.Qt.AlignRight)
self.dialog_layout.addWidget(self.hour_finish_label, 1, 3, 1, 1)
self.minute_label = QtGui.QLabel(StartTimeDialog)
self.minute_label = QtWidgets.QLabel(StartTimeDialog)
self.minute_label.setObjectName('minute_label')
self.dialog_layout.addWidget(self.minute_label, 2, 0, 1, 1)
self.minute_spin_box = QtGui.QSpinBox(StartTimeDialog)
self.minute_spin_box = QtWidgets.QSpinBox(StartTimeDialog)
self.minute_spin_box.setObjectName('minute_spin_box')
self.minute_spin_box.setMinimum(0)
self.minute_spin_box.setMaximum(59)
self.dialog_layout.addWidget(self.minute_spin_box, 2, 1, 1, 1)
self.minute_finish_spin_box = QtGui.QSpinBox(StartTimeDialog)
self.minute_finish_spin_box = QtWidgets.QSpinBox(StartTimeDialog)
self.minute_finish_spin_box.setObjectName('minute_finish_spin_box')
self.minute_finish_spin_box.setMinimum(0)
self.minute_finish_spin_box.setMaximum(59)
self.dialog_layout.addWidget(self.minute_finish_spin_box, 2, 2, 1, 1)
self.minute_finish_label = QtGui.QLabel(StartTimeDialog)
self.minute_finish_label = QtWidgets.QLabel(StartTimeDialog)
self.minute_finish_label.setObjectName('minute_label')
self.minute_finish_label.setAlignment(QtCore.Qt.AlignRight)
self.dialog_layout.addWidget(self.minute_finish_label, 2, 3, 1, 1)
self.second_label = QtGui.QLabel(StartTimeDialog)
self.second_label = QtWidgets.QLabel(StartTimeDialog)
self.second_label.setObjectName('second_label')
self.dialog_layout.addWidget(self.second_label, 3, 0, 1, 1)
self.second_spin_box = QtGui.QSpinBox(StartTimeDialog)
self.second_spin_box = QtWidgets.QSpinBox(StartTimeDialog)
self.second_spin_box.setObjectName('second_spin_box')
self.second_spin_box.setMinimum(0)
self.second_spin_box.setMaximum(59)
self.second_finish_spin_box = QtGui.QSpinBox(StartTimeDialog)
self.second_finish_spin_box = QtWidgets.QSpinBox(StartTimeDialog)
self.second_finish_spin_box.setObjectName('second_finish_spin_box')
self.second_finish_spin_box.setMinimum(0)
self.second_finish_spin_box.setMaximum(59)
self.dialog_layout.addWidget(self.second_finish_spin_box, 3, 2, 1, 1)
self.second_finish_label = QtGui.QLabel(StartTimeDialog)
self.second_finish_label = QtWidgets.QLabel(StartTimeDialog)
self.second_finish_label.setObjectName('second_label')
self.second_finish_label.setAlignment(QtCore.Qt.AlignRight)
self.dialog_layout.addWidget(self.second_finish_label, 3, 3, 1, 1)

View File

@ -22,7 +22,7 @@
"""
The actual start time form.
"""
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from .starttimedialog import Ui_StartTimeDialog
@ -30,7 +30,7 @@ from openlp.core.common import Registry, RegistryProperties, UiStrings, translat
from openlp.core.lib.ui import critical_error_message_box
class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog, RegistryProperties):
class StartTimeForm(QtWidgets.QDialog, Ui_StartTimeDialog, RegistryProperties):
"""
The start time dialog
"""
@ -41,7 +41,7 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog, RegistryProperties):
super(StartTimeForm, self).__init__(Registry().get('main_window'))
self.setupUi(self)
def exec_(self):
def exec(self):
"""
Run the Dialog with correct heading.
"""
@ -58,7 +58,7 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog, RegistryProperties):
self.hour_finish_label.setText('%s%s' % (str(hour), UiStrings().Hours))
self.minute_finish_label.setText('%s%s' % (str(minutes), UiStrings().Minutes))
self.second_finish_label.setText('%s%s' % (str(seconds), UiStrings().Seconds))
return QtGui.QDialog.exec_(self)
return QtWidgets.QDialog.exec(self)
def accept(self):
"""
@ -79,7 +79,7 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog, RegistryProperties):
return
self.item['service_item'].start_time = start
self.item['service_item'].end_time = end
return QtGui.QDialog.accept(self)
return QtWidgets.QDialog.accept(self)
def _time_split(self, seconds):
"""

View File

@ -25,7 +25,7 @@ The Theme wizard
import logging
import os
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry, RegistryProperties, UiStrings, translate
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
@ -37,7 +37,7 @@ from .themewizard import Ui_ThemeWizard
log = logging.getLogger(__name__)
class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
class ThemeForm(QtWidgets.QWizard, Ui_ThemeWizard, RegistryProperties):
"""
This is the Theme Import Wizard, which allows easy creation and editing of
OpenLP themes.
@ -158,7 +158,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
"""
if not event:
event = QtGui.QResizeEvent(self.size(), self.size())
QtGui.QWizard.resizeEvent(self, event)
QtWidgets.QWizard.resizeEvent(self, event)
if self.currentPage() == self.preview_page:
frame_width = self.preview_box_label.lineWidth()
pixmap_width = self.preview_area.width() - 2 * frame_width
@ -177,9 +177,9 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
background_image = BackgroundType.to_string(BackgroundType.Image)
if self.page(self.currentId()) == self.background_page and \
self.theme.background_type == background_image and is_not_image_file(self.theme.background_filename):
QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeWizard', 'Background Image Empty'),
translate('OpenLP.ThemeWizard', 'You have not selected a '
'background image. Please select one before continuing.'))
QtWidgets.QMessageBox.critical(self, translate('OpenLP.ThemeWizard', 'Background Image Empty'),
translate('OpenLP.ThemeWizard', 'You have not selected a '
'background image. Please select one before continuing.'))
return False
else:
return True
@ -189,7 +189,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
Detects Page changes and updates as appropriate.
"""
enabled = self.page(page_id) == self.area_position_page
self.setOption(QtGui.QWizard.HaveCustomButton1, enabled)
self.setOption(QtWidgets.QWizard.HaveCustomButton1, enabled)
if self.page(page_id) == self.preview_page:
self.update_theme()
frame = self.theme_manager.generate_image(self.theme)
@ -212,7 +212,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
paint.setPen(QtGui.QPen(QtCore.Qt.red, 2))
paint.drawRect(self.renderer.get_footer_rectangle(self.theme))
paint.end()
self.theme_layout_form.exec_(pixmap)
self.theme_layout_form.exec(pixmap)
def on_outline_check_check_box_state_changed(self, state):
"""
@ -253,7 +253,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
if self.update_theme_allowed:
self.theme.font_footer_override = not (value == QtCore.Qt.Checked)
def exec_(self, edit=False):
def exec(self, edit=False):
"""
Run the wizard.
"""
@ -270,7 +270,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
self.next()
else:
self.setWindowTitle(UiStrings().NewTheme)
return QtGui.QWizard.exec_(self)
return QtWidgets.QWizard.exec(self)
def initializePage(self, page_id):
"""
@ -428,8 +428,9 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
"""
images_filter = get_images_filter()
images_filter = '%s;;%s (*.*)' % (images_filter, UiStrings().AllFiles)
filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.ThemeWizard', 'Select Image'),
self.image_file_edit.text(), images_filter)
filename, filter_used = QtWidgets.QFileDialog.getOpenFileName(
self, translate('OpenLP.ThemeWizard', 'Select Image'),
self.image_file_edit.text(), images_filter)
if filename:
self.theme.background_filename = filename
self.set_background_page_values()
@ -522,4 +523,4 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
if not self.edit_mode and not self.theme_manager.check_if_theme_exists(self.theme.theme_name):
return
self.theme_manager.save_theme(self.theme, save_from, save_to)
return QtGui.QDialog.accept(self)
return QtWidgets.QDialog.accept(self)

View File

@ -22,7 +22,7 @@
"""
The layout of the theme
"""
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import translate
from openlp.core.lib import build_icon
@ -39,25 +39,25 @@ class Ui_ThemeLayoutDialog(object):
"""
themeLayoutDialog.setObjectName('themeLayoutDialogDialog')
themeLayoutDialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
self.preview_layout = QtGui.QVBoxLayout(themeLayoutDialog)
self.preview_layout = QtWidgets.QVBoxLayout(themeLayoutDialog)
self.preview_layout.setObjectName('preview_layout')
self.preview_area = QtGui.QWidget(themeLayoutDialog)
self.preview_area = QtWidgets.QWidget(themeLayoutDialog)
self.preview_area.setObjectName('preview_area')
self.preview_area_layout = QtGui.QGridLayout(self.preview_area)
self.preview_area_layout.setMargin(0)
self.preview_area_layout = QtWidgets.QGridLayout(self.preview_area)
self.preview_area_layout.setContentsMargins(0, 0, 0, 0)
self.preview_area_layout.setColumnStretch(0, 1)
self.preview_area_layout.setRowStretch(0, 1)
self.preview_area_layout.setObjectName('preview_area_layout')
self.theme_display_label = QtGui.QLabel(self.preview_area)
self.theme_display_label.setFrameShape(QtGui.QFrame.Box)
self.theme_display_label = QtWidgets.QLabel(self.preview_area)
self.theme_display_label.setFrameShape(QtWidgets.QFrame.Box)
self.theme_display_label.setScaledContents(True)
self.theme_display_label.setObjectName('theme_display_label')
self.preview_area_layout.addWidget(self.theme_display_label)
self.preview_layout.addWidget(self.preview_area)
self.main_colour_label = QtGui.QLabel(self.preview_area)
self.main_colour_label = QtWidgets.QLabel(self.preview_area)
self.main_colour_label.setObjectName('main_colour_label')
self.preview_layout.addWidget(self.main_colour_label)
self.footer_colour_label = QtGui.QLabel(self.preview_area)
self.footer_colour_label = QtWidgets.QLabel(self.preview_area)
self.footer_colour_label.setObjectName('footer_colour_label')
self.preview_layout.addWidget(self.footer_colour_label)
self.button_box = create_button_box(themeLayoutDialog, 'button_box', ['ok'])

View File

@ -22,12 +22,12 @@
"""
The form layout
"""
from PyQt4 import QtGui, QtCore
from PyQt5 import QtCore, QtWidgets
from .themelayoutdialog import Ui_ThemeLayoutDialog
class ThemeLayoutForm(QtGui.QDialog, Ui_ThemeLayoutDialog):
class ThemeLayoutForm(QtWidgets.QDialog, Ui_ThemeLayoutDialog):
"""
The exception dialog
"""
@ -38,7 +38,7 @@ class ThemeLayoutForm(QtGui.QDialog, Ui_ThemeLayoutDialog):
super(ThemeLayoutForm, self).__init__(parent)
self.setupUi(self)
def exec_(self, image):
def exec(self, image):
"""
Run the Dialog with correct heading.
"""
@ -46,4 +46,4 @@ class ThemeLayoutForm(QtGui.QDialog, Ui_ThemeLayoutDialog):
self.theme_display_label.setPixmap(pixmap)
display_aspect_ratio = float(image.width()) / image.height()
self.theme_display_label.setFixedSize(400, 400 / display_aspect_ratio)
return QtGui.QDialog.exec_(self)
return QtWidgets.QDialog.exec(self)

View File

@ -27,7 +27,7 @@ import zipfile
import shutil
from xml.etree.ElementTree import ElementTree, XML
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, OpenLPMixin, RegistryMixin, \
check_directory_exists, UiStrings, translate, is_win
@ -49,9 +49,9 @@ class Ui_ThemeManager(object):
:param widget: The screen object the the dialog is to be attached to.
"""
# start with the layout
self.layout = QtGui.QVBoxLayout(widget)
self.layout = QtWidgets.QVBoxLayout(widget)
self.layout.setSpacing(0)
self.layout.setMargin(0)
self.layout.setContentsMargins(0, 0, 0, 0)
self.layout.setObjectName('layout')
self.toolbar = OpenLPToolbar(widget)
self.toolbar.setObjectName('toolbar')
@ -83,10 +83,10 @@ class Ui_ThemeManager(object):
tooltip=translate('OpenLP.ThemeManager', 'Export a theme.'),
triggers=self.on_export_theme)
self.layout.addWidget(self.toolbar)
self.theme_widget = QtGui.QWidgetAction(self.toolbar)
self.theme_widget = QtWidgets.QWidgetAction(self.toolbar)
self.theme_widget.setObjectName('theme_widget')
# create theme manager list
self.theme_list_widget = QtGui.QListWidget(widget)
self.theme_list_widget = QtWidgets.QListWidget(widget)
self.theme_list_widget.setAlternatingRowColors(True)
self.theme_list_widget.setIconSize(QtCore.QSize(88, 50))
self.theme_list_widget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
@ -94,7 +94,7 @@ class Ui_ThemeManager(object):
self.layout.addWidget(self.theme_list_widget)
self.theme_list_widget.customContextMenuRequested.connect(self.context_menu)
# build the context menu
self.menu = QtGui.QMenu()
self.menu = QtWidgets.QMenu()
self.edit_action = create_widget_action(self.menu,
text=translate('OpenLP.ThemeManager', '&Edit Theme'),
icon=':/themes/theme_edit.png', triggers=self.on_edit_theme)
@ -120,7 +120,7 @@ class Ui_ThemeManager(object):
self.theme_list_widget.currentItemChanged.connect(self.check_list_state)
class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, RegistryProperties):
class ThemeManager(OpenLPMixin, RegistryMixin, QtWidgets.QWidget, Ui_ThemeManager, RegistryProperties):
"""
Manages the orders of Theme.
"""
@ -195,7 +195,7 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
self.delete_action.setVisible(visible)
self.rename_action.setVisible(visible)
self.global_action.setVisible(visible)
self.menu.exec_(self.theme_list_widget.mapToGlobal(point))
self.menu.exec(self.theme_list_widget.mapToGlobal(point))
def change_global_from_tab(self):
"""
@ -247,7 +247,7 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
theme = ThemeXML()
theme.set_default_header_footer()
self.theme_form.theme = theme
self.theme_form.exec_()
self.theme_form.exec()
self.load_themes()
def on_rename_theme(self, field=None):
@ -261,7 +261,7 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
item = self.theme_list_widget.currentItem()
old_theme_name = item.data(QtCore.Qt.UserRole)
self.file_rename_form.file_name_edit.setText(old_theme_name)
if self.file_rename_form.exec_():
if self.file_rename_form.exec():
new_theme_name = self.file_rename_form.file_name_edit.text()
if old_theme_name == new_theme_name:
return
@ -284,7 +284,7 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
old_theme_name = item.data(QtCore.Qt.UserRole)
self.file_rename_form.file_name_edit.setText(translate('OpenLP.ThemeManager',
'Copy of %s', 'Copy of <theme name>') % old_theme_name)
if self.file_rename_form.exec_(True):
if self.file_rename_form.exec(True):
new_theme_name = self.file_rename_form.file_name_edit.text()
if self.check_if_theme_exists(new_theme_name):
theme_data = self.get_theme_data(old_theme_name)
@ -320,7 +320,7 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
if theme.background_type == 'image':
self.old_background_image = theme.background_filename
self.theme_form.theme = theme
self.theme_form.exec_(True)
self.theme_form.exec(True)
self.old_background_image = None
self.renderer.update_theme(theme.theme_name)
self.load_themes()
@ -374,18 +374,18 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
critical_error_message_box(message=translate('OpenLP.ThemeManager', 'You have not selected a theme.'))
return
theme = item.data(QtCore.Qt.UserRole)
path = QtGui.QFileDialog.getExistingDirectory(self,
translate('OpenLP.ThemeManager', 'Save Theme - (%s)') % theme,
Settings().value(self.settings_section +
'/last directory export'))
path = QtWidgets.QFileDialog.getExistingDirectory(self,
translate('OpenLP.ThemeManager', 'Save Theme - (%s)') % theme,
Settings().value(self.settings_section +
'/last directory export'))
self.application.set_busy_cursor()
if path:
Settings().setValue(self.settings_section + '/last directory export', path)
if self._export_theme(path, theme):
QtGui.QMessageBox.information(self,
translate('OpenLP.ThemeManager', 'Theme Exported'),
translate('OpenLP.ThemeManager',
'Your theme has been successfully exported.'))
QtWidgets.QMessageBox.information(self,
translate('OpenLP.ThemeManager', 'Theme Exported'),
translate('OpenLP.ThemeManager',
'Your theme has been successfully exported.'))
self.application.set_normal_cursor()
def _export_theme(self, path, theme):
@ -475,7 +475,7 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
else:
name = text_name
thumb = os.path.join(self.thumb_path, '%s.png' % text_name)
item_name = QtGui.QListWidgetItem(name)
item_name = QtWidgets.QListWidgetItem(name)
if validate_thumb(theme, thumb):
icon = build_icon(thumb)
else:
@ -521,14 +521,14 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
:param theme_name: Name of the theme.
:return: Confirm if the theme is to be overwritten.
"""
ret = QtGui.QMessageBox.question(self, translate('OpenLP.ThemeManager', 'Theme Already Exists'),
translate('OpenLP.ThemeManager',
'Theme %s already exists. Do you want to replace it?')
.replace('%s', theme_name),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
return ret == QtGui.QMessageBox.Yes
ret = QtWidgets.QMessageBox.question(self, translate('OpenLP.ThemeManager', 'Theme Already Exists'),
translate('OpenLP.ThemeManager',
'Theme %s already exists. Do you want to replace it?')
.replace('%s', theme_name),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.No)
return ret == QtWidgets.QMessageBox.Yes
def unzip_theme(self, file_name, directory):
"""
@ -742,11 +742,11 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
theme = item.text()
# confirm deletion
if confirm:
answer = QtGui.QMessageBox.question(self, confirm_title, confirm_text % theme,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
answer = QtWidgets.QMessageBox.question(
self, confirm_title, confirm_text % theme,
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.No)
if answer == QtWidgets.QMessageBox.No:
return False
# should be the same unless default
if theme != item.data(QtCore.Qt.UserRole):

View File

@ -24,7 +24,7 @@ The Themes configuration tab
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry, Settings, ThemeLevel, UiStrings, translate
from openlp.core.lib import SettingsTab
@ -49,47 +49,47 @@ class ThemesTab(SettingsTab):
"""
self.setObjectName('ThemesTab')
super(ThemesTab, self).setupUi()
self.global_group_box = QtGui.QGroupBox(self.left_column)
self.global_group_box = QtWidgets.QGroupBox(self.left_column)
self.global_group_box.setObjectName('global_group_box')
self.global_group_box_layout = QtGui.QVBoxLayout(self.global_group_box)
self.global_group_box_layout = QtWidgets.QVBoxLayout(self.global_group_box)
self.global_group_box_layout.setObjectName('global_group_box_layout')
self.default_combo_box = QtGui.QComboBox(self.global_group_box)
self.default_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
self.default_combo_box.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.default_combo_box = QtWidgets.QComboBox(self.global_group_box)
self.default_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToMinimumContentsLength)
self.default_combo_box.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
self.default_combo_box.setObjectName('default_combo_box')
self.global_group_box_layout.addWidget(self.default_combo_box)
self.default_list_view = QtGui.QLabel(self.global_group_box)
self.default_list_view = QtWidgets.QLabel(self.global_group_box)
self.default_list_view.setObjectName('default_list_view')
self.global_group_box_layout.addWidget(self.default_list_view)
self.left_layout.addWidget(self.global_group_box)
self.universal_group_box = QtGui.QGroupBox(self.left_column)
self.universal_group_box = QtWidgets.QGroupBox(self.left_column)
self.universal_group_box.setObjectName('universal_group_box')
self.universal_group_box_layout = QtGui.QVBoxLayout(self.universal_group_box)
self.universal_group_box_layout = QtWidgets.QVBoxLayout(self.universal_group_box)
self.universal_group_box_layout.setObjectName('universal_group_box_layout')
self.wrap_footer_check_box = QtGui.QCheckBox(self.universal_group_box)
self.wrap_footer_check_box = QtWidgets.QCheckBox(self.universal_group_box)
self.wrap_footer_check_box.setObjectName('wrap_footer_check_box')
self.universal_group_box_layout.addWidget(self.wrap_footer_check_box)
self.left_layout.addWidget(self.universal_group_box)
self.left_layout.addStretch()
self.level_group_box = QtGui.QGroupBox(self.right_column)
self.level_group_box = QtWidgets.QGroupBox(self.right_column)
self.level_group_box.setObjectName('level_group_box')
self.level_layout = QtGui.QFormLayout(self.level_group_box)
self.level_layout = QtWidgets.QFormLayout(self.level_group_box)
self.level_layout.setLabelAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.level_layout.setFormAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.level_layout.setObjectName('level_layout')
self.song_level_radio_button = QtGui.QRadioButton(self.level_group_box)
self.song_level_radio_button = QtWidgets.QRadioButton(self.level_group_box)
self.song_level_radio_button.setObjectName('song_level_radio_button')
self.song_level_label = QtGui.QLabel(self.level_group_box)
self.song_level_label = QtWidgets.QLabel(self.level_group_box)
self.song_level_label.setObjectName('song_level_label')
self.level_layout.addRow(self.song_level_radio_button, self.song_level_label)
self.service_level_radio_button = QtGui.QRadioButton(self.level_group_box)
self.service_level_radio_button = QtWidgets.QRadioButton(self.level_group_box)
self.service_level_radio_button.setObjectName('service_level_radio_button')
self.service_level_label = QtGui.QLabel(self.level_group_box)
self.service_level_label = QtWidgets.QLabel(self.level_group_box)
self.service_level_label.setObjectName('service_level_label')
self.level_layout.addRow(self.service_level_radio_button, self.service_level_label)
self.global_level_radio_button = QtGui.QRadioButton(self.level_group_box)
self.global_level_radio_button = QtWidgets.QRadioButton(self.level_group_box)
self.global_level_radio_button.setObjectName('global_level_radio_button')
self.global_level_label = QtGui.QLabel(self.level_group_box)
self.global_level_label = QtWidgets.QLabel(self.level_group_box)
self.global_level_label.setObjectName('global_level_label')
self.level_layout.addRow(self.global_level_radio_button, self.global_level_label)
label_top_margin = (self.song_level_radio_button.sizeHint().height() -

View File

@ -22,7 +22,7 @@
"""
The Create/Edit theme wizard
"""
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import UiStrings, translate, is_macosx
from openlp.core.lib import build_icon, ColorButton
@ -41,213 +41,213 @@ class Ui_ThemeWizard(object):
theme_wizard.setObjectName('OpenLP.ThemeWizard')
theme_wizard.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
theme_wizard.setModal(True)
theme_wizard.setOptions(QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.HaveCustomButton1)
theme_wizard.setOptions(QtWidgets.QWizard.IndependentPages |
QtWidgets.QWizard.NoBackButtonOnStartPage | QtWidgets.QWizard.HaveCustomButton1)
if is_macosx():
theme_wizard.setPixmap(QtGui.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
theme_wizard.setPixmap(QtWidgets.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
theme_wizard.resize(646, 400)
else:
theme_wizard.setWizardStyle(QtGui.QWizard.ModernStyle)
self.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
theme_wizard.setWizardStyle(QtWidgets.QWizard.ModernStyle)
self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
# Welcome Page
add_welcome_page(theme_wizard, ':/wizards/wizard_createtheme.bmp')
# Background Page
self.background_page = QtGui.QWizardPage()
self.background_page = QtWidgets.QWizardPage()
self.background_page.setObjectName('background_page')
self.background_layout = QtGui.QVBoxLayout(self.background_page)
self.background_layout = QtWidgets.QVBoxLayout(self.background_page)
self.background_layout.setObjectName('background_layout')
self.background_type_layout = QtGui.QFormLayout()
self.background_type_layout = QtWidgets.QFormLayout()
self.background_type_layout.setObjectName('background_type_layout')
self.background_label = QtGui.QLabel(self.background_page)
self.background_label = QtWidgets.QLabel(self.background_page)
self.background_label.setObjectName('background_label')
self.background_combo_box = QtGui.QComboBox(self.background_page)
self.background_combo_box = QtWidgets.QComboBox(self.background_page)
self.background_combo_box.addItems(['', '', '', ''])
self.background_combo_box.setObjectName('background_combo_box')
self.background_type_layout.addRow(self.background_label, self.background_combo_box)
self.background_type_layout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
self.background_type_layout.setItem(1, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.background_layout.addLayout(self.background_type_layout)
self.background_stack = QtGui.QStackedLayout()
self.background_stack = QtWidgets.QStackedLayout()
self.background_stack.setObjectName('background_stack')
self.color_widget = QtGui.QWidget(self.background_page)
self.color_widget = QtWidgets.QWidget(self.background_page)
self.color_widget.setObjectName('color_widget')
self.color_layout = QtGui.QFormLayout(self.color_widget)
self.color_layout.setMargin(0)
self.color_layout = QtWidgets.QFormLayout(self.color_widget)
self.color_layout.setContentsMargins(0, 0, 0, 0)
self.color_layout.setObjectName('color_layout')
self.color_label = QtGui.QLabel(self.color_widget)
self.color_label = QtWidgets.QLabel(self.color_widget)
self.color_label.setObjectName('color_label')
self.color_button = ColorButton(self.color_widget)
self.color_button.setObjectName('color_button')
self.color_layout.addRow(self.color_label, self.color_button)
self.color_layout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
self.color_layout.setItem(1, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.background_stack.addWidget(self.color_widget)
self.gradient_widget = QtGui.QWidget(self.background_page)
self.gradient_widget = QtWidgets.QWidget(self.background_page)
self.gradient_widget.setObjectName('Gradient_widget')
self.gradient_layout = QtGui.QFormLayout(self.gradient_widget)
self.gradient_layout.setMargin(0)
self.gradient_layout = QtWidgets.QFormLayout(self.gradient_widget)
self.gradient_layout.setContentsMargins(0, 0, 0, 0)
self.gradient_layout.setObjectName('gradient_layout')
self.gradient_start_label = QtGui.QLabel(self.gradient_widget)
self.gradient_start_label = QtWidgets.QLabel(self.gradient_widget)
self.gradient_start_label.setObjectName('gradient_start_label')
self.gradient_start_button = ColorButton(self.gradient_widget)
self.gradient_start_button.setObjectName('gradient_start_button')
self.gradient_layout.addRow(self.gradient_start_label, self.gradient_start_button)
self.gradient_end_label = QtGui.QLabel(self.gradient_widget)
self.gradient_end_label = QtWidgets.QLabel(self.gradient_widget)
self.gradient_end_label.setObjectName('gradient_end_label')
self.gradient_end_button = ColorButton(self.gradient_widget)
self.gradient_end_button.setObjectName('gradient_end_button')
self.gradient_layout.addRow(self.gradient_end_label, self.gradient_end_button)
self.gradient_type_label = QtGui.QLabel(self.gradient_widget)
self.gradient_type_label = QtWidgets.QLabel(self.gradient_widget)
self.gradient_type_label.setObjectName('Gradient_type_label')
self.gradient_combo_box = QtGui.QComboBox(self.gradient_widget)
self.gradient_combo_box = QtWidgets.QComboBox(self.gradient_widget)
self.gradient_combo_box.setObjectName('gradient_combo_box')
self.gradient_combo_box.addItems(['', '', '', '', ''])
self.gradient_layout.addRow(self.gradient_type_label, self.gradient_combo_box)
self.gradient_layout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer)
self.gradient_layout.setItem(3, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.background_stack.addWidget(self.gradient_widget)
self.image_widget = QtGui.QWidget(self.background_page)
self.image_widget = QtWidgets.QWidget(self.background_page)
self.image_widget.setObjectName('image_widget')
self.image_layout = QtGui.QFormLayout(self.image_widget)
self.image_layout.setMargin(0)
self.image_layout = QtWidgets.QFormLayout(self.image_widget)
self.image_layout.setContentsMargins(0, 0, 0, 0)
self.image_layout.setObjectName('image_layout')
self.image_color_label = QtGui.QLabel(self.color_widget)
self.image_color_label = QtWidgets.QLabel(self.color_widget)
self.image_color_label.setObjectName('image_color_label')
self.image_color_button = ColorButton(self.color_widget)
self.image_color_button.setObjectName('image_color_button')
self.image_layout.addRow(self.image_color_label, self.image_color_button)
self.image_label = QtGui.QLabel(self.image_widget)
self.image_label = QtWidgets.QLabel(self.image_widget)
self.image_label.setObjectName('image_label')
self.image_file_layout = QtGui.QHBoxLayout()
self.image_file_layout = QtWidgets.QHBoxLayout()
self.image_file_layout.setObjectName('image_file_layout')
self.image_file_edit = QtGui.QLineEdit(self.image_widget)
self.image_file_edit = QtWidgets.QLineEdit(self.image_widget)
self.image_file_edit.setObjectName('image_file_edit')
self.image_file_layout.addWidget(self.image_file_edit)
self.image_browse_button = QtGui.QToolButton(self.image_widget)
self.image_browse_button = QtWidgets.QToolButton(self.image_widget)
self.image_browse_button.setObjectName('image_browse_button')
self.image_browse_button.setIcon(build_icon(':/general/general_open.png'))
self.image_file_layout.addWidget(self.image_browse_button)
self.image_layout.addRow(self.image_label, self.image_file_layout)
self.image_layout.setItem(2, QtGui.QFormLayout.LabelRole, self.spacer)
self.image_layout.setItem(2, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.background_stack.addWidget(self.image_widget)
self.transparent_widget = QtGui.QWidget(self.background_page)
self.transparent_widget = QtWidgets.QWidget(self.background_page)
self.transparent_widget.setObjectName('TransparentWidget')
self.transparent_layout = QtGui.QFormLayout(self.transparent_widget)
self.transparent_layout.setMargin(0)
self.transparent_layout = QtWidgets.QFormLayout(self.transparent_widget)
self.transparent_layout.setContentsMargins(0, 0, 0, 0)
self.transparent_layout.setObjectName('Transparent_layout')
self.background_stack.addWidget(self.transparent_widget)
self.background_layout.addLayout(self.background_stack)
theme_wizard.addPage(self.background_page)
# Main Area Page
self.main_area_page = QtGui.QWizardPage()
self.main_area_page = QtWidgets.QWizardPage()
self.main_area_page.setObjectName('main_area_page')
self.main_area_layout = QtGui.QFormLayout(self.main_area_page)
self.main_area_layout = QtWidgets.QFormLayout(self.main_area_page)
self.main_area_layout.setObjectName('main_area_layout')
self.main_font_label = QtGui.QLabel(self.main_area_page)
self.main_font_label = QtWidgets.QLabel(self.main_area_page)
self.main_font_label.setObjectName('main_font_label')
self.main_font_combo_box = QtGui.QFontComboBox(self.main_area_page)
self.main_font_combo_box = QtWidgets.QFontComboBox(self.main_area_page)
self.main_font_combo_box.setObjectName('main_font_combo_box')
self.main_area_layout.addRow(self.main_font_label, self.main_font_combo_box)
self.main_color_label = QtGui.QLabel(self.main_area_page)
self.main_color_label = QtWidgets.QLabel(self.main_area_page)
self.main_color_label.setObjectName('main_color_label')
self.main_properties_layout = QtGui.QHBoxLayout()
self.main_properties_layout = QtWidgets.QHBoxLayout()
self.main_properties_layout.setObjectName('main_properties_layout')
self.main_color_button = ColorButton(self.main_area_page)
self.main_color_button.setObjectName('main_color_button')
self.main_properties_layout.addWidget(self.main_color_button)
self.main_properties_layout.addSpacing(20)
self.main_bold_check_box = QtGui.QCheckBox(self.main_area_page)
self.main_bold_check_box = QtWidgets.QCheckBox(self.main_area_page)
self.main_bold_check_box.setObjectName('main_bold_check_box')
self.main_properties_layout.addWidget(self.main_bold_check_box)
self.main_properties_layout.addSpacing(20)
self.main_italics_check_box = QtGui.QCheckBox(self.main_area_page)
self.main_italics_check_box = QtWidgets.QCheckBox(self.main_area_page)
self.main_italics_check_box.setObjectName('MainItalicsCheckBox')
self.main_properties_layout.addWidget(self.main_italics_check_box)
self.main_area_layout.addRow(self.main_color_label, self.main_properties_layout)
self.main_size_label = QtGui.QLabel(self.main_area_page)
self.main_size_label = QtWidgets.QLabel(self.main_area_page)
self.main_size_label.setObjectName('main_size_label')
self.main_size_layout = QtGui.QHBoxLayout()
self.main_size_layout = QtWidgets.QHBoxLayout()
self.main_size_layout.setObjectName('main_size_layout')
self.main_size_spin_box = QtGui.QSpinBox(self.main_area_page)
self.main_size_spin_box = QtWidgets.QSpinBox(self.main_area_page)
self.main_size_spin_box.setMaximum(999)
self.main_size_spin_box.setValue(16)
self.main_size_spin_box.setObjectName('main_size_spin_box')
self.main_size_layout.addWidget(self.main_size_spin_box)
self.main_line_count_label = QtGui.QLabel(self.main_area_page)
self.main_line_count_label = QtWidgets.QLabel(self.main_area_page)
self.main_line_count_label.setObjectName('main_line_count_label')
self.main_size_layout.addWidget(self.main_line_count_label)
self.main_area_layout.addRow(self.main_size_label, self.main_size_layout)
self.line_spacing_label = QtGui.QLabel(self.main_area_page)
self.line_spacing_label = QtWidgets.QLabel(self.main_area_page)
self.line_spacing_label.setObjectName('line_spacing_label')
self.line_spacing_spin_box = QtGui.QSpinBox(self.main_area_page)
self.line_spacing_spin_box = QtWidgets.QSpinBox(self.main_area_page)
self.line_spacing_spin_box.setMinimum(-250)
self.line_spacing_spin_box.setMaximum(250)
self.line_spacing_spin_box.setObjectName('line_spacing_spin_box')
self.main_area_layout.addRow(self.line_spacing_label, self.line_spacing_spin_box)
self.outline_check_box = QtGui.QCheckBox(self.main_area_page)
self.outline_check_box = QtWidgets.QCheckBox(self.main_area_page)
self.outline_check_box.setObjectName('outline_check_box')
self.outline_layout = QtGui.QHBoxLayout()
self.outline_layout = QtWidgets.QHBoxLayout()
self.outline_layout.setObjectName('outline_layout')
self.outline_color_button = ColorButton(self.main_area_page)
self.outline_color_button.setEnabled(False)
self.outline_color_button.setObjectName('Outline_color_button')
self.outline_layout.addWidget(self.outline_color_button)
self.outline_layout.addSpacing(20)
self.outline_size_label = QtGui.QLabel(self.main_area_page)
self.outline_size_label = QtWidgets.QLabel(self.main_area_page)
self.outline_size_label.setObjectName('outline_size_label')
self.outline_layout.addWidget(self.outline_size_label)
self.outline_size_spin_box = QtGui.QSpinBox(self.main_area_page)
self.outline_size_spin_box = QtWidgets.QSpinBox(self.main_area_page)
self.outline_size_spin_box.setEnabled(False)
self.outline_size_spin_box.setObjectName('outline_size_spin_box')
self.outline_layout.addWidget(self.outline_size_spin_box)
self.main_area_layout.addRow(self.outline_check_box, self.outline_layout)
self.shadow_check_box = QtGui.QCheckBox(self.main_area_page)
self.shadow_check_box = QtWidgets.QCheckBox(self.main_area_page)
self.shadow_check_box.setObjectName('shadow_check_box')
self.shadow_layout = QtGui.QHBoxLayout()
self.shadow_layout = QtWidgets.QHBoxLayout()
self.shadow_layout.setObjectName('shadow_layout')
self.shadow_color_button = ColorButton(self.main_area_page)
self.shadow_color_button.setEnabled(False)
self.shadow_color_button.setObjectName('shadow_color_button')
self.shadow_layout.addWidget(self.shadow_color_button)
self.shadow_layout.addSpacing(20)
self.shadow_size_label = QtGui.QLabel(self.main_area_page)
self.shadow_size_label = QtWidgets.QLabel(self.main_area_page)
self.shadow_size_label.setObjectName('shadow_size_label')
self.shadow_layout.addWidget(self.shadow_size_label)
self.shadow_size_spin_box = QtGui.QSpinBox(self.main_area_page)
self.shadow_size_spin_box = QtWidgets.QSpinBox(self.main_area_page)
self.shadow_size_spin_box.setEnabled(False)
self.shadow_size_spin_box.setObjectName('shadow_size_spin_box')
self.shadow_layout.addWidget(self.shadow_size_spin_box)
self.main_area_layout.addRow(self.shadow_check_box, self.shadow_layout)
theme_wizard.addPage(self.main_area_page)
# Footer Area Page
self.footer_area_page = QtGui.QWizardPage()
self.footer_area_page = QtWidgets.QWizardPage()
self.footer_area_page.setObjectName('footer_area_page')
self.footer_area_layout = QtGui.QFormLayout(self.footer_area_page)
self.footer_area_layout = QtWidgets.QFormLayout(self.footer_area_page)
self.footer_area_layout.setObjectName('footer_area_layout')
self.footer_font_label = QtGui.QLabel(self.footer_area_page)
self.footer_font_label = QtWidgets.QLabel(self.footer_area_page)
self.footer_font_label.setObjectName('FooterFontLabel')
self.footer_font_combo_box = QtGui.QFontComboBox(self.footer_area_page)
self.footer_font_combo_box = QtWidgets.QFontComboBox(self.footer_area_page)
self.footer_font_combo_box.setObjectName('footer_font_combo_box')
self.footer_area_layout.addRow(self.footer_font_label, self.footer_font_combo_box)
self.footer_color_label = QtGui.QLabel(self.footer_area_page)
self.footer_color_label = QtWidgets.QLabel(self.footer_area_page)
self.footer_color_label.setObjectName('footer_color_label')
self.footer_color_button = ColorButton(self.footer_area_page)
self.footer_color_button.setObjectName('footer_color_button')
self.footer_area_layout.addRow(self.footer_color_label, self.footer_color_button)
self.footer_size_label = QtGui.QLabel(self.footer_area_page)
self.footer_size_label = QtWidgets.QLabel(self.footer_area_page)
self.footer_size_label.setObjectName('footer_size_label')
self.footer_size_spin_box = QtGui.QSpinBox(self.footer_area_page)
self.footer_size_spin_box = QtWidgets.QSpinBox(self.footer_area_page)
self.footer_size_spin_box.setMaximum(999)
self.footer_size_spin_box.setValue(10)
self.footer_size_spin_box.setObjectName('FooterSizeSpinBox')
self.footer_area_layout.addRow(self.footer_size_label, self.footer_size_spin_box)
self.footer_area_layout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer)
self.footer_area_layout.setItem(3, QtWidgets.QFormLayout.LabelRole, self.spacer)
theme_wizard.addPage(self.footer_area_page)
# Alignment Page
self.alignment_page = QtGui.QWizardPage()
self.alignment_page = QtWidgets.QWizardPage()
self.alignment_page.setObjectName('alignment_page')
self.alignment_layout = QtGui.QFormLayout(self.alignment_page)
self.alignment_layout = QtWidgets.QFormLayout(self.alignment_page)
self.alignment_layout.setObjectName('alignment_layout')
self.horizontal_label = QtGui.QLabel(self.alignment_page)
self.horizontal_label = QtWidgets.QLabel(self.alignment_page)
self.horizontal_label.setObjectName('horizontal_label')
self.horizontal_combo_box = QtGui.QComboBox(self.alignment_page)
self.horizontal_combo_box = QtWidgets.QComboBox(self.alignment_page)
self.horizontal_combo_box.addItems(['', '', '', ''])
self.horizontal_combo_box.setObjectName('horizontal_combo_box')
self.alignment_layout.addRow(self.horizontal_label, self.horizontal_combo_box)
@ -255,138 +255,125 @@ class Ui_ThemeWizard(object):
self.vertical_label.setObjectName('vertical_label')
self.vertical_combo_box.setObjectName('vertical_combo_box')
self.alignment_layout.addRow(self.vertical_label, self.vertical_combo_box)
self.transitions_label = QtGui.QLabel(self.alignment_page)
self.transitions_label = QtWidgets.QLabel(self.alignment_page)
self.transitions_label.setObjectName('transitions_label')
self.transitions_check_box = QtGui.QCheckBox(self.alignment_page)
self.transitions_check_box = QtWidgets.QCheckBox(self.alignment_page)
self.transitions_check_box.setObjectName('transitions_check_box')
self.alignment_layout.addRow(self.transitions_label, self.transitions_check_box)
self.alignment_layout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer)
self.alignment_layout.setItem(3, QtWidgets.QFormLayout.LabelRole, self.spacer)
theme_wizard.addPage(self.alignment_page)
# Area Position Page
self.area_position_page = QtGui.QWizardPage()
self.area_position_page = QtWidgets.QWizardPage()
self.area_position_page.setObjectName('area_position_page')
self.area_position_layout = QtGui.QHBoxLayout(self.area_position_page)
self.area_position_layout = QtWidgets.QHBoxLayout(self.area_position_page)
self.area_position_layout.setObjectName('area_position_layout')
self.main_position_group_box = QtGui.QGroupBox(self.area_position_page)
self.main_position_group_box = QtWidgets.QGroupBox(self.area_position_page)
self.main_position_group_box.setObjectName('main_position_group_box')
self.main_position_layout = QtGui.QFormLayout(self.main_position_group_box)
self.main_position_layout = QtWidgets.QFormLayout(self.main_position_group_box)
self.main_position_layout.setObjectName('main_position_layout')
self.main_position_check_box = QtGui.QCheckBox(self.main_position_group_box)
self.main_position_check_box = QtWidgets.QCheckBox(self.main_position_group_box)
self.main_position_check_box.setObjectName('main_position_check_box')
self.main_position_layout.addRow(self.main_position_check_box)
self.main_x_label = QtGui.QLabel(self.main_position_group_box)
self.main_x_label = QtWidgets.QLabel(self.main_position_group_box)
self.main_x_label.setObjectName('main_x_label')
self.main_x_spin_box = QtGui.QSpinBox(self.main_position_group_box)
self.main_x_spin_box = QtWidgets.QSpinBox(self.main_position_group_box)
self.main_x_spin_box.setMaximum(9999)
self.main_x_spin_box.setObjectName('main_x_spin_box')
self.main_position_layout.addRow(self.main_x_label, self.main_x_spin_box)
self.main_y_label = QtGui.QLabel(self.main_position_group_box)
self.main_y_label = QtWidgets.QLabel(self.main_position_group_box)
self.main_y_label.setObjectName('main_y_label')
self.main_y_spin_box = QtGui.QSpinBox(self.main_position_group_box)
self.main_y_spin_box = QtWidgets.QSpinBox(self.main_position_group_box)
self.main_y_spin_box.setMaximum(9999)
self.main_y_spin_box.setObjectName('main_y_spin_box')
self.main_position_layout.addRow(self.main_y_label, self.main_y_spin_box)
self.main_width_label = QtGui.QLabel(self.main_position_group_box)
self.main_width_label = QtWidgets.QLabel(self.main_position_group_box)
self.main_width_label.setObjectName('main_width_label')
self.main_width_spin_box = QtGui.QSpinBox(self.main_position_group_box)
self.main_width_spin_box = QtWidgets.QSpinBox(self.main_position_group_box)
self.main_width_spin_box.setMaximum(9999)
self.main_width_spin_box.setObjectName('main_width_spin_box')
self.main_position_layout.addRow(self.main_width_label, self.main_width_spin_box)
self.main_height_label = QtGui.QLabel(self.main_position_group_box)
self.main_height_label = QtWidgets.QLabel(self.main_position_group_box)
self.main_height_label.setObjectName('main_height_label')
self.main_height_spin_box = QtGui.QSpinBox(self.main_position_group_box)
self.main_height_spin_box = QtWidgets.QSpinBox(self.main_position_group_box)
self.main_height_spin_box.setMaximum(9999)
self.main_height_spin_box.setObjectName('main_height_spin_box')
self.main_position_layout.addRow(self.main_height_label, self.main_height_spin_box)
self.area_position_layout.addWidget(self.main_position_group_box)
self.footer_position_group_box = QtGui.QGroupBox(self.area_position_page)
self.footer_position_group_box = QtWidgets.QGroupBox(self.area_position_page)
self.footer_position_group_box.setObjectName('footer_position_group_box')
self.footer_position_layout = QtGui.QFormLayout(self.footer_position_group_box)
self.footer_position_layout = QtWidgets.QFormLayout(self.footer_position_group_box)
self.footer_position_layout.setObjectName('footer_position_layout')
self.footer_position_check_box = QtGui.QCheckBox(self.footer_position_group_box)
self.footer_position_check_box = QtWidgets.QCheckBox(self.footer_position_group_box)
self.footer_position_check_box.setObjectName('footer_position_check_box')
self.footer_position_layout.addRow(self.footer_position_check_box)
self.footer_x_label = QtGui.QLabel(self.footer_position_group_box)
self.footer_x_label = QtWidgets.QLabel(self.footer_position_group_box)
self.footer_x_label.setObjectName('footer_x_label')
self.footer_x_spin_box = QtGui.QSpinBox(self.footer_position_group_box)
self.footer_x_spin_box = QtWidgets.QSpinBox(self.footer_position_group_box)
self.footer_x_spin_box.setMaximum(9999)
self.footer_x_spin_box.setObjectName('footer_x_spin_box')
self.footer_position_layout.addRow(self.footer_x_label, self.footer_x_spin_box)
self.footer_y_label = QtGui.QLabel(self.footer_position_group_box)
self.footer_y_label = QtWidgets.QLabel(self.footer_position_group_box)
self.footer_y_label.setObjectName('footer_y_label')
self.footer_y_spin_box = QtGui.QSpinBox(self.footer_position_group_box)
self.footer_y_spin_box = QtWidgets.QSpinBox(self.footer_position_group_box)
self.footer_y_spin_box.setMaximum(9999)
self.footer_y_spin_box.setObjectName('footer_y_spin_box')
self.footer_position_layout.addRow(self.footer_y_label, self.footer_y_spin_box)
self.footer_width_label = QtGui.QLabel(self.footer_position_group_box)
self.footer_width_label = QtWidgets.QLabel(self.footer_position_group_box)
self.footer_width_label.setObjectName('footer_width_label')
self.footer_width_spin_box = QtGui.QSpinBox(self.footer_position_group_box)
self.footer_width_spin_box = QtWidgets.QSpinBox(self.footer_position_group_box)
self.footer_width_spin_box.setMaximum(9999)
self.footer_width_spin_box.setObjectName('footer_width_spin_box')
self.footer_position_layout.addRow(self.footer_width_label, self.footer_width_spin_box)
self.footer_height_label = QtGui.QLabel(self.footer_position_group_box)
self.footer_height_label = QtWidgets.QLabel(self.footer_position_group_box)
self.footer_height_label.setObjectName('footer_height_label')
self.footer_height_spin_box = QtGui.QSpinBox(self.footer_position_group_box)
self.footer_height_spin_box = QtWidgets.QSpinBox(self.footer_position_group_box)
self.footer_height_spin_box.setMaximum(9999)
self.footer_height_spin_box.setObjectName('footer_height_spin_box')
self.footer_position_layout.addRow(self.footer_height_label, self.footer_height_spin_box)
self.area_position_layout.addWidget(self.footer_position_group_box)
theme_wizard.addPage(self.area_position_page)
# Preview Page
self.preview_page = QtGui.QWizardPage()
self.preview_page = QtWidgets.QWizardPage()
self.preview_page.setObjectName('preview_page')
self.preview_layout = QtGui.QVBoxLayout(self.preview_page)
self.preview_layout = QtWidgets.QVBoxLayout(self.preview_page)
self.preview_layout.setObjectName('preview_layout')
self.theme_name_layout = QtGui.QFormLayout()
self.theme_name_layout = QtWidgets.QFormLayout()
self.theme_name_layout.setObjectName('theme_name_layout')
self.theme_name_label = QtGui.QLabel(self.preview_page)
self.theme_name_label = QtWidgets.QLabel(self.preview_page)
self.theme_name_label.setObjectName('theme_name_label')
self.theme_name_edit = QtGui.QLineEdit(self.preview_page)
self.theme_name_edit = QtWidgets.QLineEdit(self.preview_page)
self.theme_name_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":<>+%]+'), self))
self.theme_name_edit.setObjectName('ThemeNameEdit')
self.theme_name_layout.addRow(self.theme_name_label, self.theme_name_edit)
self.preview_layout.addLayout(self.theme_name_layout)
self.preview_area = QtGui.QWidget(self.preview_page)
self.preview_area = QtWidgets.QWidget(self.preview_page)
self.preview_area.setObjectName('PreviewArea')
self.preview_area_layout = QtGui.QGridLayout(self.preview_area)
self.preview_area_layout.setMargin(0)
self.preview_area_layout = QtWidgets.QGridLayout(self.preview_area)
self.preview_area_layout.setContentsMargins(0, 0, 0, 0)
self.preview_area_layout.setColumnStretch(0, 1)
self.preview_area_layout.setRowStretch(0, 1)
self.preview_area_layout.setObjectName('preview_area_layout')
self.preview_box_label = QtGui.QLabel(self.preview_area)
self.preview_box_label.setFrameShape(QtGui.QFrame.Box)
self.preview_box_label = QtWidgets.QLabel(self.preview_area)
self.preview_box_label.setFrameShape(QtWidgets.QFrame.Box)
self.preview_box_label.setScaledContents(True)
self.preview_box_label.setObjectName('preview_box_label')
self.preview_area_layout.addWidget(self.preview_box_label)
self.preview_layout.addWidget(self.preview_area)
theme_wizard.addPage(self.preview_page)
self.retranslateUi(theme_wizard)
QtCore.QObject.connect(self.background_combo_box, QtCore.SIGNAL('currentIndexChanged(int)'),
self.background_stack, QtCore.SLOT('setCurrentIndex(int)'))
QtCore.QObject.connect(self.outline_check_box, QtCore.SIGNAL('toggled(bool)'), self.outline_color_button,
QtCore.SLOT('setEnabled(bool)'))
QtCore.QObject.connect(self.outline_check_box, QtCore.SIGNAL('toggled(bool)'), self.outline_size_spin_box,
QtCore.SLOT('setEnabled(bool)'))
QtCore.QObject.connect(self.shadow_check_box, QtCore.SIGNAL('toggled(bool)'), self.shadow_color_button,
QtCore.SLOT('setEnabled(bool)'))
QtCore.QObject.connect(self.shadow_check_box, QtCore.SIGNAL('toggled(bool)'), self.shadow_size_spin_box,
QtCore.SLOT('setEnabled(bool)'))
QtCore.QObject.connect(self.main_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.main_x_spin_box,
QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.main_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.main_y_spin_box,
QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.main_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.main_width_spin_box,
QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.main_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.main_height_spin_box,
QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.footer_x_spin_box,
QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.footer_y_spin_box,
QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'),
self.footer_width_spin_box, QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'),
self.footer_height_spin_box, QtCore.SLOT('setDisabled(bool)'))
self.background_combo_box.currentIndexChanged.connect(self.background_stack.setCurrentIndex)
self.outline_check_box.toggled.connect(self.outline_color_button.setEnabled)
self.outline_check_box.toggled.connect(self.outline_size_spin_box.setEnabled)
self.shadow_check_box.toggled.connect(self.shadow_color_button.setEnabled)
self.shadow_check_box.toggled.connect(self.shadow_size_spin_box.setEnabled)
self.main_position_check_box.toggled.connect(self.main_x_spin_box.setDisabled)
self.main_position_check_box.toggled.connect(self.main_y_spin_box.setDisabled)
self.main_position_check_box.toggled.connect(self.main_width_spin_box.setDisabled)
self.main_position_check_box.toggled.connect(self.main_height_spin_box.setDisabled)
self.footer_position_check_box.toggled.connect(self.footer_x_spin_box.setDisabled)
self.footer_position_check_box.toggled.connect(self.footer_y_spin_box.setDisabled)
self.footer_position_check_box.toggled.connect(self.footer_width_spin_box.setDisabled)
self.footer_position_check_box.toggled.connect(self.footer_height_spin_box.setDisabled)
def retranslateUi(self, theme_wizard):
"""
@ -481,12 +468,12 @@ class Ui_ThemeWizard(object):
self.footer_height_label.setText(translate('OpenLP.ThemeWizard', 'Height:'))
self.footer_height_spin_box.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
self.footer_position_check_box.setText(translate('OpenLP.ThemeWizard', 'Use default location'))
theme_wizard.setOption(QtGui.QWizard.HaveCustomButton1, False)
theme_wizard.setButtonText(QtGui.QWizard.CustomButton1, translate('OpenLP.ThemeWizard', 'Layout Preview'))
theme_wizard.setOption(QtWidgets.QWizard.HaveCustomButton1, False)
theme_wizard.setButtonText(QtWidgets.QWizard.CustomButton1, translate('OpenLP.ThemeWizard', 'Layout Preview'))
self.preview_page.setTitle(translate('OpenLP.ThemeWizard', 'Preview and Save'))
self.preview_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Preview the theme and save it.'))
self.theme_name_label.setText(translate('OpenLP.ThemeWizard', 'Theme name:'))
# Align all QFormLayouts towards each other.
label_width = max(self.background_label.minimumSizeHint().width(),
self.horizontal_label.minimumSizeHint().width())
self.spacer.changeSize(label_width, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.spacer.changeSize(label_width, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)

View File

@ -25,7 +25,7 @@ The :mod:``wizard`` module provides generic wizard tools for OpenLP.
import logging
import os
from PyQt4 import QtGui
from PyQt5 import QtGui, QtWidgets
from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings, translate, is_macosx
from openlp.core.lib import build_icon
@ -66,7 +66,7 @@ class WizardStrings(object):
'A song format e.g. PowerSong')
class OpenLPWizard(QtGui.QWizard, RegistryProperties):
class OpenLPWizard(QtWidgets.QWizard, RegistryProperties):
"""
Generic OpenLP wizard to provide generic functionality and a unified look
and feel.
@ -97,8 +97,8 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
self.setObjectName(name)
self.open_icon = build_icon(':/general/general_open.png')
self.delete_icon = build_icon(':/general/general_delete.png')
self.finish_button = self.button(QtGui.QWizard.FinishButton)
self.cancel_button = self.button(QtGui.QWizard.CancelButton)
self.finish_button = self.button(QtWidgets.QWizard.FinishButton)
self.cancel_button = self.button(QtWidgets.QWizard.CancelButton)
self.setupUi(image)
self.register_fields()
self.custom_init()
@ -114,12 +114,12 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
"""
self.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
self.setModal(True)
self.setOptions(QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnLastPage)
self.setOptions(QtWidgets.QWizard.IndependentPages |
QtWidgets.QWizard.NoBackButtonOnStartPage | QtWidgets.QWizard.NoBackButtonOnLastPage)
if is_macosx():
self.setPixmap(QtGui.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
self.setPixmap(QtWidgets.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
else:
self.setWizardStyle(QtGui.QWizard.ModernStyle)
self.setWizardStyle(QtWidgets.QWizard.ModernStyle)
add_welcome_page(self, image)
self.add_custom_pages()
if self.with_progress_page:
@ -155,35 +155,35 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
Add the progress page for the wizard. This page informs the user how
the wizard is progressing with its task.
"""
self.progress_page = QtGui.QWizardPage()
self.progress_page = QtWidgets.QWizardPage()
self.progress_page.setObjectName('progress_page')
self.progress_layout = QtGui.QVBoxLayout(self.progress_page)
self.progress_layout.setMargin(48)
self.progress_layout = QtWidgets.QVBoxLayout(self.progress_page)
self.progress_layout.setContentsMargins(48, 48, 48, 48)
self.progress_layout.setObjectName('progress_layout')
self.progress_label = QtGui.QLabel(self.progress_page)
self.progress_label = QtWidgets.QLabel(self.progress_page)
self.progress_label.setObjectName('progress_label')
self.progress_label.setWordWrap(True)
self.progress_layout.addWidget(self.progress_label)
self.progress_bar = QtGui.QProgressBar(self.progress_page)
self.progress_bar = QtWidgets.QProgressBar(self.progress_page)
self.progress_bar.setObjectName('progress_bar')
self.progress_layout.addWidget(self.progress_bar)
# Add a QTextEdit and a copy to file and copy to clipboard button to be
# able to provide feedback to the user. Hidden by default.
self.error_report_text_edit = QtGui.QTextEdit(self.progress_page)
self.error_report_text_edit = QtWidgets.QTextEdit(self.progress_page)
self.error_report_text_edit.setObjectName('error_report_text_edit')
self.error_report_text_edit.setHidden(True)
self.error_report_text_edit.setReadOnly(True)
self.progress_layout.addWidget(self.error_report_text_edit)
self.error_button_layout = QtGui.QHBoxLayout()
self.error_button_layout = QtWidgets.QHBoxLayout()
self.error_button_layout.setObjectName('error_button_layout')
spacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
spacer = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.error_button_layout.addItem(spacer)
self.error_copy_to_button = QtGui.QPushButton(self.progress_page)
self.error_copy_to_button = QtWidgets.QPushButton(self.progress_page)
self.error_copy_to_button.setObjectName('error_copy_to_button')
self.error_copy_to_button.setHidden(True)
self.error_copy_to_button.setIcon(build_icon(':/system/system_edit_copy.png'))
self.error_button_layout.addWidget(self.error_copy_to_button)
self.error_save_to_button = QtGui.QPushButton(self.progress_page)
self.error_save_to_button = QtWidgets.QPushButton(self.progress_page)
self.error_save_to_button.setObjectName('error_save_to_button')
self.error_save_to_button.setHidden(True)
self.error_save_to_button.setIcon(build_icon(':/general/general_save.png'))
@ -191,12 +191,12 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
self.progress_layout.addLayout(self.error_button_layout)
self.addPage(self.progress_page)
def exec_(self):
def exec(self):
"""
Run the wizard.
"""
self.set_defaults()
return QtGui.QWizard.exec_(self)
return QtWidgets.QWizard.exec(self)
def reject(self):
"""
@ -205,7 +205,7 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
log.debug('Wizard cancelled by user.')
if self.with_progress_page and self.currentPage() == self.progress_page:
Registry().execute('openlp_stop_wizard')
self.done(QtGui.QDialog.Rejected)
self.done(QtWidgets.QDialog.Rejected)
def on_current_id_changed(self, page_id):
"""
@ -282,8 +282,9 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
if filters:
filters += ';;'
filters += '%s (*)' % UiStrings().AllFiles
filename = QtGui.QFileDialog.getOpenFileName(
self, title, os.path.dirname(Settings().value(self.plugin.settings_section + '/' + setting_name)), filters)
filename, filter_used = QtWidgets.QFileDialog.getOpenFileName(
self, title, os.path.dirname(Settings().value(self.plugin.settings_section + '/' + setting_name)),
filters)
if filename:
editbox.setText(filename)
Settings().setValue(self.plugin.settings_section + '/' + setting_name, filename)
@ -296,9 +297,9 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
:param editbox: An editbox (QLineEdit).
:param setting_name: The place where to save the last opened directory.
"""
folder = QtGui.QFileDialog.getExistingDirectory(
folder = QtWidgets.QFileDialog.getExistingDirectory(
self, title, Settings().value(self.plugin.settings_section + '/' + setting_name),
QtGui.QFileDialog.ShowDirsOnly)
QtWidgets.QFileDialog.ShowDirsOnly)
if folder:
editbox.setText(folder)
Settings().setValue(self.plugin.settings_section + '/' + setting_name, folder)

View File

@ -40,7 +40,7 @@ import urllib.error
import urllib.parse
from random import randint
from PyQt4 import QtGui, QtCore
from PyQt5 import QtGui, QtCore
from openlp.core.common import Registry, AppLocation, Settings, is_win, is_macosx
@ -117,7 +117,7 @@ class VersionThread(QtCore.QThread):
version = check_latest_version(app_version)
log.debug("Versions %s and %s " % (LooseVersion(str(version)), LooseVersion(str(app_version['full']))))
if LooseVersion(str(version)) > LooseVersion(str(app_version['full'])):
self.main_window.emit(QtCore.SIGNAL('openlp_version_check'), '%s' % version)
self.main_window.openlp_version_check.emit('%s' % version)
class HTTPRedirectHandlerFixed(urllib.request.HTTPRedirectHandler):

View File

@ -25,7 +25,7 @@ by the shortcuts system.
"""
import logging
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Settings
@ -357,7 +357,8 @@ class ActionList(object):
global_context = action.shortcutContext() in [QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]
affected_actions = []
if global_context:
affected_actions = [a for a in self.get_all_child_objects(action.parent()) if isinstance(a, QtGui.QAction)]
affected_actions = [a for a in self.get_all_child_objects(action.parent()) if isinstance(a,
QtWidgets.QAction)]
for existing_action in existing_actions:
if action is existing_action:
continue

View File

@ -26,7 +26,8 @@ import logging
import re
import sys
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import AppLocation, Settings, translate, is_win, is_macosx
@ -117,10 +118,10 @@ class LanguageManager(object):
Settings().setValue('core/language', language)
log.info('Language file: \'%s\' written to conf file' % language)
if message:
QtGui.QMessageBox.information(None,
translate('OpenLP.LanguageManager', 'Language'),
translate('OpenLP.LanguageManager', 'Please restart OpenLP to use your new '
'language setting.'))
QtWidgets.QMessageBox.information(None,
translate('OpenLP.LanguageManager', 'Language'),
translate('OpenLP.LanguageManager',
'Please restart OpenLP to use your new language setting.'))
@staticmethod
def init_qm_list():

View File

@ -22,7 +22,8 @@
import logging
from PyQt4 import QtGui
from PyQt5 import QtGui
from openlp.core.common import Settings, translate
from openlp.core.lib import Plugin, StringContent, build_icon
@ -188,7 +189,7 @@ class AlertsPlugin(Plugin):
Start of the Alerts dialog triggered from the main menu.
"""
self.alert_form.load_list()
self.alert_form.exec_()
self.alert_form.exec()
def about(self):
"""

View File

@ -24,14 +24,14 @@ Forms in OpenLP are made up of two classes. One class holds all the graphical el
other class holds all the functional code, like slots and loading and saving.
The first class, commonly known as the **Dialog** class, is typically named ``Ui_<name>Dialog``. It is a slightly
modified version of the class that the ``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be
modified version of the class that the ``pyuic5`` command produces from Qt5's .ui file. Typical modifications will be
converting most strings from "" to '' and using OpenLP's ``translate()`` function for translating strings.
The second class, commonly known as the **Form** class, is typically named ``<name>Form``. This class is the one which
is instantiated and used. It uses dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class mentioned
above, like so::
is instantiated and used. It uses dual inheritance to inherit from (usually) QtWidgets.QDialog and the Ui class
mentioned above, like so::
class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
class AuthorsForm(QtWidgets.QDialog, Ui_AuthorsDialog):
def __init__(self, parent=None):
super(AuthorsForm, self).__init__(parent)

View File

@ -20,7 +20,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import translate
from openlp.core.lib import build_icon
@ -40,34 +40,34 @@ class Ui_AlertDialog(object):
alert_dialog.setObjectName('alert_dialog')
alert_dialog.resize(400, 300)
alert_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
self.alert_dialog_layout = QtGui.QGridLayout(alert_dialog)
self.alert_dialog_layout = QtWidgets.QGridLayout(alert_dialog)
self.alert_dialog_layout.setObjectName('alert_dialog_layout')
self.alert_text_layout = QtGui.QFormLayout()
self.alert_text_layout = QtWidgets.QFormLayout()
self.alert_text_layout.setObjectName('alert_text_layout')
self.alert_entry_label = QtGui.QLabel(alert_dialog)
self.alert_entry_label = QtWidgets.QLabel(alert_dialog)
self.alert_entry_label.setObjectName('alert_entry_label')
self.alert_text_edit = QtGui.QLineEdit(alert_dialog)
self.alert_text_edit = QtWidgets.QLineEdit(alert_dialog)
self.alert_text_edit.setObjectName('alert_text_edit')
self.alert_entry_label.setBuddy(self.alert_text_edit)
self.alert_text_layout.addRow(self.alert_entry_label, self.alert_text_edit)
self.alert_parameter = QtGui.QLabel(alert_dialog)
self.alert_parameter = QtWidgets.QLabel(alert_dialog)
self.alert_parameter.setObjectName('alert_parameter')
self.parameter_edit = QtGui.QLineEdit(alert_dialog)
self.parameter_edit = QtWidgets.QLineEdit(alert_dialog)
self.parameter_edit.setObjectName('parameter_edit')
self.alert_parameter.setBuddy(self.parameter_edit)
self.alert_text_layout.addRow(self.alert_parameter, self.parameter_edit)
self.alert_dialog_layout.addLayout(self.alert_text_layout, 0, 0, 1, 2)
self.alert_list_widget = QtGui.QListWidget(alert_dialog)
self.alert_list_widget = QtWidgets.QListWidget(alert_dialog)
self.alert_list_widget.setAlternatingRowColors(True)
self.alert_list_widget.setObjectName('alert_list_widget')
self.alert_dialog_layout.addWidget(self.alert_list_widget, 1, 0)
self.manage_button_layout = QtGui.QVBoxLayout()
self.manage_button_layout = QtWidgets.QVBoxLayout()
self.manage_button_layout.setObjectName('manage_button_layout')
self.new_button = QtGui.QPushButton(alert_dialog)
self.new_button = QtWidgets.QPushButton(alert_dialog)
self.new_button.setIcon(build_icon(':/general/general_new.png'))
self.new_button.setObjectName('new_button')
self.manage_button_layout.addWidget(self.new_button)
self.save_button = QtGui.QPushButton(alert_dialog)
self.save_button = QtWidgets.QPushButton(alert_dialog)
self.save_button.setEnabled(False)
self.save_button.setIcon(build_icon(':/general/general_save.png'))
self.save_button.setObjectName('save_button')

View File

@ -20,7 +20,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtGui, QtCore
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import Registry, translate
from openlp.plugins.alerts.lib.db import AlertItem
@ -28,7 +28,7 @@ from openlp.plugins.alerts.lib.db import AlertItem
from .alertdialog import Ui_AlertDialog
class AlertForm(QtGui.QDialog, Ui_AlertDialog):
class AlertForm(QtWidgets.QDialog, Ui_AlertDialog):
"""
Provide UI for the alert system
"""
@ -50,14 +50,14 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
self.alert_list_widget.clicked.connect(self.on_single_click)
self.alert_list_widget.currentRowChanged.connect(self.on_current_row_changed)
def exec_(self):
def exec(self):
"""
Execute the dialog and return the exit code.
"""
self.display_button.setEnabled(False)
self.display_close_button.setEnabled(False)
self.alert_text_edit.setText('')
return QtGui.QDialog.exec_(self)
return QtWidgets.QDialog.exec(self)
def load_list(self):
"""
@ -66,7 +66,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
self.alert_list_widget.clear()
alerts = self.manager.get_all_objects(AlertItem, order_by_ref=AlertItem.text)
for alert in alerts:
item_name = QtGui.QListWidgetItem(alert.text)
item_name = QtWidgets.QListWidgetItem(alert.text)
item_name.setData(QtCore.Qt.UserRole, alert.id)
self.alert_list_widget.addItem(item_name)
if alert.text == str(self.alert_text_edit.text()):
@ -104,11 +104,11 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
Create a new alert.
"""
if not self.alert_text_edit.text():
QtGui.QMessageBox.information(self,
translate('AlertsPlugin.AlertForm', 'New Alert'),
translate('AlertsPlugin.AlertForm',
'You haven\'t specified any text for your alert. \n'
'Please type in some text before clicking New.'))
QtWidgets.QMessageBox.information(self,
translate('AlertsPlugin.AlertForm', 'New Alert'),
translate('AlertsPlugin.AlertForm',
'You haven\'t specified any text for your alert. \n'
'Please type in some text before clicking New.'))
else:
alert = AlertItem()
alert.text = self.alert_text_edit.text()
@ -175,24 +175,27 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
return False
# We found '<>' in the alert text, but the ParameterEdit field is empty.
if text.find('<>') != -1 and not self.parameter_edit.text() and \
QtGui.QMessageBox.question(self,
translate('AlertsPlugin.AlertForm', 'No Parameter Found'),
translate('AlertsPlugin.AlertForm',
'You have not entered a parameter to be replaced.\n'
'Do you want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
QtWidgets.QMessageBox.question(self,
translate('AlertsPlugin.AlertForm', 'No Parameter Found'),
translate('AlertsPlugin.AlertForm',
'You have not entered a parameter to be replaced.\n'
'Do you want to continue anyway?'),
QtWidgets.QMessageBox.StandardButtons(
QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes)
) == QtWidgets.QMessageBox.No:
self.parameter_edit.setFocus()
return False
# The ParameterEdit field is not empty, but we have not found '<>'
# in the alert text.
elif text.find('<>') == -1 and self.parameter_edit.text() and \
QtGui.QMessageBox.question(self,
translate('AlertsPlugin.AlertForm', 'No Placeholder Found'),
translate('AlertsPlugin.AlertForm', 'The alert text does not contain \'<>\'.\n'
'Do you want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
QtWidgets.QMessageBox.question(self,
translate('AlertsPlugin.AlertForm', 'No Placeholder Found'),
translate('AlertsPlugin.AlertForm',
'The alert text does not contain \'<>\'.\n'
'Do you want to continue anyway?'),
QtWidgets.QMessageBox.StandardButtons(
QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes)
) == QtWidgets.QMessageBox.No:
self.parameter_edit.setFocus()
return False
text = text.replace('<>', self.parameter_edit.text())

View File

@ -24,7 +24,7 @@ The :mod:`~openlp.plugins.alerts.lib.alertsmanager` module contains the part of
displaying of alerts.
"""
from PyQt4 import QtCore
from PyQt5 import QtCore
from openlp.core.common import OpenLPMixin, RegistryMixin, Registry, RegistryProperties, Settings, translate
@ -33,13 +33,15 @@ class AlertsManager(OpenLPMixin, RegistryMixin, QtCore.QObject, RegistryProperti
"""
AlertsManager manages the settings of Alerts.
"""
alerts_text = QtCore.pyqtSignal(list)
def __init__(self, parent):
super(AlertsManager, self).__init__(parent)
self.timer_id = 0
self.alert_list = []
Registry().register_function('live_display_active', self.generate_alert)
Registry().register_function('alerts_text', self.alert_text)
QtCore.QObject.connect(self, QtCore.SIGNAL('alerts_text'), self.alert_text)
self.alerts_text.connect(self.alert_text)
def alert_text(self, message):
"""

View File

@ -20,7 +20,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtGui
from PyQt5 import QtGui, QtWidgets
from openlp.core.common import Settings, UiStrings, translate
from openlp.core.lib import ColorButton, SettingsTab
@ -37,38 +37,38 @@ class AlertsTab(SettingsTab):
def setupUi(self):
self.setObjectName('AlertsTab')
super(AlertsTab, self).setupUi()
self.font_group_box = QtGui.QGroupBox(self.left_column)
self.font_group_box = QtWidgets.QGroupBox(self.left_column)
self.font_group_box.setObjectName('font_group_box')
self.font_layout = QtGui.QFormLayout(self.font_group_box)
self.font_layout = QtWidgets.QFormLayout(self.font_group_box)
self.font_layout.setObjectName('font_layout')
self.font_label = QtGui.QLabel(self.font_group_box)
self.font_label = QtWidgets.QLabel(self.font_group_box)
self.font_label.setObjectName('font_label')
self.font_combo_box = QtGui.QFontComboBox(self.font_group_box)
self.font_combo_box = QtWidgets.QFontComboBox(self.font_group_box)
self.font_combo_box.setObjectName('font_combo_box')
self.font_layout.addRow(self.font_label, self.font_combo_box)
self.font_color_label = QtGui.QLabel(self.font_group_box)
self.font_color_label = QtWidgets.QLabel(self.font_group_box)
self.font_color_label.setObjectName('font_color_label')
self.color_layout = QtGui.QHBoxLayout()
self.color_layout = QtWidgets.QHBoxLayout()
self.color_layout.setObjectName('color_layout')
self.font_color_button = ColorButton(self.font_group_box)
self.font_color_button.setObjectName('font_color_button')
self.color_layout.addWidget(self.font_color_button)
self.color_layout.addSpacing(20)
self.background_color_label = QtGui.QLabel(self.font_group_box)
self.background_color_label = QtWidgets.QLabel(self.font_group_box)
self.background_color_label.setObjectName('background_color_label')
self.color_layout.addWidget(self.background_color_label)
self.background_color_button = ColorButton(self.font_group_box)
self.background_color_button.setObjectName('background_color_button')
self.color_layout.addWidget(self.background_color_button)
self.font_layout.addRow(self.font_color_label, self.color_layout)
self.font_size_label = QtGui.QLabel(self.font_group_box)
self.font_size_label = QtWidgets.QLabel(self.font_group_box)
self.font_size_label.setObjectName('font_size_label')
self.font_size_spin_box = QtGui.QSpinBox(self.font_group_box)
self.font_size_spin_box = QtWidgets.QSpinBox(self.font_group_box)
self.font_size_spin_box.setObjectName('font_size_spin_box')
self.font_layout.addRow(self.font_size_label, self.font_size_spin_box)
self.timeout_label = QtGui.QLabel(self.font_group_box)
self.timeout_label = QtWidgets.QLabel(self.font_group_box)
self.timeout_label.setObjectName('timeout_label')
self.timeout_spin_box = QtGui.QSpinBox(self.font_group_box)
self.timeout_spin_box = QtWidgets.QSpinBox(self.font_group_box)
self.timeout_spin_box.setMaximum(180)
self.timeout_spin_box.setObjectName('timeout_spin_box')
self.font_layout.addRow(self.timeout_label, self.timeout_spin_box)
@ -78,11 +78,11 @@ class AlertsTab(SettingsTab):
self.font_layout.addRow(self.vertical_label, self.vertical_combo_box)
self.left_layout.addWidget(self.font_group_box)
self.left_layout.addStretch()
self.preview_group_box = QtGui.QGroupBox(self.right_column)
self.preview_group_box = QtWidgets.QGroupBox(self.right_column)
self.preview_group_box.setObjectName('preview_group_box')
self.preview_layout = QtGui.QVBoxLayout(self.preview_group_box)
self.preview_layout = QtWidgets.QVBoxLayout(self.preview_group_box)
self.preview_layout.setObjectName('preview_layout')
self.font_preview = QtGui.QLineEdit(self.preview_group_box)
self.font_preview = QtWidgets.QLineEdit(self.preview_group_box)
self.font_preview.setObjectName('font_preview')
self.preview_layout.addWidget(self.font_preview)
self.right_layout.addWidget(self.preview_group_box)

View File

@ -22,7 +22,7 @@
import logging
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.ui import UiStrings, create_action
@ -107,12 +107,12 @@ class BiblePlugin(Plugin):
"""
super(BiblePlugin, self).app_startup()
if self.manager.old_bible_databases:
if QtGui.QMessageBox.information(
if QtWidgets.QMessageBox.information(
self.main_window, translate('OpenLP', 'Information'),
translate('OpenLP', 'Bible format has changed.\nYou have to upgrade your '
'existing Bibles.\nShould OpenLP upgrade now?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == \
QtGui.QMessageBox.Yes:
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)) == \
QtWidgets.QMessageBox.Yes:
self.on_tools_upgrade_item_triggered()
def add_import_menu_item(self, import_menu):
@ -157,7 +157,7 @@ class BiblePlugin(Plugin):
if not hasattr(self, 'upgrade_wizard'):
self.upgrade_wizard = BibleUpgradeForm(self.main_window, self.manager, self)
# If the import was not cancelled then reload.
if self.upgrade_wizard.exec_():
if self.upgrade_wizard.exec():
self.media_item.reload_bibles()
def on_bible_import_click(self):

View File

@ -25,14 +25,14 @@ Forms in OpenLP are made up of two classes. One class holds all the graphical el
other class holds all the functional code, like slots and loading and saving.
The first class, commonly known as the **Dialog** class, is typically named ``Ui_<name>Dialog``. It is a slightly
modified version of the class that the ``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be
modified version of the class that the ``pyuic5`` command produces from Qt5's .ui file. Typical modifications will be
converting most strings from "" to '' and using OpenLP's ``translate()`` function for translating strings.
The second class, commonly known as the **Form** class, is typically named ``<name>Form``. This class is the one which
is instantiated and used. It uses dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class mentioned
above, like so::
is instantiated and used. It uses dual inheritance to inherit from (usually) QtWidgets.QDialog and the Ui class
mentioned above, like so::
class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
class BibleImportForm(QtWidgets.QWizard, Ui_BibleImportWizard):
def __init__(self, parent, manager, bible_plugin):
super(BibleImportForm, self).__init__(parent)

View File

@ -26,7 +26,7 @@ import logging
import os
import urllib.error
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import AppLocation, Settings, UiStrings, translate
from openlp.core.lib.db import delete_database
@ -112,194 +112,194 @@ class BibleImportForm(OpenLPWizard):
Add the bible import specific wizard pages.
"""
# Select Page
self.select_page = QtGui.QWizardPage()
self.select_page = QtWidgets.QWizardPage()
self.select_page.setObjectName('SelectPage')
self.select_page_layout = QtGui.QVBoxLayout(self.select_page)
self.select_page_layout = QtWidgets.QVBoxLayout(self.select_page)
self.select_page_layout.setObjectName('SelectPageLayout')
self.format_layout = QtGui.QFormLayout()
self.format_layout = QtWidgets.QFormLayout()
self.format_layout.setObjectName('FormatLayout')
self.format_label = QtGui.QLabel(self.select_page)
self.format_label = QtWidgets.QLabel(self.select_page)
self.format_label.setObjectName('FormatLabel')
self.format_combo_box = QtGui.QComboBox(self.select_page)
self.format_combo_box = QtWidgets.QComboBox(self.select_page)
self.format_combo_box.addItems(['', '', '', '', ''])
self.format_combo_box.setObjectName('FormatComboBox')
self.format_layout.addRow(self.format_label, self.format_combo_box)
self.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
self.format_layout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.format_layout.setItem(1, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.select_page_layout.addLayout(self.format_layout)
self.select_stack = QtGui.QStackedLayout()
self.select_stack = QtWidgets.QStackedLayout()
self.select_stack.setObjectName('SelectStack')
self.osis_widget = QtGui.QWidget(self.select_page)
self.osis_widget = QtWidgets.QWidget(self.select_page)
self.osis_widget.setObjectName('OsisWidget')
self.osis_layout = QtGui.QFormLayout(self.osis_widget)
self.osis_layout.setMargin(0)
self.osis_layout = QtWidgets.QFormLayout(self.osis_widget)
self.osis_layout.setContentsMargins(0, 0, 0, 0)
self.osis_layout.setObjectName('OsisLayout')
self.osis_file_label = QtGui.QLabel(self.osis_widget)
self.osis_file_label = QtWidgets.QLabel(self.osis_widget)
self.osis_file_label.setObjectName('OsisFileLabel')
self.osis_file_layout = QtGui.QHBoxLayout()
self.osis_file_layout = QtWidgets.QHBoxLayout()
self.osis_file_layout.setObjectName('OsisFileLayout')
self.osis_file_edit = QtGui.QLineEdit(self.osis_widget)
self.osis_file_edit = QtWidgets.QLineEdit(self.osis_widget)
self.osis_file_edit.setObjectName('OsisFileEdit')
self.osis_file_layout.addWidget(self.osis_file_edit)
self.osis_browse_button = QtGui.QToolButton(self.osis_widget)
self.osis_browse_button = QtWidgets.QToolButton(self.osis_widget)
self.osis_browse_button.setIcon(self.open_icon)
self.osis_browse_button.setObjectName('OsisBrowseButton')
self.osis_file_layout.addWidget(self.osis_browse_button)
self.osis_layout.addRow(self.osis_file_label, self.osis_file_layout)
self.osis_layout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
self.osis_layout.setItem(1, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.select_stack.addWidget(self.osis_widget)
self.csv_widget = QtGui.QWidget(self.select_page)
self.csv_widget = QtWidgets.QWidget(self.select_page)
self.csv_widget.setObjectName('CsvWidget')
self.csv_layout = QtGui.QFormLayout(self.csv_widget)
self.csv_layout.setMargin(0)
self.csv_layout = QtWidgets.QFormLayout(self.csv_widget)
self.csv_layout.setContentsMargins(0, 0, 0, 0)
self.csv_layout.setObjectName('CsvLayout')
self.csv_books_label = QtGui.QLabel(self.csv_widget)
self.csv_books_label = QtWidgets.QLabel(self.csv_widget)
self.csv_books_label.setObjectName('CsvBooksLabel')
self.csv_books_layout = QtGui.QHBoxLayout()
self.csv_books_layout = QtWidgets.QHBoxLayout()
self.csv_books_layout.setObjectName('CsvBooksLayout')
self.csv_books_edit = QtGui.QLineEdit(self.csv_widget)
self.csv_books_edit = QtWidgets.QLineEdit(self.csv_widget)
self.csv_books_edit.setObjectName('CsvBooksEdit')
self.csv_books_layout.addWidget(self.csv_books_edit)
self.csv_books_button = QtGui.QToolButton(self.csv_widget)
self.csv_books_button = QtWidgets.QToolButton(self.csv_widget)
self.csv_books_button.setIcon(self.open_icon)
self.csv_books_button.setObjectName('CsvBooksButton')
self.csv_books_layout.addWidget(self.csv_books_button)
self.csv_layout.addRow(self.csv_books_label, self.csv_books_layout)
self.csv_verses_label = QtGui.QLabel(self.csv_widget)
self.csv_verses_label = QtWidgets.QLabel(self.csv_widget)
self.csv_verses_label.setObjectName('CsvVersesLabel')
self.csv_verses_layout = QtGui.QHBoxLayout()
self.csv_verses_layout = QtWidgets.QHBoxLayout()
self.csv_verses_layout.setObjectName('CsvVersesLayout')
self.csv_verses_edit = QtGui.QLineEdit(self.csv_widget)
self.csv_verses_edit = QtWidgets.QLineEdit(self.csv_widget)
self.csv_verses_edit.setObjectName('CsvVersesEdit')
self.csv_verses_layout.addWidget(self.csv_verses_edit)
self.csv_verses_button = QtGui.QToolButton(self.csv_widget)
self.csv_verses_button = QtWidgets.QToolButton(self.csv_widget)
self.csv_verses_button.setIcon(self.open_icon)
self.csv_verses_button.setObjectName('CsvVersesButton')
self.csv_verses_layout.addWidget(self.csv_verses_button)
self.csv_layout.addRow(self.csv_verses_label, self.csv_verses_layout)
self.csv_layout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer)
self.csv_layout.setItem(3, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.select_stack.addWidget(self.csv_widget)
self.open_song_widget = QtGui.QWidget(self.select_page)
self.open_song_widget = QtWidgets.QWidget(self.select_page)
self.open_song_widget.setObjectName('OpenSongWidget')
self.open_song_layout = QtGui.QFormLayout(self.open_song_widget)
self.open_song_layout.setMargin(0)
self.open_song_layout = QtWidgets.QFormLayout(self.open_song_widget)
self.open_song_layout.setContentsMargins(0, 0, 0, 0)
self.open_song_layout.setObjectName('OpenSongLayout')
self.open_song_file_label = QtGui.QLabel(self.open_song_widget)
self.open_song_file_label = QtWidgets.QLabel(self.open_song_widget)
self.open_song_file_label.setObjectName('OpenSongFileLabel')
self.open_song_file_layout = QtGui.QHBoxLayout()
self.open_song_file_layout = QtWidgets.QHBoxLayout()
self.open_song_file_layout.setObjectName('OpenSongFileLayout')
self.open_song_file_edit = QtGui.QLineEdit(self.open_song_widget)
self.open_song_file_edit = QtWidgets.QLineEdit(self.open_song_widget)
self.open_song_file_edit.setObjectName('OpenSongFileEdit')
self.open_song_file_layout.addWidget(self.open_song_file_edit)
self.open_song_browse_button = QtGui.QToolButton(self.open_song_widget)
self.open_song_browse_button = QtWidgets.QToolButton(self.open_song_widget)
self.open_song_browse_button.setIcon(self.open_icon)
self.open_song_browse_button.setObjectName('OpenSongBrowseButton')
self.open_song_file_layout.addWidget(self.open_song_browse_button)
self.open_song_layout.addRow(self.open_song_file_label, self.open_song_file_layout)
self.open_song_layout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
self.open_song_layout.setItem(1, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.select_stack.addWidget(self.open_song_widget)
self.web_tab_widget = QtGui.QTabWidget(self.select_page)
self.web_tab_widget = QtWidgets.QTabWidget(self.select_page)
self.web_tab_widget.setObjectName('WebTabWidget')
self.web_bible_tab = QtGui.QWidget()
self.web_bible_tab = QtWidgets.QWidget()
self.web_bible_tab.setObjectName('WebBibleTab')
self.web_bible_layout = QtGui.QFormLayout(self.web_bible_tab)
self.web_bible_layout = QtWidgets.QFormLayout(self.web_bible_tab)
self.web_bible_layout.setObjectName('WebBibleLayout')
self.web_update_label = QtGui.QLabel(self.web_bible_tab)
self.web_source_label = QtWidgets.QLabel(self.web_bible_tab)
self.web_update_label.setObjectName('WebUpdateLabel')
self.web_bible_layout.setWidget(0, QtGui.QFormLayout.LabelRole, self.web_update_label)
self.web_update_button = QtGui.QPushButton(self.web_bible_tab)
self.web_bible_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.web_update_label)
self.web_update_button = QtWidgets.QPushButton(self.web_bible_tab)
self.web_update_button.setObjectName('WebUpdateButton')
self.web_bible_layout.setWidget(0, QtGui.QFormLayout.FieldRole, self.web_update_button)
self.web_source_label = QtGui.QLabel(self.web_bible_tab)
self.web_bible_layout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.web_update_button)
self.web_source_label = QtWidgets.QLabel(self.web_bible_tab)
self.web_source_label.setObjectName('WebSourceLabel')
self.web_bible_layout.setWidget(1, QtGui.QFormLayout.LabelRole, self.web_source_label)
self.web_source_combo_box = QtGui.QComboBox(self.web_bible_tab)
self.web_bible_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.web_source_label)
self.web_source_combo_box = QtWidgets.QComboBox(self.web_bible_tab)
self.web_source_combo_box.setObjectName('WebSourceComboBox')
self.web_source_combo_box.addItems(['', '', ''])
self.web_source_combo_box.setEnabled(False)
self.web_bible_layout.setWidget(1, QtGui.QFormLayout.FieldRole, self.web_source_combo_box)
self.web_translation_label = QtGui.QLabel(self.web_bible_tab)
self.web_bible_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.web_source_combo_box)
self.web_translation_label = QtWidgets.QLabel(self.web_bible_tab)
self.web_translation_label.setObjectName('web_translation_label')
self.web_bible_layout.setWidget(2, QtGui.QFormLayout.LabelRole, self.web_translation_label)
self.web_translation_combo_box = QtGui.QComboBox(self.web_bible_tab)
self.web_translation_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
self.web_bible_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.web_translation_label)
self.web_translation_combo_box = QtWidgets.QComboBox(self.web_bible_tab)
self.web_translation_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
self.web_translation_combo_box.setObjectName('WebTranslationComboBox')
self.web_translation_combo_box.setEnabled(False)
self.web_bible_layout.setWidget(2, QtGui.QFormLayout.FieldRole, self.web_translation_combo_box)
self.web_progress_bar = QtGui.QProgressBar(self)
self.web_bible_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.web_translation_combo_box)
self.web_progress_bar = QtWidgets.QProgressBar(self)
self.web_progress_bar.setRange(0, 3)
self.web_progress_bar.setObjectName('WebTranslationProgressBar')
self.web_progress_bar.setVisible(False)
self.web_bible_layout.setWidget(3, QtGui.QFormLayout.SpanningRole, self.web_progress_bar)
self.web_bible_layout.setWidget(3, QtWidgets.QFormLayout.SpanningRole, self.web_progress_bar)
self.web_tab_widget.addTab(self.web_bible_tab, '')
self.web_proxy_tab = QtGui.QWidget()
self.web_proxy_tab = QtWidgets.QWidget()
self.web_proxy_tab.setObjectName('WebProxyTab')
self.web_proxy_layout = QtGui.QFormLayout(self.web_proxy_tab)
self.web_proxy_layout = QtWidgets.QFormLayout(self.web_proxy_tab)
self.web_proxy_layout.setObjectName('WebProxyLayout')
self.web_server_label = QtGui.QLabel(self.web_proxy_tab)
self.web_server_label = QtWidgets.QLabel(self.web_proxy_tab)
self.web_server_label.setObjectName('WebServerLabel')
self.web_proxy_layout.setWidget(0, QtGui.QFormLayout.LabelRole, self.web_server_label)
self.web_server_edit = QtGui.QLineEdit(self.web_proxy_tab)
self.web_proxy_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.web_server_label)
self.web_server_edit = QtWidgets.QLineEdit(self.web_proxy_tab)
self.web_server_edit.setObjectName('WebServerEdit')
self.web_proxy_layout.setWidget(0, QtGui.QFormLayout.FieldRole, self.web_server_edit)
self.web_user_label = QtGui.QLabel(self.web_proxy_tab)
self.web_proxy_layout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.web_server_edit)
self.web_user_label = QtWidgets.QLabel(self.web_proxy_tab)
self.web_user_label.setObjectName('WebUserLabel')
self.web_proxy_layout.setWidget(1, QtGui.QFormLayout.LabelRole, self.web_user_label)
self.web_user_edit = QtGui.QLineEdit(self.web_proxy_tab)
self.web_proxy_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.web_user_label)
self.web_user_edit = QtWidgets.QLineEdit(self.web_proxy_tab)
self.web_user_edit.setObjectName('WebUserEdit')
self.web_proxy_layout.setWidget(1, QtGui.QFormLayout.FieldRole, self.web_user_edit)
self.web_password_label = QtGui.QLabel(self.web_proxy_tab)
self.web_proxy_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.web_user_edit)
self.web_password_label = QtWidgets.QLabel(self.web_proxy_tab)
self.web_password_label.setObjectName('WebPasswordLabel')
self.web_proxy_layout.setWidget(2, QtGui.QFormLayout.LabelRole, self.web_password_label)
self.web_password_edit = QtGui.QLineEdit(self.web_proxy_tab)
self.web_proxy_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.web_password_label)
self.web_password_edit = QtWidgets.QLineEdit(self.web_proxy_tab)
self.web_password_edit.setObjectName('WebPasswordEdit')
self.web_proxy_layout.setWidget(2, QtGui.QFormLayout.FieldRole, self.web_password_edit)
self.web_proxy_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.web_password_edit)
self.web_tab_widget.addTab(self.web_proxy_tab, '')
self.select_stack.addWidget(self.web_tab_widget)
self.zefania_widget = QtGui.QWidget(self.select_page)
self.zefania_widget = QtWidgets.QWidget(self.select_page)
self.zefania_widget.setObjectName('ZefaniaWidget')
self.zefania_layout = QtGui.QFormLayout(self.zefania_widget)
self.zefania_layout = QtWidgets.QFormLayout(self.zefania_widget)
self.zefania_layout.setMargin(0)
self.zefania_layout.setObjectName('ZefaniaLayout')
self.zefania_file_label = QtGui.QLabel(self.zefania_widget)
self.zefania_file_label = QtWidgets.QLabel(self.zefania_widget)
self.zefania_file_label.setObjectName('ZefaniaFileLabel')
self.zefania_file_layout = QtGui.QHBoxLayout()
self.zefania_file_layout = QtWidgets.QHBoxLayout()
self.zefania_file_layout.setObjectName('ZefaniaFileLayout')
self.zefania_file_edit = QtGui.QLineEdit(self.zefania_widget)
self.zefania_file_edit = QtWidgets.QLineEdit(self.zefania_widget)
self.zefania_file_edit.setObjectName('ZefaniaFileEdit')
self.zefania_file_layout.addWidget(self.zefania_file_edit)
self.zefania_browse_button = QtGui.QToolButton(self.zefania_widget)
self.zefania_browse_button = QtWidgets.QToolButton(self.zefania_widget)
self.zefania_browse_button.setIcon(self.open_icon)
self.zefania_browse_button.setObjectName('ZefaniaBrowseButton')
self.zefania_file_layout.addWidget(self.zefania_browse_button)
self.zefania_layout.addRow(self.zefania_file_label, self.zefania_file_layout)
self.zefania_layout.setItem(5, QtGui.QFormLayout.LabelRole, self.spacer)
self.zefania_layout.setItem(5, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.select_stack.addWidget(self.zefania_widget)
self.select_page_layout.addLayout(self.select_stack)
self.addPage(self.select_page)
# License Page
self.license_details_page = QtGui.QWizardPage()
self.license_details_page = QtWidgets.QWizardPage()
self.license_details_page.setObjectName('LicenseDetailsPage')
self.license_details_layout = QtGui.QFormLayout(self.license_details_page)
self.license_details_layout = QtWidgets.QFormLayout(self.license_details_page)
self.license_details_layout.setObjectName('LicenseDetailsLayout')
self.version_name_label = QtGui.QLabel(self.license_details_page)
self.version_name_label = QtWidgets.QLabel(self.license_details_page)
self.version_name_label.setObjectName('VersionNameLabel')
self.license_details_layout.setWidget(0, QtGui.QFormLayout.LabelRole, self.version_name_label)
self.version_name_edit = QtGui.QLineEdit(self.license_details_page)
self.license_details_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.version_name_label)
self.version_name_edit = QtWidgets.QLineEdit(self.license_details_page)
self.version_name_edit.setObjectName('VersionNameEdit')
self.license_details_layout.setWidget(0, QtGui.QFormLayout.FieldRole, self.version_name_edit)
self.copyright_label = QtGui.QLabel(self.license_details_page)
self.license_details_layout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.version_name_edit)
self.copyright_label = QtWidgets.QLabel(self.license_details_page)
self.copyright_label.setObjectName('CopyrightLabel')
self.license_details_layout.setWidget(1, QtGui.QFormLayout.LabelRole, self.copyright_label)
self.copyright_edit = QtGui.QLineEdit(self.license_details_page)
self.license_details_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.copyright_label)
self.copyright_edit = QtWidgets.QLineEdit(self.license_details_page)
self.copyright_edit.setObjectName('CopyrightEdit')
self.license_details_layout.setWidget(1, QtGui.QFormLayout.FieldRole, self.copyright_edit)
self.permissions_label = QtGui.QLabel(self.license_details_page)
self.license_details_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.copyright_edit)
self.permissions_label = QtWidgets.QLabel(self.license_details_page)
self.permissions_label.setObjectName('PermissionsLabel')
self.license_details_layout.setWidget(2, QtGui.QFormLayout.LabelRole, self.permissions_label)
self.permissions_edit = QtGui.QLineEdit(self.license_details_page)
self.license_details_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.permissions_label)
self.permissions_edit = QtWidgets.QLineEdit(self.license_details_page)
self.permissions_edit.setObjectName('PermissionsEdit')
self.license_details_layout.setWidget(2, QtGui.QFormLayout.FieldRole, self.permissions_edit)
self.license_details_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.permissions_edit)
self.addPage(self.license_details_page)
def retranslateUi(self):
@ -365,7 +365,7 @@ class BibleImportForm(OpenLPWizard):
self.csv_verses_label.minimumSizeHint().width(),
self.open_song_file_label.minimumSizeHint().width(),
self.zefania_file_label.minimumSizeHint().width())
self.spacer.changeSize(label_width, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.spacer.changeSize(label_width, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
def validateCurrentPage(self):
"""

View File

@ -27,7 +27,7 @@ import os
import shutil
from tempfile import gettempdir
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import Registry, AppLocation, UiStrings, Settings, check_directory_exists, translate
from openlp.core.lib.ui import critical_error_message_box
@ -87,7 +87,7 @@ class BibleUpgradeForm(OpenLPWizard):
log.debug('Wizard cancelled by user')
self.stop_import_flag = True
if not self.currentPage() == self.progress_page:
self.done(QtGui.QDialog.Rejected)
self.done(QtWidgets.QDialog.Rejected)
def onCurrentIdChanged(self, page_id):
"""
@ -104,8 +104,8 @@ class BibleUpgradeForm(OpenLPWizard):
"""
Show the file open dialog for the OSIS file.
"""
filename = QtGui.QFileDialog.getExistingDirectory(self, translate('BiblesPlugin.UpgradeWizardForm',
'Select a Backup Directory'), '')
filename = QtWidgets.QFileDialog.getExistingDirectory(self, translate('BiblesPlugin.UpgradeWizardForm',
'Select a Backup Directory'), '')
if filename:
self.backupDirectoryEdit.setText(filename)
@ -148,53 +148,53 @@ class BibleUpgradeForm(OpenLPWizard):
Add the bible import specific wizard pages.
"""
# Backup Page
self.backup_page = QtGui.QWizardPage()
self.backup_page = QtWidgets.QWizardPage()
self.backup_page.setObjectName('BackupPage')
self.backupLayout = QtGui.QVBoxLayout(self.backup_page)
self.backupLayout = QtWidgets.QVBoxLayout(self.backup_page)
self.backupLayout.setObjectName('BackupLayout')
self.backupInfoLabel = QtGui.QLabel(self.backup_page)
self.backupInfoLabel = QtWidgets.QLabel(self.backup_page)
self.backupInfoLabel.setOpenExternalLinks(True)
self.backupInfoLabel.setTextFormat(QtCore.Qt.RichText)
self.backupInfoLabel.setWordWrap(True)
self.backupInfoLabel.setObjectName('backupInfoLabel')
self.backupLayout.addWidget(self.backupInfoLabel)
self.selectLabel = QtGui.QLabel(self.backup_page)
self.selectLabel = QtWidgets.QLabel(self.backup_page)
self.selectLabel.setObjectName('select_label')
self.backupLayout.addWidget(self.selectLabel)
self.formLayout = QtGui.QFormLayout()
self.formLayout.setMargin(0)
self.formLayout = QtWidgets.QFormLayout()
self.formLayout.setContentsMargins(0, 0, 0, 0)
self.formLayout.setObjectName('FormLayout')
self.backupDirectoryLabel = QtGui.QLabel(self.backup_page)
self.backupDirectoryLabel = QtWidgets.QLabel(self.backup_page)
self.backupDirectoryLabel.setObjectName('backupDirectoryLabel')
self.backupDirectoryLayout = QtGui.QHBoxLayout()
self.backupDirectoryLayout = QtWidgets.QHBoxLayout()
self.backupDirectoryLayout.setObjectName('BackupDirectoryLayout')
self.backupDirectoryEdit = QtGui.QLineEdit(self.backup_page)
self.backupDirectoryEdit = QtWidgets.QLineEdit(self.backup_page)
self.backupDirectoryEdit.setObjectName('BackupFolderEdit')
self.backupDirectoryLayout.addWidget(self.backupDirectoryEdit)
self.backupBrowseButton = QtGui.QToolButton(self.backup_page)
self.backupBrowseButton = QtWidgets.QToolButton(self.backup_page)
self.backupBrowseButton.setIcon(self.open_icon)
self.backupBrowseButton.setObjectName('BackupBrowseButton')
self.backupDirectoryLayout.addWidget(self.backupBrowseButton)
self.formLayout.addRow(self.backupDirectoryLabel, self.backupDirectoryLayout)
self.backupLayout.addLayout(self.formLayout)
self.noBackupCheckBox = QtGui.QCheckBox(self.backup_page)
self.noBackupCheckBox = QtWidgets.QCheckBox(self.backup_page)
self.noBackupCheckBox.setObjectName('NoBackupCheckBox')
self.backupLayout.addWidget(self.noBackupCheckBox)
self.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.backupLayout.addItem(self.spacer)
self.addPage(self.backup_page)
# Select Page
self.selectPage = QtGui.QWizardPage()
self.selectPage = QtWidgets.QWizardPage()
self.selectPage.setObjectName('SelectPage')
self.pageLayout = QtGui.QVBoxLayout(self.selectPage)
self.pageLayout = QtWidgets.QVBoxLayout(self.selectPage)
self.pageLayout.setObjectName('pageLayout')
self.scrollArea = QtGui.QScrollArea(self.selectPage)
self.scrollArea = QtWidgets.QScrollArea(self.selectPage)
self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName('scrollArea')
self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.scrollAreaContents = QtGui.QWidget(self.scrollArea)
self.scrollAreaContents = QtWidgets.QWidget(self.scrollArea)
self.scrollAreaContents.setObjectName('scrollAreaContents')
self.formLayout = QtGui.QVBoxLayout(self.scrollAreaContents)
self.formLayout = QtWidgets.QVBoxLayout(self.scrollAreaContents)
self.formLayout.setSpacing(2)
self.formLayout.setObjectName('formLayout')
self.addScrollArea()
@ -208,12 +208,12 @@ class BibleUpgradeForm(OpenLPWizard):
self.checkBox = {}
for number, filename in enumerate(self.files):
bible = OldBibleDB(self.media_item, path=self.path, file=filename[0])
self.checkBox[number] = QtGui.QCheckBox(self.scrollAreaContents)
self.checkBox[number] = QtWidgets.QCheckBox(self.scrollAreaContents)
self.checkBox[number].setObjectName('checkBox[%d]' % number)
self.checkBox[number].setText(bible.get_name())
self.checkBox[number].setCheckState(QtCore.Qt.Checked)
self.formLayout.addWidget(self.checkBox[number])
self.spacer_item = QtGui.QSpacerItem(20, 5, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.spacer_item = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.formLayout.addItem(self.spacer_item)
self.scrollArea.setWidget(self.scrollAreaContents)

View File

@ -20,7 +20,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import translate
from openlp.core.lib import build_icon
@ -32,46 +32,46 @@ class Ui_BookNameDialog(object):
book_name_dialog.setObjectName('book_name_dialog')
book_name_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
book_name_dialog.resize(400, 271)
self.book_name_layout = QtGui.QVBoxLayout(book_name_dialog)
self.book_name_layout = QtWidgets.QVBoxLayout(book_name_dialog)
self.book_name_layout.setSpacing(8)
self.book_name_layout.setMargin(8)
self.book_name_layout.setContentsMargins(8, 8, 8, 8)
self.book_name_layout.setObjectName('book_name_layout')
self.info_label = QtGui.QLabel(book_name_dialog)
self.info_label = QtWidgets.QLabel(book_name_dialog)
self.info_label.setWordWrap(True)
self.info_label.setObjectName('info_label')
self.book_name_layout.addWidget(self.info_label)
self.corresponding_layout = QtGui.QGridLayout()
self.corresponding_layout = QtWidgets.QGridLayout()
self.corresponding_layout.setColumnStretch(1, 1)
self.corresponding_layout.setSpacing(8)
self.corresponding_layout.setObjectName('corresponding_layout')
self.current_label = QtGui.QLabel(book_name_dialog)
self.current_label = QtWidgets.QLabel(book_name_dialog)
self.current_label.setObjectName('current_label')
self.corresponding_layout.addWidget(self.current_label, 0, 0, 1, 1)
self.current_book_label = QtGui.QLabel(book_name_dialog)
self.current_book_label = QtWidgets.QLabel(book_name_dialog)
self.current_book_label.setObjectName('current_book_label')
self.corresponding_layout.addWidget(self.current_book_label, 0, 1, 1, 1)
self.corresponding_label = QtGui.QLabel(book_name_dialog)
self.corresponding_label = QtWidgets.QLabel(book_name_dialog)
self.corresponding_label.setObjectName('corresponding_label')
self.corresponding_layout.addWidget(self.corresponding_label, 1, 0, 1, 1)
self.corresponding_combo_box = QtGui.QComboBox(book_name_dialog)
self.corresponding_combo_box = QtWidgets.QComboBox(book_name_dialog)
self.corresponding_combo_box.setObjectName('corresponding_combo_box')
self.corresponding_layout.addWidget(self.corresponding_combo_box, 1, 1, 1, 1)
self.book_name_layout.addLayout(self.corresponding_layout)
self.options_group_box = QtGui.QGroupBox(book_name_dialog)
self.options_group_box = QtWidgets.QGroupBox(book_name_dialog)
self.options_group_box.setObjectName('options_group_box')
self.options_layout = QtGui.QVBoxLayout(self.options_group_box)
self.options_layout = QtWidgets.QVBoxLayout(self.options_group_box)
self.options_layout.setSpacing(8)
self.options_layout.setMargin(8)
self.options_layout.setContentsMargins(8, 8, 8, 8)
self.options_layout.setObjectName('options_layout')
self.old_testament_check_box = QtGui.QCheckBox(self.options_group_box)
self.old_testament_check_box = QtWidgets.QCheckBox(self.options_group_box)
self.old_testament_check_box.setObjectName('old_testament_check_box')
self.old_testament_check_box.setCheckState(QtCore.Qt.Checked)
self.options_layout.addWidget(self.old_testament_check_box)
self.new_testament_check_box = QtGui.QCheckBox(self.options_group_box)
self.new_testament_check_box = QtWidgets.QCheckBox(self.options_group_box)
self.new_testament_check_box.setObjectName('new_testament_check_box')
self.new_testament_check_box.setCheckState(QtCore.Qt.Checked)
self.options_layout.addWidget(self.new_testament_check_box)
self.apocrypha_check_box = QtGui.QCheckBox(self.options_group_box)
self.apocrypha_check_box = QtWidgets.QCheckBox(self.options_group_box)
self.apocrypha_check_box.setObjectName('apocrypha_check_box')
self.apocrypha_check_box.setCheckState(QtCore.Qt.Checked)
self.options_layout.addWidget(self.apocrypha_check_box)

View File

@ -26,8 +26,8 @@ Module implementing BookNameForm.
import logging
import re
from PyQt4.QtGui import QDialog
from PyQt4 import QtCore
from PyQt5.QtWidgets import QDialog
from PyQt5 import QtCore
from openlp.core.common import translate
from openlp.core.lib.ui import critical_error_message_box
@ -90,7 +90,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
if add_book:
self.corresponding_combo_box.addItem(self.book_names[item['abbreviation']])
def exec_(self, name, books, max_books):
def exec(self, name, books, max_books):
self.books = books
log.debug(max_books)
if max_books <= 27:
@ -101,7 +101,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
self.reload_combo_box()
self.current_book_label.setText(str(name))
self.corresponding_combo_box.setFocus()
return QDialog.exec_(self)
return QDialog.exec(self)
def accept(self):
if not self.corresponding_combo_box.currentText():

View File

@ -20,7 +20,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import translate
from openlp.core.lib import build_icon
@ -35,46 +35,46 @@ class Ui_EditBibleDialog(object):
edit_bible_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
edit_bible_dialog.resize(520, 400)
edit_bible_dialog.setModal(True)
self.dialog_layout = QtGui.QVBoxLayout(edit_bible_dialog)
self.dialog_layout = QtWidgets.QVBoxLayout(edit_bible_dialog)
self.dialog_layout.setSpacing(8)
self.dialog_layout.setContentsMargins(8, 8, 8, 8)
self.dialog_layout.setObjectName('dialog_layout')
self.bible_tab_widget = QtGui.QTabWidget(edit_bible_dialog)
self.bible_tab_widget = QtWidgets.QTabWidget(edit_bible_dialog)
self.bible_tab_widget.setObjectName('BibleTabWidget')
# Meta tab
self.meta_tab = QtGui.QWidget()
self.meta_tab = QtWidgets.QWidget()
self.meta_tab.setObjectName('meta_tab')
self.meta_tab_layout = QtGui.QVBoxLayout(self.meta_tab)
self.meta_tab_layout = QtWidgets.QVBoxLayout(self.meta_tab)
self.meta_tab_layout.setObjectName('meta_tab_layout')
self.license_details_group_box = QtGui.QGroupBox(self.meta_tab)
self.license_details_group_box = QtWidgets.QGroupBox(self.meta_tab)
self.license_details_group_box.setObjectName('license_details_group_box')
self.license_details_layout = QtGui.QFormLayout(self.license_details_group_box)
self.license_details_layout = QtWidgets.QFormLayout(self.license_details_group_box)
self.license_details_layout.setObjectName('license_details_layout')
self.version_name_label = QtGui.QLabel(self.license_details_group_box)
self.version_name_label = QtWidgets.QLabel(self.license_details_group_box)
self.version_name_label.setObjectName('version_name_label')
self.version_name_edit = QtGui.QLineEdit(self.license_details_group_box)
self.version_name_edit = QtWidgets.QLineEdit(self.license_details_group_box)
self.version_name_edit.setObjectName('version_name_edit')
self.version_name_label.setBuddy(self.version_name_edit)
self.license_details_layout.addRow(self.version_name_label, self.version_name_edit)
self.copyright_label = QtGui.QLabel(self.license_details_group_box)
self.copyright_label = QtWidgets.QLabel(self.license_details_group_box)
self.copyright_label.setObjectName('copyright_label')
self.copyright_edit = QtGui.QLineEdit(self.license_details_group_box)
self.copyright_edit = QtWidgets.QLineEdit(self.license_details_group_box)
self.copyright_edit.setObjectName('copyright_edit')
self.copyright_label.setBuddy(self.copyright_edit)
self.license_details_layout.addRow(self.copyright_label, self.copyright_edit)
self.permissions_label = QtGui.QLabel(self.license_details_group_box)
self.permissions_label = QtWidgets.QLabel(self.license_details_group_box)
self.permissions_label.setObjectName('permissions_label')
self.permissions_edit = QtGui.QLineEdit(self.license_details_group_box)
self.permissions_edit = QtWidgets.QLineEdit(self.license_details_group_box)
self.permissions_edit.setObjectName('permissions_edit')
self.permissions_label.setBuddy(self.permissions_edit)
self.license_details_layout.addRow(self.permissions_label, self.permissions_edit)
self.meta_tab_layout.addWidget(self.license_details_group_box)
self.language_selection_group_box = QtGui.QGroupBox(self.meta_tab)
self.language_selection_group_box = QtWidgets.QGroupBox(self.meta_tab)
self.language_selection_group_box.setObjectName('language_selection_group_box')
self.language_selection_layout = QtGui.QVBoxLayout(self.language_selection_group_box)
self.language_selection_label = QtGui.QLabel(self.language_selection_group_box)
self.language_selection_layout = QtWidgets.QVBoxLayout(self.language_selection_group_box)
self.language_selection_label = QtWidgets.QLabel(self.language_selection_group_box)
self.language_selection_label.setObjectName('language_selection_label')
self.language_selection_combo_box = QtGui.QComboBox(self.language_selection_group_box)
self.language_selection_combo_box = QtWidgets.QComboBox(self.language_selection_group_box)
self.language_selection_combo_box.setObjectName('language_selection_combo_box')
self.language_selection_combo_box.addItems(['', '', '', ''])
self.language_selection_layout.addWidget(self.language_selection_label)
@ -83,28 +83,28 @@ class Ui_EditBibleDialog(object):
self.meta_tab_layout.addStretch()
self.bible_tab_widget.addTab(self.meta_tab, '')
# Book name tab
self.book_name_tab = QtGui.QWidget()
self.book_name_tab = QtWidgets.QWidget()
self.book_name_tab.setObjectName('book_name_tab')
self.book_name_tab_layout = QtGui.QVBoxLayout(self.book_name_tab)
self.book_name_tab_layout = QtWidgets.QVBoxLayout(self.book_name_tab)
self.book_name_tab_layout.setObjectName('book_name_tab_layout')
self.book_name_notice = QtGui.QLabel(self.book_name_tab)
self.book_name_notice = QtWidgets.QLabel(self.book_name_tab)
self.book_name_notice.setObjectName('book_name_notice')
self.book_name_notice.setWordWrap(True)
self.book_name_tab_layout.addWidget(self.book_name_notice)
self.scroll_area = QtGui.QScrollArea(self.book_name_tab)
self.scroll_area = QtWidgets.QScrollArea(self.book_name_tab)
self.scroll_area.setWidgetResizable(True)
self.scroll_area.setObjectName('scroll_area')
self.scroll_area.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.book_name_widget = QtGui.QWidget(self.scroll_area)
self.book_name_widget = QtWidgets.QWidget(self.scroll_area)
self.book_name_widget.setObjectName('book_name_widget')
self.book_name_widget_layout = QtGui.QFormLayout(self.book_name_widget)
self.book_name_widget_layout = QtWidgets.QFormLayout(self.book_name_widget)
self.book_name_widget_layout.setObjectName('book_name_widget_layout')
self.book_name_label = {}
self.book_name_edit = {}
for book in BiblesResourcesDB.get_books():
self.book_name_label[book['abbreviation']] = QtGui.QLabel(self.book_name_widget)
self.book_name_label[book['abbreviation']] = QtWidgets.QLabel(self.book_name_widget)
self.book_name_label[book['abbreviation']].setObjectName('book_name_label[%s]' % book['abbreviation'])
self.book_name_edit[book['abbreviation']] = QtGui.QLineEdit(self.book_name_widget)
self.book_name_edit[book['abbreviation']] = QtWidgets.QLineEdit(self.book_name_widget)
self.book_name_edit[book['abbreviation']].setObjectName('book_name_edit[%s]' % book['abbreviation'])
self.book_name_widget_layout.addRow(
self.book_name_label[book['abbreviation']],

View File

@ -24,7 +24,7 @@ import logging
import os
import re
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import RegistryProperties, UiStrings, translate
from openlp.core.lib.ui import critical_error_message_box
@ -35,7 +35,7 @@ from openlp.plugins.bibles.lib.db import BiblesResourcesDB
log = logging.getLogger(__name__)
class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
class EditBibleForm(QtWidgets.QDialog, Ui_EditBibleDialog, RegistryProperties):
"""
Class to manage the editing of a bible
"""
@ -97,7 +97,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
"""
log.debug('BibleEditForm.reject')
self.bible = None
QtGui.QDialog.reject(self)
QtWidgets.QDialog.reject(self)
def accept(self):
"""
@ -130,7 +130,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
self.manager.update_book(self.bible, book)
self.bible = None
self.application.set_normal_cursor()
QtGui.QDialog.accept(self)
QtWidgets.QDialog.accept(self)
def validate_meta(self, name, copyright):
"""

View File

@ -20,7 +20,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import translate
from openlp.core.lib import build_icon
@ -32,25 +32,25 @@ class Ui_LanguageDialog(object):
language_dialog.setObjectName('language_dialog')
language_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
language_dialog.resize(400, 165)
self.language_layout = QtGui.QVBoxLayout(language_dialog)
self.language_layout = QtWidgets.QVBoxLayout(language_dialog)
self.language_layout.setSpacing(8)
self.language_layout.setMargin(8)
self.language_layout.setContentsMargins(8, 8, 8, 8)
self.language_layout.setObjectName('language_layout')
self.bible_label = QtGui.QLabel(language_dialog)
self.bible_label = QtWidgets.QLabel(language_dialog)
self.bible_label.setObjectName('bible_label')
self.language_layout.addWidget(self.bible_label)
self.info_label = QtGui.QLabel(language_dialog)
self.info_label = QtWidgets.QLabel(language_dialog)
self.info_label.setWordWrap(True)
self.info_label.setObjectName('info_label')
self.language_layout.addWidget(self.info_label)
self.language_h_box_layout = QtGui.QHBoxLayout()
self.language_h_box_layout = QtWidgets.QHBoxLayout()
self.language_h_box_layout.setSpacing(8)
self.language_h_box_layout.setObjectName('language_h_box_layout')
self.language_label = QtGui.QLabel(language_dialog)
self.language_label = QtWidgets.QLabel(language_dialog)
self.language_label.setObjectName('language_label')
self.language_h_box_layout.addWidget(self.language_label)
self.language_combo_box = QtGui.QComboBox(language_dialog)
size_policy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
self.language_combo_box = QtWidgets.QComboBox(language_dialog)
size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
size_policy.setHorizontalStretch(0)
size_policy.setVerticalStretch(0)
size_policy.setHeightForWidth(self.language_combo_box.sizePolicy().hasHeightForWidth())

View File

@ -25,7 +25,7 @@ Module implementing LanguageForm.
"""
import logging
from PyQt4.QtGui import QDialog
from PyQt5.QtWidgets import QDialog
from openlp.core.common import translate
from openlp.core.lib.ui import critical_error_message_box
@ -49,13 +49,13 @@ class LanguageForm(QDialog, Ui_LanguageDialog):
super(LanguageForm, self).__init__(parent)
self.setupUi(self)
def exec_(self, bible_name):
def exec(self, bible_name):
self.language_combo_box.addItem('')
if bible_name:
self.bible_label.setText(str(bible_name))
items = BiblesResourcesDB.get_languages()
self.language_combo_box.addItems([item['name'] for item in items])
return QDialog.exec_(self)
return QDialog.exec(self)
def accept(self):
if not self.language_combo_box.currentText():

View File

@ -22,7 +22,7 @@
import logging
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry, Settings, UiStrings, translate
from openlp.core.lib import SettingsTab
@ -48,81 +48,81 @@ class BiblesTab(SettingsTab):
def setupUi(self):
self.setObjectName('BiblesTab')
super(BiblesTab, self).setupUi()
self.verse_display_group_box = QtGui.QGroupBox(self.left_column)
self.verse_display_group_box = QtWidgets.QGroupBox(self.left_column)
self.verse_display_group_box.setObjectName('verse_display_group_box')
self.verse_display_layout = QtGui.QFormLayout(self.verse_display_group_box)
self.verse_display_layout = QtWidgets.QFormLayout(self.verse_display_group_box)
self.verse_display_layout.setObjectName('verse_display_layout')
self.is_verse_number_visible_check_box = QtGui.QCheckBox(self.verse_display_group_box)
self.is_verse_number_visible_check_box = QtWidgets.QCheckBox(self.verse_display_group_box)
self.is_verse_number_visible_check_box.setObjectName('is_verse_number_visible_check_box')
self.verse_display_layout.addRow(self.is_verse_number_visible_check_box)
self.new_chapters_check_box = QtGui.QCheckBox(self.verse_display_group_box)
self.new_chapters_check_box = QtWidgets.QCheckBox(self.verse_display_group_box)
self.new_chapters_check_box.setObjectName('new_chapters_check_box')
self.verse_display_layout.addRow(self.new_chapters_check_box)
self.display_style_label = QtGui.QLabel(self.verse_display_group_box)
self.display_style_label = QtWidgets.QLabel(self.verse_display_group_box)
self.display_style_label.setObjectName('display_style_label')
self.display_style_combo_box = QtGui.QComboBox(self.verse_display_group_box)
self.display_style_combo_box = QtWidgets.QComboBox(self.verse_display_group_box)
self.display_style_combo_box.addItems(['', '', '', ''])
self.display_style_combo_box.setObjectName('display_style_combo_box')
self.verse_display_layout.addRow(self.display_style_label, self.display_style_combo_box)
self.layout_style_label = QtGui.QLabel(self.verse_display_group_box)
self.layout_style_label = QtWidgets.QLabel(self.verse_display_group_box)
self.layout_style_label.setObjectName('layout_style_label')
self.layout_style_combo_box = QtGui.QComboBox(self.verse_display_group_box)
self.layout_style_combo_box = QtWidgets.QComboBox(self.verse_display_group_box)
self.layout_style_combo_box.setObjectName('layout_style_combo_box')
self.layout_style_combo_box.addItems(['', '', ''])
self.verse_display_layout.addRow(self.layout_style_label, self.layout_style_combo_box)
self.bible_second_check_box = QtGui.QCheckBox(self.verse_display_group_box)
self.bible_second_check_box = QtWidgets.QCheckBox(self.verse_display_group_box)
self.bible_second_check_box.setObjectName('bible_second_check_box')
self.verse_display_layout.addRow(self.bible_second_check_box)
self.bible_theme_label = QtGui.QLabel(self.verse_display_group_box)
self.bible_theme_label = QtWidgets.QLabel(self.verse_display_group_box)
self.bible_theme_label.setObjectName('BibleTheme_label')
self.bible_theme_combo_box = QtGui.QComboBox(self.verse_display_group_box)
self.bible_theme_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
self.bible_theme_combo_box.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.bible_theme_combo_box = QtWidgets.QComboBox(self.verse_display_group_box)
self.bible_theme_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToMinimumContentsLength)
self.bible_theme_combo_box.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
self.bible_theme_combo_box.addItem('')
self.bible_theme_combo_box.setObjectName('BibleThemecombo_box')
self.verse_display_layout.addRow(self.bible_theme_label, self.bible_theme_combo_box)
self.change_note_label = QtGui.QLabel(self.verse_display_group_box)
self.change_note_label = QtWidgets.QLabel(self.verse_display_group_box)
self.change_note_label.setWordWrap(True)
self.change_note_label.setObjectName('change_note_label')
self.verse_display_layout.addRow(self.change_note_label)
self.left_layout.addWidget(self.verse_display_group_box)
self.scripture_reference_group_box = QtGui.QGroupBox(self.left_column)
self.scripture_reference_group_box = QtWidgets.QGroupBox(self.left_column)
self.scripture_reference_group_box.setObjectName('scripture_reference_group_box')
self.scripture_reference_layout = QtGui.QGridLayout(self.scripture_reference_group_box)
self.verse_separator_check_box = QtGui.QCheckBox(self.scripture_reference_group_box)
self.scripture_reference_layout = QtWidgets.QGridLayout(self.scripture_reference_group_box)
self.verse_separator_check_box = QtWidgets.QCheckBox(self.scripture_reference_group_box)
self.verse_separator_check_box.setObjectName('verse_separator_check_box')
self.scripture_reference_layout.addWidget(self.verse_separator_check_box, 0, 0)
self.verse_separator_line_edit = QtGui.QLineEdit(self.scripture_reference_group_box)
self.verse_separator_line_edit = QtWidgets.QLineEdit(self.scripture_reference_group_box)
self.verse_separator_line_edit.setObjectName('verse_separator_line_edit')
self.scripture_reference_layout.addWidget(self.verse_separator_line_edit, 0, 1)
self.range_separator_check_box = QtGui.QCheckBox(self.scripture_reference_group_box)
self.range_separator_check_box = QtWidgets.QCheckBox(self.scripture_reference_group_box)
self.range_separator_check_box.setObjectName('range_separator_check_box')
self.scripture_reference_layout.addWidget(self.range_separator_check_box, 1, 0)
self.range_separator_line_edit = QtGui.QLineEdit(self.scripture_reference_group_box)
self.range_separator_line_edit = QtWidgets.QLineEdit(self.scripture_reference_group_box)
self.range_separator_line_edit.setObjectName('range_separator_line_edit')
self.scripture_reference_layout.addWidget(self.range_separator_line_edit, 1, 1)
self.list_separator_check_box = QtGui.QCheckBox(self.scripture_reference_group_box)
self.list_separator_check_box = QtWidgets.QCheckBox(self.scripture_reference_group_box)
self.list_separator_check_box.setObjectName('list_separator_check_box')
self.scripture_reference_layout.addWidget(self.list_separator_check_box, 2, 0)
self.list_separator_line_edit = QtGui.QLineEdit(self.scripture_reference_group_box)
self.list_separator_line_edit = QtWidgets.QLineEdit(self.scripture_reference_group_box)
self.list_separator_line_edit.setObjectName('list_separator_line_edit')
self.scripture_reference_layout.addWidget(self.list_separator_line_edit, 2, 1)
self.end_separator_check_box = QtGui.QCheckBox(self.scripture_reference_group_box)
self.end_separator_check_box = QtWidgets.QCheckBox(self.scripture_reference_group_box)
self.end_separator_check_box.setObjectName('end_separator_check_box')
self.scripture_reference_layout.addWidget(self.end_separator_check_box, 3, 0)
self.end_separator_line_edit = QtGui.QLineEdit(self.scripture_reference_group_box)
self.end_separator_line_edit = QtWidgets.QLineEdit(self.scripture_reference_group_box)
self.end_separator_line_edit.setObjectName('end_separator_line_edit')
self.end_separator_line_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^0-9]*'),
self.end_separator_line_edit))
self.scripture_reference_layout.addWidget(self.end_separator_line_edit, 3, 1)
self.left_layout.addWidget(self.scripture_reference_group_box)
self.right_column.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.language_selection_group_box = QtGui.QGroupBox(self.right_column)
self.right_column.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
self.language_selection_group_box = QtWidgets.QGroupBox(self.right_column)
self.language_selection_group_box.setObjectName('language_selection_group_box')
self.language_selection_layout = QtGui.QVBoxLayout(self.language_selection_group_box)
self.language_selection_label = QtGui.QLabel(self.language_selection_group_box)
self.language_selection_layout = QtWidgets.QVBoxLayout(self.language_selection_group_box)
self.language_selection_label = QtWidgets.QLabel(self.language_selection_group_box)
self.language_selection_label.setObjectName('language_selection_label')
self.language_selection_combo_box = QtGui.QComboBox(self.language_selection_group_box)
self.language_selection_combo_box = QtWidgets.QComboBox(self.language_selection_group_box)
self.language_selection_combo_box.setObjectName('language_selection_combo_box')
self.language_selection_combo_box.addItems(['', '', ''])
self.language_selection_layout.addWidget(self.language_selection_label)

View File

@ -27,7 +27,7 @@ import re
import sqlite3
import time
from PyQt4 import QtCore
from PyQt5 import QtCore
from sqlalchemy import Column, ForeignKey, Table, or_, types, func
from sqlalchemy.exc import OperationalError
from sqlalchemy.orm import class_mapper, mapper, relation
@ -107,7 +107,7 @@ def init_schema(url):
return session
class BibleDB(QtCore.QObject, Manager, RegistryProperties):
class BibleDB(Manager, RegistryProperties):
"""
This class represents a database-bound Bible. It is used as a base class for all the custom importers, so that
the can implement their own import methods, but benefit from the database methods in here via inheritance,
@ -129,7 +129,6 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
The name of the database. This is also used as the file name for SQLite databases.
"""
log.info('BibleDB loaded')
QtCore.QObject.__init__(self)
self.bible_plugin = parent
self.session = None
if 'path' not in kwargs:
@ -315,7 +314,7 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
else:
from openlp.plugins.bibles.forms import BookNameForm
book_name = BookNameForm(self.wizard)
if book_name.exec_(book, self.get_books(), maxbooks):
if book_name.exec(book, self.get_books(), maxbooks):
book_id = book_name.book_id
if book_id:
AlternativeBookNamesDB.create_alternative_book_name(
@ -467,7 +466,7 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
from openlp.plugins.bibles.forms import LanguageForm
language = None
language_form = LanguageForm(self.wizard)
if language_form.exec_(bible_name):
if language_form.exec(bible_name):
language = str(language_form.language_combo_box.currentText())
if not language:
return False

View File

@ -22,7 +22,7 @@
import logging
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtWidgets
from openlp.core.common import Registry, Settings, UiStrings, translate
from openlp.core.lib import MediaManagerItem, ItemCapabilities, ServiceItemContext, create_separated_list
@ -51,6 +51,8 @@ class BibleMediaItem(MediaManagerItem):
"""
This is the custom media manager item for Bibles.
"""
bibles_go_live = QtCore.pyqtSignal(list)
bibles_add_to_service = QtCore.pyqtSignal(list)
log.info('Bible Media Item loaded')
def __init__(self, parent, plugin):
@ -62,6 +64,8 @@ class BibleMediaItem(MediaManagerItem):
"""
Do some additional setup.
"""
self.bibles_go_live.connect(self.go_live_remote)
self.bibles_add_to_service.connect(self.add_to_service_remote)
# Place to store the search results for both bibles.
self.settings = self.plugin.settings_tab
self.quick_preview_allowed = True
@ -89,7 +93,7 @@ class BibleMediaItem(MediaManagerItem):
message=translate('BiblesPlugin.MediaItem',
'You cannot combine single and dual Bible verse search results. '
'Do you want to delete your search results and start a new search?'),
parent=self, question=True) == QtGui.QMessageBox.Yes:
parent=self, question=True) == QtWidgets.QMessageBox.Yes:
self.list_view.clear()
self.display_results(bible, second_bible)
@ -111,10 +115,10 @@ class BibleMediaItem(MediaManagerItem):
def add_search_tab(self, prefix, name):
self.search_tab_bar.addTab(name)
tab = QtGui.QWidget()
tab = QtWidgets.QWidget()
tab.setObjectName(prefix + 'Tab')
tab.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
layout = QtGui.QGridLayout(tab)
tab.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
layout = QtWidgets.QGridLayout(tab)
layout.setObjectName(prefix + 'Layout')
setattr(self, prefix + 'Tab', tab)
setattr(self, prefix + 'Layout', layout)
@ -132,33 +136,33 @@ class BibleMediaItem(MediaManagerItem):
idx = 5
tab = getattr(self, prefix + 'Tab')
layout = getattr(self, prefix + 'Layout')
version_label = QtGui.QLabel(tab)
version_label = QtWidgets.QLabel(tab)
version_label.setObjectName(prefix + 'VersionLabel')
layout.addWidget(version_label, idx, 0, QtCore.Qt.AlignRight)
version_combo_box = create_horizontal_adjusting_combo_box(tab, prefix + 'VersionComboBox')
version_label.setBuddy(version_combo_box)
layout.addWidget(version_combo_box, idx, 1, 1, 2)
second_label = QtGui.QLabel(tab)
second_label = QtWidgets.QLabel(tab)
second_label.setObjectName(prefix + 'SecondLabel')
layout.addWidget(second_label, idx + 1, 0, QtCore.Qt.AlignRight)
second_combo_box = create_horizontal_adjusting_combo_box(tab, prefix + 'SecondComboBox')
version_label.setBuddy(second_combo_box)
layout.addWidget(second_combo_box, idx + 1, 1, 1, 2)
style_label = QtGui.QLabel(tab)
style_label = QtWidgets.QLabel(tab)
style_label.setObjectName(prefix + 'StyleLabel')
layout.addWidget(style_label, idx + 2, 0, QtCore.Qt.AlignRight)
style_combo_box = create_horizontal_adjusting_combo_box(tab, prefix + 'StyleComboBox')
style_combo_box.addItems(['', '', ''])
layout.addWidget(style_combo_box, idx + 2, 1, 1, 2)
search_button_layout = QtGui.QHBoxLayout()
search_button_layout = QtWidgets.QHBoxLayout()
search_button_layout.setObjectName(prefix + 'search_button_layout')
search_button_layout.addStretch()
lock_button = QtGui.QToolButton(tab)
lock_button = QtWidgets.QToolButton(tab)
lock_button.setIcon(self.unlock_icon)
lock_button.setCheckable(True)
lock_button.setObjectName(prefix + 'LockButton')
search_button_layout.addWidget(lock_button)
search_button = QtGui.QPushButton(tab)
search_button = QtWidgets.QPushButton(tab)
search_button.setObjectName(prefix + 'SearchButton')
search_button_layout.addWidget(search_button)
layout.addLayout(search_button_layout, idx + 3, 1, 1, 2)
@ -177,17 +181,17 @@ class BibleMediaItem(MediaManagerItem):
setattr(self, prefix + 'SearchButton', search_button)
def add_end_header_bar(self):
self.search_tab_bar = QtGui.QTabBar(self)
self.search_tab_bar = QtWidgets.QTabBar(self)
self.search_tab_bar.setExpanding(False)
self.search_tab_bar.setObjectName('search_tab_bar')
self.page_layout.addWidget(self.search_tab_bar)
# Add the Quick Search tab.
self.add_search_tab('quick', translate('BiblesPlugin.MediaItem', 'Quick'))
self.quick_search_label = QtGui.QLabel(self.quickTab)
self.quick_search_label = QtWidgets.QLabel(self.quickTab)
self.quick_search_label.setObjectName('quick_search_label')
self.quickLayout.addWidget(self.quick_search_label, 0, 0, QtCore.Qt.AlignRight)
self.quick_search_edit = SearchEdit(self.quickTab)
self.quick_search_edit.setSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Fixed)
self.quick_search_edit.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Fixed)
self.quick_search_edit.setObjectName('quick_search_edit')
self.quick_search_label.setBuddy(self.quick_search_edit)
self.quickLayout.addWidget(self.quick_search_edit, 0, 1, 1, 2)
@ -195,35 +199,35 @@ class BibleMediaItem(MediaManagerItem):
self.quickTab.setVisible(True)
# Add the Advanced Search tab.
self.add_search_tab('advanced', translate('BiblesPlugin.MediaItem', 'Advanced'))
self.advanced_book_label = QtGui.QLabel(self.advancedTab)
self.advanced_book_label = QtWidgets.QLabel(self.advancedTab)
self.advanced_book_label.setObjectName('advanced_book_label')
self.advancedLayout.addWidget(self.advanced_book_label, 0, 0, QtCore.Qt.AlignRight)
self.advanced_book_combo_box = create_horizontal_adjusting_combo_box(self.advancedTab,
'advanced_book_combo_box')
self.advanced_book_label.setBuddy(self.advanced_book_combo_box)
self.advancedLayout.addWidget(self.advanced_book_combo_box, 0, 1, 1, 2)
self.advanced_chapter_label = QtGui.QLabel(self.advancedTab)
self.advanced_chapter_label = QtWidgets.QLabel(self.advancedTab)
self.advanced_chapter_label.setObjectName('advanced_chapter_label')
self.advancedLayout.addWidget(self.advanced_chapter_label, 1, 1, 1, 2)
self.advanced_verse_label = QtGui.QLabel(self.advancedTab)
self.advanced_verse_label = QtWidgets.QLabel(self.advancedTab)
self.advanced_verse_label.setObjectName('advanced_verse_label')
self.advancedLayout.addWidget(self.advanced_verse_label, 1, 2)
self.advanced_from_label = QtGui.QLabel(self.advancedTab)
self.advanced_from_label = QtWidgets.QLabel(self.advancedTab)
self.advanced_from_label.setObjectName('advanced_from_label')
self.advancedLayout.addWidget(self.advanced_from_label, 3, 0, QtCore.Qt.AlignRight)
self.advanced_from_chapter = QtGui.QComboBox(self.advancedTab)
self.advanced_from_chapter = QtWidgets.QComboBox(self.advancedTab)
self.advanced_from_chapter.setObjectName('advanced_from_chapter')
self.advancedLayout.addWidget(self.advanced_from_chapter, 3, 1)
self.advanced_from_verse = QtGui.QComboBox(self.advancedTab)
self.advanced_from_verse = QtWidgets.QComboBox(self.advancedTab)
self.advanced_from_verse.setObjectName('advanced_from_verse')
self.advancedLayout.addWidget(self.advanced_from_verse, 3, 2)
self.advanced_to_label = QtGui.QLabel(self.advancedTab)
self.advanced_to_label = QtWidgets.QLabel(self.advancedTab)
self.advanced_to_label.setObjectName('advanced_to_label')
self.advancedLayout.addWidget(self.advanced_to_label, 4, 0, QtCore.Qt.AlignRight)
self.advanced_to_chapter = QtGui.QComboBox(self.advancedTab)
self.advanced_to_chapter = QtWidgets.QComboBox(self.advancedTab)
self.advanced_to_chapter.setObjectName('advanced_to_chapter')
self.advancedLayout.addWidget(self.advanced_to_chapter, 4, 1)
self.advanced_to_verse = QtGui.QComboBox(self.advancedTab)
self.advanced_to_verse = QtWidgets.QComboBox(self.advancedTab)
self.advanced_to_verse.setObjectName('advanced_to_verse')
self.advancedLayout.addWidget(self.advanced_to_verse, 4, 2)
self.add_search_fields('advanced', UiStrings().Advanced)
@ -236,8 +240,7 @@ class BibleMediaItem(MediaManagerItem):
self.advanced_from_chapter.activated.connect(self.on_advanced_from_chapter)
self.advanced_from_verse.activated.connect(self.on_advanced_from_verse)
self.advanced_to_chapter.activated.connect(self.on_advanced_to_chapter)
QtCore.QObject.connect(self.quick_search_edit, QtCore.SIGNAL('searchTypeChanged(int)'),
self.update_auto_completer)
self.quick_search_edit.searchTypeChanged.connect(self.update_auto_completer)
self.quickVersionComboBox.activated.connect(self.update_auto_completer)
self.quickStyleComboBox.activated.connect(self.on_quick_style_combo_box_changed)
self.advancedStyleComboBox.activated.connect(self.on_advanced_style_combo_box_changed)
@ -472,7 +475,7 @@ class BibleMediaItem(MediaManagerItem):
if not hasattr(self, 'import_wizard'):
self.import_wizard = BibleImportForm(self, self.plugin.manager, self.plugin)
# If the import was not cancelled then reload.
if self.import_wizard.exec_():
if self.import_wizard.exec():
self.reload_bibles()
def on_edit_click(self):
@ -483,7 +486,7 @@ class BibleMediaItem(MediaManagerItem):
if bible:
self.edit_bible_form = EditBibleForm(self, self.main_window, self.plugin.manager)
self.edit_bible_form.load_bible(bible)
if self.edit_bible_form.exec_():
if self.edit_bible_form.exec():
self.reload_bibles()
def on_delete_click(self):
@ -496,13 +499,13 @@ class BibleMediaItem(MediaManagerItem):
elif self.advancedTab.isVisible():
bible = self.advancedVersionComboBox.currentText()
if bible:
if QtGui.QMessageBox.question(
if QtWidgets.QMessageBox.question(
self, UiStrings().ConfirmDelete,
translate('BiblesPlugin.MediaItem', 'Are you sure you want to completely delete "%s" Bible from '
'OpenLP?\n\nYou will need to re-import this Bible to use it '
'again.') % bible,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.No:
return
self.plugin.manager.delete_bible(bible)
self.reload_bibles()
@ -682,12 +685,12 @@ class BibleMediaItem(MediaManagerItem):
new_search_results.append(verse)
text.append((verse.book.book_reference_id, verse.chapter, verse.verse, verse.verse))
if passage_not_found:
QtGui.QMessageBox.information(
QtWidgets.QMessageBox.information(
self, translate('BiblesPlugin.MediaItem', 'Information'),
translate('BiblesPlugin.MediaItem', 'The second Bible does not contain all the verses '
'that are in the main Bible. Only verses found in both Bibles will be shown. %d '
'verses have not been included in the results.') % count,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok))
self.search_results = new_search_results
self.second_search_results = bibles[second_bible].get_verses(text)
if not self.quickLockButton.isChecked():
@ -764,7 +767,7 @@ class BibleMediaItem(MediaManagerItem):
second_version)
else:
bible_text = '%s %d%s%d (%s)' % (book, verse.chapter, verse_separator, verse.verse, version)
bible_verse = QtGui.QListWidgetItem(bible_text)
bible_verse = QtWidgets.QListWidgetItem(bible_text)
bible_verse.setData(QtCore.Qt.UserRole, data)
items.append(bible_verse)
return items

View File

@ -20,7 +20,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import UiStrings, translate
from openlp.core.lib import build_icon
@ -36,34 +36,34 @@ class Ui_CustomEditDialog(object):
custom_edit_dialog.setObjectName('custom_edit_dialog')
custom_edit_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
custom_edit_dialog.resize(450, 350)
self.dialog_layout = QtGui.QVBoxLayout(custom_edit_dialog)
self.dialog_layout = QtWidgets.QVBoxLayout(custom_edit_dialog)
self.dialog_layout.setObjectName('dialog_layout')
self.title_layout = QtGui.QHBoxLayout()
self.title_layout = QtWidgets.QHBoxLayout()
self.title_layout.setObjectName('title_layout')
self.title_label = QtGui.QLabel(custom_edit_dialog)
self.title_label = QtWidgets.QLabel(custom_edit_dialog)
self.title_label.setObjectName('title_label')
self.title_layout.addWidget(self.title_label)
self.title_edit = QtGui.QLineEdit(custom_edit_dialog)
self.title_edit = QtWidgets.QLineEdit(custom_edit_dialog)
self.title_label.setBuddy(self.title_edit)
self.title_edit.setObjectName('title_edit')
self.title_layout.addWidget(self.title_edit)
self.dialog_layout.addLayout(self.title_layout)
self.central_layout = QtGui.QHBoxLayout()
self.central_layout = QtWidgets.QHBoxLayout()
self.central_layout.setObjectName('central_layout')
self.slide_list_view = QtGui.QListWidget(custom_edit_dialog)
self.slide_list_view = QtWidgets.QListWidget(custom_edit_dialog)
self.slide_list_view.setAlternatingRowColors(True)
self.slide_list_view.setObjectName('slide_list_view')
self.central_layout.addWidget(self.slide_list_view)
self.button_layout = QtGui.QVBoxLayout()
self.button_layout = QtWidgets.QVBoxLayout()
self.button_layout.setObjectName('button_layout')
self.add_button = QtGui.QPushButton(custom_edit_dialog)
self.add_button = QtWidgets.QPushButton(custom_edit_dialog)
self.add_button.setObjectName('add_button')
self.button_layout.addWidget(self.add_button)
self.edit_button = QtGui.QPushButton(custom_edit_dialog)
self.edit_button = QtWidgets.QPushButton(custom_edit_dialog)
self.edit_button.setEnabled(False)
self.edit_button.setObjectName('edit_button')
self.button_layout.addWidget(self.edit_button)
self.edit_all_button = QtGui.QPushButton(custom_edit_dialog)
self.edit_all_button = QtWidgets.QPushButton(custom_edit_dialog)
self.edit_all_button.setObjectName('edit_all_button')
self.button_layout.addWidget(self.edit_all_button)
self.delete_button = create_button(custom_edit_dialog, 'delete_button', role='delete',
@ -79,23 +79,23 @@ class Ui_CustomEditDialog(object):
self.button_layout.addWidget(self.down_button)
self.central_layout.addLayout(self.button_layout)
self.dialog_layout.addLayout(self.central_layout)
self.bottom_form_layout = QtGui.QFormLayout()
self.bottom_form_layout = QtWidgets.QFormLayout()
self.bottom_form_layout.setObjectName('bottom_form_layout')
self.theme_label = QtGui.QLabel(custom_edit_dialog)
self.theme_label = QtWidgets.QLabel(custom_edit_dialog)
self.theme_label.setObjectName('theme_label')
self.theme_combo_box = QtGui.QComboBox(custom_edit_dialog)
self.theme_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
self.theme_combo_box = QtWidgets.QComboBox(custom_edit_dialog)
self.theme_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
self.theme_combo_box.setObjectName('theme_combo_box')
self.theme_label.setBuddy(self.theme_combo_box)
self.bottom_form_layout.addRow(self.theme_label, self.theme_combo_box)
self.credit_label = QtGui.QLabel(custom_edit_dialog)
self.credit_label = QtWidgets.QLabel(custom_edit_dialog)
self.credit_label.setObjectName('credit_label')
self.credit_edit = QtGui.QLineEdit(custom_edit_dialog)
self.credit_edit = QtWidgets.QLineEdit(custom_edit_dialog)
self.credit_edit.setObjectName('credit_edit')
self.credit_label.setBuddy(self.credit_edit)
self.bottom_form_layout.addRow(self.credit_label, self.credit_edit)
self.dialog_layout.addLayout(self.bottom_form_layout)
self.preview_button = QtGui.QPushButton()
self.preview_button = QtWidgets.QPushButton()
self.button_box = create_button_box(custom_edit_dialog, 'button_box', ['cancel', 'save'],
[self.preview_button])
self.dialog_layout.addWidget(self.button_box)

View File

@ -22,7 +22,7 @@
import logging
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import Registry, translate
from openlp.core.lib.ui import critical_error_message_box, find_and_set_in_combo_box
@ -34,7 +34,7 @@ from .editcustomslideform import EditCustomSlideForm
log = logging.getLogger(__name__)
class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
class EditCustomForm(QtWidgets.QDialog, Ui_CustomEditDialog):
"""
Class documentation goes here.
"""
@ -101,7 +101,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
"""
log.debug('accept')
if self.save_custom():
QtGui.QDialog.accept(self)
QtWidgets.QDialog.accept(self)
def save_custom(self):
"""
@ -146,7 +146,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
Add a new blank slide.
"""
self.edit_slide_form.set_text('')
if self.edit_slide_form.exec_():
if self.edit_slide_form.exec():
self.slide_list_view.addItems(self.edit_slide_form.get_text())
def on_edit_button_clicked(self):
@ -154,7 +154,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
Edit the currently selected slide.
"""
self.edit_slide_form.set_text(self.slide_list_view.currentItem().text())
if self.edit_slide_form.exec_():
if self.edit_slide_form.exec():
self.update_slide_list(self.edit_slide_form.get_text())
def on_edit_all_button_clicked(self):
@ -168,7 +168,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
if row != self.slide_list_view.count() - 1:
slide_text += '\n[===]\n'
self.edit_slide_form.set_text(slide_text)
if self.edit_slide_form.exec_():
if self.edit_slide_form.exec():
self.update_slide_list(self.edit_slide_form.get_text(), True)
def on_preview_button_clicked(self):

View File

@ -20,7 +20,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtGui
from PyQt5 import QtWidgets
from openlp.core.common import UiStrings, translate
from openlp.core.lib import SpellTextEdit, build_icon
@ -32,7 +32,7 @@ class Ui_CustomSlideEditDialog(object):
custom_slide_edit_dialog.setObjectName('custom_slide_edit_dialog')
custom_slide_edit_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
custom_slide_edit_dialog.resize(350, 300)
self.dialog_layout = QtGui.QVBoxLayout(custom_slide_edit_dialog)
self.dialog_layout = QtWidgets.QVBoxLayout(custom_slide_edit_dialog)
self.slide_text_edit = SpellTextEdit(self)
self.slide_text_edit.setObjectName('slide_text_edit')
self.dialog_layout.addWidget(self.slide_text_edit)

Some files were not shown because too many files have changed in this diff Show More