¿ªÔÆÌåÓý

Locked Re: Signal Heads, signal masts, main and advance signals.


 

Hi Bob,

I tried to use the SignalFollower.py script, but get errors logged.


Information from the log:
PanelPro version 4.6-R81496dc starts under Java 1.8.0_77 on Linux amd64 v4.4.0-79-generic at Sat Jun 17 13:22:37 CEST 2017 [main]
Starting with profile Inglenook_Sidings_Simulator.3e3d4a8e [main]
...
Run file /home/user/.jmri/Inglenook_Sidings_Simulator/SignalFollower.py [main]
python 2.7 is provided by jython 2.7.0 [main]
ECMAScript ECMA - 262 Edition 5.1 is provided by Oracle Nashorn 1.8.0_77 [main]
ERROR - Error in script /home/user/.jmri/Inglenook_Sidings_Simulator/SignalFollower.py. [main]
javax.script.ScriptException: AttributeError: 'NoneType' object has no attribute 'addPropertyChangeListener' in <script> at line number 30


My Script:
# Has one SignalHead follow the state of another/
# Use this is you have e.g. a "repeater" signal head
# on the fascia that shows the appearance of a head
# on the layout
#
# Author: Bob Jacobsen, copyright 2016
# Part of the JMRI distribution

import jmri
import java

# Define the listener.
class SignalFollowerListener(java.beans.PropertyChangeListener):
def set(self, inputName, outputName) :
self.inSignal = signals.getSignalHead(inputName)
self.outSignal = signals.getSignalHead(outputName)
self.inSignal.addPropertyChangeListener(self)
return
def propertyChange(self, event):
self.outSignal.setAppearance(self.inSignal.getAppearance())
return

# Example of use - add a line like the following
# that includes system or user names for the signal head to be repeated,
# and the signal head to repeat it onto. These must already exist.
# SignalFollowerListener().set("CH2001","CH2001R")
# SignalFollowerListener().set("CH2002","CH2002R")

# SignalFollowerListener().set("ih1","ih4")
SignalFollowerListener().set("SBB Main 3","SBB Vorsignal")


I've tried with both the system name and the user name: both fail.

Have I missed something in the set up?
Do the scripts in the jython folder of JMRI.4.6 get run at start up? If so have I created a duplicate class?

Regards
Otto

Join [email protected] to automatically receive all group messages.