2256 Commits

Author SHA1 Message Date
Ghostkeeper
58f4d44694
Don't crash when switching to printer with fewer extruders
This seems to have happened with an UM2+C.

Fixes Sentry issue CURA-2R5.
2021-09-21 13:40:40 +02:00
Remco Burema
b2eae08cc7
Merge pull request #10327 from Ultimaker/CURA-6096_profile_database
Store metadata in database
2021-09-09 17:29:40 +02:00
Ghostkeeper
034f62ea2c
Match table name with container type
The table name is used as the container type in the resulting metadata, so we need to use the container type string as table name correctly, or none of the profiles can be found.

Contributes to issue CURA-6096.
2021-09-08 16:40:22 +02:00
Ghostkeeper
057ba8cdeb
Fix setting container type of subclasses
This mistake caused all of the container types to end up as either None or the actual instance itself, which was causing crashes.

Contributes to issue CURA-6096.
2021-09-08 15:46:25 +02:00
Ghostkeeper
adac0af1ec
Revert "Use SQLQueryFactory for container DB"
This reverts commit 571a051041b7c126ca942055961c7714312a967f.
2021-09-08 15:10:32 +02:00
luz paz
d68f375e38 Fix various typos
Found via `codespell -q 3 -S *.po,*.pot -L childs,initialy,lod,ned,te,slicable,sur,tutoriels,wont`
2021-09-07 11:33:54 -04:00
jelle Spijker
571a051041
Use SQLQueryFactory for container DB
Needed to add a Filter possibility to facilitate that
Created a Simple UserString class which can be used as:

```py
        sql_filter = SQLFilter(f"SELECT {{}} FROM table_name WHERE id = ?")
        cursor.execute(sql_filter)  # Will execute: SELECT * FROM table_name WHERE id = ?
        cursor.execute(sql_filter["id", "name"])  # Will execute: SELECT id, name FROM table_name WHERE id = ?

```

Contributes to CURA-6096
2021-09-02 16:55:24 +02:00
jelle Spijker
4067d9d607
Fixed typing
Contributes to CURA-6096
2021-09-02 10:17:40 +02:00
jelle Spijker
f80e1ec279
Updated documentation
Contributes to CURA-6096
2021-09-01 18:58:03 +02:00
jelle Spijker
7aa08d4acd
Use a class to build to sql queries
This greatly reduced the amount of duplicate code in the DataBaseHandlers
Not sure how secure this is SQL injections. Need to check that and maybe
put in some guards. Using double underscores for now and only provide a
getter. But then again why bother with an SQL injection as
you can just as easily modify the Python code, and we still have the old
Containers to fallback to if the Database gets corrupted.

Contributes to CURA-6096
2021-09-01 16:58:48 +02:00
Jaime van Kessel
3191baf5a0 Add delete to handlers
CURA-6096
2021-08-27 14:36:04 +02:00
Jaime van Kessel
55d6ff0e61 Clean up formating of the insert queries
CURA-6096
2021-08-25 13:58:11 +02:00
Jaime van Kessel
132b863e13 Add update queries for variant, intent & qualit DB handlers
CURA-6096
2021-08-25 13:48:25 +02:00
Jaime van Kessel
2bef85c6c2 Remove weird whitespace
CURA-6096
2021-08-24 14:45:52 +02:00
Jaime van Kessel
e0e8223c5d Move DB handling into specialised classes
This keeps CuraContainerRegistry a lot cleaner, especially when more container types are
added

Cura-6096
2021-08-20 15:40:50 +02:00
Jaime van Kessel
27f0fe8bb9 Ensure that all metadata of profiles is stored
CURA-6096
2021-08-20 14:40:55 +02:00
Jaime van Kessel
6f32809a3a Prepare the inserts before actually doing them
CURA-6096
2021-08-20 13:09:40 +02:00
Jaime van Kessel
5311c949f0 Add variants to the database
CURA-6096
2021-08-20 11:05:37 +02:00
Jaime van Kessel
48ab21ac68 Add functions to get & add variants & qualities from DB
CURA-6096
2021-08-20 10:17:57 +02:00
Jaime van Kessel
3f80fcb5e5 Add first stub for profile database
CURA-6096
2021-08-19 15:20:20 +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
Ghostkeeper
f82384d93c
Revert "Revert CURA-8055 in the 4.10 branch. This should not have been merged in there."
This reverts commit 4d29de45796dc42f76c774a216a0601bb57cf790.
Effectively this re-applies the changes for CURA-8055 / #9957.
2021-06-24 14:20:38 +02:00
Ghostkeeper
4d29de4579
Revert CURA-8055 in the 4.10 branch. This should not have been merged in there.
Revert "Change file extension to .umm"

This reverts commit 56db7f7144083df4bca77746d7ee30f2a54fda36.

Revert "Re-enable compression"

This reverts commit 62bc9be22bbc5595dbfce69893163c3a0ebc4415.

Revert "Add documentation"

This reverts commit e9031f1aff5d40f3c69ac625edf11963a3253eb8.

Revert "Fix writing bytes to string-stream"

This reverts commit 66b2825a667f9aa9618005d2a5875383a3658f4f.

Revert "Hide button entirely if no export is available"

This reverts commit ec727e1068c3ac2cab7f95fb88c5d4d101e28e17.

Revert "Basic implementation of exporting all materials in a .zip archive"

This reverts commit bdcaef134f556f455f352786123476ec40e3ae4c.

Revert "Implement default path for exporting all materials"

This reverts commit e66783664bf73dd9b1e3c6af6f01321763470d2e.

Revert "Implement a sync button and file dialogue to export all materials"

This reverts commit abba3bdd10a994a1b38bcb426a27ba379febeac7.

Revert "Add notion of whether printers support the material export archive"

This reverts commit f436cb8e7b879a8913b25f2a049413ec0721f1c5.
2021-06-24 14:15:54 +02:00
Ghostkeeper
f436cb8e7b
Add notion of whether printers support the material export archive
Contributes to issue CURA-8055.
2021-06-08 16:50:03 +02:00
Ghostkeeper
2f8f98fcca
Add a log entry for importing, duplicating or removing a material
We encountered an issue yesterday that we had to find in a log file when a user was importing a material. Nothing is shown in the log when importing a material, so it was impossible to find.
Now we'll log this action. It is a direct user action, so info is a good log level.
2021-06-04 02:51:13 +02:00
Ghostkeeper
58369822fc
Clean up invalid quality changes robust to asynchronous changes
It's possible that a profile is no longer in the registry by the time it gets to that point in the list if this clean-up is triggered by the very action of deleting a profile.

Fixes Sentry issue CURA-1T5.
2021-03-16 16:36:01 +01:00
Ghostkeeper
ba5b033499
Don't crash when not able to read maximum file name length
Just use a safe-ish maximum then.

Fixes Sentry issue CURA-1QY.
2021-02-04 17:10:03 +01:00
Ghostkeeper
1b8463ba30
Catch TypeError when parsing setting version
Someone had a list in the setting version, which then crashed Cura.
2021-01-19 14:09:46 +01:00
Ghostkeeper
0788df4797
Add log entry upon exporting container
Quite a salient moment in the log. According to our log levels definitions this must be info since it's the direct result of a user interaction.
2021-01-06 14:11:15 +01:00
Remco Burema
9afbc64934
Merge branch '4.8' 2020-11-10 11:31:53 +01:00
Kostas Karmas
4b35bd1724 Correct the print sequence when discarding the current changes
CURA-7827
2020-11-09 18:10:50 +01:00
Kostas Karmas
fab2c31b4f Cover the last remaining case when setting the print sequence
If for some reason the print sequence is set to one-at-a-time be default in the printer definition
and the number of extruders of the printer is set to >=2, then the print_sequence won't show up in
neither the quality changes nor the user changes, yet it will still have "one-at-a-time" as a
value. In a such case, it will still need to be set to "all-at-once" in the user changes.

This is a theoretical case, as it is very unlikely for a printer to have "one-at-a-time" set by
default in its definition (.def.json) file and still be able to support more than one extruders.
But it is a world full of possibilities out there, so you never know...

CURA-7827
2020-11-09 16:55:43 +01:00
Kostas Karmas
07453e101e Add detailed documentation for _correctPrintSequence function
CURA-7827
2020-11-09 16:32:05 +01:00
Kostas Karmas
2ccdd11098 Properly set the print sequence in the correct container
Previously, the print sequence would be always set to all-at-once in the user container whenever
the second extruder would be enabled. This was causing an interface issue, where the circular
reset-setting arrow would appear next to the setting, even if the quality changes already had the
correct value ("all-at-once").

This is now fixed by checking the following:
- If print_sequence == "one_at_a_time" in the quality (so it is already saved in a quality profile)
then set the print_sequence to "all_at_once" in the user changes so that it will be displayed as
an unsaved change
- If print_sequence == "one_at_a_time" in the user changes container only, meaning that it is not
saved in any quality profiles, then just reset the print_sequence in the user changes, so that it
will have the correct value ("all-at-once") without the reset-setting arrow appearing next to it.

CURA-7827
2020-11-09 16:20:13 +01:00
Kostas Karmas
a1c7ebe1c3 Fix mypy complaints
CURA-7827
2020-11-05 19:04:29 +01:00
Kostas Karmas
845c994cbc Replace f string since it's not available in Python3.5
That should fix the failing test which produces a SyntaxError.

CURA-7827
2020-11-05 17:38:34 +01:00
Kostas Karmas
1a759f81df Change print sequence when the number of enabled extruders changes
Fixes https://github.com/Ultimaker/Cura/issues/8682 while still maintaining the correct behavior for CURA-6914.

CURA-7827
2020-11-05 16:58:47 +01:00
Ghostkeeper
31ee864f04
Disallow printer names that start with a dot
Fixes #8639.
2020-10-30 11:10:46 +01:00
Konstantinos Karmas
4e6097f499
Revert "Prevent duplicate adding of extruders" 2020-10-27 11:29:08 +01:00
Ghostkeeper
5cfe18d31c
Clarify user-facing string to remove internal terminology
The user doesn't know what a global stack is. This is a message that more clearly specifies what is really happening as far as the user can see.

The global stack may be None if this code is executed while there is no active printer. Normally the only time there is no active printer is:
- during first launch, while in the welcome screen
- during start-up until the profiles have been loaded
- if there was a profile corruption of some kind with the active printer.

So this function should not get called during those times. It probably isn't called except for the last case (in which case it's acceptable I guess).
This change is made after a request from a translator what the hell this means.

Contributes to issue CURA-7783.
2020-10-27 10:54:07 +01:00
Konstantinos Karmas
4804072625
Merge pull request #8553 from Ultimaker/CURA-7501_no_double_adding_extruders
Prevent duplicate adding of extruders
2020-10-26 17:02:51 +01:00
Ghostkeeper
4b3fda21e2
Prevent duplicate adding of extruders
The addMachineExtruders function assumes that this is a new printer (first time the printer is activated since a restart of Cura) and it needs to add the extruder stacks to it. However most of the time when we're switching, it's not to a new printer. If it's not a new printer, this function would get called anyway and we'd be adding the extruders multiple times. This then does a lot of unnecessary work and eventually fails a couple of calls deep.
This change prevents it from adding the extruders if there are already extruders associated with the printer, thus preventing this unnecessary work (switch is faster) and preventing the error from happening.

Discovered during work on CURA-7501.
2020-10-16 16:09:37 +02:00
Jaime van Kessel
50ae33c42d
Force an re-evaluation of a setting when extruder has been disabled
CURA-7770
2020-10-16 10:50:05 +02:00
Kostas Karmas
f25bfd717e Recalculate the number of user settings after setting the quality group
So that the dialog ensures actually knows that there are no changed settings and will not show up.

CURA-7728
2020-10-06 09:55:11 +02:00
Jaime van Kessel
dd359da1cf
Prevent crash when material is unknown
Fixes CURA-GV
2020-09-16 16:37:09 +02:00
Remco Burema
3fcd7d567f
Show warning icon on import non-visible profile.
part of CURA-7691
2020-09-16 08:26:41 +02:00
Kostas Karmas
0524e8d129 Fix missing quality profile when message says its successful
Make sure to add the container before doing any other checks. Then, if the importing fails, remove
all the profiles related to that quality.

CURA-7691
2020-09-11 11:35:39 +02:00
Kostas Karmas
665496ceff Warn when importing quality profiles that don't match the current configuration
When importing a profile that doesn't much the current nozzle combination (e.g. importing a 'high'
quality when we have AA0.8 and AA0.4 nozzles), the profile was being accepted and a success message
was shown to the user, but the quality did not show up in the profile list.

This commit fixes that by accepting the quality profile and informing the user that the profile is
not visible due to the current configuration.

CURA-7691
2020-09-10 16:58:30 +02:00
Jelle Spijker
0725bdcd64
Merge pull request #8335
Speed up disable extruder
2020-09-09 09:42:36 +02:00