g.gui.timeline.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/usr/bin/env python
  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 to compare temporal datasets by displaying their temporal extents in a plot.
  23. #% keywords: general
  24. #% keywords: GUI
  25. #% keywords: temporal
  26. #%end
  27. #%option G_OPT_STDS_INPUTS
  28. #% required: no
  29. #%end
  30. #%flag
  31. #% key: 3
  32. #% description: Show also 3D plot of spatio-temporal extents
  33. #%end
  34. import os
  35. import sys
  36. import wx
  37. gui_wx_path = os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython')
  38. if gui_wx_path not in sys.path:
  39. sys.path.append(gui_wx_path)
  40. import grass.script as grass
  41. from core.utils import _, GuiModuleMain
  42. def main():
  43. try:
  44. from timeline.frame import TimelineFrame
  45. except ImportError, e:
  46. grass.fatal(e.message)
  47. datasets = options['inputs'].strip().split(',')
  48. datasets = [data for data in datasets if data]
  49. view3d = flags['3']
  50. app = wx.App()
  51. frame = TimelineFrame(None)
  52. frame.SetDatasets(datasets)
  53. frame.Show3D(view3d)
  54. frame.Show()
  55. app.MainLoop()
  56. if __name__ == '__main__':
  57. options, flags = grass.parser()
  58. GuiModuleMain(main)