-
Notifications
You must be signed in to change notification settings - Fork 8
Attr #21
base: master
Are you sure you want to change the base?
Conversation
AntoineDupre
left a comment
There was a problem hiding this 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 !
svgsynoptic2/taurussynopticwidget.py
Outdated
| # 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: |
There was a problem hiding this comment.
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_valueBut 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 |
There was a problem hiding this comment.
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).
|
|
||
| elif isinstance(value, (bool, np.bool_)): | ||
| #Change value | ||
| #value = self.set_custom_value('/'.join(model.split('/')[:-1]), value) |
There was a problem hiding this comment.
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.
Solve problems: