Skip to content

Commit

Permalink
Merge pull request #206 from robotools/issue205-radio-group
Browse files Browse the repository at this point in the history
Fix superclass __init__ invocation
  • Loading branch information
typesupply committed Mar 22, 2024
2 parents 83c8c53 + 27b1943 commit 0881768
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Lib/vanilla/vanillaRadioGroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from vanilla.vanillaBase import VanillaBaseControl, _sizeStyleMap
from vanilla.vanillaButton import Button
from vanilla.vanillaStackGroup import VerticalStackGroup, HorizontalStackGroup
from objc import super

try:
from AppKit import NSRadioButtonType
Expand All @@ -23,7 +24,7 @@ def _init(self, cls, posSize, titles, callback=None, sizeStyle="regular"):
self._buttonHeight = self._heights[sizeStyle]
self._callback = callback
self._sizeStyle = sizeStyle
super().__init__(posSize, spacing=spacing, alignment="leading")
cls.__init__(self, posSize, spacing=spacing, alignment="leading")
self._buildButtons(titles, sizeStyle)

def _buildButtons(self, titles, sizeStyle):
Expand Down Expand Up @@ -126,7 +127,7 @@ def radioGroupCallback(self, sender):
)

def __init__(self, posSize, titles, callback=None, sizeStyle="regular"):
self._init(VerticalRadioGroup, posSize, titles, callback=callback, sizeStyle=sizeStyle)
self._init(VerticalStackGroup, posSize, titles, callback=callback, sizeStyle=sizeStyle)


class HorizontalRadioGroup(HorizontalStackGroup, _RadioGroupMixin):
Expand Down Expand Up @@ -188,7 +189,7 @@ def radioGroupCallback(self, sender):
)

def __init__(self, posSize, titles, callback=None, sizeStyle="regular"):
self._init(HorizontalRadioGroup, posSize, titles, callback=callback, sizeStyle=sizeStyle)
self._init(HorizontalStackGroup, posSize, titles, callback=callback, sizeStyle=sizeStyle)


class RadioButton(Button):
Expand Down

0 comments on commit 0881768

Please sign in to comment.