69 Commits

Author SHA1 Message Date
Remco Burema
bb42fa0527
Don't restore files ignored with current backup policy.
Restoring plugins will casue a headache when (they are large and) the central storage was removed in the mean time. Since it's current policy to ignore plugins _anyway_ when backing up, the simple solution is to also just don't restore them, even if they where present to begin with. Of course this is also applied to other to-be-ignored files and folder types.

should 'fix' CURA-8666
2021-11-30 17:34:49 +01:00
Ghostkeeper
9ab41c062b
Handle encoding errors in back-up zips
Seems to happen when there's files in there with badly-encoded characters in the file names.

Fixes Sentry issue CURA-2S7.
2021-09-21 14:20:59 +02:00
Ghostkeeper
a1ecea020c
Catch errors when backing up the preferences file
The file may not exist. In fact, that may be the whole reason why people want to restore a back-up. Try it, and give an error if it fails.

Fixes Sentry issue CURA-2QT.
2021-09-20 15:13:34 +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
Konstantinos Karmas
4435a10f9d Revert "Show warning when restoring backup failed"
We decided to add the warning message in a separate ticket for 4.11.

This reverts commit 584a387debec75023094db6cba84a8bf1781d6ea.
2021-06-25 09:22:12 +02:00
jelle Spijker
584a387deb Show warning when restoring backup failed
We now allow the backup to fail gracefully when partial files
fail to be restored. But the user is not actively informed by
these failures. Leaving him/her unaware of the state of his
configuration folder.

This commit show's a message windows, listing the failed files.
Due to a string freeze at the moment we reuse the following i18n
message:

> The following error occurred while trying to restore a Cura backup:
followed by a list of files that fails to be restored.

Which is not ideal, but a sufficient warning in my opinion. At least
better then being completely uninformed.

Contributes to CURA-8313
2021-06-25 08:24:06 +02:00
Konstantinos Karmas
4fe199ccc7 Ignore files-in-use while restoring a backup
Sometimes, while a backup is being restore, one of the files in the current config folder may be still in use. This means that once the backup tries to replace this file with the one in the backup, the entire backup restoration fails and half the configuration folder has been messed up.

To prevent that, we decided to ignore files that are currently in use while restoring a backup. This _may_ lead to a slightly wrong configuration (e.g. a plugin may not be restored properly), but it is an acceptable result, as the rest of the configuration folder is restored properly.

CURA-8313
2021-06-24 17:26:57 +02:00
Konstantinos Karmas
bcd44b8b6f Process events while extracting the downloaded backup
To prevent the UI from being frozen. This way, the user knows that something is happening in the background and Cura didn't just stop working.

CURA-8313
2021-06-22 17:01:36 +02:00
Konstantinos Karmas
7c72e84215 Read preferences from new restored configs
Before calling the illuminate, we need to make sure that the previous cached Preferences have been overridden by the newly restored preferences from the backup. Otherwise, the `illuminate()` function will bring back the cached preferences and the new ones from the backup will be lost.

CURA-8313
2021-06-22 15:16:13 +02:00
Jaime van Kessel
ee16f61d65
Add missing typing
CURA-8313
2021-06-17 16:21:01 +02:00
Jaime van Kessel
40a981b902
Re-enable the backing up of plugins
Because we're adding a messgae for the user if the loading of a plugin failed
(which can happen after backing up a plugin in central storage), we can re-enable
the backing up of plugins again.

CURA-8313
2021-06-17 15:36:45 +02:00
Jaime van Kessel
fa690a0f5e
Fix issue with restoring backups from 4.10
There were some cases where issues could occur due to plugins no longer being there

CURA-8313
2021-06-16 13:51:09 +02:00
Remco Burema
4fc43c2b32
Compare version-objects, not strings.
This would've gone so wrong if we actually released 4.10 without this, since, as a string, 4.10 is 'smaller than' 4.6 (for example), because alphanumerical-order.

done as part of CURA-8269
2021-06-03 09:25:59 +02:00
Jaime van Kessel
cb2a7e1daa
Remove plugins that weren't restored in the backup from the installed list
CURA-8269
2021-06-01 14:37:12 +02:00
Jaime van Kessel
2d572eef7f
No longer include plugins in the backup
Backups are synced with your account anyway. Backing up the plugins means that you
quickly reach the limit of the max size (250mb) that the backups allow.

CURA-8269
2021-06-01 13:34:07 +02:00
Kostas Karmas
7e98fb7fb0 Fix crashing while restoring a backup file with the wrong encoding
Fixes sentry issue CURA-24R
2021-04-19 14:24:42 +02:00
Jelle Spijker
3fd3fd7c7d
Obfuscate sensitive preference data from the back-up
CURA-7180 keyring storage
2021-03-17 08:54:16 +01:00
Ghostkeeper
c7b960edfa
Don't send -1 as profile count
The server gives an error about this and we got complaints about it. As far as we know this can only happen when users mess with their profile folders. Still, it's good to not send -1. The original implementation of this is indeed very naive, but we don't have the resources to refactor that now.
2020-07-21 10:42:24 +02:00
Ghostkeeper
79cc6ec897
Also report failure if the file system can't handle the archive contents
For instance if the file name is too long for this file system, if the computer is running out of disk space or if there is a general failure to write here.

Fixes Sentry issue CURA-YQ.
2020-06-25 09:47:59 +02:00
Nino van Hooff
89f0970a88 Remove trailing whitespace from Python files 2020-05-29 14:30:33 +02:00
Jelle Spijker
d69bf84424
Updated comments in Backup
Converted doxygen style comments to reStructuredText style in the files
 found in Cura/cura/Backup directory recursively  using the script
dox_2_rst.py (provided in the Uranium repo). Comments were manually
 checked and changed if needed.
2020-05-08 15:39:16 +02:00
Remco Burema
380e377cf3
Scout some documentation to docstring.
part of CURA-7325
2020-03-26 18:26:14 +01:00
Remco Burema
3c50b78e68
Fix: Definitions could be partly saved between backup restore and quit.
part of CURA-7325
2020-03-26 18:19:47 +01:00
Remco Burema
a03a2885b6
Check if main config file is in backup zip.
Prevent unpacking of possibly spoofed backups (as a last line of defence if other security has failed).
Zips with partially known content are a lot harder to spoof.
Thanks WhiteHats :-)
2020-01-31 16:26:30 +01:00
Jaime van Kessel
1c9eab6b2b Prevent crashes when backup fails to be restored
Also add a bit of logging so that we know what / how it went wrong
2019-05-16 15:48:09 +02:00
Jaime van Kessel
186eef0b68 Fix backup causing a crash in specific situations 2019-05-16 15:38:44 +02:00
Lipu Fei
4876d5af00 Fix data saving before making a backup
CURA-6471
2019-04-24 08:21:11 +02:00
Jaime van Kessel
8acafe09f6 No longer prevent old versions from being restored in backup
CURA-5983
2019-04-04 14:28:29 +02:00
Ghostkeeper
5469613c17
Don't fail the samefile check if second file didn't exist
If the backup file didn't exist but the original did, then apparently they are not the same file so the copy should be allowed.
2018-11-26 09:40:14 +01:00
Ghostkeeper
c9eb57cead
Don't copy preference file to the same location
This crashes Cura on start-up for some people.
2018-11-26 09:32:59 +01:00
ChrisTerBeke
acb7df710c Fix getting cura application instance 2018-10-01 15:37:28 +02:00
Lipu Fei
c04c7654c1 Make Backup._application private 2018-09-28 14:31:36 +02:00
Lipu Fei
6e2f7e72b6 Fix missing argument 2018-09-28 12:34:00 +02:00
Lipu Fei
3a01b63343 Fix refactor and tests 2018-09-28 12:33:16 +02:00
Lipu Fei
6e46772170 Fix imports in Backup 2018-09-28 12:25:03 +02:00
Lipu Fei
dd150bbab9 Resolve circular imports for CuraAPI 2018-09-28 12:07:00 +02:00
Ghostkeeper
c9480f2f2b
Add types for backup metadata 2018-07-04 17:30:01 +02:00
Diego Prado Gesto
f2768fd761 CURA-5330 Fix typing in the Backups 2018-06-13 16:35:48 +02:00
Diego Prado Gesto
554a3fd908 Merge branch 'master' into mypy_fixes
Conflicts:
cura/Backups/Backup.py
cura/Settings/ExtruderManager.py
cura/Settings/MachineManager.py
2018-06-13 11:53:02 +02:00
Ghostkeeper
2eedc96f36
Convert to Doxygen documentation
Like the rest of Cura and Uranium.
2018-06-11 15:06:48 +02:00
Diego Prado Gesto
a6815e7c61 CURA-5330 Add typing to Backup 2018-06-08 16:31:43 +02:00
ChrisTerBeke
2422ee38e8 Fix init py in backups module 2018-05-24 09:46:18 +02:00
ChrisTerBeke
809cab4ea5
Cleanup for cfd1b7b813ccdac76c623243a03633b2059d9a0e 2018-05-23 19:18:11 +02:00
Lipu Fei
cfd1b7b813 Fix AutoSave conflicts with BackupManager
- Move AutoSave out of the plugins. It's a built-in module now.
 - Add enable/disable saving data on CuraApplication.
 - Avoid saving data in backup restore
2018-05-23 11:25:47 +02:00
ChrisTerBeke
2bbcb2dd7d Save settings before moving config file on Linux 2018-05-22 17:45:30 +02:00
ChrisTerBeke
a20de3581a Add info message when failed because of version mismatch 2018-05-18 10:08:00 +02:00
ChrisTerBeke
a0d3dae920 Do not allow restore different version 2018-05-18 10:07:20 +02:00
ChrisTerBeke
7b3f334678 Fix ignored files for Windows 2018-05-17 15:07:28 +02:00
Diego Prado Gesto
aa07de45ed Start fixing restore on Windows 2018-05-17 12:13:01 +02:00