mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 03:46:05 +08:00
Merge branch 'master' of https://github.com/Ultimaker/Cura
This commit is contained in:
commit
7fd7b3a868
@ -1,6 +1,6 @@
|
|||||||
# Copyright (c) 2020 Ultimaker B.V.
|
# Copyright (c) 2020 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 sys
|
||||||
import threading
|
import threading
|
||||||
from typing import Any, Callable, Optional, TYPE_CHECKING
|
from typing import Any, Callable, Optional, TYPE_CHECKING
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ class LocalAuthorizationServer:
|
|||||||
self._web_server.setState(state)
|
self._web_server.setState(state)
|
||||||
|
|
||||||
# Start the server on a new thread.
|
# Start the server on a new thread.
|
||||||
self._web_server_thread = threading.Thread(None, self._web_server.serve_forever, daemon = self._daemon)
|
self._web_server_thread = threading.Thread(None, self._serve_forever, daemon = self._daemon)
|
||||||
self._web_server_thread.start()
|
self._web_server_thread.start()
|
||||||
|
|
||||||
def stop(self) -> None:
|
def stop(self) -> None:
|
||||||
@ -87,3 +87,21 @@ class LocalAuthorizationServer:
|
|||||||
pass
|
pass
|
||||||
self._web_server = None
|
self._web_server = None
|
||||||
self._web_server_thread = None
|
self._web_server_thread = None
|
||||||
|
|
||||||
|
def _serve_forever(self) -> None:
|
||||||
|
"""
|
||||||
|
If the platform is windows, this function calls the serve_forever function of the _web_server, catching any
|
||||||
|
OSErrors that may occur in the thread, thus making the reported message more log-friendly.
|
||||||
|
If it is any other platform, it just calls the serve_forever function immediately.
|
||||||
|
|
||||||
|
:return: None
|
||||||
|
"""
|
||||||
|
if self._web_server:
|
||||||
|
if sys.platform == "win32":
|
||||||
|
try:
|
||||||
|
self._web_server.serve_forever()
|
||||||
|
except OSError as e:
|
||||||
|
Logger.warning(str(e))
|
||||||
|
else:
|
||||||
|
# Leave the default behavior in non-windows platforms
|
||||||
|
self._web_server.serve_forever()
|
||||||
|
@ -91,8 +91,6 @@ class CloudOutputDeviceManager:
|
|||||||
if self._syncing:
|
if self._syncing:
|
||||||
return
|
return
|
||||||
|
|
||||||
Logger.info("Syncing cloud printer clusters")
|
|
||||||
|
|
||||||
self._syncing = True
|
self._syncing = True
|
||||||
self._account.setSyncState(self.SYNC_SERVICE_NAME, SyncState.SYNCING)
|
self._account.setSyncState(self.SYNC_SERVICE_NAME, SyncState.SYNCING)
|
||||||
self._api.getClusters(self._onGetRemoteClustersFinished, self._onGetRemoteClusterFailed)
|
self._api.getClusters(self._onGetRemoteClustersFinished, self._onGetRemoteClusterFailed)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user