test.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. # used for testing and development purposes
  21. class Plugin(core.api.Plugin, core.api.Child):
  22. def initialize(self):
  23. return
  24. # do not trigger version property set, it is a module for testing purposes
  25. core.api.subscribe_by_parents_interface(core.api.ICode, self)
  26. def callback(self, parent, data, is_updated):
  27. text = data.get_content()
  28. for region in data.iterate_regions():
  29. print "Region:", region.get_name(), region.get_cursor()
  30. for marker in data.iterate_markers(region_id=region.get_id(), exclude_children = True):
  31. print "\tMarker:", data.get_marker_types()().to_str(marker.get_type()), text[marker.get_offset_begin():marker.get_offset_end()]