-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path__init__.py
More file actions
32 lines (25 loc) · 722 Bytes
/
__init__.py
File metadata and controls
32 lines (25 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import subprocess
import atexit
import signal
def get_name():
return ("Browser Plotter")
def requirements_met():
return True
def plot(data_path, plot_spec, python_cmd):
program_path = os.path.dirname(__file__)
if python_cmd is None:
print("Unable to plot: python not found in path")
else:
plot_cmd = []
plot_cmd.append(python_cmd)
plot_cmd.append(os.path.join(program_path, "server.py"))
print(data_path)
plot_cmd.append(data_path)
for spec in plot_spec.split():
plot_cmd.append(spec)
print ("Plotting with: \"" + ' '.join(plot_cmd) + "\"")
server_proc = subprocess.Popen(plot_cmd, cwd = program_path)
atexit.register(shut_down, server_proc)
def shut_down(proc):
proc.kill()