@@ -31,7 +31,8 @@ def __init__(self):
31
31
self ._shuffle_start_index = 0
32
32
self ._current_index = 0
33
33
self .is_full_screen : bool = False
34
- self .is_playing : bool = False
34
+ # self.is_playing: bool = False
35
+ self .is_playing : bool = bpg .autoplay
35
36
self ._seed = time .time ()
36
37
37
38
# timer
@@ -59,7 +60,7 @@ def initialize_images(self, mode=None, current_image_path=None,
59
60
self ._current_index = self .get_index_from_image_path (
60
61
current_image_path )
61
62
self ._shuffle_start_index = self ._current_index
62
- # self.image_shuffle()
63
+ self .image_shuffle ()
63
64
self ._set_image (self ._current_index )
64
65
65
66
def is_image_landscape (self , image : QPixmap ):
@@ -244,24 +245,37 @@ def keyReleaseEvent(self, event: QKeyEvent):
244
245
elif key == Qt .Key_T :
245
246
print ("T pressed" )
246
247
self .increase_timer (bpg .max_pause_secs )
247
- self .pause ()
248
+
249
+ if self .is_playing :
250
+ self .play ()
251
+ else :
252
+ self .pause ()
253
+
248
254
self .setFocus ()
249
255
# self.set_title(self.get_current_image_path_str())
250
256
251
257
def toggle_play (self ):
252
- l .log ("toggle auto play is" + str (self .is_playing ))
253
258
self .is_playing = not self .is_playing
254
- self .play ()
259
+ l .log (
260
+ str .format (
261
+ "toggle auto play from {} to {}" ,
262
+ (str (self .is_playing )),
263
+ (str (not self .is_playing )))
264
+ )
265
+ if self .is_playing :
266
+ self .play ()
267
+ else :
268
+ self .pause ()
255
269
256
270
def play (self ):
257
- l .log ("starting play timer " )
258
- if self .is_playing :
259
- self .timer .start ()
271
+ l .log ("slideshow running " )
272
+ # self.is_playing = True
273
+ self .timer .start ()
260
274
261
275
def pause (self ):
262
- if not self . is_playing :
263
- l . log ( "pausing auto play: " + str ( self .is_playing ))
264
- self .timer .stop ()
276
+ l . log ( "slideshow paused" )
277
+ # self.is_playing = False
278
+ self .timer .stop ()
265
279
266
280
def play_image_next (self ):
267
281
if self .is_playing :
0 commit comments