From 97cad4e003bef906408c3fb7813182392a17c360 Mon Sep 17 00:00:00 2001 From: Logxen Date: Thu, 14 Jun 2012 23:41:54 -0700 Subject: [PATCH] make send_now check that the printer is online before talking to it --- printcore.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/printcore.py b/printcore.py index e0a074a..c03292d 100755 --- a/printcore.py +++ b/printcore.py @@ -209,13 +209,16 @@ class printcore(): def send_now(self,command): """Sends a command to the printer ahead of the command queue, without a checksum """ - if(self.printing): - self.priqueue+=[command] - else: - while not self.clear: - time.sleep(0.001) - self._send(command) - #callback for command sent + if(self.online): + if(self.printing): + self.priqueue+=[command] + else: + while not self.clear: + time.sleep(0.001) + self._send(command) + #callback for command sent + else + print "Not connected to printer." def _print(self): #callback for printing started