test.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #
  2. # Metrix++, Copyright 2009-2013, Metrix++ Project
  3. # Link: http://metrixplusplus.sourceforge.net
  4. #
  5. # This file is a part of Metrix++ Tool.
  6. #
  7. # Metrix++ is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, version 3 of the License.
  10. #
  11. # Metrix++ is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with Metrix++. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. import core.api
  20. import logging
  21. # used for testing and development purposes
  22. class Plugin(core.api.Plugin, core.api.Child):
  23. def initialize(self):
  24. return
  25. # do not trigger version property set, it is a module for testing purposes
  26. core.api.subscribe_by_parents_interface(core.api.ICode, self)
  27. def callback(self, parent, data, is_updated):
  28. text = data.get_content()
  29. for region in data.iterate_regions():
  30. logging.warn(region.get_name() + " " + region.get_cursor())
  31. for marker in data.iterate_markers(region_id=region.get_id(), exclude_children = True):
  32. logging.warn("\tMarker: " + data.get_marker_types()().to_str(marker.get_type()) +
  33. " " + text[marker.get_offset_begin():marker.get_offset_end()])