filter_hp: début de proprification
This commit is contained in:
parent
a16ab6f9d7
commit
fd86e567a9
2 changed files with 44 additions and 40 deletions
|
@ -10,7 +10,7 @@ et ton adhésion annuelle s'achève le {{ fin_adhesion|date }}.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
Pour réadhérer ou prolonger ta connexion, tu peux nous retrouver
|
Pour réadhérer ou prolonger ta connexion, tu peux nous retrouver
|
||||||
lors d'une de nos permanences. Les horaires actuels sont disponibles à
|
lors d'une de nos permanences. Les horaires actuels sont disponibles à
|
||||||
l'adresse http://www.crans.org/PermanencesCrans .
|
l'adresse www.crans.org/PermanencesCrans .
|
||||||
|
|
||||||
La cotisation à l'année (adhésion et connexion) s'élève à 50€. La réadhésion
|
La cotisation à l'année (adhésion et connexion) s'élève à 50€. La réadhésion
|
||||||
seule s'élève à 10€ par an auxquels s'ajoutent 5€ par mois de connectivité.
|
seule s'élève à 10€ par an auxquels s'ajoutent 5€ par mois de connectivité.
|
||||||
|
|
|
@ -6,6 +6,22 @@ import sys
|
||||||
|
|
||||||
DEFAULT_BAC = 7
|
DEFAULT_BAC = 7
|
||||||
|
|
||||||
|
PUNCH_DRV2PCL_OPTS = {
|
||||||
|
"2HolePunchLeft": "LEFT_2PT_DIN",
|
||||||
|
"2HolePunchRight": "RIGHT_2PT_DIN",
|
||||||
|
"2HolePunchTop": "TOP_2PT_DIN",
|
||||||
|
"2HolePunchBottom": "BT_2PT_DIN",
|
||||||
|
"4HolePunchLeft": "LEFT_4PT_DIN",
|
||||||
|
"4HolePunchRight": "RIGHT_4PT_DIN",
|
||||||
|
}
|
||||||
|
|
||||||
|
STAPLE_DRV2PCL_OPTS = {
|
||||||
|
"TopLeft": "LEFT_1PT_ANGLED",
|
||||||
|
"TopRight": "RIGHT_1PT_ANGLED",
|
||||||
|
"Left": "LEFT_2PT",
|
||||||
|
"Right": "RIGHT_2PT",
|
||||||
|
}
|
||||||
|
|
||||||
# Commande ghostscript de conversion en PCL
|
# Commande ghostscript de conversion en PCL
|
||||||
params = ['gs', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pxlmono',
|
params = ['gs', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pxlmono',
|
||||||
#'-sPAPERSIZE=A4',
|
#'-sPAPERSIZE=A4',
|
||||||
|
@ -71,50 +87,38 @@ def tweak(source, dest, **opt_):
|
||||||
break
|
break
|
||||||
dest.write(x)
|
dest.write(x)
|
||||||
|
|
||||||
|
def parse_opt(argv):
|
||||||
|
"""Parse les arguments à la cups depuis un argv, pour usage dans tweak."""
|
||||||
|
backend = argv[0]
|
||||||
|
jobid = int(argv[1])
|
||||||
|
cupsuser = argv[2]
|
||||||
|
jobname = argv[3]
|
||||||
|
copies = int(argv[4])
|
||||||
|
options = argv[5].split(' ')
|
||||||
|
filename = (argv[6:] or ['-'])[0]
|
||||||
|
|
||||||
|
opt = {
|
||||||
|
'filename': filename,
|
||||||
|
'jobname': jobname,
|
||||||
|
'copies': copies,
|
||||||
|
}
|
||||||
|
opt['jobname'] = argv[3]
|
||||||
|
|
||||||
|
|
||||||
|
# Pour les options supplémentaires
|
||||||
|
for entry in options:
|
||||||
|
key, value = options.split("=", 1)
|
||||||
|
if key == "HPPunchingOptions":
|
||||||
|
opt['hole'] = PUNCH_DRV2PCL_OPTS[value]
|
||||||
|
if key == "HPStaplerOptions":
|
||||||
|
opt['staple'] = STAPLE_DRV2PCL_OPTS[value]
|
||||||
|
return opt
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
opt = {}
|
opt = parse_opt(sys.argv)
|
||||||
try:
|
|
||||||
opt['jobname'] = sys.argv[3]
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Pour le nombre de copies
|
proc = subprocess.Popen(params + [opt['filename']],
|
||||||
|
|
||||||
opt['copies'] = int(sys.argv[4])
|
|
||||||
|
|
||||||
# Pour les agraphes et les trous
|
|
||||||
|
|
||||||
optns = sys.argv[5].split()
|
|
||||||
for options in optns:
|
|
||||||
option = options.split("=")
|
|
||||||
if option[0]=="HPPunchingOptions":
|
|
||||||
if option[1]=="2HolePunchLeft":
|
|
||||||
opt['hole']= "LEFT_2PT_DIN"
|
|
||||||
elif option[1]=="2HolePunchRight":
|
|
||||||
opt['hole']= "RIGHT_2PT_DIN"
|
|
||||||
elif option[1]=="2HolePunchTop":
|
|
||||||
opt['hole']= "TOP_2PT_DIN"
|
|
||||||
elif option[1]=="2HolePunchBottom":
|
|
||||||
opt['hole']= "BT_2PT_DIN"
|
|
||||||
elif option[1]=="4HolePunchLeft":
|
|
||||||
opt['hole']= "LEFT_4PT_DIN"
|
|
||||||
elif option[1]=="4HolePunchRight":
|
|
||||||
opt['hole']= "RIGHT_4PT_DIN"
|
|
||||||
if option[0]=="HPStaplerOptions":
|
|
||||||
if option[1]=="TopLeft":
|
|
||||||
opt['staple']= "LEFT_1PT_ANGLED"
|
|
||||||
elif option[1]=="TopRight":
|
|
||||||
opt['staple']= "RIGHT_1PT_ANGLED"
|
|
||||||
elif option[1]=="Left":
|
|
||||||
opt['staple']= "LEFT_2PT"
|
|
||||||
elif option[1]=="Right":
|
|
||||||
opt['staple']= "RIGHT_2PT"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fname = '-'
|
|
||||||
proc = subprocess.Popen(params + [fname],
|
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
stdin=sys.stdin)
|
stdin=sys.stdin)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue