29 Commits

Author SHA1 Message Date
Jelle Spijker
453de95d12
Defensive programming
Long API calls might return after the Local or Remote
PackageList has been deconstructed. Somehow setting
the ownership in QML doesn't seem to work for this.
So we guard against this with a try catch block.

Contributes to: CURA-8587
2021-12-08 09:58:53 +01:00
Jelle Spijker
9e4258ef8b
Set the is_recently_installed flag
Contributes to: CURA-8587
2021-12-07 16:22:31 +01:00
Jelle Spijker
013e0b51e9
Storing multiple ongoing_requests
A bit of defensive programming

Contributes to: CURA-8587
2021-12-07 15:56:35 +01:00
Ghostkeeper
a084b689b5
Add one remaining forgotten type import
Contributes to issue CURA-8587.
2021-12-06 17:26:12 +01:00
Jelle Spijker
1cc3d374a0
Show the uninstall button for packages which can be downgraded to the bundled version
Contributes to: CURA-8587
2021-12-06 14:11:31 +01:00
Jelle Spijker
28b6bfb729
Fixed the update button busy state
Contributes to: CURA-8587
2021-12-06 13:53:44 +01:00
Jelle Spijker
325783ca46
Persistent handled state across Package Lists
Contributes to: CURA-8587
2021-12-06 10:19:14 +01:00
Jelle Spijker
2d9c557a13
Only check for updates when logged in
Contributes to: CURA-8587
2021-12-06 09:43:09 +01:00
Jelle Spijker
863e92d0d2
Fixed state of manage buttons
Contributes to: CURA-8587
2021-12-06 09:14:40 +01:00
Jelle Spijker
305fb4ab09
renamed locally_installed property
Contributes to: CURA-8587
2021-12-05 16:23:23 +01:00
Jelle Spijker
743ac67cdb
un-/subscribe the user to installed packages
Contributes to: CURA-8587
2021-12-03 17:08:28 +01:00
Jelle Spijker
3b3d986058
Groundwork for installing/updating packages
Contributes to: CURA-8587
2021-12-03 13:27:26 +01:00
Jelle Spijker
ff5a4a4f5a
Adding functionality to the manageButtons
Contributes to: CURA-8587
2021-12-03 13:27:16 +01:00
Jelle Spijker
02e2e0a1c6
Filter already installed packages from the install listviews
Contributes to: CURA-8587
2021-12-03 13:25:46 +01:00
Jelle Spijker
09bc28d840
Moved local package logic out of the LocalPackageList
Contributes to: CURA-8587
2021-12-03 13:25:46 +01:00
Jelle Spijker
6514fdf9f2
Check the server if a package can be updated
The server is queried using the local packages_id and version to
determine if they can be updated. The Manage button state is set
accordingly. This is done in an async way to keep the UI responsive

A.t.m I'm not sure if I might need to move this logic out, since
we also need to make this query when check periodically for updates.
when the list is not shown. But that would also entail creating
the installed packages list before the Manage Packages tab is ever
created in the Marketplace.

Contributes to: CURA-8587
2021-12-03 13:25:43 +01:00
Jelle Spijker
11b3b08198
Implemented code review suggestions
Contributes to CURA-8558
2021-11-04 08:23:46 +01:00
Jelle Spijker
e01e47b8fa
Performance increase for obtaining LocalPackages
The speed increase on the function when running Yappi
`LocalPackageList.updatePackages`
| original | now  |
|----------|------|
|  14 ms   | 4 ms |

Contributes to CURA-8558
2021-11-04 08:23:46 +01:00
Jelle Spijker
3a94fc0ced
Apply suggestions from code review
Applied code review comments

Co-authored-by: Jaime van Kessel <nallath@gmail.com>
2021-11-03 17:58:16 +01:00
Jelle Spijker
e7aecb6c06
Fixed mypy typing failure
@ghostkeeper being nerd snipped
It's giving that typing failure because the section variable is re-used.
First as elements from self._getSections (strs) and then as elements
from sorted_sections.values() (List[PackageModel]s). Python has no
variable scopes within functions so the variable still exists after the
first for loop.

Contributes to CURA-8558
2021-11-03 16:29:35 +01:00
j.spijker@ultimaker.com
f9f43b79b0
Don't pollute the package_info with section_title
The previous implementation added a section_title to the package_info
which was also stored in the packages.json. The section_title is now
provided to the PackageModel as an extra optional argument.

Contributes to CURA-8558
2021-11-03 15:15:46 +01:00
j.spijker@ultimaker.com
edc71f12a3
Updated documentation and typing
Contributes to CURA-8558
2021-11-03 15:15:46 +01:00
j.spijker@ultimaker.com
0218703592
To be installed packages are still listed for the current session
A user might still need to interact with a **to be installed** package.
But the current package list doesn't list that package anymore.

Introduced a `getPackagesToInstall()` method in the Uranium PackageManager
to circumvent this issue.

Contributes to CURA-8558
2021-11-03 15:15:45 +01:00
j.spijker@ultimaker.com
080e3b9f27
To be removed packages are still listed for the current session
A user might still need to interact with a **to be removed** package and
it is also still being used in the current Cura session. But the current
package list doesn't list that package anymore.

Introduced a `getPackagesToRemove()` method in the Uranium PackageManager
to circumvent this issue.

Contributes to CURA-8558
2021-11-03 15:15:45 +01:00
j.spijker@ultimaker.com
8fad2e0f39
Changed section header for Installed Plugins
As agreed with UX changed: `Installed Cura Plugins` to `Installed Plugins`

Contributes to CURA-8558
2021-11-03 15:15:45 +01:00
j.spijker@ultimaker.com
1b7b0b9caf
Sort the different sections and packages
The order in which UX defined the different sections are:
- Installed Cura Plugins
- Installed Materials
- Bundled Plugins
- Bundled Materials

All packages need to be order at least by section, but I also took
the liberty to sort the packages in these sections by Alphabet.

Contributes to CURA-8558
2021-11-02 16:21:27 +01:00
j.spijker@ultimaker.com
3f700e5d0c
Only show Footer when the packagelist is paginated
It doesn't make sense to show a footer when items are retrieved in one
go. Except when an error occurs.

Contributes to CURA-8558
2021-11-02 14:34:36 +01:00
j.spijker@ultimaker.com
c4c99f6657
Added sections to the packagelists
By providing a `section_title` with a string to the `package_data`
packages can be subdivided in sections, each with its own header.
For remote packages this will be `None` and therefore no sections are
created there.

Contributes to CURA-8558
2021-11-02 14:34:35 +01:00
Jelle Spijker
86d5d315bc
Differentiate between local and remote packages
There is a distinction between packages which are already
installed on the local machine and packages which are
available on the remote server. Even with this difference
it is important that they are handled the same and can be
reused in the same GUI elements.

In order to reduce code duplication I created a parent object
PackageList which contains the base logic and interface for
the QML and let both RemotePackageList and LocalPackageList
inherit from this.

UX specified that the gear icon (Settings.svg) should be
separate from the tabs of material and plugins. This also
ment that the current tab  item couldn't set the pageTitle
anymore. This is now defined in the Package component and
set when the loader has loaded the external QML file.

Contributes to CURA-8558
2021-11-01 17:12:18 +01:00