Skip to content

Commit

Permalink
Merge pull request #37 from mraspaud/fix-minor-is-tick-type
Browse files Browse the repository at this point in the history
Fix the add overlay function to accept `minor_is_tick` as a boolean
  • Loading branch information
mraspaud authored Nov 7, 2019
2 parents 60a725e + c0f11e0 commit 46dc1f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pycoast/cw_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,9 +850,9 @@ def add_overlay_from_dict(self, overlays, area_def, cache_epoch=None, background
font = truetype(font, font_size)
fill = overlays['grid'].get('fill', None)
minor_outline = overlays['grid'].get('minor_outline', 'white')
minor_is_tick = overlays['grid'].get('minor_is_tick',
'true').lower() in \
['true', 'yes', '1']
minor_is_tick = overlays['grid'].get('minor_is_tick', True)
if isinstance(minor_is_tick, str):
minor_is_tick = minor_is_tick.lower() in ['true', 'yes', '1']
lon_placement = overlays['grid'].get('lon_placement', 'tb')
lat_placement = overlays['grid'].get('lat_placement', 'lr')

Expand Down
7 changes: 7 additions & 0 deletions pycoast/tests/test_pycoast.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,13 @@ def test_cache(self):
self.assertNotEqual(os.path.getmtime(cache_filename), mtime)
self.assertTrue(fft_metric(euro_data, res),
'Writing of contours failed')

overlays.pop('cache')
overlays['grid'] = {'outline': (255, 255, 255), 'outline_opacity': 175,
'minor_outline': (200, 200, 200), 'minor_outline_opacity': 127,
'width': 1.0, 'minor_width': 0.5, 'minor_is_tick': True,
'write_text': True, 'lat_placement': 'lr', 'lon_placement': 'b'}
img = cw.add_overlay_from_dict(overlays, area_def)
os.remove(os.path.join(tmp, 'pycoast_cache_fakearea.png'))

def test_get_resolution(self):
Expand Down

0 comments on commit 46dc1f2

Please sign in to comment.