diff bin/webcontrol @ 1858:7772cc48e016

reformat all python Ignore-this: 1135b78893f8b3d31badddda7f45678f
author drewp@bigasterisk.com
date Tue, 21 May 2019 23:56:12 +0000
parents b5efddd80dad
children f066d6e874db
line wrap: on
line diff
--- a/bin/webcontrol	Tue May 21 23:55:35 2019 +0000
+++ b/bin/webcontrol	Tue May 21 23:56:12 2019 +0000
@@ -21,14 +21,14 @@
 from light9.namespaces import L9
 from urllib import urlencode
 
+
 # move to web lib
 def post(url, **args):
-    return getPage(url,
-                   method='POST',
-                   postdata=urlencode(args))
+    return getPage(url, method='POST', postdata=urlencode(args))
 
 
 class Commands(object):
+
     @staticmethod
     def playSong(graph, songUri):
         s = xmlrpclib.ServerProxy(networking.musicPlayer.url)
@@ -45,17 +45,22 @@
     @staticmethod
     def worklightsOn(graph):
         return post(networking.keyboardComposer.path('fadesub'),
-                    subname='scoop', level=.5, secs=.5)
+                    subname='scoop',
+                    level=.5,
+                    secs=.5)
 
     @staticmethod
     def worklightsOff(graph):
         return post(networking.keyboardComposer.path('fadesub'),
-                    subname='scoop', level=0, secs=.5)
+                    subname='scoop',
+                    level=0,
+                    secs=.5)
 
     @staticmethod
     def dimmerSet(graph, dimmer, value):
         raise NotImplementedError("subcomposer doesnt have an http port yet")
 
+
 class Main(rend.Page):
     docFactory = loaders.xmlfile(sibpath(__file__, "../light9/webcontrol.html"))
 
@@ -75,9 +80,9 @@
         out = []
         for song in songs:
             out.append(
-                T.form(method="post", action="playSong")[
-                    T.input(type='hidden', name='songUri', value=song),
-                    T.button(type='submit')[graph.label(song)]])
+                T.form(method="post", action="playSong")
+                [T.input(type='hidden', name='songUri', value=song),
+                 T.button(type='submit')[graph.label(song)]])
         return out
 
     @inlineCallbacks
@@ -85,18 +90,19 @@
         try:
             func = getattr(Commands, segments[0])
             req = inevow.IRequest(ctx)
-            simpleArgDict = dict((k, v[0]) for k,v in req.args.items())
+            simpleArgDict = dict((k, v[0]) for k, v in req.args.items())
             try:
                 ret = yield robust_apply(func, func, self.graph,
                                          **simpleArgDict)
-            except KeyboardInterrupt: raise
+            except KeyboardInterrupt:
+                raise
             except Exception, e:
                 print "Error on command %s" % segments[0]
                 traceback.print_exc()
-                returnValue((url.here.up().
-                             add('status', str(e)).
-                             add('error', 1), segments[1:]))
-                
+                returnValue((url.here.up().add('status',
+                                               str(e)).add('error',
+                                                           1), segments[1:]))
+
             returnValue((url.here.up().add('status', ret), segments[1:]))
             #actually return the orig page, with a status message from the func
         except AttributeError:
@@ -105,7 +111,8 @@
 
     def child_icon(self, ctx):
         return static.File("/usr/share/pyshared/elisa/plugins/poblesec/tango")
-            
+
+
 graph = showconfig.getGraph()
 show = showconfig.showUri()