Selaa lähdekoodia

misc+slides basico

David 10 vuotta sitten
vanhempi
commit
7548e14899
6 muutettua tiedostoa jossa 32 lisäystä ja 5 poistoa
  1. 0 0
      client/clock.py
  2. 0 0
      client/keyboard.py
  3. 6 3
      client/main.py
  4. 25 0
      client/slides.py
  5. 0 1
      client/sock.py
  6. 1 1
      node/node.lua

+ 0 - 0
client/clock.py


+ 0 - 0
client/keyboard.py


+ 6 - 3
client/main.py

@@ -2,9 +2,12 @@
 from keyboard import Keyboard
 from sock import Sock
 from clock import Clock
+from slides import Slides
+
 import time
 
 HANDLE_KBD = 1
+STATE = "diapo"
 
 s = Sock()
 s.start()
@@ -16,10 +19,10 @@ if HANDLE_KBD == 1:
 c = Clock(s)
 c.start()
 
+slides = Slides("../node/")
 if HANDLE_KBD == 1:
     k.join()
-    print("k")
+
+
 c.join()
-print("c")
 s.join()
-print("s")

+ 25 - 0
client/slides.py

@@ -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]

+ 0 - 1
client/sock.py

@@ -1,7 +1,6 @@
 import socket
 import threading
 import json
-import time
 class Sock(threading.Thread):
     def __init__(self):
         super(Sock, self).__init__()

+ 1 - 1
node/node.lua

@@ -2,7 +2,7 @@ gl.setup(800,600)
 
 local json = require "json"
 local font = resource.load_font("silkscreen.ttf")
-local cur_image = resource.load_image("../test/1.png")
+local cur_image = resource.load_image("1.png")
 
 node.alias("eba")