On arrange un peu ce que l'imprimante nous dit.
darcs-hash:20061001210145-68412-526fa4c826bb58d1f313a493eab51b3eebb9b5ea.gz
This commit is contained in:
parent
8803111d26
commit
4ce327d99f
1 changed files with 11 additions and 4 deletions
|
@ -6,17 +6,24 @@ sys.path.append("/usr/scripts/gestion")
|
||||||
|
|
||||||
import hptools
|
import hptools
|
||||||
|
|
||||||
|
dico = {
|
||||||
|
"PrÁt": u"Prêt",
|
||||||
|
"Pr menus, appuy \x1e": u"",
|
||||||
|
}
|
||||||
|
|
||||||
def etat():
|
def etat():
|
||||||
""" Renvoie une liste des differents ecrans actuels du display de l'imprimante """
|
""" Renvoie une liste des differents ecrans actuels du display de l'imprimante """
|
||||||
liste_oid = ["mib-2.43.16.5.1.2.1.1","mib-2.43.16.5.1.2.1.2","mib-2.43.16.5.1.2.1.3","mib-2.43.16.5.1.2.1.4","mib-2.43.16.5.1.2.1.5"]
|
liste_oid = ["mib-2.43.16.5.1.2.1.1","mib-2.43.16.5.1.2.1.2","mib-2.43.16.5.1.2.1.3","mib-2.43.16.5.1.2.1.4","mib-2.43.16.5.1.2.1.5"]
|
||||||
try:
|
try:
|
||||||
comm = hptools.snmp(host="laserjet.adm.crans.org",version="1",community="public")
|
comm = hptools.snmp(host="laserjet.adm.crans.org",version="1",community="public")
|
||||||
liste_mssg = []
|
liste_msg = []
|
||||||
for oid in liste_oid:
|
for oid in liste_oid:
|
||||||
liste_mssg += [comm.get_string(oid)]
|
msg = comm.get_string(oid)
|
||||||
|
msg = dico.get(msg, msg).encode("ISO-8859-1")
|
||||||
|
if msg: liste_msg.append(msg)
|
||||||
except Exception,err:
|
except Exception,err:
|
||||||
liste_mssg = [unicode(err)]*len(liste_oid)
|
liste_msg.append("[%s]" % unicode(err))
|
||||||
return liste_mssg
|
return liste_msg
|
||||||
|
|
||||||
def enregistre(filename="/usr/script/impression/imprimante.etat"):
|
def enregistre(filename="/usr/script/impression/imprimante.etat"):
|
||||||
l = etat()
|
l = etat()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue