Merge branch '30rc1-fixes2' into 'master'

Various bug fixes

Closes #978 and #976

See merge request openlp/openlp!384
This commit is contained in:
Raoul Snyman 2022-01-21 21:32:09 +00:00
commit 91322f87d2
5 changed files with 15 additions and 10 deletions

View File

@ -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

View File

@ -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)

View File

@ -80,8 +80,8 @@ class PlanningCenterTab(SettingsTab):
)
self.instructions_label.setText(
translate('PlanningCenterPlugin.PlanningCenterTab',
"""Enter your <b>Planning Center Online</b> <i>Personal Access Token</i> details in the text boxes \
below. Personal Access Tokens are created by doing the following:
"""Enter your <b>Planning Center Online</b> <i>Personal Access Token</i> details in the text \
boxes below. Personal Access Tokens are created by doing the following:
<ol>
<li>Login to your Planning Center Online account at<br>
<a href=https://api.planningcenteronline.com/oauth/applications>

View File

@ -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):
"""

View File

@ -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):