Skip to content

Commit

Permalink
Pass item type to ListStore
Browse files Browse the repository at this point in the history
  • Loading branch information
jtojnar committed Mar 10, 2023
1 parent 79f8170 commit 9c03e03
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/operations/ensure_coauthors.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ def get_coauthors(commit_message: str) -> list[str]:


def get_missing_coauthors(
# Should be Gio.ListStore[PackageUpdate] but pygobject does not implement Generic.
updates: Gio.ListStore,
updates: Gio.ListStore[PackageUpdate],
) -> Generator[tuple[Ggit.Commit, set[str]], None, None]:
for update in updates:
authors: set[str] = set()
Expand Down
4 changes: 3 additions & 1 deletion src/package_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class PackageUpdate(GObject.Object):
editing_stack_page = GObject.Property(type=str, default="not-editing")
final_commit_message_rich = GObject.Property(type=str)

_commits: Gio.ListStore[CommitInfo]

def __init__(self, subject: str, commits: list[Ggit.Commit], **kwargs):
super().__init__(**kwargs)
self._subject = subject
Expand Down Expand Up @@ -188,6 +190,6 @@ def changes_reviewed(self):
def changes_reviewed(self, changes_reviewed): # type: ignore[no-redef]
self._changes_reviewed = changes_reviewed

@GObject.Property(type=Gio.ListStore)
@GObject.Property(type=Gio.ListStore[CommitInfo])
def commits(self):
return self._commits
2 changes: 1 addition & 1 deletion src/package_update.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ class PackageUpdate(GObject.Object):
final_commit_message: str
changelog_link: str
changes_reviewed: bool
commits: Gio.ListStore
commits: Gio.ListStore[CommitInfo]
props: Props = ...
2 changes: 1 addition & 1 deletion src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class NonemastWindow(Adw.ApplicationWindow):
# Mapping between updates’ commit subjects and their indices in updates_store.
_updates_subject_indices: dict[str, int] = {}

updates = GObject.Property(type=Gio.ListStore)
updates = GObject.Property(type=Gio.ListStore[PackageUpdate])
updates_search_filter = Gtk.Template.Child()

details_stack = Gtk.Template.Child()
Expand Down
2 changes: 1 addition & 1 deletion src/window.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class UpdateDetails(Gtk.Box):

class NonemastWindow(Adw.ApplicationWindow):
class Props(Adw.ApplicationWindow.Props):
updates: Gio.ListStore
updates: Gio.ListStore[PackageUpdate]
props: Props = ...

0 comments on commit 9c03e03

Please sign in to comment.