p4p icon indicating copy to clipboard operation
p4p copied to clipboard

add support to initialise NTEnum like NTScalar

Open m2es3h opened this issue 1 year ago • 3 comments

When initialising an NTEnum with a python dict, it is assumed that the dict is meant for the Value.value and contains index and choices keys for the value. This PR adds ability to initialise value and any other fields of the NTEnum, similar to initialising an NTScalar.

pv = SharedPV(
    nt=NTEnum(display=True),
    initial={
        'value.index': 0,
        'value.choices': ['STOP', 'START', 'STANDBY'],
        'display.description': "Pump on/off control word."
    }
)

m2es3h avatar Aug 20 '24 18:08 m2es3h

Just wondering if this has been resolved yet? Let me know if there is anything I can do to help. Two issues (this one and #153) can then be closed for the price of one!

kurup avatar Jan 24 '25 18:01 kurup

@kurup I'm happy with this PR as it is now, just needs review and approval on your end.

m2es3h avatar Jan 31 '25 18:01 m2es3h

I've done a couple of tests of this code with our customised wrapper for p4p and it seems to work fine. So I'm happy for you to merge it into master. Thanks!

kurup avatar Feb 17 '25 17:02 kurup

Hello, is this in a state to be merged yet @mdavidsaver ? we've been looking at using p4p to instantiate NTEnum types and having this in the main repo would massively simplify our set up!

kathryn-baker avatar Jun 04 '25 15:06 kathryn-baker

@m2es3h, would it be possible to merge or rebase from main and push your changes again, to trigger the CI/CD tests again?

Monarda avatar Aug 06 '25 15:08 Monarda

@Monarda I've sync'd this PR with epics-base:master, now just waiting for a maintainer to approve the CI/CD workflow. I'm not a maintainer and cannot trigger CI/CD or merge.

m2es3h avatar Aug 06 '25 19:08 m2es3h

I've run the CI and it all looks good. Awaiting approval from @mdavidsaver before merging.

AlexanderWells-diamond avatar Aug 07 '25 08:08 AlexanderWells-diamond

Thank you for your patience.

mdavidsaver avatar Aug 14 '25 14:08 mdavidsaver