Skip to content
Permalink
Browse files

simple example of using a CollectingReporter in a script.

  • Loading branch information...
pabender committed Jun 4, 2019
1 parent ca65391 commit b7d71a243fd2a961503fbee93c04bf52d237c46d
Showing with 25 additions and 0 deletions.
  1. +25 −0 jython/CollectingReporterExample.py
@@ -0,0 +1,25 @@
# Provides an example of retreiving the collection maintained
# by a jmri.CollectingReporter.
#
# This script simply retreives the contents of the collection
# and prints each entry. Entries may not be strings, so the
# output may require further interpretation, which this script
# does not perform.
#
# Author: Paul Bender, copyright 2019
# Part of the JMRI distribution
#
# The Reporter name is hardcoded in the example.
# Change the value to something that makes sense for your layout

import jmri

# get the reporter manager from the InstanceManager
rm = jmri.InstanceManager.getDefault(jmri.ReporterManager)
# ask for the reporter, and store it in rptr.
rptr = rm.getReporter("ZRD5C3:7")
# ask the reporter for the collection
array = rptr.getCollection().toArray()
# and print each entry
for i in array:
print i

0 comments on commit b7d71a2

Please sign in to comment.
You can’t perform that action at this time.