events.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. """!
  2. @package core.events
  3. @brief General events
  4. Put here only truly general events. Once you find that your event can be
  5. generated in more than one class, put your event here. Otherwise,
  6. leave it in your class file. Events are expected to be grass/gis related.
  7. General notice:
  8. Command events are propagated to parent windows. However, they do not propagate
  9. beyond dialogs. Events do not propagate at all.
  10. Command events works only with windows, not EvtHandlers, so for other objects
  11. than windows you need to have extra parameter - guiparent - which can be used
  12. for creating command events.
  13. \code
  14. mapEvent = gMapCreated(self._guiparent.GetId(), ...)
  15. wx.PostEvent(self._guiparent, mapEvent)
  16. \endcode
  17. @todo naming conventions for events
  18. (C) 2012 by the GRASS Development Team
  19. This program is free software under the GNU General Public License
  20. (>=v2). Read the file COPYING that comes with GRASS for details.
  21. @author Vaclav Petras <wenzeslaus gmail.com>
  22. """
  23. from wx.lib.newevent import NewCommandEvent
  24. from wx.lib.newevent import NewEvent
  25. # Notification event intended to update statusbar.
  26. # The message attribute contains the text of the message (plain text)
  27. gShowNotification, EVT_SHOW_NOTIFICATION = NewCommandEvent()
  28. # Occurs event when some map is created or updated by a module.
  29. # attributes: name: map name, ltype: map type,
  30. # add: if map should be added to layer tree (questionable attribute)
  31. gMapCreated, EVT_MAP_CREATED = NewCommandEvent()
  32. gZoomChanged, EVT_ZOOM_CHANGED = NewEvent()