ISISComputingGroup / lewis-ess

Let's write intricate simulators!
GNU General Public License v3.0
21 stars 19 forks source link

Make it possible to expose methods and functions as PVs #217

Closed MichaelWedel closed 7 years ago

MichaelWedel commented 7 years ago

This fixes #211.

With these changes it has been made easier to expose getter/setter method pairs as PVs. Free functions and other callables can be used as well, allowing for the same functionality as Cmd/Var in stream.

OwenArnold commented 7 years ago

@MichaelWedel Declaring a property without a setter does not require author to set the read_only=True argument. Is that something we should sanitise?

Setting the read_only flag gives a nice output at runtime

Second-Int: Driver rejects value 1

Failing to do so seems to give garbage

OwenArnold commented 7 years ago

@MichaelWedel. Other than that I think the changes are good to go. 👍 For ensuring the examples got updates.

MichaelWedel commented 7 years ago

I see what you mean. This behavior is quite old I think, but it's fixed for getter/setter methods, where this happens automatically (so manual read_only=True is not required). It should be possible to do the same for properties. I'll look into it quickly.