forked from tango-controls/pytango
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Enum types for DevEnum attributes
TANGO implements DevEnum attributes as an integer value combined with a list label strings. The current PyTango implementation requires the user to fetch the labels separately from the values, and match them up manually. This makes it difficult to use. This new implementation combines the information to create proper enumerated types. #### Client-side changes When the DeviceProxy reads a DevEnum attribute, a Python `enum.IntEnum` object is returned instead of just an integer. This object can be compared to integers directly, so minimal changes are expected for old code. The benefit is that new code using the enumerations directly will be more readable. #### Server-side changes Not much was required here. Added a utility function that extracts the labels from an `enum.Enum` class and verifies that the values will work with the core TANGO implementation. #### Warning The `DeviceProxy` maintains a cache of the attributes, which includes the Enumeration class. If the device server changes the enum_labels for an attribute that the DeviceProxy has already cached, then the DeviceProxy will not know about it. A new instance of the DeviceProxy will have to be created after any significant interface change on the server. Addresses issue tango-controls#188
- Loading branch information
1 parent
d86cf90
commit 5f3a4fd
Showing
6 changed files
with
96 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters