g.gui.dbmgr.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env python3
  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. # % keyword: general
  23. # % keyword: GUI
  24. # % keyword: attribute table
  25. # % keyword: database
  26. # %end
  27. # %option G_OPT_V_MAP
  28. # %end
  29. import grass.script as gscript
  30. def main():
  31. options, flags = gscript.parser()
  32. import wx
  33. from grass.script.setup import set_gui_path
  34. set_gui_path()
  35. from dbmgr.manager import AttributeManager
  36. mapName = gscript.find_file(options['map'], element='vector')['fullname']
  37. if not mapName:
  38. gscript.set_raise_on_error(False)
  39. gscript.fatal(_("Vector map <%s> not found") % options['map'])
  40. app = wx.App()
  41. gscript.message(
  42. _("Loading attribute data for vector map <%s>...") %
  43. mapName)
  44. f = AttributeManager(
  45. parent=None,
  46. id=wx.ID_ANY,
  47. base_title=_("Attribute Table Manager - GRASS GIS"),
  48. size=(900, 600),
  49. vectorName=mapName,
  50. )
  51. f.Show()
  52. app.MainLoop()
  53. if __name__ == "__main__":
  54. main()