events.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. # Post it to BufferedWindow instance, which you want to update.
  26. # For relevant attributes for the event see
  27. # mapdisp.mapwindow.BufferedWindow UpdateMap method arguments.
  28. # If event does not contain attribute corresponding to argument with default
  29. # value, the default value will be used.
  30. # Arguments with no default value must be among event attributes
  31. # in order to be the event processed.
  32. # TODO implement to NVIZ GLWindow
  33. # TODO change direct calling of UpdateMap method to posting this event
  34. gUpdateMap, EVT_UPDATE_MAP = NewEvent()