Fix call_on_qt_thread decorator

CURA-6225

Do thread check in the wrapper function, not outside.
This commit is contained in:
Lipu Fei 2019-02-15 15:11:09 +01:00
parent ace638ec81
commit f521fae152
2 changed files with 13 additions and 2 deletions

View file

@ -44,8 +44,12 @@ class UFPWriter(MeshWriter):
# 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):
print("------------> self _write = ", self._write)
return self._write(stream, nodes, mode = mode)
@call_on_qt_thread
def _write(self, stream, nodes, mode = MeshWriter.OutputMode.BinaryMode):
archive = VirtualFile()
archive.openStream(stream, "application/x-ufp", OpenMode.WriteOnly)