Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with zone_list saving in tile configuration #266

Closed
wants to merge 2 commits into from

Conversation

shred86
Copy link

@shred86 shred86 commented Jun 10, 2024

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 in self.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 new tile_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 a tk.StringVar and has to be converted to a Python string
  • The string is then converted to a list so it can be iterated
  • Convert zone_list to a set for optimization (faster and removes any duplicate coordinates within a zone)
  • Check if the active coords (longitude + 1 since the active coordinates are based on the SW corner) are in the set
  • Finally, write the matching zones to the configuration file

Changes:

  • When write_tile_cfg is called, only save zones for the selected/active tile.
  • Clean up some cfg_vars descriptions for consistency.
  • Added feedback (console output) when configuration window buttons (Load Tile Config, Write Tile Config, etc.) are used.

The bottom two are obviously just clean up and personal preference, but I thought it was a simple but helpful change.

@shred86
Copy link
Author

shred86 commented Jun 16, 2024

Incorporated into #269

@shred86 shred86 closed this Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: zone_list being added to wrong tile configuration
1 participant