From 1d0b57837061372ad42afeb9205194b2bb4c4161 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 21 Jan 2022 21:32:09 +0000 Subject: [PATCH] Various bug fixes --- openlp/core/ui/themeform.py | 12 ++++++++---- openlp/core/ui/themelayoutform.py | 2 +- .../plugins/planningcenter/lib/planningcentertab.py | 4 ++-- .../presentations/lib/presentationcontroller.py | 4 ++-- .../presentations/test_presentationcontroller.py | 3 ++- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 950a46d7b..506b7450d 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -186,12 +186,12 @@ class ThemeForm(QtWidgets.QWizard, Ui_ThemeWizard, RegistryProperties): pixmap.fill(QtCore.Qt.white) paint = QtGui.QPainter(pixmap) paint.setPen(QtGui.QPen(QtCore.Qt.blue, 2)) - main_rect = QtCore.QRect(self.theme.font_main_x, self.theme.font_main_y, - self.theme.font_main_width - 1, self.theme.font_main_height - 1) + main_rect = QtCore.QRect(int(self.theme.font_main_x), int(self.theme.font_main_y), + int(self.theme.font_main_width - 1), int(self.theme.font_main_height - 1)) paint.drawRect(main_rect) paint.setPen(QtGui.QPen(QtCore.Qt.red, 2)) - footer_rect = QtCore.QRect(self.theme.font_footer_x, self.theme.font_footer_y, - self.theme.font_footer_width - 1, self.theme.font_footer_height - 1) + footer_rect = QtCore.QRect(int(self.theme.font_footer_x), int(self.theme.font_footer_y), + int(self.theme.font_footer_width - 1), int(self.theme.font_footer_height - 1)) paint.drawRect(footer_rect) paint.end() self.theme_layout_form.exec(pixmap) @@ -372,8 +372,12 @@ class ThemeForm(QtWidgets.QWizard, Ui_ThemeWizard, RegistryProperties): self.theme.font_main_color = self.main_area_page.font_color self.theme.font_main_size = self.main_area_page.font_size self.theme.font_main_line_adjustment = self.main_area_page.line_spacing + self.theme.font_main_outline = self.main_area_page.is_outline_enabled + self.theme.font_main_outline_color = self.main_area_page.outline_color self.theme.font_main_outline_size = self.main_area_page.outline_size + self.theme.font_main_shadow = self.main_area_page.is_shadow_enabled self.theme.font_main_shadow_size = self.main_area_page.shadow_size + self.main_area_page.shadow_color = self.theme.font_main_shadow_color self.theme.font_main_bold = self.main_area_page.is_bold self.theme.font_main_italics = self.main_area_page.is_italic # footer page diff --git a/openlp/core/ui/themelayoutform.py b/openlp/core/ui/themelayoutform.py index bae39191f..a94305843 100644 --- a/openlp/core/ui/themelayoutform.py +++ b/openlp/core/ui/themelayoutform.py @@ -45,5 +45,5 @@ class ThemeLayoutForm(QtWidgets.QDialog, Ui_ThemeLayoutDialog): pixmap.setDevicePixelRatio(self.theme_display_label.devicePixelRatio()) self.theme_display_label.setPixmap(pixmap) display_aspect_ratio = float(image.width()) / image.height() - self.theme_display_label.setFixedSize(400, 400 / display_aspect_ratio) + self.theme_display_label.setFixedSize(400, int(400 / display_aspect_ratio)) return QtWidgets.QDialog.exec(self) diff --git a/openlp/plugins/planningcenter/lib/planningcentertab.py b/openlp/plugins/planningcenter/lib/planningcentertab.py index 0efb3cab4..c023238db 100644 --- a/openlp/plugins/planningcenter/lib/planningcentertab.py +++ b/openlp/plugins/planningcenter/lib/planningcentertab.py @@ -80,8 +80,8 @@ class PlanningCenterTab(SettingsTab): ) self.instructions_label.setText( translate('PlanningCenterPlugin.PlanningCenterTab', - """Enter your Planning Center Online Personal Access Token details in the text boxes \ -below. Personal Access Tokens are created by doing the following: + """Enter your Planning Center Online Personal Access Token details in the text \ +boxes below. Personal Access Tokens are created by doing the following:
  1. Login to your Planning Center Online account at
    diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index ca78c3ebe..7331984ac 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -368,11 +368,11 @@ class PresentationDocument(object): """ if titles: titles_path = self.get_thumbnail_folder() / 'titles.txt' - titles_path.write_text('\n'.join(titles)) + titles_path.write_text('\n'.join(titles), encoding='utf-8') if notes: for slide_no, note in enumerate(notes, 1): notes_path = self.get_thumbnail_folder() / 'slideNotes{number:d}.txt'.format(number=slide_no) - notes_path.write_text(note) + notes_path.write_text(note, encoding='utf-8') def get_sha256_file_hash(self): """ diff --git a/tests/openlp_plugins/presentations/test_presentationcontroller.py b/tests/openlp_plugins/presentations/test_presentationcontroller.py index 90ef03d04..93c8ef160 100644 --- a/tests/openlp_plugins/presentations/test_presentationcontroller.py +++ b/tests/openlp_plugins/presentations/test_presentationcontroller.py @@ -96,7 +96,8 @@ def test_save_titles_and_notes(document): # THEN: the last call to open should have been for slideNotes2.txt assert mocked_write_text.call_count == 3, 'There should be exactly three files written' - mocked_write_text.assert_has_calls([call('uno\ndos'), call('one'), call('two')]) + mocked_write_text.assert_has_calls([call('uno\ndos', encoding='utf-8'), call('one', encoding='utf-8'), + call('two', encoding='utf-8')]) def test_save_titles_and_notes_with_none(document):