g.gui.timeline.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/usr/bin/env python3
  2. ############################################################################
  3. #
  4. # MODULE: g.gui.timeline.py
  5. # AUTHOR(S): Anna Kratochvilova
  6. # PURPOSE: Timeline Tool is a wxGUI component (based on matplotlib)
  7. # which allows the user to compare temporal datasets' extents.
  8. # COPYRIGHT: (C) 2012-13 by Anna Kratochvilova, and the GRASS Development Team
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; either version 2 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # This program is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU General Public License for more details.
  19. #
  20. ############################################################################
  21. # %module
  22. # % description: Allows comparing temporal datasets by displaying their temporal extents in a plot.
  23. # % keyword: general
  24. # % keyword: GUI
  25. # % keyword: temporal
  26. # % keywords: plot
  27. # %end
  28. # %option G_OPT_STDS_INPUTS
  29. # % required: no
  30. # %end
  31. # %flag
  32. # % key: 3
  33. # % description: Show also 3D plot of spatio-temporal extents
  34. # %end
  35. import grass.script as gscript
  36. def main():
  37. options, flags = gscript.parser()
  38. import wx
  39. from grass.script.setup import set_gui_path
  40. set_gui_path()
  41. try:
  42. from timeline.frame import TimelineFrame
  43. except ImportError as e:
  44. # TODO: why do we need this special check here, the reason of error
  45. # is wrong intallation or something, no need to report this to the
  46. # user in a nice way
  47. gscript.fatal(str(e))
  48. datasets = options["inputs"].strip().split(",")
  49. datasets = [data for data in datasets if data]
  50. view3d = flags["3"]
  51. app = wx.App()
  52. frame = TimelineFrame(
  53. parent=None,
  54. title=_("Timeline Tool - GRASS GIS"),
  55. )
  56. frame.SetDatasets(datasets)
  57. frame.Show3D(view3d)
  58. frame.Show()
  59. app.MainLoop()
  60. if __name__ == "__main__":
  61. main()