mapsets_picker.py 582 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env python3
  2. import wx
  3. from grass.script.setup import set_gui_path
  4. set_gui_path()
  5. # Imports require path to GUI code to be set.
  6. from core.gcmd import RunCommand # noqa: E402
  7. from gui_core.preferences import MapsetAccess # noqa: E402
  8. def main():
  9. app = wx.App()
  10. dlg = MapsetAccess(parent=None)
  11. dlg.CenterOnScreen()
  12. if dlg.ShowModal() == wx.ID_OK:
  13. ms = dlg.GetMapsets()
  14. RunCommand(
  15. "g.mapsets", parent=None, mapset="%s" % ",".join(ms), operation="set"
  16. )
  17. dlg.Destroy()
  18. if __name__ == "__main__":
  19. main()