diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index e1203569b..5ab83db49 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -805,7 +805,7 @@ class SlideController(DisplayController): Go to the requested slide """ index = 0 - if len(message) == 0 or message[0]=='undefined': + if len(message) == 0 or message[0] == 'undefined': return else: index = int(message[0]) diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 559917c8e..0088346db 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -463,15 +463,14 @@ class ImpressDocument(PresentationDocument): pages = self.document.getDrawPages() if 0 < slide_no <= pages.getCount(): page = pages.getByIndex(slide_no - 1) - if text_type==TextType.Notes: + if text_type == TextType.Notes: page = page.getNotesPage() for index in range(page.getCount()): shape = page.getByIndex(index) shape_type = shape.getShapeType() if shape.supportsService("com.sun.star.drawing.Text"): # if they requested title, make sure it is the title - if text_type!=TextType.Title or \ - shape_type == "com.sun.star.presentation.TitleTextShape": + if text_type != TextType.Title or shape_type == "com.sun.star.presentation.TitleTextShape": text += shape.getString() + '\n' return text diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py index 0196c317b..81e71a61a 100644 --- a/openlp/plugins/presentations/lib/powerpointcontroller.py +++ b/openlp/plugins/presentations/lib/powerpointcontroller.py @@ -27,7 +27,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -This modul is for controlling powerpiont. PPT API documentation: +This module is for controlling powerpoint. PPT API documentation: `http://msdn.microsoft.com/en-us/library/aa269321(office.10).aspx`_ """ import os @@ -343,6 +343,7 @@ class PowerpointDocument(PresentationDocument): self.save_titles_and_notes(titles, notes) return + def _get_text_from_shapes(shapes): """ Returns any text extracted from the shapes on a presentation slide. @@ -361,7 +362,7 @@ if os.name == "nt": ppE = win32com.client.getevents("PowerPoint.Application") class PowerpointEvents(ppE): - def OnSlideShowBegin(self, hwnd ): + def OnSlideShowBegin(self, hwnd): #print("SS Begin") return @@ -369,16 +370,15 @@ if os.name == "nt": #print("SS End") return - def OnSlideShowNextSlide( self, hwnd ): + def OnSlideShowNextSlide(self, hwnd): Registry().execute('slidecontroller_live_change', hwnd.View.CurrentShowPosition - 1) #print('Slide change:',hwnd.View.CurrentShowPosition) return - def OnSlideShowOnNext(self, hwnd ): + def OnSlideShowOnNext(self, hwnd): #print("SS Advance") return def OnSlideShowOnPrevious(self, hwnd): #print("SS GoBack") return - diff --git a/openlp/plugins/presentations/lib/ppinterface.py b/openlp/plugins/presentations/lib/ppinterface.py index 50e9e722f..6de119c20 100644 --- a/openlp/plugins/presentations/lib/ppinterface.py +++ b/openlp/plugins/presentations/lib/ppinterface.py @@ -27,8 +27,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -These declarations have been extracted from the interface file created by -makepy +These declarations have been extracted from the interface file created by makepy """ class constants: ppPlaceholderBody =2 # from enum PpPlaceholderType diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index 7242edb37..ebe1a2b23 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -170,7 +170,7 @@ class PptviewDocument(PresentationDocument): with zip_file.open('ppt/presentation.xml') as pres: tree = ElementTree.parse(pres) nodes = tree.getroot().findall(".//p:sldIdLst/p:sldId", namespaces=namespaces) - print ("slide count: " + str(len(nodes))) + #print("slide count: " + str(len(nodes))) # initialize the lists titles = ['' for i in range(len(nodes))] notes = ['' for i in range(len(nodes))] @@ -199,7 +199,7 @@ class PptviewDocument(PresentationDocument): nodes = tree.getroot().findall(".//p:ph[@type='" + node_type + "']../../..//p:txBody//a:t", namespaces=namespaces) # if we found any content - if nodes and len(nodes)>0: + if nodes and len(nodes) > 0: for node in nodes: if len(text) > 0: text += '\n' diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index 19097e4af..3f45c89cf 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -247,8 +247,7 @@ class PresentationDocument(object): ``slide_no`` The slide an image is required for, starting at 1 """ - path = os.path.join(self.get_thumbnail_folder(), - self.controller.thumbnail_prefix + str(slide_no) + '.png') + path = os.path.join(self.get_thumbnail_folder(), self.controller.thumbnail_prefix + str(slide_no) + '.png') if os.path.isfile(path) or not check_exists: return path else: @@ -478,6 +477,7 @@ class PresentationController(object): plugin_manager = property(_get_plugin_manager) + class TextType(object): """ Type Enumeration for Types of Text to request diff --git a/openlp/plugins/remotes/lib/httprouter.py b/openlp/plugins/remotes/lib/httprouter.py index 4018f7363..45b09e8fb 100644 --- a/openlp/plugins/remotes/lib/httprouter.py +++ b/openlp/plugins/remotes/lib/httprouter.py @@ -403,7 +403,7 @@ class HttpRouter(object): if controller_name and file_name: if controller_name in supported_controllers: full_path = urllib.parse.unquote(file_name) - if not '..' in full_path: # no hacking please + if not '..' in full_path: # no hacking please full_path = os.path.normpath(os.path.join(AppLocation.get_section_data_path(controller_name), 'thumbnails/' + full_path)) if os.path.exists(full_path): @@ -412,10 +412,10 @@ class HttpRouter(object): ext, content_type = self.get_content_type(full_path) image = self.image_manager.get_image(full_path, just_file_name, dimensions) content = image_to_byte(image, False) - if len(content)==0: + if len(content) == 0: return self.do_not_found() self.send_response(200) - self.send_header('Content-type',content_type) + self.send_header('Content-type', content_type) self.end_headers() return content @@ -513,9 +513,9 @@ class HttpRouter(object): if current_item.is_capable(ItemCapabilities.HasThumbnails): # If the file is under our app directory tree send the # portion after the match - dataPath = AppLocation.get_data_path() - if frame['image'][0:len(dataPath)] == dataPath: - item['img'] = urllib.request.pathname2url(frame['image'][len(dataPath):]) + data_path = AppLocation.get_data_path() + if frame['image'][0:len(data_path)] == data_path: + item['img'] = urllib.request.pathname2url(frame['image'][len(data_path):]) item['text'] = str(frame['title']) item['html'] = str(frame['title']) item['selected'] = (self.live_controller.selected_row == index) diff --git a/tests/functional/openlp_plugins/presentations/test_powerpointcontroller.py b/tests/functional/openlp_plugins/presentations/test_powerpointcontroller.py index faa7c043b..cd68d572d 100644 --- a/tests/functional/openlp_plugins/presentations/test_powerpointcontroller.py +++ b/tests/functional/openlp_plugins/presentations/test_powerpointcontroller.py @@ -37,6 +37,7 @@ from openlp.plugins.presentations.lib.powerpointcontroller import \ TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources')) + class TestLibModule(TestCase): def setUp(self): @@ -127,7 +128,7 @@ class TestLibModule(TestCase): result = _get_text_from_shapes(shapes) # THEN: it should return the text - self.assertEqual(result, 'slideText\nslideText\n','result should match \'slideText\nslideText\n\'') + self.assertEqual(result, 'slideText\nslideText\n', 'result should match \'slideText\nslideText\n\'') def get_text_from_shapes_with_no_shapes_test(self): """