diff options
author | Ghostkeeper <rubend@tutanota.com> | 2018-06-15 16:09:19 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2018-06-15 16:09:19 +0300 |
commit | 10f22f9c2572902edb6e0eea49ba58e1e241c7fd (patch) | |
tree | 09f502db561bb9cb5132f5fccf86d2ac0f29c243 /plugins/GCodeGzWriter/GCodeGzWriter.py | |
parent | e957f7b650f9af432089e222685e52ae0bc64958 (diff) |
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.
Diffstat (limited to 'plugins/GCodeGzWriter/GCodeGzWriter.py')
-rw-r--r-- | plugins/GCodeGzWriter/GCodeGzWriter.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/GCodeGzWriter/GCodeGzWriter.py b/plugins/GCodeGzWriter/GCodeGzWriter.py index 06fafb5995..6ddecdb0bd 100644 --- a/plugins/GCodeGzWriter/GCodeGzWriter.py +++ b/plugins/GCodeGzWriter/GCodeGzWriter.py @@ -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 |