mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 10:17:52 -06:00
Merge branch '4.0'
This commit is contained in:
commit
473633de2c
4 changed files with 11 additions and 5 deletions
|
@ -87,7 +87,7 @@ class AuthorizationHelpers:
|
||||||
token_request = requests.get("{}/check-token".format(self._settings.OAUTH_SERVER_URL), headers = {
|
token_request = requests.get("{}/check-token".format(self._settings.OAUTH_SERVER_URL), headers = {
|
||||||
"Authorization": "Bearer {}".format(access_token)
|
"Authorization": "Bearer {}".format(access_token)
|
||||||
})
|
})
|
||||||
except ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
# Connection was suddenly dropped. Nothing we can do about that.
|
# Connection was suddenly dropped. Nothing we can do about that.
|
||||||
Logger.logException("e", "Something failed while attempting to parse the JWT token")
|
Logger.logException("e", "Something failed while attempting to parse the JWT token")
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -5,6 +5,8 @@ import json
|
||||||
import webbrowser
|
import webbrowser
|
||||||
from typing import Optional, TYPE_CHECKING
|
from typing import Optional, TYPE_CHECKING
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
import requests.exceptions
|
||||||
|
|
||||||
|
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Signal import Signal
|
from UM.Signal import Signal
|
||||||
|
@ -49,7 +51,11 @@ class AuthorizationService:
|
||||||
def getUserProfile(self) -> Optional["UserProfile"]:
|
def getUserProfile(self) -> Optional["UserProfile"]:
|
||||||
if not self._user_profile:
|
if not self._user_profile:
|
||||||
# If no user profile was stored locally, we try to get it from JWT.
|
# If no user profile was stored locally, we try to get it from JWT.
|
||||||
self._user_profile = self._parseJWT()
|
try:
|
||||||
|
self._user_profile = self._parseJWT()
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
# Unable to get connection, can't login.
|
||||||
|
return None
|
||||||
|
|
||||||
if not self._user_profile and self._auth_data:
|
if not self._user_profile and self._auth_data:
|
||||||
# If there is still no user profile from the JWT, we have to log in again.
|
# If there is still no user profile from the JWT, we have to log in again.
|
||||||
|
|
|
@ -199,7 +199,7 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice):
|
||||||
# \param content_type: The content type of the body data.
|
# \param content_type: The content type of the body data.
|
||||||
# \param on_finished: The function to call when the response is received.
|
# \param on_finished: The function to call when the response is received.
|
||||||
# \param on_progress: The function to call when the progress changes. Parameters are bytes_sent / bytes_total.
|
# \param on_progress: The function to call when the progress changes. Parameters are bytes_sent / bytes_total.
|
||||||
def put(self, url: str, data: Union[str, bytes], content_type: Optional[str] = None,
|
def put(self, url: str, data: Union[str, bytes], content_type: Optional[str] = "application/json",
|
||||||
on_finished: Optional[Callable[[QNetworkReply], None]] = None,
|
on_finished: Optional[Callable[[QNetworkReply], None]] = None,
|
||||||
on_progress: Optional[Callable[[int, int], None]] = None) -> None:
|
on_progress: Optional[Callable[[int, int], None]] = None) -> None:
|
||||||
self._validateManager()
|
self._validateManager()
|
||||||
|
|
|
@ -355,8 +355,8 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
def sendJobToTop(self, print_job_uuid: str) -> None:
|
def sendJobToTop(self, print_job_uuid: str) -> None:
|
||||||
# This function is part of the output device (and not of the printjob output model) as this type of operation
|
# This function is part of the output device (and not of the printjob output model) as this type of operation
|
||||||
# is a modification of the cluster queue and not of the actual job.
|
# is a modification of the cluster queue and not of the actual job.
|
||||||
data = "{\"list\": \"queued\",\"to_position\": 0}"
|
data = "{\"to_position\": 0}"
|
||||||
self.post("print_jobs/{uuid}/action/move".format(uuid = print_job_uuid), data, on_finished=None)
|
self.put("print_jobs/{uuid}/move_to_position".format(uuid = print_job_uuid), data, on_finished=None)
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def deleteJobFromQueue(self, print_job_uuid: str) -> None:
|
def deleteJobFromQueue(self, print_job_uuid: str) -> None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue