From d35839aa540a2349b5058a734fe6eb3ae9342696 Mon Sep 17 00:00:00 2001 From: Adam Mayer Date: Fri, 8 Dec 2017 22:22:40 -0500 Subject: [PATCH] moving doc directory; breaking out command line method to own file --- apple410/cmdline.py | 36 +++++++++++++++++++++++++++++ {doc => docs}/Apple 401 Plotter.md | 0 {doc => docs}/pm1-5.jpg | Bin {doc => docs}/pm11-15.jpg | Bin {doc => docs}/pm6-10.jpg | Bin 5 files changed, 36 insertions(+) create mode 100644 apple410/cmdline.py rename {doc => docs}/Apple 401 Plotter.md (100%) rename {doc => docs}/pm1-5.jpg (100%) rename {doc => docs}/pm11-15.jpg (100%) rename {doc => docs}/pm6-10.jpg (100%) diff --git a/apple410/cmdline.py b/apple410/cmdline.py new file mode 100644 index 0000000..963b95f --- /dev/null +++ b/apple410/cmdline.py @@ -0,0 +1,36 @@ +import sys +import argparse + +def main(): + parser = argparse.ArgumentParser("apple410", + description="Send a file to an Apple 410 Color Plotter.", + epilog=""" + If you're having trouble sending commands to your plotter, double check + that your baud rate is in agreement with the DIP switches on the back + of your plotter and that your serial port implements hardware flow + control. + """) + parser.add_argument('-d', '--device', default='/dev/ttyUSB0', + help='The serial port that communicates with the plotter') + parser.add_argument('-b', '--baud', default=9600, type=int, + help='The baud rate of the serial port') + parser.add_argument('--svg', action='store_true', + help='Parse input as an SVG file') + parser.add_argument('FILE', + help='The file to send to the plotter. "-" will send commands from standard input.') + args = parser.parse_args() + if args.FILE == "-": + f = sys.stdin + else: + f = open(scr) + if len(sys.argv) > 1: + scr = sys.argv[1] + if args.svg: + print("SVG conversion is not yet implemented!") + sys.exit(1) + a = Apple410(args.device,baud=args.baud) + for line in f.readlines(): + print("Sending {}".format(line.strip())) + a.send(line.strip()) + + diff --git a/doc/Apple 401 Plotter.md b/docs/Apple 401 Plotter.md similarity index 100% rename from doc/Apple 401 Plotter.md rename to docs/Apple 401 Plotter.md diff --git a/doc/pm1-5.jpg b/docs/pm1-5.jpg similarity index 100% rename from doc/pm1-5.jpg rename to docs/pm1-5.jpg diff --git a/doc/pm11-15.jpg b/docs/pm11-15.jpg similarity index 100% rename from doc/pm11-15.jpg rename to docs/pm11-15.jpg diff --git a/doc/pm6-10.jpg b/docs/pm6-10.jpg similarity index 100% rename from doc/pm6-10.jpg rename to docs/pm6-10.jpg