42 Commits

Author SHA1 Message Date
Jaime van Kessel
f948b7c4fc
Add bit more logging around MachineNode loading 2020-07-20 16:03:06 +02:00
Nino van Hooff
89f0970a88 Remove trailing whitespace from Python files 2020-05-29 14:30:33 +02:00
Jelle Spijker
120541a8db
Updated comments in Models
Converted doxygen style comments to reStructuredText style in the files
 found in Cura/cura/Model directory recursively  using the script
dox_2_rst.py (provided in the Uranium repo). Comments were manually
 checked and changed if needed.

 Note: dox_2rst.py struggles with decorated functions.
2020-05-08 18:59:38 +02:00
Jaime van Kessel
81b33b8649
Add some missing typing 2020-01-10 14:58:53 +01:00
Ghostkeeper
aed2346465
Don't sleep for extruder stacks
Contributes to issue CURA-6793.
2019-10-23 09:53:22 +02:00
Ghostkeeper
5b70d409ed
Improve documentation for lazy-loading background task
In particular the thread switching sleep was a bit mysterious.

Contributes to issue CURA_6793.
2019-10-23 09:46:44 +02:00
Ghostkeeper
f69360fb14
Make lazy-load container a protected inner class
Contributes to issue CURA-6793.
2019-10-23 09:42:43 +02:00
Ghostkeeper
f1e35907d2
Make MachineNodeLoadJob protected inner class
It should not be used outside of this class.

Contributes to issue CURA-6793.
2019-10-23 09:41:05 +02:00
Ghostkeeper
f3736f0576
Add typing for _machines
Contributes to issue CURA-6793.

Co-Authored-By: Jaime van Kessel <nallath@gmail.com>
2019-10-23 07:40:12 +00:00
Ghostkeeper
87f9c6d7cc
Add typing for MachineNodeMap's constructor
Contributes to issue CURA-6793.

Co-Authored-By: Jaime van Kessel <nallath@gmail.com>
2019-10-16 14:11:29 +00:00
Ghostkeeper
8179dfc412
Make cache of machines a protected field
We don't want to use it outside of the mapping. This mapping should be transparent.
We are still using it from our tests though but that's fine. Tests are allowed to touch private fields.

Contributes to issue CURA-6793.
2019-10-16 15:04:07 +02:00
Ghostkeeper
f6d83d7a6b
Fix sign of __contains__
Should've been the other way around!

Contributes to issue CURA-6793.
2019-10-10 16:10:19 +02:00
Ghostkeeper
ab4fade017
Fix check if definition with ID exists
It's not an InstanceContainer but a DefinitionContainer.
Also, when checking with the ID, it'll short circuit to the dictionary look up by ID. Then it's faster to directly check without specifying what type of container it is to prevent another nested function call.

Contributes to issue CURA-6793.
2019-10-10 15:36:19 +02:00
Ghostkeeper
38e723b51c
Fix loading GlobalStacks on different thread
The findContainerStacks() will list all container stacks and lazily load them. However this lazy loading is done on the thread that's calling it. The lazy loading will create GlobalStack objects, which are QObjects. The QML code then can't access those QObjects because they are created on different threads. So now instead we'll do the find query on the main thread but all the rest on the background thread.

Contributes to issue CURA-6973.
2019-10-10 15:32:14 +02:00
Ghostkeeper
9323ed5d04
Add implementation of get() for the pretend-dict
Some places are using this.

Contributes to issue CURA-6973.
2019-10-10 14:56:00 +02:00
Ghostkeeper
268da885ee
Remove unused _loadAll function
This one is no longer used since we no longer load all stacks upon start-up.

Contributes to issue CURA-6793.
2019-10-10 14:48:46 +02:00
Ghostkeeper
c5b957d0b1
Remove debug code
Contributes to issue CURA-6793.
2019-10-09 16:45:43 +02:00
Ghostkeeper
5199e3e6db
Add background job to pre-load other added printers
Not just the active one.

Contributes to issue CURA-6793.
2019-10-09 16:44:00 +02:00
Ghostkeeper
4ffda015db
Implement lazy loading for machine nodes
Should be completely transparent. It'll fail the unit tests though because it now pretends that all printers have machine nodes.

Contributes to issue CURA-6793.
2019-10-09 10:53:58 +02:00
Jaime van Kessel
85ed22de4c
Add some profiling decorators to the ContainerTree 2019-10-04 13:29:22 +02:00
Ghostkeeper
c8be172343
Add debugging functionality to visualise the container tree
Could be useful for later, don't you think?

Contributes to issue CURA-6831.
2019-10-02 08:55:12 +02:00
Jaime van Kessel
7e3f265068
Add a function to add a MachineNode to the tree.
This solves the issue that machines created by the stack builder broke the material updating

CURA-6791
2019-09-23 13:18:11 +02:00
Ghostkeeper
5debdd4cf6
Fix getting extruder list everywhere
Didn't test this beyond my own automated test, it seems.

Contributes to issue CURA-6600.
2019-09-09 16:47:29 +02:00
Ghostkeeper
8bcd9b339a
Use GlobalStack.extrudersList instead of GlobalStack.extruders to iterate
Otherwise the iteration can happen in any arbitrary order (due to the dict) and this can cause the result to not match to the desired combination of configurations per extruder.

Contributes to issue CURA-6600.
2019-09-06 17:20:03 +02:00
Ghostkeeper
4bdc819f12
Fix nondetermistic result with dictionary values list
Because global_stack.extruders.values can be returned in any order, the configurations matching with the lists doesn't always give a result.
It happened to work on my computer with the test, but there is no guarantee of that.

This is probably also going wrong in other places. I don't think we should use the .extruders property anywhere really!

Contributes to issue CURA-6600.
2019-09-06 17:15:45 +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
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
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
6c6dd0efad
Add signals to signal that a material got changed or removed
The material models need to know this.

Contributes to issue CURA-6600.
2019-08-22 09:25:25 +02:00
Jaime van Kessel
8d05ebef9d Fix crash on adding a new printer
CURA-6600
2019-08-16 10:24:50 +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
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
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
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
8e49991087
Resolve circular imports
Some of these are only used for the type checks.

Contributes to issue CURA-6600.
2019-08-06 17:04:29 +02:00
Ghostkeeper
65b1a43e88
Load tree when all metadata has been loaded
This should build up the tree initially.

Contributes to issue CURA-6600.
2019-08-06 09:16:41 +02:00
Ghostkeeper
2565be01f3
Add variants as they get added to the registry
Contributes to issue CURA-6600.
2019-08-06 08:58:34 +02:00
Ghostkeeper
e84a75094a
Add a MachineNode once a definition for it gets loaded
This means that we've added this machine. We need to pre-load all of the containers for that printer then.

Contributes to issue CURA-6600.
2019-08-05 17:49:21 +02:00
Ghostkeeper
9fda7bd0b9
Rework container tree structure
This sets up a few new classes, subclasses of ContainerNode.

This is intended to simplify the current structure in the QualityManager.

Contributes to issue CURA-6600.
2019-08-05 17:39:19 +02:00