Blackened
This commit is contained in:
parent
0907d013cd
commit
76af0891e9
14 changed files with 95 additions and 63 deletions
|
|
@ -8,38 +8,38 @@ _actions = {
|
|||
"rule": "/camera/capture/",
|
||||
"view_class": camera.CaptureAPI,
|
||||
"description": "Take a single still capture",
|
||||
"conditions": True
|
||||
"conditions": True,
|
||||
},
|
||||
"preview_start": {
|
||||
"rule": "/camera/preview/start",
|
||||
"view_class": camera.GPUPreviewStartAPI,
|
||||
"description": "Start the on-board GPU preview",
|
||||
"conditions": True
|
||||
"conditions": True,
|
||||
},
|
||||
"preview_stop": {
|
||||
"rule": "/camera/preview/stop",
|
||||
"view_class": camera.GPUPreviewStopAPI,
|
||||
"description": "Stop the on-board GPU preview",
|
||||
"conditions": True
|
||||
"conditions": True,
|
||||
},
|
||||
"move": {
|
||||
"rule": "/stage/move/",
|
||||
"view_class": stage.MoveStageAPI,
|
||||
"description": "Move the microscope stage",
|
||||
"conditions": True
|
||||
"conditions": True,
|
||||
},
|
||||
"shutdown": {
|
||||
"rule": "/system/shutdown/",
|
||||
"view_class": system.ShutdownAPI,
|
||||
"description": "Shutdown the device",
|
||||
"conditions": (platform == "linux")
|
||||
"conditions": (platform == "linux"),
|
||||
},
|
||||
"reboot": {
|
||||
"rule": "/system/reboot/",
|
||||
"view_class": system.RebootAPI,
|
||||
"description": "Reboot the device",
|
||||
"conditions": (platform == "linux")
|
||||
}
|
||||
"conditions": (platform == "linux"),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ def actions_representation():
|
|||
"links": {"self": url_for(f".{name}")},
|
||||
"description": action["description"],
|
||||
"rule": action["rule"],
|
||||
"view_class": str(action["view_class"])
|
||||
"view_class": str(action["view_class"]),
|
||||
}
|
||||
|
||||
actions[name] = d
|
||||
|
|
|
|||
|
|
@ -84,11 +84,11 @@ class CaptureAPI(MicroscopeView):
|
|||
|
||||
# Inject system metadata
|
||||
system_metadata = {
|
||||
"microscope_settings": self.microscope.read_settings(),
|
||||
"microscope_state": self.microscope.state,
|
||||
"microscope_id": self.microscope.id,
|
||||
"microscope_name": self.microscope.name,
|
||||
}
|
||||
"microscope_settings": self.microscope.read_settings(),
|
||||
"microscope_state": self.microscope.state,
|
||||
"microscope_id": self.microscope.id,
|
||||
"microscope_name": self.microscope.name,
|
||||
}
|
||||
output.system_metadata.update(system_metadata)
|
||||
|
||||
# Insert custom metadata
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class ShutdownAPI(MicroscopeView):
|
|||
.. :quickref: Actions; Shutdown
|
||||
|
||||
"""
|
||||
subprocess.Popen(['shutdown', '-h', 'now'])
|
||||
subprocess.Popen(["shutdown", "-h", "now"])
|
||||
|
||||
return "{}", 201
|
||||
|
||||
|
|
@ -24,6 +24,6 @@ class RebootAPI(MicroscopeView):
|
|||
.. :quickref: Actions; Shutdown
|
||||
|
||||
"""
|
||||
subprocess.Popen(['sudo', 'shutdown', '-r', 'now'])
|
||||
subprocess.Popen(["sudo", "shutdown", "-r", "now"])
|
||||
|
||||
return "{}", 201
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue