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

typing: Gio: Make ListModel and ListStore generic #115

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jtojnar
Copy link
Contributor

@jtojnar jtojnar commented Mar 9, 2023

No description provided.

@jtojnar
Copy link
Contributor Author

jtojnar commented Mar 9, 2023

Hmm, my app crashes when I try to use it so probably requires changes to pygobject itself:

Traceback (most recent call last):
  File "/nix/store/m8l8vlxnp3a5wbvrx162qzjfakbayds8-nonemast-0.1.0/bin/..nonemast-wrapped-wrapped", line 30, in <module>
    from nonemast import main
  File "/nix/store/m8l8vlxnp3a5wbvrx162qzjfakbayds8-nonemast-0.1.0/share/nonemast/nonemast/main.py", line 11, in <module>
    from .window import NonemastWindow
  File "/nix/store/m8l8vlxnp3a5wbvrx162qzjfakbayds8-nonemast-0.1.0/share/nonemast/nonemast/window.py", line 19, in <module>
    from .operations import ensure_coauthors
  File "/nix/store/m8l8vlxnp3a5wbvrx162qzjfakbayds8-nonemast-0.1.0/share/nonemast/nonemast/operations/ensure_coauthors.py", line 17, in <module>
    def ensure_coauthors(updates: Gio.ListStore[PackageUpdate]) -> None:
TypeError: 'GObjectMeta' object is not subscriptable

Edit: Opened https://gitlab.gnome.org/GNOME/pygobject/-/merge_requests/237

@jtojnar jtojnar marked this pull request as draft March 21, 2023 11:10
def __getitem__(self, position: int) -> GObject.Object: ...
def __iter__(self) -> Iterator[GObject.Object]: ...
class ListModel(GObject.GInterface, Generic[ItemType]):
# override
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think thats necessary, if the class itself has a "override" annotation, then it will be completely ignored by the generator. So no need to add override to each method.

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

Successfully merging this pull request may close these issues.

2 participants