51 Commits

Author SHA1 Message Date
Ghostkeeper
515c7459d3
Catch EnvironmentError when writing to UFP files
This should result in a user-visible error message rather than a crashing application.

Fixes Sentry issue CURA-28E.
2021-06-07 14:34:26 +02:00
Ghostkeeper
9a65008952
Catch correct exceptions
To catch the exception of duplicate file types, catch only the exception that triggers at this, OPCError. To catch generic file writing errors, catch all of EnvironmentError, not just OSError.
2021-06-07 14:28:33 +02:00
Remco Burema
9144f38814
Fix wrong import. 2021-01-21 09:04:39 +01:00
Remco Burema
f4ef3b44e3
Properly retrieve snapshot (now made on slice).
Circumvents the snapshot/thumbnail not working when the focus is not on the main window, even if the thread is main. This was an issue when writing a file to Digital Factory becasue that workflow uses a modal window.

Thanks for the idea Jelle!
2021-01-21 08:55:45 +01:00
Remco Burema
4fc0612806
Make a snapshot on slice instead of write.
In some cases, UFP-writing is going to be done when the OpenGL-context is off the main window. This doesn't work. That unfortunately also goes for this commit, but it's a work in progress.
2021-01-21 08:19:17 +01:00
Kostas Karmas
32df06c280 Add TODO comment to explain the commenting out of the snapshot
CURA-7865
2021-01-20 12:51:13 +01:00
Kostas Karmas
a72a58cca1 Comment out the generation of the snapshot
While generating UFP files from outside the main thread, the snapshot generation crashes Cura
due to the OpenGL context.

To avoid that, for the time being, we comment out the generation of the snapshot.

CURA-7865
2021-01-20 11:23:48 +01:00
Kostas Karmas
72310919c3 Fix coding style
CURA-6915
2020-07-06 11:08:33 +02:00
Nino van Hooff
c64cff9a47 Merge remote-tracking branch 'origin/CURA-6915_identify_objects_on_buildplate' into CURA-6915_identify_objects_on_buildplate 2020-07-03 14:47:17 +02:00
Nino van Hooff
b1cc651a6a Use DepthFirstIterator to get all descendant Nodes
CURA-6915
2020-07-03 14:46:59 +02:00
Nino van Hooff
6cfdda0842
Apply suggestions from code review
CURA-6915

Co-authored-by: Jaime van Kessel <nallath@gmail.com>
2020-07-03 14:42:08 +02:00
Nino van Hooff
ead0594c56 Write group content metadata for ufp export
CURA-6915
2020-07-03 09:56:28 +02:00
Nino van Hooff
a56489b885 Exclude non-printing nodes from ufp export
CURA-6915
2020-07-02 17:19:21 +02:00
Jaime van Kessel
f2b209b79f
Apply suggestions from code review
Fix the codestyle

CURA-6915
2020-07-01 14:20:22 +02:00
Nino van Hooff
707745b2bf Revert "Revert "Write a list of object names to the global metadata of ufp files""
Was accidentally committed to master, now on a separate branch

CURA-6915

This reverts commit f660755b
2020-06-30 13:53:25 +02:00
Nino van Hooff
f660755b07 Revert "Write a list of object names to the global metadata of ufp files"
This was accidentally committed to master

This reverts commit 67836851
2020-06-30 13:51:02 +02:00
Nino van Hooff
6783685126 Write a list of object names to the global metadata of ufp
files

CURA-6915
2020-06-30 13:32:08 +02:00
Ghostkeeper
44abd08b32
Use newer extruderList rather than deprecated extruders property
Done during Turbo Testing and Tooling.
2020-06-05 15:17:36 +02:00
Ghostkeeper
1047cdd76c
Catch OSError when actually writing the UFP stream
This includes getting an error message when we don't have write access any more or when the file was deleted or connection lost while we were writing to it.

Fixes Sentry issue CURA-GX.
2020-04-09 14:55:14 +02:00
Lipu Fei
94e89ad4ac Fix merge conflicts with master 2019-09-24 14:26:43 +02:00
Jaime van Kessel
3ab0b5decf
Add extra exception handling for UFPwriter 2019-09-24 09:24:36 +02:00
Ghostkeeper
bb0c9c80dc
Don't use material groups to find just the root container
Just look it up in the container registry. If you know the ID, this look-up is just a dictionary look-up as well.

Contributes to issue CURA-6600.
2019-09-13 14:42:27 +02:00
Ghostkeeper
882e60bf95
Fix typing of application
Because CuraApplication has the getMachineManager() function and such, not UM.Application.

Discovered during work on CURA-6600.
2019-09-13 14:42:26 +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
620cd9c45d Change the comment of the UFP mimetype to the correct description 2019-03-21 14:32:27 +01:00
Jaime van Kessel
1a037bdb82 Prevent UFP writer from crashing if the base file of a material can not be found
Another issue found in the crash reports
2019-01-31 14:48:40 +01:00
Remco Burema
110d2daa81 [CURA-5775] The snaphot-creation of the UFP-writer should only be called when writing to UFP-files. 2018-10-04 15:54:22 +02:00
Ghostkeeper
0ce9bf61be
Move MIME type declarations into constructors of readers
So that if you disable the plug-in, the MIME type declaration is also not added.

Fixes #4151.
2018-09-27 13:58:06 +02:00
Lipu Fei
570d0715ed Add call_on_qt_thread to UFPWriter.write()
CURA-5555
2018-08-29 17:38:36 +02:00
Lipu Fei
8f5aa82bdb Fix adding materials in UFP
CURA-5555

Need to use getContainer() for a MaterialNode.
2018-08-29 17:38:36 +02:00
Lipu Fei
939484bc91 Fix adding materials in UFP
CURA-5555

 - Store materials in virtual path "/Materials"
 - Correct material relationship type
 - Add origin for material relationship
 - Use MaterialManager instead of ContainerRegistry to get materials
 - Other minor changes
2018-08-29 17:25:36 +02:00
Aleksei S
423f1210b0 Catch erros and open the write stream only if the material cointaner is found
CURA-5555
2018-08-27 11:10:41 +02:00
Aleksei S
ea935024cf Add materil xml file to UFP file
CURA-5555
2018-08-24 13:02:06 +02:00
Remco Burema
ca25638c07 .ufp should also not show up in recent files since it's a gcode format 2018-08-21 11:01:35 +02:00
Diego Prado Gesto
38a0c9b66d Add some extra information when the Cura can't write the files. 2018-08-03 12:02:11 +02:00
Jack Ha
0e7edc3eaf CURA-4425 the thumbnail now crops correctly 2018-02-05 14:36:42 +01:00
Ghostkeeper
cfb5d71c27
Fix imports
Needs to be a capital letter now. Also remove the unused one (the kitty is no longer there).

Contributes to issue CURA-4872.
2018-02-01 10:34:38 +01:00
Jack Ha
c42f186812 CURA-4425 first thumbnail in UFP file; updated CuraSceneModel and PreviewPass 2018-01-31 17:08:32 +01:00
Ghostkeeper
2fe9860bb9
Use streaming open function
This way we can actually write the result to the correct stream rather than opening a random file separately (which was placeholder).

Contributes to issue CURA-4872.
2018-01-31 08:52:28 +01:00
Ghostkeeper
ebe221f604
Add origin to thumbnail relation
This thumbnail is now about the g-code, so let the relation say that.

Contributes to issue CURA-4872.
2018-01-31 08:43:40 +01:00
Ghostkeeper
a9048a587d
Use new open_stream
This allows us to do something else than write to a file, too.

Contributes to issue CURA-4872.
2018-01-29 17:25:36 +01:00
Ghostkeeper
fec553dbee
Return true after successfully writing the file
This is how Uranium detects that it's been written successfully.

Contributes to issue CURA-4872.
2018-01-29 13:06:38 +01:00
Ghostkeeper
2d48fbb608
Rename file_type parameter to relation_type
It was renamed in libCharon for better semantic meaning.

Contributes to issue CURA-4872.
2018-01-29 12:51:23 +01:00
Ghostkeeper
6f833051f8
Close archive after writing
It gets flushed then and everything.

Contributes to issue CURA-4972.
2018-01-26 16:28:34 +01:00
Ghostkeeper
e3e8e8b170
Fix opening kitty file
Contributes to issue CURA-4872.
2018-01-26 16:21:01 +01:00
Ghostkeeper
20b903855f
Close streams before opening the next
Because zipfile can't handle multiple open streams at the same time.

Contributes to issue CURA-4872.
2018-01-26 16:15:30 +01:00
Ghostkeeper
b6c7a0829f
Use virtual_path parameter instead of target
This parameter was renamed.

Contributes to issue CURA-4872.
2018-01-26 15:43:14 +01:00
Ghostkeeper
d299786de7
Convert g-code to bytes before writing it to archive
Contributes to issue CURA-4872.
2018-01-26 15:41:39 +01:00
Ghostkeeper
8bd351c133
Add placeholder thumbnail to package
This kitten really likes boxes of all kinds: Cardboard and plastic boxes for sure, but also digital boxes such as the UFP.

Contributes to issue CURA-4872.
2018-01-26 13:52:20 +01:00
Ghostkeeper
8a3a3d32da
Fix imports to Charon classes
Contributes to issue CURA-4872.
2018-01-26 13:34:45 +01:00