mirror of
https://github.com/phooky/Apple-410.git
synced 2024-10-31 21:07:02 +00:00
wrapping up plot_to_svg.
This commit is contained in:
parent
91a055cc5a
commit
28b99686fb
@ -1,6 +1,13 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import serial
|
import serial
|
||||||
import time
|
import time
|
||||||
|
from plot_to_svg import Plotter
|
||||||
|
|
||||||
|
def plot_to_svg(instream, outstream):
|
||||||
|
"Convert a set of plot instructions to an SVG. Works mininmally."
|
||||||
|
p = Plotter()
|
||||||
|
p.read(instream)
|
||||||
|
p.write(outstream)
|
||||||
|
|
||||||
class Apple410:
|
class Apple410:
|
||||||
"""A simple class for queing up commands for the Apple 410"""
|
"""A simple class for queing up commands for the Apple 410"""
|
||||||
|
@ -158,10 +158,13 @@ class Plotter:
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
sys.stderr.write("Unrecognized command code {}\n".format(cmd_code))
|
sys.stderr.write("Unrecognized command code {}\n".format(cmd_code))
|
||||||
|
|
||||||
p = Plotter()
|
def read(self,inf):
|
||||||
|
for line in inf.readlines():
|
||||||
|
line = line.strip()
|
||||||
|
p.process_cmd(line)
|
||||||
|
|
||||||
for line in sys.stdin.readlines():
|
if __name__=='__main__':
|
||||||
line = line.strip()
|
p = Plotter()
|
||||||
p.process_cmd(line)
|
p.read(sys.stdin)
|
||||||
|
p.write(sys.stdout)
|
||||||
|
|
||||||
p.write(sys.stdout)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user