errors.py 528 B

123456789101112131415161718192021222324
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Wed Aug 15 17:33:27 2012
  4. @author: pietro
  5. """
  6. from functools import wraps
  7. from grass.exceptions import (FlagError, ParameterError, DBError,
  8. GrassError, OpenError)
  9. from grass.pygrass.messages import get_msgr
  10. def must_be_open(method):
  11. @wraps(method)
  12. def wrapper(self, *args, **kargs):
  13. if self.is_open():
  14. return method(self, *args, **kargs)
  15. else:
  16. get_msgr().warning(_("The map is close!"))
  17. return wrapper