Commit fe1cc166 authored by Guillaume Seguin's avatar Guillaume Seguin

Merge branch 'experimental' of github.com:kliment/Printrun into experimental

parents fc43d553 c4f61a4a
...@@ -103,6 +103,9 @@ class printcore(): ...@@ -103,6 +103,9 @@ class printcore():
self.read_thread.join() self.read_thread.join()
self.read_thread = None self.read_thread = None
self._stop_sender() self._stop_sender()
if self.print_thread:
self.printing = False
self.print_thread.join()
try: try:
self.printer.close() self.printer.close()
except socket.error: except socket.error:
...@@ -426,7 +429,7 @@ class printcore(): ...@@ -426,7 +429,7 @@ class printcore():
traceback.print_exc() traceback.print_exc()
finally: finally:
self.print_thread = None self.print_thread = None
self._start_sender() if self.stop_send_thread == False: self._start_sender()
#now only "pause" is implemented as host command #now only "pause" is implemented as host command
def processHostCommand(self, command): def processHostCommand(self, command):
......
...@@ -461,7 +461,12 @@ class pronsole(cmd.Cmd): ...@@ -461,7 +461,12 @@ class pronsole(cmd.Cmd):
except: except:
pass pass
return baselist+glob.glob('/dev/ttyUSB*') + glob.glob('/dev/ttyACM*') +glob.glob("/dev/tty.*")+glob.glob("/dev/cu.*")+glob.glob("/dev/rfcomm*") for g in ['/dev/ttyUSB*', '/dev/ttyACM*', "/dev/tty.*", "/dev/cu.*", "/dev/rfcomm*"]:
baselist+=glob.glob(g)
return filter(self._bluetoothSerialFilter, baselist)
def _bluetoothSerialFilter(self, serial):
return not ("Bluetooth" in serial or "FireFly" in serial)
def online(self): def online(self):
self.log("\rPrinter is now online") self.log("\rPrinter is now online")
......
...@@ -558,6 +558,10 @@ if __name__ == "__main__": ...@@ -558,6 +558,10 @@ if __name__ == "__main__":
help='Does not connect to the 3D printer' help='Does not connect to the 3D printer'
) )
parser.add_argument('--loud', default=False, action='store_true',
help='Enables verbose printer output'
)
args = parser.parse_args() args = parser.parse_args()
dry_run = args.dry_run dry_run = args.dry_run
...@@ -567,27 +571,40 @@ if __name__ == "__main__": ...@@ -567,27 +571,40 @@ if __name__ == "__main__":
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..."
prontserve = Prontserve(dry_run=dry_run) prontserve = Prontserve(dry_run=dry_run)
if dry_run==False: prontserve.do_connect("") prontserve.p.loud = args.loud
time.sleep(1)
prontserve.run_sensor_loop()
prontserve.run_print_queue_loop()
application.listen(8888)
print "\n"+"-"*80
welcome = textwrap.dedent(u"""
+---+ \x1B[0;32mProntserve: Your printer just got a whole lot better.\x1B[0m
| \u2713 | Ready to print.
+---+ More details at http://localhost:8888/""")
warn_if_dry_run()
sys.stdout.write(welcome)
print "\n"
warn_if_dry_run()
print "-"*80 + "\n"
try: try:
if dry_run==False:
prontserve.do_connect("")
if prontserve.p.printer == None: sys.exit(1)
print "Connecting to printer..."
for x in range(0,50-1):
if prontserve.p.online == True: break
sys.stdout.write(".")
sys.stdout.flush()
time.sleep(0.1)
print ""
if prontserve.p.online == False:
print "Unable to connect to printer: Connection timed-out."
sys.exit(1)
time.sleep(1)
prontserve.run_sensor_loop()
prontserve.run_print_queue_loop()
application.listen(8888)
print "\n"+"-"*80
welcome = textwrap.dedent(u"""
+---+ \x1B[0;32mProntserve: Your printer just got a whole lot better.\x1B[0m
| \u2713 | Ready to print.
+---+ More details at http://localhost:8888/""")
warn_if_dry_run()
sys.stdout.write(welcome)
print "\n"
warn_if_dry_run()
print "-"*80 + "\n"
prontserve.ioloop.start() prontserve.ioloop.start()
except: except:
prontserve.p.disconnect() prontserve.p.disconnect()
...@@ -89,5 +89,3 @@ def interceptor(func): ...@@ -89,5 +89,3 @@ def interceptor(func):
cls._execute = wrapper(cls._execute) cls._execute = wrapper(cls._execute)
return cls return cls
return classwrapper return classwrapper
print "moo"
\ No newline at end of file
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