Commit graph

993 commits

Author SHA1 Message Date
Ghostkeeper
9297890d78
Fix typing of approximate diameter and add typing to function for it
Seems I forgot to add typing and that's biting my bum right now.

Contributes to issue CURA-6600.
2019-08-27 17:21:22 +02:00
Ghostkeeper
3952366798
Move createMaterial to MaterialManagementModel and simplify it a bit
We can reuse our duplicateMaterial function again but in a simpler way. Also finding the preferred material is simpler with our container tree.
However there seems to be a problem with finding the preferred material; it's not finding generic_pla for UM3 and AA0.4 anyway, and then falls back on a random material. This needs to be fixed in the variant node class.

Contributes to issue CURA-6600.
2019-08-27 17:21:22 +02:00
Ghostkeeper
957894b614
Fix duplicating a favourite material
The duplicate must also be favourite.

Contributes to issue CURA-6600.
2019-08-27 17:21:21 +02:00
Ghostkeeper
1874a6453d
Move duplicateMaterial into MaterialManagementModel
To move away from the deprecated MaterialManager class.

Contributes to issue CURA-6600.
2019-08-27 17:21:21 +02:00
Remco Burema
c333e980dc Merge branch 'feature_intent_container_tree' of https://github.com/Ultimaker/Cura into feature_intent_container_tree 2019-08-27 15:50:21 +02:00
Ghostkeeper
63ae6ee9ec
Fix updating materials models when materials change before first printer switch
Otherwise the _extruder_stack field would not yet be set.

Contributes to issue CURA-6600.
2019-08-27 15:47:41 +02:00
Ghostkeeper
3dc7c7b61c
Move removeMaterial to MaterialManagementModel
Moving away from the MaterialManager.

Contributes to issue CURA-6600.
2019-08-27 15:47:40 +02:00
Ghostkeeper
99ccddefa4
Move setMaterialName to MaterialManagementModel
No longer use the material manager which is deprecated.

Contributes to issue CURA-6600.
2019-08-27 15:47:40 +02:00
Ghostkeeper
5b8ed91b04
Create new MaterialManagementModel and move canMaterialBeRemoved
Just like the QualityManagementModel, this class is intended to be used as proxy for the material management page in the preferences. I'm intending to move all relevant pyqtSlots from the material manager into this one. The advantage of this switch is that the material manager had no well-bounded scope and so tended to become a big mess of all sorts of functions. This one has a clear scope: serve as a proxy for the buttons you can press in the preferences screen for materials.

Contributes to issue CURA-6600.
2019-08-27 15:47:40 +02:00
Remco Burema
f7a15ca507 Merge branch 'feature_intent_container_tree' of https://github.com/Ultimaker/Cura into feature_intent_container_tree 2019-08-27 15:46:59 +02:00
Remco Burema
d5a8b2640f Fix 'getQualityChangesGroups' now gives a list issues.
part of CURA-6600
2019-08-27 15:46:47 +02:00
Jaime van Kessel
36dfd23e3f Remove old buildplate function
CURA-6600
2019-08-27 15:06:27 +02:00
Jaime van Kessel
d479e5ec58 Removed no longer used initialize function
CURA-6600
2019-08-27 15:05:39 +02:00
Jaime van Kessel
d1a8ce54a1 Merge branch 'feature_intent' of github.com:Ultimaker/Cura into feature_intent_container_tree 2019-08-27 14:18:41 +02:00
Jaime van Kessel
1d9d411732 Merge branch 'master' of github.com:Ultimaker/Cura into feature_intent 2019-08-27 14:17:57 +02:00
Jaime van Kessel
72ea1257d7 Prevent crash when machine isn't configured correctly yet
CURA-6600
2019-08-27 13:50:12 +02:00
Ghostkeeper
3f5563514c
Remove _current_quality_changes_group shadow administration
Get the quality changes group back from whichever one is actually active on the stack. This prevents the two from getting out of sync, which makes the code easier to maintain.

Contributes to issue CURA-6600.
2019-08-27 13:03:29 +02:00
Ghostkeeper
8f34b3dd73
Set quality profiles to preferred quality upon stack creation
A good default.
Possible bug: If there are multiple matching quality profiles but the preferred quality profiles matches none or multiple of them, a random one is chosen. The random profile for the global stack may not match the random one for the extruder?

Contributes to issue CURA-6600.
2019-08-27 09:07:23 +02:00
Ghostkeeper
fcab800a8d
Add function to find preferred quality profile
Not for global yet, so it doesn't appear as if anything is loaded yet.

Contributes to issue CURA-6600.
2019-08-26 17:50:46 +02:00
Ghostkeeper
557c3d9515
Skip global stacks better
Otherwise it wouldn't skip custom-defined stacks, such as the PPA's stack class.

Contributes to issue CURA-6600.
2019-08-26 17:11:22 +02:00
Ghostkeeper
60939d220b
Log time it takes to add container tree for a printer
It's useful to know, at least while we're building this.

Contributes to issue CURA-6600.
2019-08-26 16:58:13 +02:00
Ghostkeeper
16ee96def9
Fix skipping definition containers when adding new printers
The speed improvement didn't work.
It still doesn't seem to have a lot of effect. Maybe it's not the creating of the tree that causes this slowdown?

Contributes to issue CURA-6600.
2019-08-26 16:30:16 +02:00
Ghostkeeper
01c0472872
Don't create container tree for extruder definitions
That wouldn't work properly anyway, but it still took quite a lot of time to create these.

Contributes to issue CURA-6600.
2019-08-26 15:49:52 +02:00
Ghostkeeper
599dcb34bc
Fix sorting qualities by quality type
Otherwise the dictionary ends up being filled by container ID which then causes the quality type to not be present in the dictionary, ending up with an empty list of quality groups.

Contributes to issue CURA-6600.
2019-08-26 15:25:11 +02:00
Ghostkeeper
a90b4cc136
Fix finding global qualities: Metadata is not boolean
It's a string, strangely.

Contributes to issue CURA-6600.
2019-08-26 15:05:01 +02:00
Ghostkeeper
af9c5cd55c
Find global qualities for quality_definition as well
We don't have global qualities specific to e.g. the Ultimaker 3 Extended.

Contributes to issue CURA-6600.
2019-08-26 14:47:58 +02:00
Ghostkeeper
3655981c41
Use container tree to get the current printer's quality groups
Contributes to issue CURA-6600.
2019-08-26 14:00:35 +02:00
Ghostkeeper
51710c2868
Use new MachineNode.getQualityChangesGroups instead of quality manager
I hope that the machine node doesn't become a collection of functions that don't fit anywhere else, but this isn't contributing to that hope. However I still think that this is particular to a certain printer, so it's within the object-oriented programming paradigm. And it's also within the scope of the class, which is getting the available profiles. So it still sort of fits.

Contributes to issue CURA-6600.
2019-08-23 17:29:32 +02:00
Ghostkeeper
b1ce9b64d4
Add function to construct QualityChangesGroups for machine
It doesn't cache these any more, but reconstructs them when asked for.

Contributes to issue CURA-6600.
2019-08-23 17:26:57 +02:00
Ghostkeeper
bcd450daa0
Don't make QualityChangesGroup hold ContainerNodes
It can't hold ContainerNodes since the quality changes are no longer nodes in any tree.

This now makes it hold metadata instead.

Contributes to issue CURA-6600.
2019-08-23 17:11:21 +02:00
Ghostkeeper
430bcc90a8
Make QualityChangesGroup depend on intent
This is probably the main implementation of CURA-6600.
2019-08-23 16:44:08 +02:00
Ghostkeeper
1febfde3cc
Fix switching to printers without variant
Since the 'empty_variant' nozzle is now just in the tree, this check is no longer even necessary.

Contributes to issue CURA-6600.
2019-08-23 15:38:58 +02:00
Ghostkeeper
4fb656ea7b
Don't use deprecated Preferences.getInstance()
Contributes to issue CURA-6600.
2019-08-23 14:46:42 +02:00
Ghostkeeper
40b562093d
Don't unnecessarily deprecate the getMetaDataEntry functionality
If possible you should group the metadata queries but otherwise this is still fine to use.

Contributes to issue CURA-6600.
2019-08-23 13:43:30 +02:00
Ghostkeeper
99bf82dee3
Fix displaying list of nozzles
Make it use the ContainerTree structure since the original VariantManager's structure is not populated any more.

Contributes to issue CURA-6600.
2019-08-23 13:22:25 +02:00
Ghostkeeper
37bd7c6b0e
Always return a MaterialNode from getDefaultMaterial
Its function is, after all, to find the default. It should always have a default. Sometimes that will be the empty material, but so be it.

Contributes to issue CURA-6600.
2019-08-22 17:13:46 +02:00
Ghostkeeper
9bcf2698d5
Log warning when preferred material can't be found
Contributes to issue CURA-6600.
2019-08-22 17:02:09 +02:00
Ghostkeeper
9dca6c0127
Return empty node if preferred node couldn't be found
Or any node, really. There must now always be a subnode.

Contributes to issue CURA-6600.
2019-08-22 16:52:38 +02:00
Ghostkeeper
d06ce211ff
Document new requirement that there must always be one child
Contributes to issue CURA-6600.
2019-08-22 16:47:57 +02:00
Ghostkeeper
46cf7aafa9
Encode empty containers in container tree if necessary
You can now be assured that there is ALWAYS at least one child node, except for child nodes of intent profiles which don't exist.

Contributes to issue CURA-6600.
2019-08-22 16:44:52 +02:00
Ghostkeeper
81a33af3aa
Use variant node's preferredMaterial function from MaterialManager too
We can reuse that code.

Contributes to issue CURA-6600.
2019-08-22 15:46:29 +02:00
Ghostkeeper
0302ae4257
Don't find any variants if the machine says it doesn't have them
Even if there might be a matching variant...

Contributes to issue CURA-6600.
2019-08-22 15:44:41 +02:00
Ghostkeeper
999e19940e
Also don't add any materials added later if there are no materials
Keeps it consistent.

Contributes to issue CURA-6600.
2019-08-22 15:43:16 +02:00
Ghostkeeper
6f77c8735c
Don't load any materials for printers that don't have them
For instance the Ultimaker 2 shouldn't display any materials.

Contributes to issue CURA-6600.
2019-08-22 15:37:05 +02:00
Ghostkeeper
295ad564c0
Add function to find preferred material for configuration of printer/nozzle
This is supposed to replace the material manager's getDefaultMaterial function.

Contributes to issue CURA-6600.
2019-08-22 15:34:24 +02:00
Ghostkeeper
7b83e51439
Use container tree to determine default material
Using the new architecture here.

Contributes to issue CURA-6600.
2019-08-22 15:04:20 +02:00
Ghostkeeper
8ef410e826
Update the _available_materials in the actual _update function
It's confusing that this would be updated in the _canUpdate function. Just cleanliness.

Contributes to issue CURA-6600.
2019-08-22 09:25:26 +02:00
Ghostkeeper
ea1c99b708
Update _favorite_ids in BaseMaterialsModel._update
And make all subclasses run its super _update as well to make sure that this gets updated for them. It's necessary for the _createMaterialItem functionality because it needs to add an is_favorite role.

Contributes to issue CURA-6600.
2019-08-22 09:25:26 +02:00
Ghostkeeper
5d76f96354
Fix getting available materials without material manager
It's a bit weird still that this is executed in the _canUpdate... Oh well.

Contributes to issue CURA-6600.
2019-08-22 09:25:26 +02:00
Ghostkeeper
4ad6f4f635
Update materials models when container tree updates
Instead of relying on MaterialManager to do this.

Contributes to issue CURA-6600.
2019-08-22 09:25:25 +02:00