Commit 1bd51e92 authored by D1plo1d's avatar D1plo1d

Moving the prontserve initialization inside __main__

parent 7d797b75
...@@ -521,32 +521,33 @@ class PrintJobQueue(EventEmitter): ...@@ -521,32 +521,33 @@ class PrintJobQueue(EventEmitter):
# Server Start Up # Server Start Up
# ------------------------------------------------- # -------------------------------------------------
parser = argparse.ArgumentParser( if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='Runs a 3D printer server using the Construct Protocol' description='Runs a 3D printer server using the Construct Protocol'
) )
parser.add_argument('--dry-run', default=False, action='store_true', parser.add_argument('--dry-run', default=False, action='store_true',
help='Does not connect to the 3D printer' help='Does not connect to the 3D printer'
) )
args = parser.parse_args() args = parser.parse_args()
dry_run = args.dry_run dry_run = args.dry_run
def warn_if_dry_run(): def warn_if_dry_run():
if dry_run: if dry_run:
for i in range(0,7): for i in range(0,7):
sys.stdout.write("\x1B[0;33m Dry Run \x1B[0m") sys.stdout.write("\x1B[0;33m Dry Run \x1B[0m")
print "" print ""
print "Prontserve is starting..." print "Prontserve is starting..."
prontserve = Prontserve(dry_run=dry_run) prontserve = Prontserve(dry_run=dry_run)
if dry_run==False: prontserve.do_connect("") if dry_run==False: prontserve.do_connect("")
time.sleep(1) time.sleep(1)
prontserve.run_sensor_loop() prontserve.run_sensor_loop()
prontserve.run_print_queue_loop() prontserve.run_print_queue_loop()
if __name__ == "__main__":
application.listen(8888) application.listen(8888)
print "\n"+"-"*80 print "\n"+"-"*80
welcome = textwrap.dedent(u""" welcome = textwrap.dedent(u"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment