forked from openlp/openlp
Implement going to the previous serviceitem.
This commit is contained in:
parent
ad0eacd4f0
commit
aa982492e4
|
@ -1174,7 +1174,8 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
|
||||||
if not self.service_item:
|
if not self.service_item:
|
||||||
return
|
return
|
||||||
if self.service_item.is_command():
|
if self.service_item.is_command():
|
||||||
past_end = Registry().execute('%s_next' % self.service_item.name.lower(), [self.service_item, self.is_live])
|
past_end = Registry().execute('{text}_next'.format(text=self.service_item.name.lower()),
|
||||||
|
[self.service_item, self.is_live])
|
||||||
# Check if we have gone past the end of the last slide
|
# Check if we have gone past the end of the last slide
|
||||||
if self.is_live and past_end and past_end[0]:
|
if self.is_live and past_end and past_end[0]:
|
||||||
if wrap is None:
|
if wrap is None:
|
||||||
|
@ -1211,9 +1212,17 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
|
||||||
if not self.service_item:
|
if not self.service_item:
|
||||||
return
|
return
|
||||||
if self.service_item.is_command():
|
if self.service_item.is_command():
|
||||||
Registry().execute('{text}_previous'.format(text=self.service_item.name.lower()),
|
before_start = Registry().execute('{text}_previous'.format(text=self.service_item.name.lower()),
|
||||||
[self.service_item, self.is_live])
|
[self.service_item, self.is_live])
|
||||||
if self.is_live:
|
# Check id we have tried to go before that start slide
|
||||||
|
if self.is_live and before_start and before_start[0]:
|
||||||
|
print('detected before start!')
|
||||||
|
if self.slide_limits == SlideLimits.Wrap:
|
||||||
|
self.on_slide_selected_index([self.preview_widget.slide_count() - 1])
|
||||||
|
elif self.is_live and self.slide_limits == SlideLimits.Next:
|
||||||
|
self.keypress_queue.append(ServiceItemAction.PreviousLastSlide)
|
||||||
|
self._process_queue()
|
||||||
|
elif self.is_live:
|
||||||
self.update_preview()
|
self.update_preview()
|
||||||
else:
|
else:
|
||||||
row = self.preview_widget.current_slide_number() - 1
|
row = self.preview_widget.current_slide_number() - 1
|
||||||
|
|
|
@ -46,6 +46,18 @@ from openlp.plugins.presentations.lib.presentationcontroller import Presentation
|
||||||
if is_win():
|
if is_win():
|
||||||
from win32com.client import Dispatch
|
from win32com.client import Dispatch
|
||||||
import pywintypes
|
import pywintypes
|
||||||
|
uno_available = False
|
||||||
|
try:
|
||||||
|
service_manager = Dispatch('com.sun.star.ServiceManager')
|
||||||
|
service_manager._FlagAsMethod('Bridge_GetStruct')
|
||||||
|
XSlideShowListenerObj = service_manager.Bridge_GetStruct('com.sun.star.presentation.XSlideShowListener')
|
||||||
|
|
||||||
|
class SlideShowListenerImport(XSlideShowListenerObj.__class__):
|
||||||
|
pass
|
||||||
|
except (AttributeError, pywintypes.com_error):
|
||||||
|
class SlideShowListenerImport(object):
|
||||||
|
pass
|
||||||
|
|
||||||
# Declare an empty exception to match the exception imported from UNO
|
# Declare an empty exception to match the exception imported from UNO
|
||||||
|
|
||||||
class ErrorCodeIOException(Exception):
|
class ErrorCodeIOException(Exception):
|
||||||
|
@ -58,6 +70,9 @@ else:
|
||||||
from com.sun.star.task import ErrorCodeIOException
|
from com.sun.star.task import ErrorCodeIOException
|
||||||
from com.sun.star.presentation import XSlideShowListener
|
from com.sun.star.presentation import XSlideShowListener
|
||||||
|
|
||||||
|
class SlideShowListenerImport(unohelper.Base, XSlideShowListener):
|
||||||
|
pass
|
||||||
|
|
||||||
uno_available = True
|
uno_available = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
uno_available = False
|
uno_available = False
|
||||||
|
@ -504,8 +519,10 @@ class ImpressDocument(PresentationDocument):
|
||||||
notes.append(note)
|
notes.append(note)
|
||||||
self.save_titles_and_notes(titles, notes)
|
self.save_titles_and_notes(titles, notes)
|
||||||
|
|
||||||
|
if is_win():
|
||||||
|
property_object = self.controller.manager.Bridge_GetStruct('com.sun.star.beans.PropertyValue')
|
||||||
|
|
||||||
class SlideShowListener(unohelper.Base, XSlideShowListener):
|
class SlideShowListener(SlideShowListenerImport):
|
||||||
"""
|
"""
|
||||||
Listener interface to receive global slide show events.
|
Listener interface to receive global slide show events.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -203,8 +203,10 @@ class Controller(object):
|
||||||
return
|
return
|
||||||
if not self.activate():
|
if not self.activate():
|
||||||
return
|
return
|
||||||
self.doc.previous_step()
|
ret = self.doc.previous_step()
|
||||||
self.poll()
|
self.poll()
|
||||||
|
print('previous returning: %d' % ret)
|
||||||
|
return ret
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
"""
|
"""
|
||||||
|
@ -435,11 +437,12 @@ class MessageListener(object):
|
||||||
"""
|
"""
|
||||||
is_live = message[1]
|
is_live = message[1]
|
||||||
if is_live:
|
if is_live:
|
||||||
self.live_handler.previous()
|
ret = self.live_handler.previous()
|
||||||
if Settings().value('core/click live slide to unblank'):
|
if Settings().value('core/click live slide to unblank'):
|
||||||
Registry().execute('slidecontroller_live_unblank')
|
Registry().execute('slidecontroller_live_unblank')
|
||||||
|
return ret
|
||||||
else:
|
else:
|
||||||
self.preview_handler.previous()
|
return self.preview_handler.previous()
|
||||||
|
|
||||||
def shutdown(self, message):
|
def shutdown(self, message):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -468,12 +468,16 @@ class PowerpointDocument(PresentationDocument):
|
||||||
Triggers the previous slide on the running presentation.
|
Triggers the previous slide on the running presentation.
|
||||||
"""
|
"""
|
||||||
log.debug('previous_step')
|
log.debug('previous_step')
|
||||||
|
# if we are at the presentations start we can't go further back, just return True
|
||||||
|
if self.presentation.SlideShowWindow.View.GetClickIndex() == 0 and self.get_slide_number() == 1:
|
||||||
|
return True
|
||||||
try:
|
try:
|
||||||
self.presentation.SlideShowWindow.View.Previous()
|
self.presentation.SlideShowWindow.View.Previous()
|
||||||
except (AttributeError, pywintypes.com_error):
|
except (AttributeError, pywintypes.com_error):
|
||||||
log.exception('Caught exception while in previous_step')
|
log.exception('Caught exception while in previous_step')
|
||||||
trace_error_handler(log)
|
trace_error_handler(log)
|
||||||
self.show_error_msg()
|
self.show_error_msg()
|
||||||
|
return False
|
||||||
|
|
||||||
def get_slide_text(self, slide_no):
|
def get_slide_text(self, slide_no):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -246,15 +246,17 @@ class PresentationDocument(object):
|
||||||
def next_step(self):
|
def next_step(self):
|
||||||
"""
|
"""
|
||||||
Triggers the next effect of slide on the running presentation. This might be the next animation on the current
|
Triggers the next effect of slide on the running presentation. This might be the next animation on the current
|
||||||
slide, or the next slide
|
slide, or the next slide.
|
||||||
|
Returns True if we stepped beyond the slides of the presentation
|
||||||
"""
|
"""
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def previous_step(self):
|
def previous_step(self):
|
||||||
"""
|
"""
|
||||||
Triggers the previous slide on the running presentation
|
Triggers the previous slide on the running presentation
|
||||||
|
Returns True if we stepped beyond the slides of the presentation
|
||||||
"""
|
"""
|
||||||
pass
|
return False
|
||||||
|
|
||||||
def convert_thumbnail(self, image_path, index):
|
def convert_thumbnail(self, image_path, index):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue