diff src/server/server.py @ 1063:4b69f69c6ffd

server: new ProgressHandler helper class, to handle progressing actions
author Goffi <goffi@goffi.org>
date Sun, 11 Mar 2018 19:30:37 +0100
parents c2037b44f84e
children d1324e43d448
line wrap: on
line diff
--- a/src/server/server.py	Sun Mar 11 19:29:23 2018 +0100
+++ b/src/server/server.py	Sun Mar 11 19:30:37 2018 +0100
@@ -54,7 +54,7 @@
 import libervia
 from libervia.server import websockets
 from libervia.server.pages import LiberviaPage
-from libervia.server.utils import quote
+from libervia.server.utils import quote, ProgressHandler
 from functools import partial
 
 try:
@@ -1483,6 +1483,12 @@
         self.bridge.register_signal("psEventRaw", partial(LiberviaPage.onNodeEvent, self), "plugin")
         self.bridge.register_signal("messageNew", partial(LiberviaPage.onSignal, self, "messageNew"))
 
+        # Progress handling
+        self.bridge.register_signal("progressStarted", partial(ProgressHandler._signal, "started"))
+        self.bridge.register_signal("progressFinished", partial(ProgressHandler._signal, "finished"))
+        self.bridge.register_signal("progressError", partial(ProgressHandler._signal, "error"))
+
+
         # media dirs
         # FIXME: get rid of dirname and "/" in C.XXX_DIR
         self.putChild(os.path.dirname(C.MEDIA_DIR), ProtectedFile(self.media_dir))