g.gui.gmodeler.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env python
  2. ############################################################################
  3. #
  4. # MODULE: Graphical Modeler
  5. # AUTHOR(S): Martin Landa <landa.martin gmail.com>
  6. # PURPOSE: Graphical Modeler to create, edit, and manage models
  7. # COPYRIGHT: (C) 2010-2012 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: Allows to interactively create, edit and manage models.
  22. #% keywords: general
  23. #% keywords: gui
  24. #% keywords: graphical modeler
  25. #% keywords: workflow
  26. #%end
  27. #%option G_OPT_F_INPUT
  28. #% key: file
  29. #% description: Name of model file to be loaded
  30. #% key_desc: name.gxm
  31. #% required: no
  32. #% guisection: Model
  33. #%end
  34. import os
  35. import sys
  36. import wx
  37. import gettext
  38. import grass.script as grass
  39. sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
  40. from core.giface import StandaloneGrassInterface
  41. from gmodeler.frame import ModelFrame
  42. def main():
  43. import gettext
  44. gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)
  45. app = wx.PySimpleApp()
  46. wx.InitAllImageHandlers()
  47. frame = ModelFrame(parent = None, giface = StandaloneGrassInterface())
  48. if options['file']:
  49. frame.LoadModelFile(options['file'])
  50. frame.Show()
  51. app.MainLoop()
  52. if __name__ == "__main__":
  53. options, flags = grass.parser()
  54. main()