g.gui.psmap.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env python
  2. ############################################################################
  3. #
  4. # MODULE: g.gui.psmap
  5. # AUTHOR(S): Anna Kratochvilova <kratochanna gmail.com>
  6. # PURPOSE: Cartographic Composer
  7. # COPYRIGHT: (C) 2011-2012 by Anna Kratochvilova, and the GRASS Development Team
  8. #
  9. # This program is free software; you can redistribute 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: Tool for creating hardcopy map outputs.
  22. #% keywords: general
  23. #% keywords: gui
  24. #% keywords: printing
  25. #%end
  26. #%option G_OPT_F_INPUT
  27. #% key: file
  28. #% label: File containing mapping instructions to load
  29. #% description: See ps.map manual for details
  30. #% key_desc: name
  31. #% required: no
  32. #%end
  33. import os
  34. import sys
  35. import gettext
  36. import wx
  37. import grass.script as grass
  38. sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
  39. from core.globalvar import CheckWxVersion
  40. from psmap.frame import PsMapFrame
  41. from psmap.instructions import Instruction
  42. def main():
  43. gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)
  44. app = wx.PySimpleApp()
  45. if not CheckWxVersion([2, 9]):
  46. wx.InitAllImageHandlers()
  47. frame = PsMapFrame(parent = None)
  48. frame.Show()
  49. if options['file']:
  50. frame.LoadFile(options['file'])
  51. app.MainLoop()
  52. if __name__ == "__main__":
  53. options, flags = grass.parser()
  54. main()