robotools / vanilla

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

AttributeError: 'super' object has no attribute 'tabView_didSelectTabViewItem_' #186

Closed HugoJourdan closed 8 months ago

HugoJourdan commented 1 year ago

I wrote a script with an UI made with vanilla and I'm using this following snippet at the end of my script to open UI windows.

if __name__ == "__main__":
    from vanilla.test.testTools import executeVanillaTest
    executeVanillaTest(myScript)

It works perfectly on my side, but I shared it with a college and it got this error :

Traceback (most recent call last):
  File "/Users/xxx/xxxxxxxxxx.py", line 486, in <module>
    executeVanillaTest(xxxxxxxxxx)
  File "/opt/homebrew/lib/python3.11/site-packages/vanilla/test/testTools.py", line 59, in executeVanillaTest
    cls(**kwargs)
  File "/Users/xxx/xxxxxxxxxx.py", line 127, in __init__
    renameFont.tabs = Tabs((0, self.linePos, -0, 100), ["Find/Replace", "Add Prefix"])
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/vanilla/vanillaTabs.py", line 183, in __init__
    self._tabViewController.addTabViewItem_(tab._tabItem)
  File "/opt/homebrew/lib/python3.11/site-packages/vanilla/vanillaTabs.py", line 35, in tabView_didSelectTabViewItem_
    super().tabView_didSelectTabViewItem_(tabView, tabViewItem)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'super' object has no attribute 'tabView_didSelectTabViewItem_'

He installed last version of vanilla using pip3 install cocoa-vanilla

typemytype commented 1 year ago

we are very lazy in pushing the latest version to pypi...

try pip3 install git+https://github.com/robotools/vanilla to get the latest version

HugoJourdan commented 1 year ago

Thanks, but It didn't fix this issue unfortunately

typemytype commented 1 year ago

what pyobjc version do you have? what macOS version?

it seems to go wrong here https://github.com/robotools/vanilla/blob/master/Lib/vanilla/vanillaTabs.py#L32-L35

but I cannot reproduce it

HugoJourdan commented 1 year ago

From my side it work : pyobj : 9.0.1 macOS : Ventura 13.2.1

My colleague : pyobj : 9.1.1 Mac OS : Monterey 12.5.1

typemytype commented 1 year ago

which python?

HugoJourdan commented 1 year ago

Downgrading to pyobj 9.0.1 fixed the issue. We are both with 3.11

typemytype commented 1 year ago

FYI according the spec super() must be called... so it must be available https://developer.apple.com/documentation/appkit/nstabviewcontroller/1428243-tabview?changes=_6_1&language=objc

HugoJourdan commented 1 year ago

I assume it's problem from pyobj side...

typemytype commented 1 year ago

cannot reproduce it on 3.11... with the latest objc, vanilla

import vanilla

class Demo:

    def __init__(self):
        self.w = vanilla.Window((400, 400))
        self.w.tabs = vanilla.Tabs((10, 10, -10, -10), ["one", "two", "three"])
        self.w.open()

if __name__ == "__main__":
    from vanilla.test.testTools import executeVanillaTest
    executeVanillaTest(Demo)
typemytype commented 1 year ago

oh yes, got it... with pyobjc 9.1.1

typemytype commented 1 year ago

reported here https://github.com/ronaldoussoren/pyobjc/issues/549

downgrade for now :(