Des sendall partout
LE protocole spcifi darcs-hash:20050610074844-c3cc4-8de5d7781cd2b6c3539cca8aa99064af5b0db98f.gz
This commit is contained in:
parent
3b92540742
commit
dd70640b4c
1 changed files with 6 additions and 6 deletions
|
@ -23,17 +23,17 @@ class hp9500:
|
||||||
"""Ouvre la connexion vers l'imprimante"""
|
"""Ouvre la connexion vers l'imprimante"""
|
||||||
|
|
||||||
if not self.__douille:
|
if not self.__douille:
|
||||||
self.__douille = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.__douille = socket.socket(socket.AF_INET, socket.SOCK_STREAM,socket.IPPROTO_TCP)
|
||||||
self.__douille.connect((self.hostname, self.port))
|
self.__douille.connect((self.hostname, self.port))
|
||||||
#delai d'attente pour la réception des données
|
#delai d'attente pour la réception des données
|
||||||
self.__douille.settimeout(30)
|
self.__douille.settimeout(30)
|
||||||
self.__douille.send(self.UEL+"@PJL\n")
|
self.__douille.sendall(self.UEL+"@PJL\n")
|
||||||
|
|
||||||
def cx_close(self):
|
def cx_close(self):
|
||||||
"""Ferme la connexion vers l'imprimante"""
|
"""Ferme la connexion vers l'imprimante"""
|
||||||
|
|
||||||
if self.__douille:
|
if self.__douille:
|
||||||
self.__douille.send(self.UEL+"\n")
|
self.__douille.sendall(self.UEL+"\n")
|
||||||
self.__douille.close()
|
self.__douille.close()
|
||||||
self.__douille=None
|
self.__douille=None
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class hp9500:
|
||||||
|
|
||||||
command=str(command)
|
command=str(command)
|
||||||
command="@PJL " + command + "\n"
|
command="@PJL " + command + "\n"
|
||||||
self.__douille.send(command)
|
self.__douille.sendall(command)
|
||||||
|
|
||||||
#debug
|
#debug
|
||||||
print command
|
print command
|
||||||
|
@ -91,7 +91,7 @@ class hp9500:
|
||||||
return "ERREUR : la connexion vers l'imprimante n'est pas ouverte"
|
return "ERREUR : la connexion vers l'imprimante n'est pas ouverte"
|
||||||
|
|
||||||
fichier=open(filename)
|
fichier=open(filename)
|
||||||
self.__douille.sendall(fichier.read())
|
self.__douille.sendall(fichier.read()+"\n@PJL"*1024)
|
||||||
fichier.close()
|
fichier.close()
|
||||||
|
|
||||||
def write_postscript(self,filename, name, display):
|
def write_postscript(self,filename, name, display):
|
||||||
|
@ -108,7 +108,7 @@ class hp9500:
|
||||||
self.pjl_command('JOB DISPLAY=\"%s\" NAME=\"%s\"' % (display,name))
|
self.pjl_command('JOB DISPLAY=\"%s\" NAME=\"%s\"' % (display,name))
|
||||||
self.pjl_command('ENTER LANGUAGE = POSTSCRIPT ')
|
self.pjl_command('ENTER LANGUAGE = POSTSCRIPT ')
|
||||||
self.write_file(filename)
|
self.write_file(filename)
|
||||||
self.__douille.send(self.UEL+"@PJL EOJ NAME=\"%s\"\n" % (name))
|
self.__douille.sendall(self.UEL+"@PJL EOJ NAME=\"%s\"\n" % (name))
|
||||||
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue