Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kliment/Printrun.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorD1plo1d <d1plo1d@d1plo1d.com>2013-06-12 07:51:20 +0400
committerD1plo1d <d1plo1d@d1plo1d.com>2013-06-12 07:51:20 +0400
commit9c55957e64d6471fd495878b28958cc61c2df1c9 (patch)
tree53ace08cadcf119d01d8e082bfc8a94ee0557d59 /printcore.py
parent2e10c296d6de6bf6f8576ba8efd3f1eaf5b88216 (diff)
Patching disconnect to stop the print_thread
By setting printing to false and not restarting the sender thread when the print_thread exits in the disconnect method this should allow printcore to disconnect even if the print thread is running. In particular this makes it possible to ctrl+c out of prontserve durring an m109 where it previously errored out and hung with the following error: Can't read from printer (disconnected?) (SerialException): device reports readiness to read but returned no data (device disconnected?)
Diffstat (limited to 'printcore.py')
-rwxr-xr-xprintcore.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/printcore.py b/printcore.py
index f906335..f74d0fb 100755
--- a/printcore.py
+++ b/printcore.py
@@ -103,6 +103,9 @@ class printcore():
self.read_thread.join()
self.read_thread = None
self._stop_sender()
+ if self.print_thread:
+ self.printing = False
+ self.print_thread.join()
try:
self.printer.close()
except socket.error:
@@ -426,7 +429,7 @@ class printcore():
traceback.print_exc()
finally:
self.print_thread = None
- self._start_sender()
+ if self.stop_send_thread == False: self._start_sender()
#now only "pause" is implemented as host command
def processHostCommand(self, command):