(self, item, action)
| 1923 | self._set_selected_state(self._get(name, by_label, nr), selected) |
| 1924 | |
| 1925 | def _set_selected_state(self, item, action): |
| 1926 | # action: |
| 1927 | # bool False: off |
| 1928 | # bool True: on |
| 1929 | if self.disabled: |
| 1930 | raise AttributeError("control '%s' is disabled" % self.name) |
| 1931 | if self.readonly: |
| 1932 | raise AttributeError("control '%s' is readonly" % self.name) |
| 1933 | action = bool(action) |
| 1934 | compat = self._form.backwards_compat |
| 1935 | if not compat and item.disabled: |
| 1936 | raise AttributeError("item is disabled") |
| 1937 | else: |
| 1938 | if compat and item.disabled and action: |
| 1939 | raise AttributeError("item is disabled") |
| 1940 | if self.multiple: |
| 1941 | item.__dict__["_selected"] = action |
| 1942 | else: |
| 1943 | if not action: |
| 1944 | item.__dict__["_selected"] = False |
| 1945 | else: |
| 1946 | for o in self.items: |
| 1947 | o.__dict__["_selected"] = False |
| 1948 | item.__dict__["_selected"] = True |
| 1949 | |
| 1950 | def toggle_single(self, by_label=None): |
| 1951 | """Deprecated: toggle the selection of the single item in this control. |
no outgoing calls
no test coverage detected