forked from openlp/openlp
More styling issues
This commit is contained in:
parent
1a83a0a557
commit
b495c47a5a
@ -805,7 +805,7 @@ class SlideController(DisplayController):
|
|||||||
Go to the requested slide
|
Go to the requested slide
|
||||||
"""
|
"""
|
||||||
index = 0
|
index = 0
|
||||||
if len(message) == 0 or message[0]=='undefined':
|
if len(message) == 0 or message[0] == 'undefined':
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
index = int(message[0])
|
index = int(message[0])
|
||||||
|
@ -463,15 +463,14 @@ class ImpressDocument(PresentationDocument):
|
|||||||
pages = self.document.getDrawPages()
|
pages = self.document.getDrawPages()
|
||||||
if 0 < slide_no <= pages.getCount():
|
if 0 < slide_no <= pages.getCount():
|
||||||
page = pages.getByIndex(slide_no - 1)
|
page = pages.getByIndex(slide_no - 1)
|
||||||
if text_type==TextType.Notes:
|
if text_type == TextType.Notes:
|
||||||
page = page.getNotesPage()
|
page = page.getNotesPage()
|
||||||
for index in range(page.getCount()):
|
for index in range(page.getCount()):
|
||||||
shape = page.getByIndex(index)
|
shape = page.getByIndex(index)
|
||||||
shape_type = shape.getShapeType()
|
shape_type = shape.getShapeType()
|
||||||
if shape.supportsService("com.sun.star.drawing.Text"):
|
if shape.supportsService("com.sun.star.drawing.Text"):
|
||||||
# if they requested title, make sure it is the title
|
# if they requested title, make sure it is the title
|
||||||
if text_type!=TextType.Title or \
|
if text_type != TextType.Title or shape_type == "com.sun.star.presentation.TitleTextShape":
|
||||||
shape_type == "com.sun.star.presentation.TitleTextShape":
|
|
||||||
text += shape.getString() + '\n'
|
text += shape.getString() + '\n'
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# 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`_
|
`http://msdn.microsoft.com/en-us/library/aa269321(office.10).aspx`_
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
@ -343,6 +343,7 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
self.save_titles_and_notes(titles, notes)
|
self.save_titles_and_notes(titles, notes)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def _get_text_from_shapes(shapes):
|
def _get_text_from_shapes(shapes):
|
||||||
"""
|
"""
|
||||||
Returns any text extracted from the shapes on a presentation slide.
|
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")
|
ppE = win32com.client.getevents("PowerPoint.Application")
|
||||||
|
|
||||||
class PowerpointEvents(ppE):
|
class PowerpointEvents(ppE):
|
||||||
def OnSlideShowBegin(self, hwnd ):
|
def OnSlideShowBegin(self, hwnd):
|
||||||
#print("SS Begin")
|
#print("SS Begin")
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -369,16 +370,15 @@ if os.name == "nt":
|
|||||||
#print("SS End")
|
#print("SS End")
|
||||||
return
|
return
|
||||||
|
|
||||||
def OnSlideShowNextSlide( self, hwnd ):
|
def OnSlideShowNextSlide(self, hwnd):
|
||||||
Registry().execute('slidecontroller_live_change', hwnd.View.CurrentShowPosition - 1)
|
Registry().execute('slidecontroller_live_change', hwnd.View.CurrentShowPosition - 1)
|
||||||
#print('Slide change:',hwnd.View.CurrentShowPosition)
|
#print('Slide change:',hwnd.View.CurrentShowPosition)
|
||||||
return
|
return
|
||||||
|
|
||||||
def OnSlideShowOnNext(self, hwnd ):
|
def OnSlideShowOnNext(self, hwnd):
|
||||||
#print("SS Advance")
|
#print("SS Advance")
|
||||||
return
|
return
|
||||||
|
|
||||||
def OnSlideShowOnPrevious(self, hwnd):
|
def OnSlideShowOnPrevious(self, hwnd):
|
||||||
#print("SS GoBack")
|
#print("SS GoBack")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -27,8 +27,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
These declarations have been extracted from the interface file created by
|
These declarations have been extracted from the interface file created by makepy
|
||||||
makepy
|
|
||||||
"""
|
"""
|
||||||
class constants:
|
class constants:
|
||||||
ppPlaceholderBody =2 # from enum PpPlaceholderType
|
ppPlaceholderBody =2 # from enum PpPlaceholderType
|
||||||
|
@ -170,7 +170,7 @@ class PptviewDocument(PresentationDocument):
|
|||||||
with zip_file.open('ppt/presentation.xml') as pres:
|
with zip_file.open('ppt/presentation.xml') as pres:
|
||||||
tree = ElementTree.parse(pres)
|
tree = ElementTree.parse(pres)
|
||||||
nodes = tree.getroot().findall(".//p:sldIdLst/p:sldId", namespaces=namespaces)
|
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
|
# initialize the lists
|
||||||
titles = ['' for i in range(len(nodes))]
|
titles = ['' for i in range(len(nodes))]
|
||||||
notes = ['' 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",
|
nodes = tree.getroot().findall(".//p:ph[@type='" + node_type + "']../../..//p:txBody//a:t",
|
||||||
namespaces=namespaces)
|
namespaces=namespaces)
|
||||||
# if we found any content
|
# if we found any content
|
||||||
if nodes and len(nodes)>0:
|
if nodes and len(nodes) > 0:
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
if len(text) > 0:
|
if len(text) > 0:
|
||||||
text += '\n'
|
text += '\n'
|
||||||
|
@ -247,8 +247,7 @@ class PresentationDocument(object):
|
|||||||
``slide_no``
|
``slide_no``
|
||||||
The slide an image is required for, starting at 1
|
The slide an image is required for, starting at 1
|
||||||
"""
|
"""
|
||||||
path = os.path.join(self.get_thumbnail_folder(),
|
path = os.path.join(self.get_thumbnail_folder(), self.controller.thumbnail_prefix + str(slide_no) + '.png')
|
||||||
self.controller.thumbnail_prefix + str(slide_no) + '.png')
|
|
||||||
if os.path.isfile(path) or not check_exists:
|
if os.path.isfile(path) or not check_exists:
|
||||||
return path
|
return path
|
||||||
else:
|
else:
|
||||||
@ -478,6 +477,7 @@ class PresentationController(object):
|
|||||||
|
|
||||||
plugin_manager = property(_get_plugin_manager)
|
plugin_manager = property(_get_plugin_manager)
|
||||||
|
|
||||||
|
|
||||||
class TextType(object):
|
class TextType(object):
|
||||||
"""
|
"""
|
||||||
Type Enumeration for Types of Text to request
|
Type Enumeration for Types of Text to request
|
||||||
|
@ -403,7 +403,7 @@ class HttpRouter(object):
|
|||||||
if controller_name and file_name:
|
if controller_name and file_name:
|
||||||
if controller_name in supported_controllers:
|
if controller_name in supported_controllers:
|
||||||
full_path = urllib.parse.unquote(file_name)
|
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),
|
full_path = os.path.normpath(os.path.join(AppLocation.get_section_data_path(controller_name),
|
||||||
'thumbnails/' + full_path))
|
'thumbnails/' + full_path))
|
||||||
if os.path.exists(full_path):
|
if os.path.exists(full_path):
|
||||||
@ -412,10 +412,10 @@ class HttpRouter(object):
|
|||||||
ext, content_type = self.get_content_type(full_path)
|
ext, content_type = self.get_content_type(full_path)
|
||||||
image = self.image_manager.get_image(full_path, just_file_name, dimensions)
|
image = self.image_manager.get_image(full_path, just_file_name, dimensions)
|
||||||
content = image_to_byte(image, False)
|
content = image_to_byte(image, False)
|
||||||
if len(content)==0:
|
if len(content) == 0:
|
||||||
return self.do_not_found()
|
return self.do_not_found()
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header('Content-type',content_type)
|
self.send_header('Content-type', content_type)
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
return content
|
return content
|
||||||
|
|
||||||
@ -513,9 +513,9 @@ class HttpRouter(object):
|
|||||||
if current_item.is_capable(ItemCapabilities.HasThumbnails):
|
if current_item.is_capable(ItemCapabilities.HasThumbnails):
|
||||||
# If the file is under our app directory tree send the
|
# If the file is under our app directory tree send the
|
||||||
# portion after the match
|
# portion after the match
|
||||||
dataPath = AppLocation.get_data_path()
|
data_path = AppLocation.get_data_path()
|
||||||
if frame['image'][0:len(dataPath)] == dataPath:
|
if frame['image'][0:len(data_path)] == data_path:
|
||||||
item['img'] = urllib.request.pathname2url(frame['image'][len(dataPath):])
|
item['img'] = urllib.request.pathname2url(frame['image'][len(data_path):])
|
||||||
item['text'] = str(frame['title'])
|
item['text'] = str(frame['title'])
|
||||||
item['html'] = str(frame['title'])
|
item['html'] = str(frame['title'])
|
||||||
item['selected'] = (self.live_controller.selected_row == index)
|
item['selected'] = (self.live_controller.selected_row == index)
|
||||||
|
@ -37,6 +37,7 @@ from openlp.plugins.presentations.lib.powerpointcontroller import \
|
|||||||
|
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources'))
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources'))
|
||||||
|
|
||||||
|
|
||||||
class TestLibModule(TestCase):
|
class TestLibModule(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -127,7 +128,7 @@ class TestLibModule(TestCase):
|
|||||||
result = _get_text_from_shapes(shapes)
|
result = _get_text_from_shapes(shapes)
|
||||||
|
|
||||||
# THEN: it should return the text
|
# 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):
|
def get_text_from_shapes_with_no_shapes_test(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user