62 Commits

Author SHA1 Message Date
Ghostkeeper
f849df6ba3
Remove old df_access additional right
It is replaced by the new permissions system. The rights are more specific than 'digital factory access, yes or no'. It's now about whether you can read/write printers/projects/print jobs/etc and can differ whether it is your own project/job/etc or someone else's.

Contributes to issue CURA-9220.
2022-07-26 17:49:55 +02:00
jspijker
f9d4628b95 Merge branch 'main' into CURA-9365
# Conflicts:
#	.github/workflows/ci.yml
#	.github/workflows/cura-installer.yml
#	.github/workflows/requirements-conan-package.txt
#	resources/definitions/Mark2_for_Ultimaker2.def.json
#	resources/definitions/elegoo_neptune_2.def.json
#	resources/definitions/elegoo_neptune_2D.def.json
2022-07-08 12:37:32 +02:00
Ghostkeeper
15c1b96d7b
Fix crash if a Digital Library project is made by deleted user
If the user that created a project has been deleted, the response from the API doesn't include a username. This crashes Cura because it had no default for the username.
The organization_shared field was also optional.

Done as a small fry to fix a bug found by a colleague.
2022-07-07 15:04:15 +02:00
Ghostkeeper
96192adce2
Catch wrong cloud responses when it responds with a new file name
It could happen if there are bugs in the cloud, e.g. if they strip special characters somewhere.
We'd want to know it if they do. But we also don't want Cura to crash if the remote connection is not reliable, or if there's changes/bugs in the future.

Fixes Sentry issue CURA-42F.
2022-06-27 11:30:38 +02:00
c.lamboo
854607a725 Provide source_file_id with print file
Had to implement this a bit differently as stated in the ticket. This field is returned when uploading the project file.

Logic needed a bit of a change as the new behavior dictates a sequence (we can only upload the print file after the project file is uploaded, and we know the correct `file_id`/`source_file_id`) where before these two api calls were done in parallel.

CURA-8555
2022-06-15 13:36:34 +02:00
c.lamboo
f67d086182 Boyscouting modern python typing
CURA-8555
2022-06-15 13:27:47 +02:00
c.lamboo
0d4c3fa34d Use modern python typing notation
CURA-8555
2022-06-14 16:20:38 +02:00
j.delarago
cf52d384dd Wrapping Retrieval in DFRetrieval does not seem to work in QT6, the object returned only undefined for all enum values.
Fixed by creating and registering the enum inside DigitalFactoryController.py

CURA-9126
2022-04-21 11:22:07 +02:00
Remco Burema
448fbf7408
Qt5->Qt6: Register QML enums as (uncreatable) meta object not type.
part of CURA-8591
2021-12-29 11:37:18 +01:00
Remco Burema
20b435af76
Qt5->Qt6: More renamed stuff.
part of CURA-8591
2021-12-29 11:18:49 +01:00
Remco Burema
7021ff0b67
Qt5->Qt6: Replace QT_ENUMS with pyqtEnum.
part of CURA-8591
2021-12-28 14:59:25 +01:00
Remco Burema
32b52c6166
Qt5->Qt6: Rectify constant locations: UserRole, CppOwnership
part of CURA-8591
2021-12-28 14:54:56 +01:00
Remco Burema
abe7c1bf7f
Search/replace Qt5->Qt6.
part of upgrading Qt to v6.2: CURA-8591
2021-12-28 14:46:02 +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
Jelle Spijker
666880ad20
Only show certain App Switcher icons when account has DF access
Added a dictionary where additional user rights can be set.
A plugin such as the DigitalFactory can update this dictionary
if certain account rights change. The `account.additionalRights`
is intended to allow us some flexibility, without breaking the API
in the future.

The Application Switcher now queries the additional account rights,
which is updated by the DF plugin to only show `My printers`,
`Digital Library` and `Print jobs` when the user has access to the
DF.

Contributes to CURA-8624
2021-10-18 15:37:06 +02:00
Konstantinos Karmas
87add2c8de Revert "Revert "Use optional last output (file) name from output-dev to set project name.""
This reverts commit 24ff3692bd5b73828a1c5a58cdd55400cdddad9c.
2021-09-15 12:26:18 +02:00
Konstantinos Karmas
4e89ee0ccc Check against the correct SDK version
Since the `self.setLastOutputName` is available in 4.12 (SDK 7.8.0) onwards.

CURA-8566
2021-09-14 16:05:04 +02:00
Jaime van Kessel
c593f62271 Only set the lastOutputName if the SDK is high enough
This ensures that the DF plugin is backwards compatible

CURA-8358
2021-09-14 14:43:10 +02:00
Ghostkeeper
24ff3692bd
Revert "Use optional last output (file) name from output-dev to set project name."
This reverts commit c2c53d51c1954315324982bd916b8aad5c19946d.
2021-09-10 16:46:53 +02:00
Ghostkeeper
9e2b556ce8
Revert "Only change project name when saving to project files."
This reverts commit b97920e5b155caaab6a8b3bb167853a00ae4b604.
2021-09-10 16:46:39 +02:00
Remco Burema
b97920e5b1
Only change project name when saving to project files.
CURA-8358
2021-09-01 18:11:10 +02:00
Remco Burema
c2c53d51c1
Use optional last output (file) name from output-dev to set project name.
Instead of relying on the filename emitted when the workspace is changed. This is done so the user can also change the project name when saving to an output device, such as a local file, or the digital library, that supports changeing the (file)name.

CURA-8358
2021-09-01 16:04:05 +02:00
Jaime van Kessel
668624e13d Set lifetimes correctly 2021-08-19 10:01:01 +02:00
Konstantinos Karmas
9f31e1421b Make lifetime optional in the getBackwardsCompatibleMessage
This should fix the failing tests
2021-08-18 17:18:21 +02:00
Ghostkeeper
a40c7e7410
Default lifetime for successful upload messages
There is no real reason to keep this visible indefinitely.
2021-08-18 15:36:41 +02:00
Remco Burema
3061490675
Fix look for string in enum-type.
CURA-8473
2021-08-12 10:05:16 +02:00
Remco Burema
ecf820f3db
Fix tests.
CURA-8473
2021-08-11 12:35:54 +02:00
Remco Burema
5d7804deae
Digital Library plugin needs to be backwards compatible.
Message-types are a new parameter to Messages, so they can't be used in SDK/API versions smaller than 7.7.0.

CURA-8473
2021-08-11 12:14:02 +02:00
Jaime van Kessel
57e66a5796 Add campaign links
CURA-8441
2021-08-05 15:42:23 +02:00
Jelle Spijker
2263969d5f
Updated message with message types
Contributes to CURA-8418
2021-07-28 08:45:42 +02:00
Jaime van Kessel
900db57f0f
Update messages to use the message_types
CURA-8418
2021-07-27 11:54:43 +02:00
Remco Burema
71937bf828
DL: Align with online backend on allowed characters.
CURA-8395
2021-07-20 17:58:29 +02:00
Remco Burema
f9557295fa
Allow non-ASCII characters for DL project names.
CURA-8395
2021-07-16 12:39:41 +02:00
Konstantinos Karmas
11d86b98ef Merge branch 'master' into CURA-8112_Inform_the_user_about_their_subscription_limits 2021-07-14 15:52:27 +02:00
Konstantinos Karmas
fd322c0512 Fix having no "load more projects" available when using the search
When the `_onGetProjectsFirstPageFinished` is reached, the pagination manager already contains the correct pagination metadata and links, so calling `clear()` there resets them giving the impression that there is no next page.

This commit fixed that by calling the `clear()` function should when the search filter is applied, instead.

CURA-8009
2021-07-14 15:32:57 +02:00
Konstantinos Karmas
7027a8f904 Fix mypy complaint again
Mypy doesn't recognize that the check for `None` has happened before calling the `callbackWrap` (before the get request has been made).

CURA-8112
2021-07-14 13:08:51 +02:00
Konstantinos Karmas
300176cdc6 Check for the maximum **private** projects
When checking whether the user is allowed to create a new library project, we need to retrieve the **private** (aka non-shared) projects that are linked to the user's account. If the user has reached the maximum private projects, then they are no longer allowed to create new ones.

**Note**: We need to set the `pagination_manager` to `None` when doing this get request, or else the next/previous links of the pagination will become mixed up with the pagination links of the list of projects shown to the user, corrupting them and creating the wrong "get more projects" link.

CURA-8112
2021-07-14 13:03:03 +02:00
Konstantinos Karmas
3dbbe7276b Remove check for account subscriptions
Since the variable `self._user_has_access` already contains the information on whether the user can access the Digital Library.

CURA-8112
2021-07-14 12:55:28 +02:00
Konstantinos Karmas
2961d20c04 Fix mypy complaint
CURA-8112
2021-07-13 17:38:15 +02:00
Konstantinos Karmas
2d45b8c2cd Show an "Upgrade plan" button to users that have reached maximum projects
Instead of letting users go through the project creation process only to get rejected with a "subscription limits reached" message, now the "New Library project" button is being replaced with an "Upgrade plan" button when the maximum allowed projects have been reached for the specific amount. The button is accompanied by a tooltip that explains the situation to the user. Once clicked, the user is redirected to the subscriptions page.

CURA-8112
2021-07-13 17:28:38 +02:00
Jaime van Kessel
888f62a9ea
Add missing typing
CURA-8009
2021-07-13 16:55:28 +02:00
Konstantinos Karmas
9d8286d90c Set the correct initial value in the feature budget attributes
They were defined as `Optional[int]` but started with the default value as `False`.

CURA-8112
2021-07-13 16:52:36 +02:00
Ghostkeeper
72eb839d07
Add missing search filter parameter to refresh query
Thank you, automated tests.

Contributes to issue CURA-8009.
2021-07-13 16:18:36 +02:00
Ghostkeeper
1269c28d0a
Reduce wait time before sending query
Most people should be able to type 5 characters per second. And those that can't will just have to see it refresh after every stroke.

Contributes to issue CURA-8009.
2021-07-12 18:46:54 +02:00
Ghostkeeper
94e229aa44
Clear list of projects every time we load the first page
Otherwise when we refresh the project list after searching it would put the new results at the end. That's not what we want.

Contributes to issue CURA-8009.
2021-07-12 18:44:11 +02:00
Ghostkeeper
02932a1f62
Add filter to API call for project list
This passes the filter on to the API call and causes the API call, so that we only get the projects that the user searched for.

Contributes to issue CURA-8009.
2021-07-12 18:43:15 +02:00
Ghostkeeper
65f7eb5ea8
Add function to update search filter when the user types
Seems to work fine.
The pyqtSignal is not technically necessary unless we display this filter in the interface anywhere. We don't currently. If the signal is not present it would complain about non-notifyable properties. And making it a slot instead of a signal seems a bit unintuitive to me in how the field is being used.

Contributes to issue CURA-8009.
2021-07-12 17:41:10 +02:00
Remco Burema
85f98bdaff
Appease type-checking system even further.
That last one should have worked really.

part of CURA-8138
2021-07-09 21:36:20 +02:00
Remco Burema
6f99837db5
Fix typing.
part of CURA-8138
2021-07-09 21:17:33 +02:00
Remco Burema
c78618bc15
Digital Library: Allow 'personal users' to DL.
Users with an account and an UM printer should have some basic access to the Digital Library. To this end, and to remain future proof, the online team has made an extension to its API so now feature budgets can be gauge. At the moment it's only checked wether the user has any access to personal projects at all. If so, the interface shows Digital Library functionality. Known issue: Removing the last printer from DF while still logged in leaves the DL access in the Cura interface until logged out or Cura restarted. Additionally, I think the response for a logged in user without any printer from the API is just 'data = empty list' instead of everything set to False and 0 (which should be the case as they're all listed as required fields in their docs ... maybe I'm missing something). In any case, the code as is now can handle that as well.

CURA-8138
2021-07-09 21:06:49 +02:00