mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 16:27:51 -06:00
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:
parent
88ba2ac345
commit
0ce9bf61be
4 changed files with 27 additions and 25 deletions
|
@ -1,5 +1,6 @@
|
|||
#Copyright (c) 2018 Ultimaker B.V.
|
||||
#Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
from typing import cast
|
||||
|
||||
from Charon.VirtualFile import VirtualFile #To open UFP files.
|
||||
|
@ -9,6 +10,7 @@ from io import StringIO #For converting g-code to bytes.
|
|||
from UM.Application import Application
|
||||
from UM.Logger import Logger
|
||||
from UM.Mesh.MeshWriter import MeshWriter #The writer we need to implement.
|
||||
from UM.MimeTypeDatabase import MimeTypeDatabase, MimeType
|
||||
from UM.PluginRegistry import PluginRegistry #To get the g-code writer.
|
||||
from PyQt5.QtCore import QBuffer
|
||||
|
||||
|
@ -22,6 +24,15 @@ catalog = i18nCatalog("cura")
|
|||
class UFPWriter(MeshWriter):
|
||||
def __init__(self):
|
||||
super().__init__(add_to_recent_files = False)
|
||||
|
||||
MimeTypeDatabase.addMimeType(
|
||||
MimeType(
|
||||
name = "application/x-cura-stl-file",
|
||||
comment = "Cura UFP File",
|
||||
suffixes = ["ufp"]
|
||||
)
|
||||
)
|
||||
|
||||
self._snapshot = None
|
||||
Application.getInstance().getOutputDeviceManager().writeStarted.connect(self._createSnapshot)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue