Skip to content

Commit

Permalink
Support for python 3 (fix #23), release 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Zverik committed Jun 1, 2016
1 parent 3415338 commit a74939f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Nik4 Change History

## *master*
## 1.6, 1.06.2016

* `--version` option.
* Added `--fonts` option for registering additional fonts. [#16](https://github.com/Zverik/Nik4/issues/16)
* Fixed `--center` with `--scale` error. [#18](https://github.com/Zverik/Nik4/issues/18)
* Swapped sizes 4A0 and 2A0. [#17](https://github.com/Zverik/Nik4/issues/17)
* Support Python 3. [#23](https://github.com/Zverik/Nik4/issues/23)

## 1.5, 7.12.2014

Expand Down
22 changes: 11 additions & 11 deletions nik4.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
except ImportError:
HAS_CAIRO = False

VERSION = '1.5.2'
VERSION = '1.6'
TILE_BUFFER = 128
IM_MONTAGE = 'montage'

Expand Down Expand Up @@ -376,12 +376,12 @@ def add_fonts(path):
select_layers(m, options.add_layers.split(',') if options.add_layers else [], options.hide_layers.split(',') if options.hide_layers else [])

if options.debug:
print 'scale={}'.format(scale)
print 'scale_factor={}'.format(scale_factor)
print 'size={},{}'.format(size[0], size[1])
print 'bbox={}'.format(bbox)
print 'bbox_wgs84={}'.format(transform.backward(bbox) if bbox else None)
print 'layers=' + ','.join([l.name for l in m.layers if l.active])
print('scale={}'.format(scale))
print('scale_factor={}'.format(scale_factor))
print('size={},{}'.format(size[0], size[1]))
print('bbox={}'.format(bbox))
print('bbox_wgs84={}'.format(transform.backward(bbox) if bbox else None))
print('layers=' + ','.join([l.name for l in m.layers if l.active]))

# generate metadata
if options.ozi:
Expand Down Expand Up @@ -424,14 +424,14 @@ def add_fonts(path):
m.buffer_size = TILE_BUFFER
tile_cnt = [int(math.ceil(1.0 * size[0] / width)), int(math.ceil(1.0 * size[1] / height))]
if options.debug:
print 'tile_count={},{}'.format(tile_cnt[0], tile_cnt[1])
print 'tile_size={},{}'.format(width, height)
print('tile_count={},{}'.format(tile_cnt[0], tile_cnt[1]))
print('tile_size={},{}'.format(width, height))
tmp_tile = '{:02d}_{:02d}_{}'
tile_files = []
for row in range(0, tile_cnt[1]):
for column in range(0, tile_cnt[0]):
if options.debug:
print 'tile={},{}'.format(row, column)
print('tile={},{}'.format(row, column))
tile_bbox = mapnik.Box2d(bbox.minx + 1.0 * width * scale * column, bbox.maxy - 1.0 * height * scale * row, bbox.minx + 1.0 * width * scale * (column + 1), bbox.maxy - 1.0 * height * scale * (row + 1))
tile_size = [width if column < tile_cnt[0] - 1 else size[0] - width * (tile_cnt[0] - 1), height if row < tile_cnt[1] - 1 else size[1] - height * (tile_cnt[1] - 1)]
m.zoom_to_box(tile_bbox)
Expand Down Expand Up @@ -465,5 +465,5 @@ def add_fonts(path):
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)

outfile.seek(0)
print outfile.read()
print(outfile.read())
outfile.close()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='Nik4',
version='1.5.2',
version='1.6.0',
license='WTFPL',
description='Command-line interface to a Mapnik rendering toolkit',
long_description="""
Expand Down

0 comments on commit a74939f

Please sign in to comment.