Beispiel #1
0
def autoPrint(job):
	if job['autoprint']:
		printer = job['autoprint']
		for (groupnum, gname) in enumerate(job['groupkey']):
			for (dockey, doc) in job['groupfiles'].iteritems():
				if doc:
					printFile(pdfdir + doc, printer )
					print( 'auto printing: Document %s sent to printer %s' % (doc, printer))
Beispiel #2
0
def autoPrint(j):
	if j['autoprint']:
		ptr = j['autoprint']
		default_key = j['groupfiles'].iterkeys().next()[0]
		#key = query_string.get('key', [default_key])[0]
		docf = getJobFile( j, default_key)
		if docf:
			printFile(pdfdir + docf, ptr )
			print( 'auto printing: Document %s sent to printer %s' % (docf, ptr))
Beispiel #3
0
def autoPrint(j):
    if j['autoprint']:
        ptr = j['autoprint']
        default_key = j['groupfiles'].iterkeys().next()[0]
        #key = query_string.get('key', [default_key])[0]
        docf = getJobFile(j, default_key)
        if docf:
            printFile(pdfdir + docf, ptr)
            print('auto printing: Document %s sent to printer %s' %
                  (docf, ptr))
Beispiel #4
0
def printfn(query_string=''):
	job = getJob(query_string)
	default_key = job['groupfiles'].iterkeys().next()[0]
	key = query_string.get('key', [default_key])[0]
	docf = getJobFile( job, key)

	if docf:
		try:		
			printFile(pdfdir + docf, ''.join(query_string['printer']) )
			return doMessage(title='Printing', message='Document %s sent to printer %s<br>' % (docf, query_string['printer']))
		except:
			traceback.print_exc(file=sys.stdout)
	return doMessage(title='Printing', message='Could not find document, problem printing! Source: %s sent to printer %s<br>' % (docf, query_string['printer']))
Beispiel #5
0
def printfn(query_string=''):
    job = getJob(query_string)
    default_key = job['groupfiles'].iterkeys().next()[0]
    key = query_string.get('key', [default_key])[0]
    docf = getJobFile(job, key)

    if docf:
        try:
            printFile(pdfdir + docf, ''.join(query_string['printer']))
            return doMessage(title='Printing',
                             message='Document %s sent to printer %s<br>' %
                             (docf, query_string['printer']))
        except:
            traceback.print_exc(file=sys.stdout)
    return doMessage(
        title='Printing',
        message=
        'Could not find document, problem printing! Source: %s sent to printer %s<br>'
        % (docf, query_string['printer']))
Beispiel #6
0
# schéma : https://cdn-learn.adafruit.com/assets/assets/000/031/833/original/raspberry_pi_gpio-diagram.png?1461025067
GPIO.setmode(GPIO.BCM)
# (possibilité de communiquer via le numéro des pins directement avec)
#GPIO.setmode(GPIO.BOARD)

# Initialisation IN, de la pin GPIO23 (bouton) et GPIO24 (LED).
GPIO.setup(
    23, GPIO.IN, pull_up_down=GPIO.PUD_UP
)  # GPIO.IN -> on écoute sur la pin (INPUT) | pull_up_down=GPIO.PUD_UP -> le raspberry gère ici le pull up pour éviter de lire un input avec des interférences entre 0 et 1
GPIO.setup(
    16, GPIO.OUT
)  # GPIO.OUT -> on envoie sur la pin (OUTPUT), ce qui allumera la LED

try:  # Essaie d'exécuter ce code...

    while True:
        button_state = GPIO.input(
            23
        )  # On lit le statut de la pin 23 et le met dans une variable (soit 1 soit 0)
        if button_state == False:
            print("on a appuyé sur le bouton")
            led.pushedButtonDetected()
            printing.printFile(
            )  # Lance la fonction dans le fichier print.py qui lance l'impression

        else:
            GPIO.output(16, False)  # Garde la LED éteinte

except:  # ... et si tu rencontres une erreur
    GPIO.cleanup()  # Nettoie les ports utilisés