scheduler.py

changeset 7
e189d4a6cb8c
parent 1
4cdc9c1f6b28
--- a/scheduler.py	Fri Jan 19 16:53:13 2018 +0000
+++ b/scheduler.py	Sat Jan 20 14:04:51 2018 +0000
@@ -3,22 +3,23 @@
 #
 
 from Queue import Queue
-from runborg import BorgInstance
 import sched
 import ui
 
-def scheduler(sched):
-    timeout=???
-    q=sched.eventqueue
-    while True:
-        timeout, timerevent=next_timed_event(sched);
-        t=Timer(timeout, lambda: q.put(timerevent));
-        event=sq.get(True):
-        # Decide what to do
 
 class Scheduler:
 
     def __init__(self, backups):
         self.backups=backups
         self.eventqueue=Queue()
-        self.t=Thread(target=scheduler, args=self)
+        self.t=Thread(target=self.__scheduler)
+        t.start()
+
+    def __scheduler(sched):
+        timeout=???
+        q=sched.eventqueue
+        while True:
+            timeout, timerevent=next_timed_event(sched);
+            t=Timer(timeout, lambda: q.put(timerevent));
+            event=sq.get(True):
+            # Decide what to do

mercurial