g.gui.gmodeler.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/usr/bin/env python
  2. ############################################################################
  3. #
  4. # MODULE: g.gui.gmodeler
  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. #% label: Graphical Modeler.
  22. #% description: Allows to interactively create, edit and manage models.
  23. #% keywords: general
  24. #% keywords: GUI
  25. #% keywords: graphical modeler
  26. #% keywords: workflow
  27. #%end
  28. #%option G_OPT_F_INPUT
  29. #% key: file
  30. #% description: Name of model file to be loaded
  31. #% key_desc: name.gxm
  32. #% required: no
  33. #% guisection: Model
  34. #%end
  35. import os
  36. import sys
  37. import wx
  38. import grass.script as grass
  39. gui_wx_path = os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython')
  40. if gui_wx_path not in sys.path:
  41. sys.path.append(gui_wx_path)
  42. from core.giface import StandaloneGrassInterface
  43. from core.globalvar import CheckWxVersion
  44. from core.utils import _
  45. from gmodeler.frame import ModelFrame
  46. def main():
  47. app = wx.PySimpleApp()
  48. if not CheckWxVersion([2, 9]):
  49. wx.InitAllImageHandlers()
  50. frame = ModelFrame(parent = None, giface = StandaloneGrassInterface())
  51. if options['file']:
  52. frame.LoadModelFile(options['file'])
  53. frame.Show()
  54. app.MainLoop()
  55. if __name__ == "__main__":
  56. options, flags = grass.parser()
  57. main()