Ajout de l'option d'agraphage.

darcs-hash:20060331191131-9e428-c680b9bab50fd49ba38867675ae6efdc47807ca4.gz
This commit is contained in:
bobot 2006-03-31 21:11:31 +02:00
parent c0e9ff0c7b
commit 0ce3abd2d4

View file

@ -52,6 +52,7 @@ class fichier_impression:
couleur = True
cout = 0.0
portrait = True
agraphe=0 #-1 : agraphe diagonale, 0 : pas d'agraphe, 1 : 1 agraphe parallele, 2: 2 agraphes, 3: 3 agraphes, 6: 6 agraphes(stitching)
user = ""
user_ldap = None # sera une instance de l'utilisateur dans la base ldap.
imprime = -1 #-2 impression en suspend, -1 mise dans la file
@ -158,6 +159,22 @@ class fichier_impression:
#options += ' -o job-sheets=crans' #page de garde de type standard
options += " -o job-billing=%.2f" % self.cout
#Indique la présence d'un ba de sortie avec agrapheuse
options += " -o Option20=MBMStaplerStacker -o OutputBin=StackerDown"
if self.agraphe==-1:
options += ' -o StapleLocation=1diagonal'
elif self.agraphe==0:
options += ' -o StapleLocation=None'
elif self.agraphe==1:
options += ' -o StapleLocation=1parallel'
elif self.agraphe==2:
options += ' -o StapleLocation=2parallel'
elif self.agraphe==3:
options += ' -o StapleLocation=3parallel'
elif self.agraphe==6:
options += ' -o StapleLocation=Stitching'
if self.transparent:
options += ' -o InputSlot=Tray1 -o Media=Transparency'
if self.taille == 'A4':
@ -248,7 +265,7 @@ class fichier_impression:
"transparent", "couleur", "cout",
"portrait", "user", "imprime",
"nom_fichier_pdf", "nom_fichier_desc",
"code", "modif_epoch", "job_id"):
"code", "modif_epoch", "job_id","agraphe"):
file_obj_desc.write(key+"="+str(getattr(self,key))+"\n")
file_obj_desc.close()
except Exception, inst :
@ -263,20 +280,24 @@ class fichier_impression:
if parse[1] == 'None':
setattr(self,parse[0],None)
else:
#pour les attributs strings
if parse[0] in ("nom_job", "taille", "user",
"nom_fichier_pdf", "nom_fichier_desc",
"job_id"):
setattr(self,parse[0],parse[1])
else:
#pour les attributs entiers
if parse[0] in ("nbr_pages", "nb_copie",
"imprime", "code"):
"imprime", "code","agraphe"):
setattr(self,parse[0],int(parse[1]))
else:
#pour les attributs boolean
if parse[0] in ("recto_verso", "transparent",
"couleur", "portrait",
"erreur_critique"):
setattr(self,parse[0],(parse[1] == 'True'))
else:
#pour les attributs flottants
if parse[0] in ("cout", "modif_epoch"):
setattr(self, parse[0], float(parse[1]))
else:
@ -308,6 +329,14 @@ class fichier_impression:
'portrait': 'Portrait',
'recto_verso' : 'Recto-Verso',
'erreur_critique' : "Problème survenu" }
dict_agraphe = { -1 : "agraphe en diagonale",
0 : "aucune agraphe",
1 : "1 agraphe parallele",
2 : "reliure 2 agraphe",
3 : "reliure 3 agraphe",
6 : "reliure 6 agraphe" }
corps = "<TABLE BORDER=0 CELLPADDDING=2>\n<TR><th ALIGN=CENTER COLSPAN=2><U>%s</U></th><td ALIGN=RIGHT>%s</TR>\n" % (self.nom_job, time.ctime(0.0))
corps += "<TR><td>\n<TABLE BORDER=2 RULES=ROWS CELLPADDDING=0>\n"
@ -318,6 +347,7 @@ class fichier_impression:
self.code = self.code[:-1]
corps += "</TABLE>\n</td>\n<td>\n<TABLE BORDER=2 RULES=ROWS CELLPADDDING=0>\n"
corps += '<TR><td>%s</td></TR>\n' % dict_agraphe[self.agraphe]
for key in ("couleur", "transparent",
"portrait", "recto_verso"):
if getattr(self, key):