parameters: (func)
return_statement: return ContextWrap
docstring: Helper decorator for checking if the message is in context of the
      main window. Class that uses this to wrap its message handlers must
      have a GetMainWindow method that returns a reference to the MainWindow
      instance that owns the object.
      @param funct: callable(self, msg)
docstring_summary: Helper decorator for checking if the message is in context of the
      main window. Class that uses this to wrap its message handlers must
      have a GetMainWindow method that returns a reference to the MainWindow
      instance that owns the object.
      @param funct: callable(self, msg)
docstring_tokens: Helper decorator for checking if the message is in context of the main window . Class that uses this to wrap its message handlers must have a GetMainWindow method that returns a reference to the MainWindow instance that owns the object . @param funct : callable ( self msg )
function: def mwcontext(func):
      """Helper decorator for checking if the message is in context of the
      main window. Class that uses this to wrap its message handlers must
      have a GetMainWindow method that returns a reference to the MainWindow
      instance that owns the object.
      @param funct: callable(self, msg)
  
      """
      def ContextWrap(self, msg):
          """Check and only call the method if the message is in the
          context of the main window or no context was specified.
  
          """
          if hasattr(self, 'GetMainWindow'):
              mw = self.GetMainWindow()
          elif hasattr(self, 'MainWindow'):
              mw = self.MainWindow
          else:
              assert False, "Must declare a GetMainWindow method"
          context = msg.GetContext()
          if context is None or mw.GetId() == context:
              func(self, msg)
  
      ContextWrap.__name__ = func.__name__
      ContextWrap.__doc__ = func.__doc__
      return ContextWrap
function_tokens: def mwcontext ( func ) : def ContextWrap ( self , msg ) : """Check and only call the method if the message is in the
          context of the main window or no context was specified.
  
          """ if hasattr ( self , 'GetMainWindow' ) : mw = self . GetMainWindow ( ) elif hasattr ( self , 'MainWindow' ) : mw = self . MainWindow else : assert False , "Must declare a GetMainWindow method" context = msg . GetContext ( ) if context is None or mw . GetId ( ) == context : func ( self , msg ) ContextWrap . __name__ = func . __name__ ContextWrap . __doc__ = func . __doc__ return ContextWrap