From 1b332c1580d8b7efd2fd0c8b287a958efaebce44 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 10 Jun 2015 17:05:29 +0200 Subject: [PATCH] Fix PDF reader using wrong maindisplay size. --- openlp/plugins/presentations/lib/pdfcontroller.py | 10 +++++----- .../openlp_plugins/presentations/test_pdfcontroller.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openlp/plugins/presentations/lib/pdfcontroller.py b/openlp/plugins/presentations/lib/pdfcontroller.py index 257d9659e..c16c54205 100644 --- a/openlp/plugins/presentations/lib/pdfcontroller.py +++ b/openlp/plugins/presentations/lib/pdfcontroller.py @@ -89,11 +89,11 @@ class PdfController(PresentationController): # Analyse the output to see it the program is mudraw, ghostscript or neither for line in runlog.splitlines(): decoded_line = line.decode() - found_mudraw = re.search('usage: mudraw.*', decoded_line) + found_mudraw = re.search('usage: mudraw.*', decoded_line, re.IGNORECASE) if found_mudraw: program_type = 'mudraw' break - found_gs = re.search('GPL Ghostscript.*', decoded_line) + found_gs = re.search('GPL Ghostscript.*', decoded_line, re.IGNORECASE) if found_gs: program_type = 'gs' break @@ -222,8 +222,8 @@ class PdfDocument(PresentationDocument): continue # Calculate the ratio from pdf to screen if width > 0 and height > 0: - width_ratio = size.right() / width - height_ratio = size.bottom() / height + width_ratio = size.width() / width + height_ratio = size.height() / height # return the resolution that should be used. 72 is default. if width_ratio > height_ratio: return int(height_ratio * 72) @@ -254,7 +254,7 @@ class PdfDocument(PresentationDocument): if not os.path.isdir(self.get_temp_folder()): os.makedirs(self.get_temp_folder()) if self.controller.mudrawbin: - runlog = check_output([self.controller.mudrawbin, '-w', str(size.right()), '-h', str(size.bottom()), + runlog = check_output([self.controller.mudrawbin, '-w', str(size.width()), '-h', str(size.height()), '-o', os.path.join(self.get_temp_folder(), 'mainslide%03d.png'), self.file_path], startupinfo=self.startupinfo) elif self.controller.gsbin: diff --git a/tests/functional/openlp_plugins/presentations/test_pdfcontroller.py b/tests/functional/openlp_plugins/presentations/test_pdfcontroller.py index 903f15119..a7b93f1da 100644 --- a/tests/functional/openlp_plugins/presentations/test_pdfcontroller.py +++ b/tests/functional/openlp_plugins/presentations/test_pdfcontroller.py @@ -135,5 +135,5 @@ class TestPdfController(TestCase, TestMixin): self.assertEqual(760, image.height(), 'The height should be 760') self.assertEqual(537, image.width(), 'The width should be 537') else: - self.assertEqual(767, image.height(), 'The height should be 767') + self.assertEqual(768, image.height(), 'The height should be 768') self.assertEqual(543, image.width(), 'The width should be 543')