26804 Commits

Author SHA1 Message Date
Jaime van Kessel
ab2cbbfecc
Merge pull request #10920 from sustmi/czech-translations-v4.12.1
Add Czech translations for v4.12.1
2021-11-30 14:40:52 +01:00
Ghostkeeper
5da63fda26
Also catch BlockingIOError when getting a keyring attribute
This occurs when there's a timeout, on some systems, when asking for the password to the keyring. We'll interpret a timeout as a refusal to enter a password.

Fixes Sentry issue CURA-332.
2021-11-30 13:27:32 +01:00
Jaime van Kessel
2f999ca399
Merge pull request #10858 from Ultimaker/PP-25_close-to-100%-density-infill-behaviour
PP-25 close to 100% density infill behaviour
2021-11-29 10:47:48 +01:00
Miroslav Sustek
45bf7b3bfc Add Czech translations for v4.12.1 2021-11-25 01:45:26 +01:00
Ghostkeeper
9a4836a7b0
Increase top distance by 1 layer for profiles using tree support
We changed tree support to have a correct top distance now. If you ask for 0 top distance, you get 0 top distance. If you ask for 0.2mm top distance, you get 0.2mm top distance (rounded to layers). Previously the top distance was too high. Yet it seems that people were happy with how easily Tree Support was removed from the print. So this is a best-effort attempt to keep the final result similar to what it was originally.
It won't work for everything, I fear. But it's about as good as we can make it.

Contributes to issue CURA-7624.
2021-11-24 13:03:33 +01:00
Ghostkeeper
1df859e046
Catch IndexError when logging errors
And log that error too, then.

Fixes Sentry issue CURA-32J.
2021-11-23 19:04:33 +01:00
Ghostkeeper
2f1c157547
Don't attempt writing a workspace before there is a global stack
This is normally not possible from the interface. However on MacOS, the application menu gets carried to the top bar of the operating system. It is not blocked there, and the user could write a project file before they even add a printer. This prevents Cura from crashing when they do that.

Fixes Sentry issue CURA-2ZR.
2021-11-23 17:54:26 +01:00
Ghostkeeper
cecd033430
Merge branch 'CURA-8541_Aborted_state_not_reflected_correctly_in_Cura_Monitor_Page' 2021-11-23 16:28:46 +01:00
Jelle Spijker
8427555d6a
Merge pull request #10901 from Ultimaker/CURA-8539_oauth_via_httprequestmanager
OAuth via HttpRequestManager
2021-11-23 13:59:45 +01:00
Jelle Spijker
36e28a245c
Fixed typing issues
Contributes to: CURA-8539
2021-11-23 13:56:04 +01:00
Jelle Spijker
0a43366ffc
Fixed some styling and typing issues
Some boyscouting.
Contributes to: CURA-8539
2021-11-23 11:10:22 +01:00
Jelle Spijker
70504f1b04
Modernize typing usage
Some boyscouting.
2021-11-23 11:10:22 +01:00
Ghostkeeper
487ececb82
Merge branch 'master' of github.com:Ultimaker/Cura 2021-11-23 11:01:30 +01:00
Ghostkeeper
7bf9ed9237
Merge branch 'master' of https://github.com/prueker/Cura into prueker-master 2021-11-23 10:57:20 +01:00
Remco Burema
1eaacacc6a
Merge branch 'fieldOfView-fix_simulation_view_crash' 2021-11-23 09:28:20 +01:00
Remco Burema
ac8d5fc12c
More explicit float's in shader just to be sure.
CURA-8714
2021-11-23 09:27:25 +01:00
Remco Burema
5b99de1ebd
Merge branch 'fix_simulation_view_crash' of https://github.com/fieldOfView/Cura into fieldOfView-fix_simulation_view_crash 2021-11-23 09:13:48 +01:00
Ghostkeeper
677b64f068
Remove unnecessary import
We're not using this library any more now. Not even in the tests.

Contributes to issue CURA-8539.
2021-11-22 19:08:17 +01:00
Ghostkeeper
3f92b46ac8
Don't restart refresh token while it's already processing
If two requests to the API occur at the same time, they will both see at the same time that they need an access token, and if it is expired they will both see that it needs refreshing. The server then sees two refreshes, both with the same refresh token. This is not allowed. The second one then gets a failure to refresh the token, which causes the user to log out.
Instead, we'll stop one of the refresh requests. They were fire-and-forget anyway, so it's not needed to actually continue the request.

Contributes to issue CURA-8539.
2021-11-22 18:52:43 +01:00
Ghostkeeper
608cce491d
Remove tests checking for data in UserProfile
The UserProfile is being stored in the account with a simple assignment, and these are just some property getters with a fallback. I don't think we need to test that.
The actual getting of a user profile (and whether that returns correctly when logged out and such) is already tested as part of the OAuth flow where that code lives.

Contributes to issue CURA-8539.
2021-11-22 18:45:04 +01:00
Ghostkeeper
1cdeb7d56b
Typing: When the user profile changes, it may also become None
This happens when logging out.

Contributes to issue CURA-8539.
2021-11-22 16:30:03 +01:00
Ghostkeeper
0196fd54ea
Add a few missing types
The return type missing caused the type checker to think it returned Any, which is clearly not true. And the type missing from _user_profile caused it to think it always had to be None, which is nonsense in any application.

Contributes to issue CURA-8539.
2021-11-22 16:24:22 +01:00
Ghostkeeper
1ee9f73075
Only call success_callback if it's not None
It could also be called as a fire-and-forget update thing.

Contributes to issue CURA-8539.
2021-11-22 16:20:37 +01:00
Ghostkeeper
595a6580f5
Use error callback and with correct number of parameters
It gives two parameters, additionally an error code. However our callback wrapper gets the error code from the reply itself so it doesn't need it.

Contributes to issue CURA-8539.
2021-11-22 16:17:30 +01:00
Ghostkeeper
4b5d698325
Fix assertion of resulting profile via callback
Needs to work differently with the asynchronous workflow.

Contributes to issue CURA-8539.
2021-11-22 15:54:42 +01:00
Ghostkeeper
fbbf1427b3
Fix patching of getUserProfile
The actual profile is not necessary for this test. But this function always returns None and we shouldn't patch it to make it return something else.

Contributes to issue CURA-8539.
2021-11-22 15:52:24 +01:00
Ghostkeeper
c5e22c53cc
Fix checking return values in log-in/log-out flow test
Contributes to issue CURA-8539.
2021-11-22 15:48:29 +01:00
Ghostkeeper
a8a41381cb
Remove test simulating request error in user profile
We're no longer generating that error. We're generating a QNetworkReply with a built-in error code and those errors are handled the same way as the failed requests tested above.

Contributes to issue CURA-8539.
2021-11-22 15:14:05 +01:00
Ghostkeeper
4139350496
Fix test checking for failure of refresh token to reset auth
It was previously mocking some return values that should now get returned via callbacks. And it was previously relying on a web service which might not connect at all.

Contributes to issue CURA-8539.
2021-11-22 15:11:35 +01:00
Ghostkeeper
3236be1c20
Also mock POST command and a failed response
Otherwise it'll end up using actual internet connections anyway. Not what we want.

Contributes to issue CURA-8539.
2021-11-22 14:45:44 +01:00
Ghostkeeper
8ea8cc752f
Also call processing functions for error callbacks
Otherwise the appropriate callbacks might not get called.

Contributes to issue CURA-8539.
2021-11-22 14:44:52 +01:00
Ghostkeeper
e8f9e92f02
Simulate an actual expired authentication token
The test should trigger the refresh token to be used to get a new authentication token.

Contributes to issue CURA-8539.
2021-11-22 14:26:15 +01:00
Ghostkeeper
70924f17aa
Mock HttpRequestManager getting the profile with refresh token
I'm not sure the refresh token is actually used though. I might want to try to guarantee that.

Contributes to issue CURA-8539.
2021-11-22 13:44:46 +01:00
Ghostkeeper
3b6ff15d60
Rewrite test to mock HttpRequestManager with authentication failure
That's the expected outcome of the premise of this test.

Contributes to issue CURA-8539.
2021-11-22 13:25:15 +01:00
Ghostkeeper
937d48a4e8
Add missing failed_callback
If it fails to check the token, respond through the callback with None as well.

Contributes to issue CURA-8539.
2021-11-22 13:24:06 +01:00
Ghostkeeper
c8aff57bfe
Actually mock a reply from the auth server
The reply is not really relevant. The reply is mocked through readJSON.
So it turns out that so far, our tests have been making actual requests to the authentication server, and depended on it being online. Not good. Mock those external dependencies!

Contributes to issue CURA-8539.
2021-11-22 12:11:45 +01:00
Ghostkeeper
c36863da56
Only call failed_callback if provided
Otherwise we'd crash because NoneType can't be called.

Contributes to issue CURA-8539.
2021-11-22 11:59:23 +01:00
Ghostkeeper
f0cbdeb903
Use docstring format for this documentation
Contributes to issue CURA-8539.
2021-11-22 10:50:06 +01:00
Ghostkeeper
9dd251975d
Test for result of callback with a callable
In this case the callback should get called immediately (no wait) so it is safe to test for this callback, albeit slightly implementation-defined.

Contributes to issue CURA-8539.
2021-11-22 10:48:45 +01:00
Ghostkeeper
30d19844f2
Always callback if there is a callback, even if no auth data
Because not having auth data is a reason to return no profile too. Otherwise the other side might wait for a response for a long time.

Contributes to issue CURA-8539.
2021-11-22 10:45:01 +01:00
Ghostkeeper
1636cca601
Add missing return
We're calling back that there is no auth data, so we should stop here and not try to obtain a user profile.

Contributes to issue CURA-8539.
2021-11-22 10:34:39 +01:00
casper
6be0d58039 Add handling of missing printJob status cases
The `printJob` now also contains a status for detecting aborted prints
that were awaiting cleanup, preventing the need for the additional
checks in the `await_cleanup` status.
2021-11-19 17:22:13 +01:00
Ghostkeeper
ffb891fb69
Fix call to failed_callback
It provides 2 arguments (reply and error) which we both ignore and proceed to call failed_callback. And failed_callback may also be None in which case we don't call anything.

Contributes to issue CURA-8539.
2021-11-19 17:09:33 +01:00
Ghostkeeper
9895015235
Call getAccessTokenUsingRefreshToken asynchronously
Getting into nested inline functions into inline functions here. Let's see what the reviewer thinks of all this!

Contributes to issue CURA-8539.
2021-11-19 17:04:37 +01:00
Ghostkeeper
7091c5f3aa
Make getAuthenticationTokenUsingXYZ asynchronous
As a result, the local webserver now needs to synchronise that with a lock. Otherwise the do_GET function would no longer block, and wouldn't properly be able to return the correct redirect URL.

Contributes to issue CURA-8539.
2021-11-19 16:55:45 +01:00
Ghostkeeper
9b55ae6dda
Remove unused imports of requests
This was the objective, really.

Contributes to issue CURA-8539.
2021-11-19 16:25:50 +01:00
Ghostkeeper
acbbf83510
Deal with absence of callback function
It may be None, so then we don't need to call back. The consumer may just take it from self._user_profile.

Contributes to issue CURA-8539.
2021-11-19 16:23:48 +01:00
Ghostkeeper
a5202b61d2
Don't emit with new profile
The signal can't accept it because it's not a QObject.

Contributes to issue CURA-8539.
2021-11-19 16:22:41 +01:00
Ghostkeeper
bfb8440a04
Get user profile asynchronously when restoring from preferences
Do not stop the start-up process for it. Let the callback handle the updating if necessary.

Contributes to issue CURA-8539.
2021-11-19 16:20:00 +01:00
Ghostkeeper
92437a920d
Store account information asynchronously when completing request
And make the PyQt properties listen to the signal of completion.

Contributes to issue CURA-8539.
2021-11-19 16:02:25 +01:00