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.
This commit is contained in:
Ghostkeeper 2018-09-27 13:58:06 +02:00
parent 88ba2ac345
commit 0ce9bf61be
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
4 changed files with 27 additions and 25 deletions

View file

@ -12,13 +12,7 @@ catalog = i18nCatalog("cura")
from . import MarlinFlavorParser, RepRapFlavorParser
MimeTypeDatabase.addMimeType(
MimeType(
name = "application/x-cura-gcode-file",
comment = "Cura GCode File",
suffixes = ["gcode"]
)
)
# Class for loading and parsing G-code files
@ -30,7 +24,15 @@ class GCodeReader(MeshReader):
def __init__(self) -> None:
super().__init__()
MimeTypeDatabase.addMimeType(
MimeType(
name = "application/x-cura-gcode-file",
comment = "Cura GCode File",
suffixes = ["gcode"]
)
)
self._supported_extensions = [".gcode", ".g"]
self._flavor_reader = None
Application.getInstance().getPreferences().addPreference("gcodereader/show_caution", True)