mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 15:29:02 +08:00
Merge branch 'network_rewrite' of github.com:Ultimaker/Cura into network_rewrite
This commit is contained in:
commit
fc3a47cb7b
@ -45,7 +45,9 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice):
|
|||||||
self._onFinishedCallbacks = {} # type: Dict[str, Callable[[QNetworkReply], None]]
|
self._onFinishedCallbacks = {} # type: Dict[str, Callable[[QNetworkReply], None]]
|
||||||
self._authentication_state = AuthState.NotAuthenticated
|
self._authentication_state = AuthState.NotAuthenticated
|
||||||
|
|
||||||
self._cached_multiparts = {} # type: Dict[int, Tuple[QHttpMultiPart, QNetworkReply]]
|
# QHttpMultiPart objects need to be kept alive and not garbage collected during the
|
||||||
|
# HTTP which uses them. We hold references to these QHttpMultiPart objects here.
|
||||||
|
self._live_multiparts = {} # type: Dict[QNetworkReply, QHttpMultiPart]
|
||||||
|
|
||||||
self._sending_gcode = False
|
self._sending_gcode = False
|
||||||
self._compressing_gcode = False
|
self._compressing_gcode = False
|
||||||
@ -170,8 +172,8 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice):
|
|||||||
return "Unknown User" # Couldn't find out username.
|
return "Unknown User" # Couldn't find out username.
|
||||||
|
|
||||||
def _clearCachedMultiPart(self, reply: QNetworkReply) -> None:
|
def _clearCachedMultiPart(self, reply: QNetworkReply) -> None:
|
||||||
if id(reply) in self._cached_multiparts:
|
if reply in self._live_multiparts:
|
||||||
del self._cached_multiparts[id(reply)]
|
del self._live_multiparts[reply]
|
||||||
|
|
||||||
def put(self, target: str, data: str, onFinished: Optional[Callable[[Any, QNetworkReply], None]]) -> None:
|
def put(self, target: str, data: str, onFinished: Optional[Callable[[Any, QNetworkReply], None]]) -> None:
|
||||||
if self._manager is None:
|
if self._manager is None:
|
||||||
@ -219,7 +221,7 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice):
|
|||||||
|
|
||||||
reply = self._manager.post(request, multi_post_part)
|
reply = self._manager.post(request, multi_post_part)
|
||||||
|
|
||||||
self._cached_multiparts[id(reply)] = (multi_post_part, reply)
|
self._live_multiparts[reply] = multi_post_part
|
||||||
|
|
||||||
if onProgress is not None:
|
if onProgress is not None:
|
||||||
reply.uploadProgress.connect(onProgress)
|
reply.uploadProgress.connect(onProgress)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user