¿ªÔÆÌåÓý

Date

Locked propertyChangeListener

 

Hi, I have included a small cut down version of something I am trying to do.?

I set up a propertyChangeLlistener for a sensor. When the sensor is activated it runs. I have simulated it running a long time just by putting a time.sleep in.
My problem is that when the se.setSate(ACTIVE) in the main function runs. It does not complete until the propertChangeListener completes.

Is there a way to have the propertyChageListener run without the main function waiting for it to complete.

I have looked at some of the documentation on threads but do not understand how to get this to work with jython.
I have used threading.Thread from the standard library start a thread running to do the long running task but this has some really strange behaviour and does not appear to run as? thread but runs sequentially.?

Some examples of why I want to do this is that when a sensor is activated I want to set a function key on the throttle a number of seconds later and not at the time the senor is activated or to start running some animation program on the layout that
could take some time.?

Thanks jim.

?Code?
---------

import jmri
import java.beans
import time

class _SET_SENSOR(jmri.jmrit.automat.AbstractAutomaton) :

? ? def init(self):
? ? ? ? ?return

?

??? def handle(slef):
??????? se=sensors.provideSensor("IStest")
??????? se.addPropertyChangeListener(_LISTENER(), "IStest", "TCPDeviceMgr")
??????? print(str(time.ctime())+" setting ACTIVE")
??????? se.setState(ACTIVE)
??????? print(str(time.ctime())+" setting INACTIVE")
???? ???se.setState(INACTIVE)
??????? return

?

class _LISTENER(java.beans.PropertyChangeListener):
??? def propertyChange(self, event):
??????? if event.newValue==2:
?????????? print(str(time.ctime())+" PropertyChange Activated...")
?????????? se=sensors.getSensor("IStest")
?????????? for oldListener in se.getPropertyChangeListenersByReference("IStest"):
?????????????? if se.getListenerRef(oldListener) == "TCPDeviceMgr":
????????????????? print(str(time.ctime())+" Removing old listner for sensor : IStest")
????????????????? se.removePropertyChangeListener(oldListener)
?????????? time.sleep(15)
?????????? print(str(time.ctime())+" PropertyChange Complete")
??????? return

test=_SET_SENSOR()
test.start()

?

OUTPUT from script
---------------------------
Thu Jan 30 08:48:24 2020 setting ACTIVE
Thu Jan 30 08:48:24 2020 PropertyChange Activated...
Thu Jan 30 08:48:24 2020 Removing old listner for sensor : IStest

--->>> 15 second gap for the time.sleep(15) inside the propertyChangeListener function.

Thu Jan 30 08:48:39 2020 PropertyChange Complete
Thu Jan 30 08:48:39 2020 setting INACTIVE


Locked Re: help with creating xml decoderfile [solved]

 

Thanks for the help!

I created the Decoder File for the Digital Bahn WaLD Decoder and it works. So from now on, i can set up the interior lightning stripe with decoder right aut of jmri.
I think, i will upload the files to the projekt, so everyone can use them in future.


Locked Raspberry Pi with DCC++ and PR3 Stand-alone LocoNet

 

I have a small track that has been successfully running DCC++ connected to a Raspberry Pi currently running PanelPro 4.6.? I am attempting to add block detection using a BDL168 and PR3.? I use TightVNC on a laptop for programming the RPi.

First, the track was cut into 16 blocks with feeders thru the BDL and the train ran normally.? Next, BDL OpSw 12 was set to "t" to terminate the LocoNet, and track power from Rail A was connected to pin 6 on the LocoNet to provide a RailSync signal per the BDL manual.

Opened Preferences to add a second connection: Mfr - Digitrax; Connection - LocoNetPR3; Serial port - /dev/ttyACM1; Cmd station - Stand-alone LocoNet.? Saved and restarted.

The console window shows -?
Active profile: DCC++
DCC++: using DCC++ Serial port on /dev/ttyACM0
LocoNet: using LocoNet PR3 on /dev/ACM1

The track power button is stuck on "Unknown".? Removed and added the PR3 to Preferences a couple of times with the same results.? Tried Steve Todd's latest image v4.18 with the same results.

What am I missing?? Where do I look next.? It's probably something simple that I have overlooked.

Thanks for any help or suggestion you may be able to offer.

Dave


Locked Re: Working offline with version 14

 

John,

Yes, as long as the "User Files Location" for both profiles have the exact same file path. ?If you are also doing decoder programming, you want to make sure the "Roster Location" for each profile matches.

Use "Help >> Locations..." to see the current location information.

If you go to Preferences >> Config Profiles, at the bottom of the screen you can enable "Show profile selector". ?This makes it easy select the proper profile based on the layout connection state.

Dave Sand


----- Original message -----
From: John <gross144john@...>
Subject: Re: [jmriusers] Working offline with version 14
Date: Wednesday, January 29, 2020 9:22 PM

So, once a simulator protocol is created, I can move back and forth between online and offline mode without losing any of the programming that has been done as long as I switch to simulator mode when opening panel pro offline?

Thank you,

John

On Wed, Jan 29, 2020 at 5:10 PM Dave Sand <ds@...> wrote:

John,

When you want to work offline, you need to use a simulation profile.? For example, if you normally have an NCE connection, the simulation profile would use the NCE Simulator.? Most the connection types will have a simulation mode.

Since the simulation profile will have its own default location for panels and rosters, you will need to use Preferences >> File Locations to change the "User Files Location" to your regular location.


Dave Sand


----- Original message -----
From: John <gross144john@...>
Subject: [jmriusers] Working offline with version 14
Date: Wednesday, January 29, 2020 4:14 PM

Yesterday everything was working correctly: turnouts, sensors, signals, blocks. Today I tried to work offline. Everything in the tables was converted to internal devices. I tried opening some backups of the XML files and most, not all, of the devices were now missing from the tables and what was there was still internal. Offline work seems to be a mistake. Is there a way to recover from this mistake?

I am using windows 8 on an ASUS notebook.

Thanks,

John





 

CV163 to value 4 did the trick. Thank you to all who replied

now to fix that caboose LOL

On Wed, Jan 29, 2020 at 1:24 PM Dave Heap <dgheap@...> wrote:
David,

> On 29 Jan 2020, at 7:16 PM, David Epling <npdcctrains@...> wrote:
>
> Why does JMRI pick it up as a v5?

Because it must be a V5. As Michaelhas said,? Atlas obviously hasn't updated the manual.

Dave in Australia






--
David Epling
Nevada Pacific Custom Model Trains & Repair
Stockton CA


Locked Re: Working offline with version 14

John
 

So, once a simulator protocol is created, I can move back and forth between online and offline mode without losing any of the programming that has been done as long as I switch to simulator mode when opening panel pro offline?

Thank you,

John


On Wed, Jan 29, 2020 at 5:10 PM Dave Sand <ds@...> wrote:
John,

When you want to work offline, you need to use a simulation profile.? For example, if you normally have an NCE connection, the simulation profile would use the NCE Simulator.? Most the connection types will have a simulation mode.

Since the simulation profile will have its own default location for panels and rosters, you will need to use Preferences >> File Locations to change the "User Files Location" to your regular location.


Dave Sand


----- Original message -----
From: John <gross144john@...>
Subject: [jmriusers] Working offline with version 14
Date: Wednesday, January 29, 2020 4:14 PM

Yesterday everything was working correctly: turnouts, sensors, signals, blocks. Today I tried to work offline. Everything in the tables was converted to internal devices. I tried opening some backups of the XML files and most, not all, of the devices were now missing from the tables and what was there was still internal. Offline work seems to be a mistake. Is there a way to recover from this mistake?

I am using windows 8 on an ASUS notebook.

Thanks,

John


Locked Re: CATS: Where is new CATS Group? Was Moving objects on the designer panel #cats

 

Dave,
Where is the new CATS group?
Thanks,
Ray Eiser


Locked Re: CATS: Moving objects on the designer panel #cats

 

Rodney,
Thanks.? We read about CLEAR is section 6.2 but it didn't sound like what we wanted to do yet it is exactly what we were looking for.? CATS is working well so far.
Dave...


 

Are drivers installed for the LocoBuffer?


--
Peter Ulvestad

JMRI Users Group Moderator - ( )
Tam Valley Group Moderator - ( )
Sprog-DCC Group Moderator - ( )
Edmonton Model Railroad Association -


 

New to group and this may have been covered before, if so can someone direct me where to look.

I have the latest jmri and java installed on a new Laptop using Windows 10. JMRI works correctly but I cannot connect to the layout; I am using a Digitrax DCS100 and LocoBuffer-USB combination that has worked on older setups but with the latest equipment I get the message "no serial port found" What can I do to find a serial port?

Jim Dickinson


Locked Re: Working offline with version 14

 

John,

When you want to work offline, you need to use a simulation profile. ?For example, if you normally have an NCE connection, the simulation profile would use the NCE Simulator. ?Most the connection types will have a simulation mode.

Since the simulation profile will have its own default location for panels and rosters, you will need to use Preferences >> File Locations to change the "User Files Location" to your regular location.


Dave Sand


----- Original message -----
From: John <gross144john@...>
Subject: [jmriusers] Working offline with version 14
Date: Wednesday, January 29, 2020 4:14 PM

Yesterday everything was working correctly: turnouts, sensors, signals, blocks. Today I tried to work offline. Everything in the tables was converted to internal devices. I tried opening some backups of the XML files and most, not all, of the devices were now missing from the tables and what was there was still internal. Offline work seems to be a mistake. Is there a way to recover from this mistake?

I am using windows 8 on an ASUS notebook.

Thanks,

John


Locked Re: 4.17.3ish and csvreader #scripting

 

Cliff,

The way we usually do this is via the release notes, which everyone reads religiously ;-)

More seriously, for something like this we try to minimise the times that we make such changes and, when we do, update our script samples to show how the new libraries work.

In general, we also try to introduce these sorts of changes earlier on in the development release schedule such that the impact of changes can be better assessed and understood prior to a future Production release and, if needed, work out better documentation and/or tooling to aid migration.

Best regards,

Matt H


Locked Working offline with version 14

John
 

Yesterday everything was working correctly: turnouts, sensors, signals, blocks. Today I tried to work offline. Everything in the tables was converted to internal devices. I tried opening some backups of the XML files and most, not all, of the devices were now missing from the tables and what was there was still internal. Offline work seems to be a mistake. Is there a way to recover from this mistake?

I am using windows 8 on an ASUS notebook.

Thanks,

John


Locked Re: 4.17.3ish and csvreader #scripting

 

Matt,

There is every reason for me to suspect that the answer will be NO, but is there a manageable way to declare a Jython import library as depreciated? Introducing a replacement library for improvement reasons might go smoother if that act did not invalidate a lot of home-brew scripts.

The more thought I give to the CSV change, which is not backward compatible, it seems that Sam may have acted as the flag-bearer for a large number of members with legacy scripts.

Our club has chosen to not use anything other than production versions. That means my laptop has both the production and test versions. Occasionally I use NetBeans "Pull from Upstream" from GitHub updates to be able to debug a script by reading small snippets of Java source code. I am not a Java programmer, but sometimes I can read portions of the code and insert breakpoints. Usually a newly developed or edited script can be more robust if tested with up to date code.

My point is, that backward compatibility is important to me, since most JMRI issues, either script or Logix, are dealt with at home instead of at the club. There is a lot of reason to expect that I am not alone in this regard.

Cliff


 

David,

On 29 Jan 2020, at 7:16 PM, David Epling <npdcctrains@...> wrote:

Why does JMRI pick it up as a v5?
Because it must be a V5. As Michaelhas said, Atlas obviously hasn't updated the manual.

Dave in Australia


 

"G",

Which "reporter" hardware are you using? It makes a difference.

If you are using Digitrax transponding, I know that it has some configuration settings which affect how reports are generated by the hardware, and perhaps one of these may help you achieve your goals. I vaguely recall that there are some limitations on what the hardware will/will not report.

I am not currently a user of any sort of "reporter", so cannot provide much help other than what I've mentioned about Digitrax, above.

Regards,
Billybob


Locked Re: CATS: Moving objects on the designer panel #cats

 

Dave,

There are several ways to perform the edits that you ask about.? You can insert and delete columns or rows to extend or contract tracks.? The problem is that other tracks may also be affected.? You can select a rectangular region of tracks (left click on one corner and shift+left click on the diagonally opposite corner).? There are two options to focus on. Edit->Clear and Edit->Copy.? If you select Clear, the contents of the cells will be cleared on the screen and copied to the CATS clipboard.? You can then move the cursor to another part of the screen and Edit->Paste, to insert the CATS clipboard back to the screen, exactly as it was cleared (the hardware addresses are kept).? The upper left corner of the cleared area is pasted at the cursor location.

If you select Edit->Copy, then the tracks in the selected area are copied to the CATS clipboard, sans the hardware device.? It is not desirable to duplicate hardware elements.? Use of Edit->Paste then acts as above, except the tracks do not include the hardware devices.

Because some of this copy/paste is complicated, it is best to save the CATS panel before doing it.

Rodney



Locked Re: CATS and LOGIX #cats #logix

 

Dave,

CATS interfaces to JMRI at the hardware device level.? The architecture is that JMRI handles the hardware dependencies and CATS supplies the logic and GUI for manipulating the hardware.? This means that CATS uses JMRI sensors (LSxx, NSxx, ISxx, etc.), turnouts (LTxx, NTxx, ITxx, etc.), etc., as referenced in Section 8.3 of the designer manual and in the selection table created by the designer Devices->JMRI Devices ... menu item (which can be extended by the user).? One uses designer to associate specific JMRI hardware devices with layout elements (block detectors, turnouts, signal heads, etc.).? When CATS loads a CATS panel, it first tries to find the named devices in JMRI and creates those that it cannot find.? JMRI can create devices via discovery or the user can can create them (think of the sensor table, turnout table, etc.) in a JMRI panel and load them prior to CATS loading its CATS panel.? Since Logix uses the same hardware devices and Logix can be included in a JMRI panel, then CATS can defer to Logix via the common hardware elements.? In other words, CATS can stimulate and respond to Logix through the JMRI hardware devices.

The procedure for telling CATS about JMRI devices is to:
  1. launch PanelPro and create your JMRI hardware tables (sensor, turnout, Logix, etc.), populating them with the hardware devices that you want to create manually.? Save that JMRI panel through Panels->Store Panels.
  2. Launch CATS.? Before loading your CATS panel, through JMRI Panels->Open Panels and load the panel created in step 1.
  3. Load the CATS panel.? In CATS, File->Load
There are some shortcuts.? In designer, Appearance->Include File ... and name the JMRI file from step 1.? Thus, the name of the JMRI panel file is passed from designer to CATS.

There is one caveat.? It is not advisable to edit the JMRI panel after loading the CATS file because CATS also adds hardware elements to the JMRI tables.? If you save the altered JMRI panel, that panel will contain the elements that CATS added, especially those unique to CATS.? When JMRI later tries to load the JMRI panel, it may not know how to create those elements.

Rodney


Locked Re: Download JMRI 4.18 Windows XP issue. #4-18 #windows-xp

 

Mick.That is fine unplug it gone plug it in back and two green lights on.
Under preferences where you enter Digitrax then Locobuffer usb the next box to enter
Com 3 not there, or opening for me to enter¡­
also the Digitrax and Locubuffer usb selection will not save! Steve¡­.
IIRC this uses an FTDI chip in which case there is a two stage
installation process as there are two software modules needed. Have
you installed the second module? It sounds like only the first has
been installed, which talks to the USB, and not the second that
creates the COM port.


On Wed, 29 Jan 2020 at 17:35, Steve Turner <sfturner@...> wrote:

Mick.That is fine unplug it gone plug it in back and two green lights on. Under preferences where you enter Digitrax then Locobuffer usb the next box to enter Com 3 not there, or opening for me to enter¡­also the Digitrax and Locubuffer usb selection will not save! Steve¡­.



From: [email protected] [mailto:[email protected]] On Behalf Of Mick Moignard
Sent: Wednesday, January 29, 2020 9:28 AM
To: [email protected]
Subject: Re: [jmriusers] Download JMRI 4.18 Windows XP issue.



Have you installed the Locobuffer drivers? Can you see it in Windows Device Manager, and watch it come and go as you plug it in and out. If you can¡¯t see it in Device Manager, the neither can JMRI..

Mick
________________________________
Mick Moignard
m: +44 7774 652504
Skype: mickmoignard

, so please excuse the typos.


Locked Re: Download JMRI 4.18 Windows XP issue. #4-18 #windows-xp

 

I had similar problems in the past and used a free utility from? nirsoft