From aa5e33da7d41a565592d32eb33f5c40af475d2b0 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 28 Jul 2019 09:30:24 +0100 Subject: [PATCH 01/10] Fix settings screen conversion --- openlp/core/common/settings.py | 13 +++++++------ openlp/core/display/screens.py | 9 +++++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index 6fbb8a8ed..6042703c5 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -90,12 +90,13 @@ def upgrade_screens(number, x_position, y_position, height, width, can_override, number: { 'number': number, geometry_key: { - 'x': x_position, - 'y': y_position, - 'height': height, - 'width': width + 'x': int(x_position), + 'y': int(y_position), + 'height': int(height), + 'width': int(width) }, - 'is_display': is_display_screen + 'is_display': is_display_screen, + 'is_primary': number } } @@ -309,7 +310,7 @@ class Settings(QtCore.QSettings): ('songuasge/db hostname', 'songusage/db hostname', []), ('songuasge/db database', 'songusage/db database', []), ('presentations / Powerpoint Viewer', '', []), - (['core/monitor', 'core/x position', 'core/y position', 'core/height', 'core/width', 'core/override', + (['core/monitor', 'core/x position', 'core/y position', 'core/height', 'core/width', 'core/override position', 'core/display on monitor'], 'core/screens', [(upgrade_screens, [1, 0, 0, None, None, False, False])]), ('bibles/proxy name', '', []), # Just remove these bible proxy settings. They weren't used in 2.4! ('bibles/proxy address', '', []), diff --git a/openlp/core/display/screens.py b/openlp/core/display/screens.py index fccb9741f..efa71cdd5 100644 --- a/openlp/core/display/screens.py +++ b/openlp/core/display/screens.py @@ -133,8 +133,13 @@ class Screen(object): self.number = int(screen_dict['number']) self.is_display = screen_dict['is_display'] self.is_primary = screen_dict['is_primary'] - self.geometry = QtCore.QRect(screen_dict['geometry']['x'], screen_dict['geometry']['y'], - screen_dict['geometry']['width'], screen_dict['geometry']['height']) + try: + self.geometry = QtCore.QRect(screen_dict['geometry']['x'], screen_dict['geometry']['y'], + screen_dict['geometry']['width'], screen_dict['geometry']['height']) + except: + # Preserve the current values as this has come from the settings update which does not have + # the geometry information + pass if 'custom_geometry' in screen_dict: self.custom_geometry = QtCore.QRect(screen_dict['custom_geometry']['x'], screen_dict['custom_geometry']['y'], From 095881cb903ec7daa313fed9ca833c86c1454fe8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 28 Jul 2019 09:40:38 +0100 Subject: [PATCH 02/10] Update logging settings --- openlp/core/threading.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/threading.py b/openlp/core/threading.py index 9a4043292..38c68638a 100644 --- a/openlp/core/threading.py +++ b/openlp/core/threading.py @@ -24,10 +24,11 @@ The :mod:`openlp.core.threading` module contains some common threading code """ from PyQt5 import QtCore +from openlp.core.common.mixins import LogMixin from openlp.core.common.registry import Registry -class ThreadWorker(QtCore.QObject): +class ThreadWorker(QtCore.QObject, LogMixin): """ The :class:`~openlp.core.threading.ThreadWorker` class provides a base class for all worker objects """ From da75c96d03fc45531eb9b73884ddf2f285660064 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 28 Jul 2019 15:40:07 +0100 Subject: [PATCH 03/10] allow last service to load on startup --- openlp/core/ui/mainwindow.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 2313e4705..f2389908d 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -635,7 +635,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert # if self.live_controller.display.isVisible(): # self.live_controller.display.setFocus() self.activateWindow() - if self.application.args: + # We will aloways have 1 but more need to be processed + if self.application.args and len(self.application.args) > 1: self.open_cmd_line_files(self.application.args) elif Settings().value(self.general_settings_section + '/auto open'): self.service_manager_contents.load_last_file() From 7f5166f3d0b5289aa8834c1c24f329d42818edef Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 28 Jul 2019 16:56:28 +0100 Subject: [PATCH 04/10] Text fixes --- openlp/core/display/render.py | 1 + openlp/core/ui/mainwindow.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/display/render.py b/openlp/core/display/render.py index 1097b5ac0..53e50446c 100644 --- a/openlp/core/display/render.py +++ b/openlp/core/display/render.py @@ -482,6 +482,7 @@ class ThemePreviewRenderer(LogMixin, DisplayWindow): :param theme_data: The theme to generated a preview for. :param force_page: Flag to tell message lines per page need to be generated. + :param generate_screenshot: Do I need to generate a screen shot? :rtype: QtGui.QPixmap """ # save value for use in format_slide diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index f2389908d..1e9e196e4 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -635,7 +635,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert # if self.live_controller.display.isVisible(): # self.live_controller.display.setFocus() self.activateWindow() - # We will aloways have 1 but more need to be processed + # We will always have 1 but more need to be processed if self.application.args and len(self.application.args) > 1: self.open_cmd_line_files(self.application.args) elif Settings().value(self.general_settings_section + '/auto open'): From 8ce94115c993e22f7b26e8952a45a1b804e99140 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 31 Jul 2019 17:26:25 +0100 Subject: [PATCH 05/10] Fix service Print code --- openlp/core/ui/printserviceform.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index 0f8ea064b..e81f82f9a 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -219,13 +219,13 @@ class PrintServiceForm(QtWidgets.QDialog, Ui_PrintServiceDialog, RegistryPropert verse_def = None verse_html = None for slide in item.get_frames(): - if not verse_def or verse_def != slide['verseTag'] or verse_html == slide['printing_html']: + if not verse_def or verse_def != slide['verse'] or verse_html == slide['text']: text_div = self._add_element('div', parent=div, class_id='itemText') - elif 'chordspacing' not in slide['printing_html']: + elif 'chordspacing' not in slide['text']: self._add_element('br', parent=text_div) - self._add_element('span', slide['printing_html'], text_div) - verse_def = slide['verseTag'] - verse_html = slide['printing_html'] + self._add_element('span', slide['text'], text_div) + verse_def = slide['verse'] + verse_html = slide['text'] # Break the page before the div element. if index != 0 and self.page_break_after_text.isChecked(): div.set('class', 'item newPage') From df2ace541e1b17c74d79c0863376aa07c82b51d6 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 31 Jul 2019 22:01:22 +0100 Subject: [PATCH 06/10] fix missing state code --- openlp/core/ui/servicemanager.py | 3 ++- openlp/core/ui/thememanager.py | 5 +++-- openlp/plugins/songs/forms/editsongform.py | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 92b34badd..aad6f1fec 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -34,6 +34,7 @@ from tempfile import NamedTemporaryFile from PyQt5 import QtCore, QtGui, QtWidgets +from openlp.core.state import State from openlp.core.common import ThemeLevel, delete_file from openlp.core.common.actions import ActionList, CategoryOrder from openlp.core.common.applocation import AppLocation @@ -828,7 +829,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi self.auto_start_action.setIcon(UiIcons().inactive) self.auto_start_action.setText(translate('OpenLP.ServiceManager', '&Auto Start - inactive')) if service_item['service_item'].is_text(): - for plugin in self.plugin_manager.plugins: + for plugin in State().list_plugins(): if plugin.name == 'custom' and plugin.status == PluginStatus.Active: self.create_custom_action.setVisible(True) break diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 4a3aa5073..06a76372d 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -30,6 +30,7 @@ from xml.etree.ElementTree import XML, ElementTree from PyQt5 import QtCore, QtWidgets +from openlp.core.state import State from openlp.core.common import delete_file from openlp.core.common.applocation import AppLocation from openlp.core.common.i18n import UiStrings, get_locale_key, translate @@ -293,7 +294,7 @@ class ThemeManager(QtWidgets.QWidget, RegistryBase, Ui_ThemeManager, LogMixin, R old_theme_data = self.get_theme_data(old_theme_name) self.clone_theme_data(old_theme_data, new_theme_name) self.delete_theme(old_theme_name) - for plugin in self.plugin_manager.plugins: + for plugin in State().list_plugins(): if plugin.uses_theme(old_theme_name): plugin.rename_theme(old_theme_name, new_theme_name) self.renderer.set_theme(self.get_theme_data(new_theme_name)) @@ -771,7 +772,7 @@ class ThemeManager(QtWidgets.QWidget, RegistryBase, Ui_ThemeManager, LogMixin, R # check for use in the system else where. if test_plugin: plugin_usage = "" - for plugin in self.plugin_manager.plugins: + for plugin in State().list_plugins(): used_count = plugin.uses_theme(theme) if used_count: plugin_usage = "{plug}{text}".format(plug=plugin_usage, diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 62d0eb7d7..e442e66d5 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -29,6 +29,7 @@ from shutil import copyfile from PyQt5 import QtCore, QtWidgets +from openlp.core.state import State from openlp.core.common.applocation import AppLocation from openlp.core.common.i18n import UiStrings, get_natural_key, translate from openlp.core.common.mixins import RegistryProperties @@ -416,7 +417,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties): Load the media files into a combobox. """ self.from_media_button.setVisible(False) - for plugin in self.plugin_manager.plugins: + for plugin in State().list_plugins(): if plugin.name == 'media' and plugin.status == PluginStatus.Active: self.from_media_button.setVisible(True) self.media_form.populate_files(plugin.media_item.get_list(MediaType.Audio)) From a8af8a8d18ab30ab8884917817e672423eb0a00f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 4 Aug 2019 08:53:56 +0100 Subject: [PATCH 07/10] fix custom copy --- openlp/plugins/custom/lib/mediaitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 3db190e8d..768bef391 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -349,7 +349,7 @@ class CustomMediaItem(MediaManagerItem): custom.credits = '' custom_xml = CustomXMLBuilder() for (idx, slide) in enumerate(item.slides): - custom_xml.add_verse_to_lyrics('custom', str(idx + 1), slide['raw_slide']) + custom_xml.add_verse_to_lyrics('custom', str(idx + 1), slide['text']) custom.text = str(custom_xml.extract_xml(), 'utf-8') self.plugin.db_manager.save_object(custom) self.on_search_text_button_clicked() From 24ab4f2cb149e2a25184482cb9e6e429e33c4dc4 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 4 Aug 2019 14:13:33 +0100 Subject: [PATCH 08/10] minor fixes --- openlp/core/ui/mainwindow.py | 4 +++- openlp/core/ui/servicemanager.py | 2 +- openlp/plugins/songs/forms/editsongform.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 1e9e196e4..da8b72856 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -635,7 +635,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert # if self.live_controller.display.isVisible(): # self.live_controller.display.setFocus() self.activateWindow() - # We will always have 1 but more need to be processed + # We have -disable-web-security added by our code. + # If a file is passed in we will have that as well so count of 2 + # If not we need to see if we want to use the previous file.so count of 1 if self.application.args and len(self.application.args) > 1: self.open_cmd_line_files(self.application.args) elif Settings().value(self.general_settings_section + '/auto open'): diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index aad6f1fec..202a926dd 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -829,7 +829,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi self.auto_start_action.setIcon(UiIcons().inactive) self.auto_start_action.setText(translate('OpenLP.ServiceManager', '&Auto Start - inactive')) if service_item['service_item'].is_text(): - for plugin in State().list_plugins(): + for plugin in State().list_plugins(): if plugin.name == 'custom' and plugin.status == PluginStatus.Active: self.create_custom_action.setVisible(True) break diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index e442e66d5..899e62122 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -417,7 +417,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties): Load the media files into a combobox. """ self.from_media_button.setVisible(False) - for plugin in State().list_plugins(): + for plugin in State().list_plugins(): if plugin.name == 'media' and plugin.status == PluginStatus.Active: self.from_media_button.setVisible(True) self.media_form.populate_files(plugin.media_item.get_list(MediaType.Audio)) From 0e96c55c8edfde2a85ed9172a79d6230d5cebcf8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 4 Aug 2019 15:06:00 +0100 Subject: [PATCH 09/10] pep 8 --- openlp/core/display/screens.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/display/screens.py b/openlp/core/display/screens.py index efa71cdd5..7d0d7f0a0 100644 --- a/openlp/core/display/screens.py +++ b/openlp/core/display/screens.py @@ -136,7 +136,7 @@ class Screen(object): try: self.geometry = QtCore.QRect(screen_dict['geometry']['x'], screen_dict['geometry']['y'], screen_dict['geometry']['width'], screen_dict['geometry']['height']) - except: + except KeyError: # Preserve the current values as this has come from the settings update which does not have # the geometry information pass From 493f33b764c66c819c155f7fa3b93de2a69fa8a7 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 4 Aug 2019 16:56:07 +0100 Subject: [PATCH 10/10] minor fix --- openlp/core/common/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index 6042703c5..bbe0b731a 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -96,7 +96,7 @@ def upgrade_screens(number, x_position, y_position, height, width, can_override, 'width': int(width) }, 'is_display': is_display_screen, - 'is_primary': number + 'is_primary': can_override } }