diff options
Diffstat (limited to 'kodereviewer/project.py')
-rw-r--r-- | kodereviewer/project.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/kodereviewer/project.py b/kodereviewer/project.py index 669ee90..d96d47b 100644 --- a/kodereviewer/project.py +++ b/kodereviewer/project.py @@ -1,4 +1,6 @@ import json +from typing import Optional + from PySide6.QtCore import QByteArray, QObject, QUrl, Signal, Slot, Property from PySide6.QtQml import QmlElement @@ -16,7 +18,7 @@ class Project(QObject): _url: QUrl _pull_requests: list[PullRequest] - pullRequestChanged = Signal() + pullRequestsChanged = Signal() def __init__(self, name: str, owner: str, url: QUrl): super().__init__() @@ -46,4 +48,11 @@ class Project(QObject): self._pull_requests = [ PullRequest(pr) for pr in data ] - self.pullRequestChanged.emit() + self.pullRequestsChanged.emit() + + def find_pull_request(self, number: int) -> Optional[PullRequest]: + for pr in self._pull_requests: + if pr.number == number: + return pr + + return None |