48
48
__version__ = "0.0.0-auto.0"
49
49
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Slideshow.git"
50
50
51
+
51
52
class PlayBackOrder :
52
53
"""Defines possible slideshow playback orders."""
53
54
# pylint: disable=too-few-public-methods
@@ -78,8 +79,9 @@ class SlideShow:
78
79
:param str folder: Specify the folder containing the image files, in quotes. Default is
79
80
the root directory, ``"/"``.
80
81
81
- :param PlayBackOrder order: The order in which the images display. You can choose random (``RANDOM``) or
82
- alphabetical (``ALPHABETICAL``). Default is ``ALPHABETICAL``.
82
+ :param PlayBackOrder order: The order in which the images display. You can choose random
83
+ (``RANDOM``) or alphabetical (``ALPHABETICAL``). Default is
84
+ ``ALPHABETICAL``.
83
85
84
86
:param bool loop: Specify whether to loop the images or play through the list once. `True`
85
87
if slideshow will continue to loop, ``False`` if it will play only once.
@@ -147,8 +149,9 @@ class SlideShow:
147
149
slideshow.brightness -= 0.001
148
150
"""
149
151
150
- def __init__ (self , display , backlight_pwm , * , folder = "/" , order = PlayBackOrder .ALPHABETICAL , loop = True ,
151
- dwell = 3 , fade_effect = True , auto_advance = True , direction = PlayBackDirection .FORWARD ):
152
+ def __init__ (self , display , backlight_pwm , * , folder = "/" , order = PlayBackOrder .ALPHABETICAL ,
153
+ loop = True , dwell = 3 , fade_effect = True , auto_advance = True ,
154
+ direction = PlayBackDirection .FORWARD ):
152
155
self .loop = loop
153
156
"""Specifies whether to loop through the images continuously or play through the list once.
154
157
``True`` will continue to loop, ``False`` will play only once."""
@@ -172,6 +175,7 @@ def __init__(self, display, backlight_pwm, *, folder="/", order=PlayBackOrder.AL
172
175
self ._img_start = None
173
176
self ._file_list = list (filter (lambda x : x .endswith ("bmp" ), os .listdir (folder )))
174
177
178
+ self ._order = None
175
179
self .order = order
176
180
"""The order in which the images display. You can choose random (``RANDOM``) or
177
181
alphabetical (``ALPHA``)."""
@@ -190,6 +194,10 @@ def __init__(self, display, backlight_pwm, *, folder="/", order=PlayBackOrder.AL
190
194
# Show the first image
191
195
self .advance ()
192
196
197
+ @property
198
+ def current_image_name (self ):
199
+ return self ._file_list [self ._current_image ]
200
+
193
201
@property
194
202
def order (self ):
195
203
"""Specifies the order in which the images are displayed. Options are random (``RANDOM``) or
0 commit comments