mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Cast result of getPluginObject to the plug-in type it implements
We know for sure what the type of that plug-in is, only we can't import that type because it's a plug-in. We can (and did) import the plug-in type object MeshWriter though. Contributes to issue CURA-5330.
This commit is contained in:
parent
e957f7b650
commit
10f22f9c25
1 changed files with 2 additions and 2 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
import gzip
|
||||
from io import StringIO, BufferedIOBase #To write the g-code to a temporary buffer, and for typing.
|
||||
from typing import List
|
||||
from typing import cast, List
|
||||
|
||||
from UM.Logger import Logger
|
||||
from UM.Mesh.MeshWriter import MeshWriter #The class we're extending/implementing.
|
||||
|
@ -32,7 +32,7 @@ class GCodeGzWriter(MeshWriter):
|
|||
|
||||
#Get the g-code from the g-code writer.
|
||||
gcode_textio = StringIO() #We have to convert the g-code into bytes.
|
||||
success = PluginRegistry.getInstance().getPluginObject("GCodeWriter").write(gcode_textio, None)
|
||||
success = cast(MeshWriter, PluginRegistry.getInstance().getPluginObject("GCodeWriter")).write(gcode_textio, None)
|
||||
if not success: #Writing the g-code failed. Then I can also not write the gzipped g-code.
|
||||
return False
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue