Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mreiferson committed Sep 30, 2010
1 parent 5703cdf commit 4534e9b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions qrencode.pyx
Expand Up @@ -24,8 +24,8 @@ cdef extern from "qrencode.h":

cdef class Encoder:
default_options = {
'mode' : QR_MODE_AN,
'eclevel': QR_ECLEVEL_L,
'mode' : QR_MODE_8,
'ec_level': QR_ECLEVEL_L,
'width': 400,
'border': 10,
'version': 5,
Expand All @@ -40,8 +40,6 @@ cdef class Encoder:

def encode(self, char *text, options={}):
cdef QRcode *_c_code
cdef int _c_level = QR_ECLEVEL_L
cdef int _c_hint = QR_MODE_8
cdef unsigned char *data

options.update(self.default_options)
Expand All @@ -50,12 +48,12 @@ cdef class Encoder:
w = options.get('width') - border * 2
v = options.get('version')
mode = options.get('mode')
eclevel = options.get('eclevel')
ec_level = options.get('ec_level')
case_sensitive = options.get('case_sensitive')

str_copy = text
str_copy = str_copy + '\0'
_c_code = QRcode_encodeString(str_copy, int(v), _c_level, _c_hint, int(case_sensitive))
_c_code = QRcode_encodeString(str_copy, int(v), int(ec_level), int(mode), int(case_sensitive))

version = _c_code.version
width = _c_code.width
Expand All @@ -68,7 +66,7 @@ cdef class Encoder:
for y in range(width):
line = ''
for x in range(width):
if data[y*width+x] % 2:
if data[y * width + x] % 2:
line += dotsize * chr(0)
else:
line += dotsize * chr(255)
Expand Down

0 comments on commit 4534e9b

Please sign in to comment.