Rewrite python-qrtools using python-qrencode instead of qrencode.

Bug #807756 reported by David Green
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QR Tools
In Progress
Wishlist
David Green

Bug Description

Rewrite python-qrtools to use the python module 'qrencode' instead of accessing the program 'qrencode' with subprocess.

Also, redesign the library to make qr codes immutable (any modifications create a new object). They could be initialised in the following ways:

    QR() #from default webcam
    QR(webcam=...) #from video input device
    QR(file=...) #from file
    QR(image=...) #from pil image
    QR(data=...) #from raw data
    QR(data=..., type=...) #from data

and then methods could be called:

    qr.to_file(file=..., scale=..., margin=...)
    qr.get_image(scale=..., margin=...)
    qr.get_raw_data()
    qr.get_data_type()
    qr.get_data()

Also, the data type system could be cleaned up a lot by using objects or classes to represent types.

Revision history for this message
Ramiro Algozino (algozino) wrote :

I agree, we need to re-think and re-write qrtools, it is kind of messy right now. I like your proposal. In respect of data recognising / decoding we can use the code we are using right now for decoding phonebook data type (that I think you should rename meCard), this line in particular:

    'phonebook': lambda data: dict(re.findall("(.*?):(.*?);", data.replace("MECARD:",""), re.IGNORECASE))

And, instead a dict we can return a list, because, for example, a meCard can have 2 "TEL:" entries. For example return:

[ ['N': 'Algozino Ramiro'], ['TEL', '1111111'], ['TEL', '2222222'], ['EMAIL', '<email address hidden>'] ]

David Green (david4dev)
Changed in qr-tools:
milestone: none → 2.1
Revision history for this message
Ramiro Algozino (algozino) wrote :

The python-qrencode module doesn't seem to be available in Natty's 64 bit repos :-( I had to manually download and install it.

Revision history for this message
David Green (david4dev) wrote :

That's strange - it *should* be in the Universe repository. According to http://packages.ubuntu.com/natty/python-qrencode it is available for i386 and amd64.

Revision history for this message
Ramiro Algozino (algozino) wrote :

Yep, it *should* but Software Center doesn't find it. I've downloaded the packet from that page.

Back to qrtools. I was thinking that it should expose in some manner the data types supported, for example:

>>> QR.DATATYPES
('text', 'email', 'mecard', 'url', ...)

David Green (david4dev)
Changed in qr-tools:
status: New → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.