rendered paste bodyIndex: /home/michal/soft/elisa/elisa/elisa-plugins/elisa/plugins/slideshow/slideshow_controller.py
===================================================================
--- /home/michal/soft/elisa/elisa/elisa-plugins/elisa/plugins/slideshow/slideshow_controller.py (wersja 5045)
+++ /home/michal/soft/elisa/elisa/elisa-plugins/elisa/plugins/slideshow/slideshow_controller.py (kopia robocza)
@@ -37,6 +37,7 @@
supported_models = ('base:list_model',)
duration = 5.0
+ backwards = False
_call_later = None
_playing = False
@@ -76,19 +77,26 @@
def playing__set(self, playing):
self._playing = playing
- if playing:
+ if playing and not self.backwards:
self.next_image()
self._call_later = reactor.callLater(self.duration,
self.next_image)
+ elif playing:
+ self.previous_image()
+ self._call_later = reactor.callLater(self.duration,
+ self.previous_image)
else:
self._cancel_last_call_later()
+ self.backwards = False
def playing__get(self):
return self._playing
def focused_changed(self, old_focused, new_focused):
if new_focused == False and self.playing == True:
- self.playing = False
+ self._cancel_last_call_later()
+ elif new_focused == True and self.playing == True:
+ self.playing = True
def next_image(self):
self._cancel_last_call_later()
@@ -98,10 +106,12 @@
self.info("Loading image at index %r", index)
self.current_index = index
if self.playing == True:
+ self.backwards = False
self._call_later = reactor.callLater(self.duration,
self.next_image)
return True
else:
+ self.playing = False
self.info("Reached end of slideshow")
return False
@@ -113,10 +123,12 @@
self.info("Loading image at index %r", index)
self.current_index = index
if self.playing == True:
+ self.backwards = True
self._call_later = reactor.callLater(self.duration,
self.previous_image)
return True
else:
+ self.playing = False
self.info("Reached beginning of slideshow")
return False