From 8590c5716cbabeac81a57c5a0bd3600d281e06f9 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Mon, 21 Jun 2010 10:51:03 +0200 Subject: [PATCH] Corretto baco nella visualizzazione della coda di stampa. --- DrPrintBackend.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/DrPrintBackend.py b/DrPrintBackend.py index 679a082..7905158 100644 --- a/DrPrintBackend.py +++ b/DrPrintBackend.py @@ -40,12 +40,25 @@ class Backend(gobject.GObject): stdin, stdout, stderr = client.exec_command("lpq -P%s" % printer) output = stdout.read() + print output + # Parse output jobs = [] - for line in re.findall(r"(\d+)\w*\s+(\w+)\s+(\d+)\s+(.+)\s+(\d+) bytes", + for line in re.findall(r"active\s+(\w+)\s+(\d+)\s+(.+)\s+(\d+) bytes", output): + job = { + 'position': 1, + 'user': line[0], + 'id': line[1], + 'filename': line[2], + 'size': line[3], + } + jobs.append (job) + + for line in re.findall(r"(\d)\w*\s+(\w+)\s+(\d+)\s+(.+)\s+(\d+) bytes", output): + pos = int(line[0]) + 1 job = { - 'position': int(line[0]), + 'position': pos, 'user': line[1], 'id': line[2], 'filename': line[3].strip(), -- 2.1.4