robotools / vanilla

A Pythonic wrapper around Cocoa.
MIT License
78 stars 28 forks source link

HorizontalRadioGroup and VerticalRadioGroup can't be enabled/disabled #208

Closed jenskutilek closed 6 months ago

jenskutilek commented 6 months ago

Modified demo code:

from vanilla import Window, HorizontalRadioGroup, VerticalRadioGroup

class RadioGroupDemo:

    def __init__(self):
        self.w = Window((300, 100))
        self.w.radioGroup = HorizontalRadioGroup(
            "auto",
            ["Option 1", "Option 2"],
            callback=self.radioGroupCallback
        )
        self.w.radioGroup.set(0)
        self.w.radioGroup.enable(True) # <-- added line
        rules = [
            "H:|-[radioGroup]-|",
            "V:|-[radioGroup(==%d)]-|" % self.w.radioGroup.getFittingHeight()
        ]
        self.w.addAutoPosSizeRules(rules)
        self.w.open()

    def radioGroupCallback(self, sender):
        print("radio group edit!", sender.get())

RadioGroupDemo()

enable() throws a traceback for HorizontalRadioGroup and VerticalRadioGroup. It works for RadioGroup.

Traceback (most recent call last):
  File "test_radiogroup.py", line 24, in <module>
    RadioGroupDemo()
  File "test_radiogroup.py", line 13, in __init__
    self.w.radioGroup.enable(True)
  File "venv/lib/python3.10/site-packages/vanilla/vanillaBase.py", line 158, in enable
    self._nsObject.setEnabled_(onOff)
AttributeError: 'VNSStackView' object has no attribute 'setEnabled_'
typemytype commented 6 months ago

added