More styling issues

This commit is contained in:
Felipe Polo-Wood 2013-12-30 13:19:50 -05:00
parent 1a83a0a557
commit b495c47a5a
8 changed files with 21 additions and 22 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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