Fix some PR comments, cleanup imports

This commit is contained in:
ChrisTerBeke 2018-11-23 14:11:43 +01:00
parent 8ee39c0489
commit 2fc5061c41
2 changed files with 13 additions and 17 deletions

View File

@ -15,10 +15,10 @@ from cura.CuraApplication import CuraApplication
# This was originally part of NetworkedPrinterOutputDevice but was moved out for re-use in other classes. # This was originally part of NetworkedPrinterOutputDevice but was moved out for re-use in other classes.
class NetworkClient: class NetworkClient:
def __init__(self, application: CuraApplication = None): def __init__(self) -> None:
# Use the given application instance or get the singleton instance. # Use the given application instance or get the singleton instance.
self._application = application or CuraApplication.getInstance() self._application = CuraApplication.getInstance()
# Network manager instance to use for this client. # Network manager instance to use for this client.
self._manager = None # type: Optional[QNetworkAccessManager] self._manager = None # type: Optional[QNetworkAccessManager]
@ -89,7 +89,7 @@ class NetworkClient:
def _validateManager(self) -> None: def _validateManager(self) -> None:
if self._manager is None: if self._manager is None:
self._createNetworkManager() self._createNetworkManager()
assert (self._manager is not None) assert self._manager is not None
## Callback for when the network manager detects that authentication is required but was not given. ## Callback for when the network manager detects that authentication is required but was not given.
@staticmethod @staticmethod

View File

@ -1,22 +1,18 @@
# Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
import os
from UM.FileHandler.FileHandler import FileHandler #For typing. import gzip
from UM.Logger import Logger
from UM.Scene.SceneNode import SceneNode #For typing.
from cura.CuraApplication import CuraApplication
from cura.NetworkClient import NetworkClient
from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState
from PyQt5.QtNetwork import QHttpMultiPart, QHttpPart, QNetworkRequest, QNetworkAccessManager, QNetworkReply, QAuthenticator
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QUrl, QCoreApplication
from time import time from time import time
from typing import Any, Callable, Dict, List, Optional from typing import Dict, List, Optional
from enum import IntEnum from enum import IntEnum
import os # To get the username from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply
import gzip from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QCoreApplication
from UM.FileHandler.FileHandler import FileHandler
from UM.Scene.SceneNode import SceneNode
from cura.NetworkClient import NetworkClient
from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState
class AuthState(IntEnum): class AuthState(IntEnum):