infomanager.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. """
  2. @package datacatalog.infomanager
  3. @brief Class for managing info messages
  4. in Data Catalog
  5. Classes:
  6. - infomanager::DataCatalogInfoManager
  7. (C) 2020 by the GRASS Development Team
  8. This program is free software under the GNU General Public License
  9. (>=v2). Read the file COPYING that comes with GRASS for details.
  10. @author Linda Kladivova
  11. @author Anna Petrasova <kratochanna gmail.com>
  12. @author Vaclav Petras <wenzeslaus gmail.com>
  13. """
  14. import wx
  15. from grass.script import gisenv
  16. class DataCatalogInfoManager:
  17. """Manager for all things related to info bar in Data Catalog"""
  18. def __init__(self, infobar, giface):
  19. self.infoBar = infobar
  20. self._giface = giface
  21. def ShowDataStructureInfo(self, onCreateLocationHandler):
  22. """Show info about the data hierarchy focused on the first-time user"""
  23. buttons = [("Create new Location", onCreateLocationHandler),
  24. ("Learn More", self._onLearnMore)]
  25. message = _(
  26. "GRASS GIS helps you organize your data using Locations (projects) "
  27. "which contain Mapsets (subprojects). All data in one Location is "
  28. "in the same coordinate reference system (CRS).\n\n"
  29. "You are currently in Mapset PERMANENT in default Location {loc} "
  30. "which uses WGS 84 (EPSG:4326). Consider creating a new Location with a CRS "
  31. "specific to your area. You can do it now or anytime later from "
  32. "the toolbar above."
  33. ).format(loc=gisenv()['LOCATION_NAME'])
  34. self.infoBar.ShowMessage(message, wx.ICON_INFORMATION, buttons)
  35. def ShowImportDataInfo(self, OnImportOgrLayersHandler, OnImportGdalLayersHandler):
  36. """Show info about the data import focused on the first-time user"""
  37. buttons = [("Import vector data", OnImportOgrLayersHandler),
  38. ("Import raster data", OnImportGdalLayersHandler)]
  39. message = _(
  40. "You have successfully created a new Location {loc}. "
  41. "Currently you are in its PERMANENT Mapset which is used for "
  42. "storing your base maps to make them readily available in other "
  43. "Mapsets. You can create new Mapsets for different tasks by right "
  44. "clicking on the Location name.\n\n"
  45. "To import data, go to the toolbar above or use the buttons below."
  46. ).format(loc=gisenv()['LOCATION_NAME'])
  47. self.infoBar.ShowMessage(message, wx.ICON_INFORMATION, buttons)
  48. def _onLearnMore(self, event):
  49. self._giface.Help(entry="grass_database")