Fix more Mypy warnings

CURA-6983
This commit is contained in:
Nino van Hooff 2020-01-14 17:57:12 +01:00
parent 53115dc3b2
commit 88e5626b59
3 changed files with 14 additions and 4 deletions

View file

@ -24,6 +24,7 @@ class DiscrepanciesPresenter(QObject):
def present(self, plugin_path: str, model: SubscribedPackagesModel):
path = os.path.join(plugin_path, self._compatibility_dialog_path)
self._dialog = self._app.createQmlComponent(path, {"subscribedPackagesModel": model})
assert self._dialog
self._dialog.accepted.connect(lambda: self._onConfirmClicked(model))
def _onConfirmClicked(self, model: SubscribedPackagesModel):

View file

@ -42,11 +42,20 @@ class DownloadPresenter:
for item in model.items:
package_id = item["package_id"]
def finishedCallback(reply: QNetworkReply, pid = package_id) -> None:
self._onFinished(pid, reply)
def progressCallback(rx: int, rt: int, pid = package_id) -> None:
self._onProgress(pid, rx, rt)
def errorCallback(reply: QNetworkReply, error: QNetworkReply.NetworkError, pid = package_id) -> None:
self._onError(pid)
request_data = manager.get(
item["download_url"],
callback = lambda reply, pid = package_id: self._onFinished(pid, reply),
download_progress_callback = lambda rx, rt, pid = package_id: self._onProgress(pid, rx, rt),
error_callback = lambda rx, rt, pid = package_id: self._onProgress(pid, rx, rt),
callback = finishedCallback,
download_progress_callback = progressCallback,
error_callback = errorCallback,
scope = self._scope)
self._progress[package_id] = {

View file

@ -48,7 +48,7 @@ class Toolbox(QObject, Extension):
self._download_request_data = None # type: Optional[HttpRequestData]
self._download_progress = 0 # type: float
self._is_downloading = False # type: bool
self._scope = UltimakerCloudScope(application)
self._scope = UltimakerCloudScope(application) # type: UltimakerCloudScope
self._request_urls = {} # type: Dict[str, str]
self._to_update = [] # type: List[str] # Package_ids that are waiting to be updated