mapsets_picker.py 542 B

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