r""" Set standard ``standard`` as currently selected. If ``standard`` does not exist in user-defined or built-in list, then the first entry of the user-defined list is set as current. If user-defined list is empty or None, then the first entry of the built-in list is
(self, standard=None)
| 866 | return standard_ref |
| 867 | |
| 868 | def set_selected_standard(self, standard=None): |
| 869 | r""" |
| 870 | Set standard ``standard`` as currently selected. If ``standard`` does not |
| 871 | exist in user-defined or built-in list, then the first entry of the |
| 872 | user-defined list is set as current. If user-defined list is empty or |
| 873 | None, then the first entry of the built-in list is set as current. |
| 874 | If both lists are empty or None, then then nothing is selected. |
| 875 | If ``standard`` is None, then the first available standard is selected. |
| 876 | |
| 877 | Parameters |
| 878 | ---------- |
| 879 | |
| 880 | standard: dict |
| 881 | The dictionary holding standard information. The complete dictionary |
| 882 | is compared with entries of internally stored lists to find the match. |
| 883 | |
| 884 | Returns |
| 885 | ------- |
| 886 | Returns reference to the selected standard (None if no entry is selected) |
| 887 | """ |
| 888 | |
| 889 | standard_ref = self.find_standard(standard) |
| 890 | |
| 891 | if not standard_ref: |
| 892 | # Set reference pointing to the first available standard description |
| 893 | if self.standards_custom: |
| 894 | self.standard_selected = self.standards_custom[0] |
| 895 | elif self.standards_built_in: |
| 896 | self.standard_selected = self.standards_built_in[0] |
| 897 | else: |
| 898 | self.standard_selected = None |
| 899 | |
| 900 | else: |
| 901 | # The reference was found in one of the arrays |
| 902 | self.standard_selected = standard_ref |
| 903 | |
| 904 | return self.standard_selected |
| 905 | |
| 906 | def is_standard_custom(self, standard): |
| 907 | r""" |