Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gtk.NoSelection.__init__ incorrectly typed #131

Open
demberto opened this issue Apr 17, 2023 · 4 comments
Open

Gtk.NoSelection.__init__ incorrectly typed #131

demberto opened this issue Apr 17, 2023 · 4 comments

Comments

@demberto
Copy link

demberto commented Apr 17, 2023

Gtk.NoSelection.__init__

https://github.com/pygobject/pygobject-stubs/blob/master/src/gi-stubs/repository/_Gtk4.pyi#L10709

Actual error

model=Gtk.NoSelection(Gtk.StringList.new(["A", "B", "C"])),
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: GObject.__init__() takes exactly 0 arguments (1 given)

Solution

Use Gtk.NoSelection.new (very weird API bindings)

Version info

  • GObject: 3.44.1
  • pygobject-stubs: 2.7.0
  • Gtk: 4.10.3
@lovetox
Copy link
Collaborator

lovetox commented May 9, 2023

I think the introspection is wrong here for some reason but i cant find the error in https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtknoselection.c#L273
and idea @mat-xc

@mat-xc
Copy link
Collaborator

mat-xc commented May 9, 2023

I am not sure I am following. It's correct for __init__ to take 0 arguments. It only allows kwargs arguments.

@lovetox
Copy link
Collaborator

lovetox commented May 9, 2023

ah ok so is this true for all inits in GTK4? Is this something PyGObject enforces ? this means we could specifiy this making the init

def init(self, * , model: Gio.ListModel = ... )

@mat-xc
Copy link
Collaborator

mat-xc commented May 9, 2023

We already discussed it here.

I am on mobile right now, if your solution works I thinks it is a good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants