|
|
@@ -0,0 +1,25 @@
|
|
|
+from glob import glob
|
|
|
+import os
|
|
|
+
|
|
|
+class Slides():
|
|
|
+ def __init__(self,path):
|
|
|
+ if os.path.isdir(path) != True:
|
|
|
+ print("PATH is not a dir")
|
|
|
+ self.files=sorted(glob("%s/*.png" % path), key=self.key_func)
|
|
|
+ for f in range(0,len(self.files)):
|
|
|
+ self.files[f] = os.path.abspath(self.files[f])
|
|
|
+ self.cur_diapo=0
|
|
|
+
|
|
|
+ def key_func(self,x):
|
|
|
+ return int(os.path.split(x)[-1].rsplit('.', 1)[0])
|
|
|
+
|
|
|
+ def cur(self):
|
|
|
+ return self.files[self.cur_diapo]
|
|
|
+
|
|
|
+ def prev(self):
|
|
|
+ self.cur_diapo=max(self.cur_diapo-1, 0)
|
|
|
+ return self.files[self.cur_diapo]
|
|
|
+
|
|
|
+ def next(self):
|
|
|
+ self.cur_diapo=min(self.cur_diapo+1, len(self.files)-1)
|
|
|
+ return self.files[self.cur_diapo]
|