Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

Attr #21

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Attr #21

wants to merge 5 commits into from

Conversation

lzytniak
Copy link
Member

@lzytniak lzytniak commented Jul 8, 2018

Solve problems:

  1. Bugfix - taurusform returns list,
  2. Opens panel for dev attr not only for device.

Copy link
Member

@AntoineDupre AntoineDupre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, looks great !

# when alarm is trigered PyAlarm attribute returns 'True' value, icon on synoptic is green
# set_custom_value change value for better alarms visualisation
# function can be customised for any other tango device classes
if 'PyAlarm' in PyTango.get_device_proxy(model).info().dev_class:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is better to keep only one return statement:

dev_class = PyTango.get_device_proxy(model).info().dev_class
return not(attr_value) if 'PyAlarm' in dev_class else attr_value

But it is less "customized friendly"

except Exception as e:
print('Problem to set custom value {0} \n for model {1}'.format(e, model))
finally:
return attr_value

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using finally like this cause that there is always returned attr_value, no matter what happens in try. There should be return after except (not inside).

@@ -202,6 +218,8 @@ def attribute_listener(self, model, evt_src, evt_type, evt_value):
(model, value))

elif isinstance(value, (bool, np.bool_)):
#Change value
#value = self.set_custom_value('/'.join(model.split('/')[:-1]), value)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this is commented, but I noticed a problem when I have too complicated functions in some parts like this. It is more possible to get error terminate called after throwing an instance of 'Tango::DevFailed' when this is uncommented. When I removed inquiry to database: PyTango.get_device_proxy(model).info().dev_class: and just checked model name for some simple schemes in name it was less possible to get such error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants