diff options
author | Lipu Fei <lipu.fei815@gmail.com> | 2018-08-29 18:33:51 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2018-08-29 18:38:36 +0300 |
commit | 570d0715eda45a1ec4caf05f143171cdd208cb9c (patch) | |
tree | 682d47b9ac6852ccf2066aecbc95b6400e3d1a86 /plugins/UFPWriter | |
parent | 8f5aa82bdb98e8df2cb6c89f061545f3f0396afc (diff) |
Add call_on_qt_thread to UFPWriter.write()
CURA-5555
Diffstat (limited to 'plugins/UFPWriter')
-rw-r--r-- | plugins/UFPWriter/UFPWriter.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/UFPWriter/UFPWriter.py b/plugins/UFPWriter/UFPWriter.py index d838aaef36..a85ee489cb 100644 --- a/plugins/UFPWriter/UFPWriter.py +++ b/plugins/UFPWriter/UFPWriter.py @@ -13,6 +13,7 @@ from UM.PluginRegistry import PluginRegistry #To get the g-code writer. from PyQt5.QtCore import QBuffer from cura.Snapshot import Snapshot +from cura.Utils.Threading import call_on_qt_thread from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") @@ -29,6 +30,11 @@ class UFPWriter(MeshWriter): Logger.log("d", "Creating thumbnail image...") self._snapshot = Snapshot.snapshot(width = 300, height = 300) + # This needs to be called on the main thread (Qt thread) because the serialization of material containers can + # trigger loading other containers. Because those loaded containers are QtObjects, they must be created on the + # Qt thread. The File read/write operations right now are executed on separated threads because they are scheduled + # by the Job class. + @call_on_qt_thread def write(self, stream, nodes, mode = MeshWriter.OutputMode.BinaryMode): archive = VirtualFile() archive.openStream(stream, "application/x-ufp", OpenMode.WriteOnly) |