| 252 | | self._spiral_mode = True |
| 253 | | icon_size = style.STANDARD_ICON_SIZE |
| 254 | | angle, radius = self._calculate_angle_and_radius(children_count, |
| 255 | | icon_size) |
| 256 | | while radius > _MAXIMUM_RADIUS: |
| 257 | | i = _ICON_SIZES.index(icon_size) |
| 258 | | if i < len(_ICON_SIZES) - 1: |
| 259 | | icon_size = _ICON_SIZES[i + 1] |
| 260 | | angle, radius = self._calculate_angle_and_radius( |
| 261 | | children_count, icon_size) |
| 262 | | else: |
| 263 | | break |
| 264 | | return radius, icon_size |
| | 252 | # Only switch to a spiral when using the Ring layout. |
| | 253 | if self.key == 'ring-layout': |
| | 254 | self._spiral_mode = True |
| | 255 | icon_size = style.STANDARD_ICON_SIZE |
| | 256 | angle, radius = self._calculate_angle_and_radius(children_count, |
| | 257 | icon_size) |
| | 258 | while radius > _MAXIMUM_RADIUS: |
| | 259 | i = _ICON_SIZES.index(icon_size) |
| | 260 | if i < len(_ICON_SIZES) - 1: |
| | 261 | icon_size = _ICON_SIZES[i + 1] |
| | 262 | angle, radius = self._calculate_angle_and_radius( |
| | 263 | children_count, icon_size) |
| | 264 | else: |
| | 265 | break |
| | 266 | return radius, icon_size |
| | 267 | else: |
| | 268 | distance = style.STANDARD_ICON_SIZE + style.DEFAULT_SPACING * \ |
| | 269 | _ICON_SPACING_FACTORS[_ICON_SIZES.index(style.SMALL_ICON_SIZE)] |
| | 270 | radius = max(children_count * distance / (2 * math.pi), |
| | 271 | _MINIMUM_RADIUS) |
| | 272 | return radius, style.SMALL_ICON_SIZE |