Fix issue with zone_list saving in tile configuration #266
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #265.
After spending some time on this and ending up trying various ideas, this ended up being what I thought was the best and simplest solution. Basically, when
write_tile_cfg
is called, loop through the zones inself.v_["zone_list"]
and compare each zone with the active tile coordinates. If any point (lat, lon) in each zone matches, then we append that to a newtile_zones
list which is then saved to the tile configuration. For future reference (mostly for myself), here's some more details:self.v_["zone_list"]
is atk.StringVar
and has to be converted to a Python stringzone_list
to a set for optimization (faster and removes any duplicate coordinates within a zone)Changes:
write_tile_cfg
is called, only save zones for the selected/active tile.cfg_vars
descriptions for consistency.The bottom two are obviously just clean up and personal preference, but I thought it was a simple but helpful change.