Commit graph

873 commits

Author SHA1 Message Date
Jaime van Kessel
2417705dfd Prevent crashes when duplicating a material
CURA-6600
2019-08-19 11:42:52 +02:00
Jaime van Kessel
76b58134ae Fix getRootMaterialIdForDiameter
CURA-6600
2019-08-19 11:07:35 +02:00
Jaime van Kessel
4dd5cb1a85 Fix getMaterialByType
CURA-6600
2019-08-19 09:44:39 +02:00
Ghostkeeper
80baeb9873
Remove _added functions for nodes that can't be added during runtime
Among the machines, variants, materials, qualities and intents, only machines and materials can ever be added during runtime. For the rest, we don't need to listen to these signals.

Contributes to issue CURA-6600.
2019-08-16 16:28:42 +02:00
Jaime van Kessel
97e77994a1 Update the removing & duplicating of material
CURA-6600
2019-08-16 10:55:12 +02:00
Jaime van Kessel
8d05ebef9d Fix crash on adding a new printer
CURA-6600
2019-08-16 10:24:50 +02:00
Ghostkeeper
46e5bc897f
Fix deprecated getQualityGroups in QualityManager
It needs to get the actual extruders, not their keys.

Contributes to issue CURA-6600.
2019-08-15 17:01:23 +02:00
Ghostkeeper
d4cd5a7ea5
Add convenience function to get quality groups for current printer
This is used very often all over the code.

Contributes to issue CURA-6600.
2019-08-15 17:01:22 +02:00
Ghostkeeper
3f944462ed
Use ContainerTree to get quality groups
Contributes to issue CURA-6600.
2019-08-15 17:01:22 +02:00
Ghostkeeper
ed19e9e15c
Use ContainerTree to find quality groups
Contributes to issue CURA-6600.
2019-08-15 17:01:22 +02:00
Ghostkeeper
8a51582210
Pre-fill list of qualities_per_type_per_extruder with empty dicts
Otherwise you get an IndexError later on.

Contributes to issue CURA-6600.
2019-08-15 17:01:21 +02:00
Ghostkeeper
44c98ba0d1
Fix import
Should've checked first...

Contributes to issue CURA-6600.
2019-08-15 17:01:21 +02:00
Ghostkeeper
02fbdd96a4
Don't return quality groups that are not available
And don't return an arbitrary group then. That arbitrary group could also be unavailable.

Contributes to issue CURA-6600.
2019-08-15 17:01:21 +02:00
Ghostkeeper
370d7adcd5
Let getDefaultQualityType use the container tree structure
Contributes to issue CURA-6600.
2019-08-15 17:01:20 +02:00
Ghostkeeper
bee5491879
Move getQualityGroups to MachineNode
It's specific to that machine and the container tree structure, so this is the best place for it we could find.

Contributes to issue CURA-6600.
2019-08-15 17:01:20 +02:00
Ghostkeeper
ca163ea5f0
Skip inactive extruders to determine available quality types
Contributes to issue CURA-6600.
2019-08-15 17:01:20 +02:00
Remco Burema
9374934d72 Merge branch 'feature_intent_container_tree' of https://github.com/Ultimaker/Cura into feature_intent_container_tree 2019-08-15 16:47:29 +02:00
Remco Burema
1609138d4d Remove deprecated ContainerNode.getChildNode(...) calls.
part of CURA-6600
2019-08-15 13:56:41 +02:00
Ghostkeeper
fb509a0692
Fix setting the global quality node
Otherwise you'd get a KeyError there.

Contributes to issue CURA-6600.
2019-08-15 13:41:11 +02:00
Remco Burema
7fb9642e45 Replace deprecated .getContainer() calls with .container
part of CURA-6600
2019-08-15 13:40:08 +02:00
Jaime van Kessel
76729360e1 Remove unused code
CURA-6600
2019-08-15 13:33:17 +02:00
Jaime van Kessel
c0f70c447e Ensure that the materials are loaded again
CURA-6600
2019-08-15 13:32:42 +02:00
Jaime van Kessel
6a3a23a725 Add time logging about how long it took to construct the container tree
CURA-6600
2019-08-15 13:11:45 +02:00
Ghostkeeper
47fe4b4c90
Re-add getMetadata()
We need to deprecate it to not break functionality of old plug-ins and such.

Contributes to issue CURA-6600.
2019-08-13 17:20:59 +02:00
Ghostkeeper
7d1f8e981b
Fix models using new MaterialNode class
The new one doesn't have getMetadata. Maybe we should allow it to have that actually.

Contributes to issue CURA-6600.
2019-08-13 17:20:58 +02:00
Ghostkeeper
5738af4bb8
No longer use deprecated MaterialManager when asking for available materials
Use the ContainerTree structure instead. That's what it's for.

Contributes to issue CURA-6600.
2019-08-13 17:20:58 +02:00
Ghostkeeper
7f84145c9a
Rewrite MaterialManager.getAvailableMaterials to use ContainerTree
Makes it a lot simpler since the nodes in the tree already encoded the fallback mechanism.
However I'm dropping support for filtering by diameter here, since the diameter is not known in the ContainerTree. I'm also dropping support for build plate materials for simplicity and to stay lean.

Contributes to issue CURA-6600.
2019-08-13 17:20:58 +02:00
Ghostkeeper
6a8e1557c3
Merge branch 'feature_intent' into feature_intent_container_tree
Conflicts:
	.gitlab-ci.yml
	cura/Machines/MaterialManager.py
	cura/Machines/VariantManager.py
	cura/Settings/ContainerManager.py
	cura/Settings/MachineManager.py
	tests/TestMachineManager.py
2019-08-13 14:59:05 +02:00
Ghostkeeper
20201c65e6
Merge branch 'master' into feature_intent
Conflicts:
	resources/bundled_packages/cura.json -> 4.1 to 4.2 upgrade package added simultaneously
	tests/TestMachineManager.py -> Due to changes in conftest.py
	tests/conftest.py -> Simultaneously expanding the magic mocks to have some correct properties
2019-08-13 14:43:28 +02:00
Ghostkeeper
8fb0a09460
Remove unused imports
Contributes to issue CURA-6600.
2019-08-13 14:06:42 +02:00
Ghostkeeper
01eaaf045d
Remove initialisation of tree in material manager
This is now all contained in the ContainerTree code.

Contributes to issue CURA-6600.
2019-08-13 14:04:57 +02:00
Ghostkeeper
2bf4ac8522
No longer trigger rebuilding node tree from quality manager
Also remove part of that from the material manager while we're at it.

Contributes to issue CURA-6600.
2019-08-12 17:29:05 +02:00
Ghostkeeper
71aed6858c
Fix getting GUID from metadata
Contributes to issue CURA-6600.
2019-08-12 17:21:26 +02:00
Ghostkeeper
ee0f2d2773
Improve documentation
Contributes to issue CURA-6600.
2019-08-12 17:18:22 +02:00
Ghostkeeper
42ba9a9f39
Pre-filter qualities on other properties before filtering on material
This prevents a LOT of double queries.

Contributes to issue CURA-6600.
2019-08-12 17:13:25 +02:00
Ghostkeeper
b1fb843f09
Implement matching qualities by material_id with same material type OR GUID
This fallback with the GUID makes this part a lot more complex, but in theory it should work. I hope that we can get some tests to debug this because it's 90% made from the top of my head now.

Contributes to issue CURA-6600.
2019-08-12 16:49:56 +02:00
Jaime van Kessel
719e69692c Fix import issues
CURA-6600
2019-08-12 15:20:09 +02:00
Jaime van Kessel
99afa6b533 Fix import issue
CURA-6600
2019-08-12 14:47:28 +02:00
Ghostkeeper
74b6501235
Check for MachineNode instead of MaterialNode
I thought I already changed that, but not apparently.

Contributes to issue CURA-6600.
2019-08-12 14:39:43 +02:00
Ghostkeeper
8f075b644d
Add global quality nodes to machine node
This means that the parent of the quality node could be one of two types. A bit confusing.

Contributes to issue CURA-6600.
2019-08-12 14:18:51 +02:00
Ghostkeeper
fff26bb021
Fix imports and references to managers
Use getInstance() where applicable.

Contributes to issue CURA-6600.
2019-08-12 14:15:40 +02:00
Ghostkeeper
91e14a90b2
Update getQualityGroups to use the new ContainerTree structure
Look how greatly this is now simplified.
The fallbacks for which material nodes to check is not yet implemented. Will do that next.

Contributes to issue CURA-6600.
2019-08-12 14:02:19 +02:00
Ghostkeeper
80e27b62d3
Don't cache singletons in constructor
It makes it harder to test these things.

Contributes to issue CURA-6600.
2019-08-09 15:53:08 +02:00
Ghostkeeper
709584cc5e
No longer listen to qualitiesChanged signal to update
It was only being called once upon initialisation. Turns out that this model updates itself properly only because the qualities don't change during runtime unless you change the active quality group (due to materials changing) or the printer itself.

Contributes to issue CURA-6600.
2019-08-09 15:14:52 +02:00
Ghostkeeper
f65e672887
Don't get build plate variants from tree any more
It's not in that tree.

Contributes to issue CURA-6600.
2019-08-09 13:43:54 +02:00
Ghostkeeper
bd714f947a
Register container tree to be built once all metadata is in
So if we ever change the order of initialisation this stays working.

Contributes to issue CURA-6600.
2019-08-09 13:40:11 +02:00
Ghostkeeper
d710a58233
Don't require VariantManager any more from CuraStackBuilder
We now use the new container tree structure there.

Contributes to issue CURA-6600.
2019-08-08 17:31:26 +02:00
Ghostkeeper
e106692165
Make ContainerTree singleton but construct in run() of application
We want to make sure that this tree is constructed during start-up after all containers have been registered, so we call getInstance() there once. If you need the tree before that, the tree will not yet have been filled and you won't get complete information, so you'd need to listen for updates.
The singleton is there so you don't need to go via CuraApplication.

Contributes to issue CURA-6600.
2019-08-08 17:30:24 +02:00
Ghostkeeper
65360c31ef
Let Quality/Material/Variant Managers be a proper singleton
Rather than a singleton contained within the CuraApplication class.

Contributes to issue CURA-6600.
2019-08-08 17:04:53 +02:00
Ghostkeeper
f31d7798ce
Add warning for adding local copies of metadata
Contributes to issue CURA-6600.
2019-08-08 16:26:38 +02:00