Activate next value.
(self, _previous: bool = False)
| 143 | return self.get_values() |
| 144 | |
| 145 | def activate_next(self, _previous: bool = False) -> None: |
| 146 | """ |
| 147 | Activate next value. |
| 148 | """ |
| 149 | current = self.get_current_value() |
| 150 | options = sorted(self.values.keys()) |
| 151 | |
| 152 | # Get current index. |
| 153 | try: |
| 154 | index = options.index(current) |
| 155 | except ValueError: |
| 156 | index = 0 |
| 157 | |
| 158 | # Go to previous/next index. |
| 159 | if _previous: |
| 160 | index -= 1 |
| 161 | else: |
| 162 | index += 1 |
| 163 | |
| 164 | # Call handler for this option. |
| 165 | next_option = options[index % len(options)] |
| 166 | self.values[next_option]() |
| 167 | |
| 168 | def activate_previous(self) -> None: |
| 169 | """ |
no test coverage detected