g.gui.dbmgr.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/env python
  2. ############################################################################
  3. #
  4. # MODULE: g.gui.dbmgr
  5. # AUTHOR(S): Martin Landa <landa.martin gmail.com>
  6. # PURPOSE: Attribute Table Manager
  7. # COPYRIGHT: (C) 2012-2013 by Martin Landa, and the GRASS Development Team
  8. #
  9. # This program is free software; you can 1redistribute it and/or
  10. # modify it under the terms of the GNU General Public License as
  11. # published by the Free Software Foundation; either version 2 of the
  12. # License, or (at your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful, but
  15. # WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. # General Public License for more details.
  18. #
  19. ############################################################################
  20. #%module
  21. #% description: Launches graphical attribute table manager.
  22. #% keywords: general
  23. #% keywords: user interface
  24. #% keywords: GUI
  25. #% keywords: attribute table
  26. #% keywords: database
  27. #%end
  28. #%option G_OPT_V_MAP
  29. #%end
  30. import os
  31. import wx
  32. import grass.script as grass
  33. from core.utils import _, GuiModuleMain
  34. from dbmgr.manager import AttributeManager
  35. def main():
  36. mapName = grass.find_file(options['map'], element = 'vector')['fullname']
  37. if not mapName:
  38. grass.set_raise_on_error(False)
  39. grass.fatal(_("Vector map <%s> not found") % options['map'])
  40. app = wx.App()
  41. grass.message(_("Loading attribute data for vector map <%s>...") % mapName)
  42. f = AttributeManager(parent = None, id = wx.ID_ANY,
  43. title = "%s - <%s>" % (_("GRASS GIS Attribute Table Manager"),
  44. mapName),
  45. size = (900, 600), vectorName = mapName)
  46. f.Show()
  47. app.MainLoop()
  48. if __name__ == "__main__":
  49. options, flags = grass.parser()
  50. GuiModuleMain(main)