g.gui.gmodeler.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. #% keyword: general
  24. #% keyword: GUI
  25. #% keyword: graphical modeler
  26. #% keyword: 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 wx
  37. import grass.script as grass
  38. from core.giface import StandaloneGrassInterface
  39. from core.globalvar import CheckWxVersion
  40. from core.utils import _, GuiModuleMain
  41. from gmodeler.frame import ModelFrame
  42. def main():
  43. app = wx.App()
  44. if not CheckWxVersion([2, 9]):
  45. wx.InitAllImageHandlers()
  46. frame = ModelFrame(parent = None, giface = StandaloneGrassInterface())
  47. if options['file']:
  48. frame.LoadModelFile(options['file'])
  49. frame.Show()
  50. app.MainLoop()
  51. if __name__ == "__main__":
  52. options, flags = grass.parser()
  53. GuiModuleMain(main)