mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
D6: Moved extensions to plugin metadata
This commit is contained in:
parent
620a3891da
commit
fecf23d66d
2 changed files with 7 additions and 6 deletions
|
@ -1033,7 +1033,7 @@ class CuraApplication(QtApplication):
|
||||||
Logger.log("d", msg)
|
Logger.log("d", msg)
|
||||||
|
|
||||||
_loading_files = []
|
_loading_files = []
|
||||||
_non_sliceable_extensions = [".gcode", ".g"]
|
non_sliceable_extensions = []
|
||||||
|
|
||||||
@pyqtSlot(QUrl)
|
@pyqtSlot(QUrl)
|
||||||
def readLocalFile(self, file):
|
def readLocalFile(self, file):
|
||||||
|
@ -1052,7 +1052,7 @@ class CuraApplication(QtApplication):
|
||||||
filename = os.path.basename(f)
|
filename = os.path.basename(f)
|
||||||
if len(self._loading_files) > 0:
|
if len(self._loading_files) > 0:
|
||||||
# If a non-slicable file is already being loaded, we prevent loading of any further non-slicable files
|
# If a non-slicable file is already being loaded, we prevent loading of any further non-slicable files
|
||||||
if extension.lower() in self._non_sliceable_extensions:
|
if extension.lower() in self.non_sliceable_extensions:
|
||||||
message = Message(
|
message = Message(
|
||||||
self._i18n_catalog.i18nc("@info:status",
|
self._i18n_catalog.i18nc("@info:status",
|
||||||
"Only one G-code file can be loaded at a time. Skipped importing {0}",
|
"Only one G-code file can be loaded at a time. Skipped importing {0}",
|
||||||
|
@ -1061,7 +1061,7 @@ class CuraApplication(QtApplication):
|
||||||
return
|
return
|
||||||
# If file being loaded is non-slicable file, then prevent loading of any other files
|
# If file being loaded is non-slicable file, then prevent loading of any other files
|
||||||
extension = os.path.splitext(self._loading_files[0])[1]
|
extension = os.path.splitext(self._loading_files[0])[1]
|
||||||
if extension.lower() in self._non_sliceable_extensions:
|
if extension.lower() in self.non_sliceable_extensions:
|
||||||
message = Message(
|
message = Message(
|
||||||
self._i18n_catalog.i18nc("@info:status",
|
self._i18n_catalog.i18nc("@info:status",
|
||||||
"Can't open any other file if G-code is loading. Skipped importing {0}",
|
"Can't open any other file if G-code is loading. Skipped importing {0}",
|
||||||
|
@ -1070,7 +1070,7 @@ class CuraApplication(QtApplication):
|
||||||
return
|
return
|
||||||
|
|
||||||
self._loading_files.append(f)
|
self._loading_files.append(f)
|
||||||
if extension in self._non_sliceable_extensions:
|
if extension in self.non_sliceable_extensions:
|
||||||
self.deleteAll()
|
self.deleteAll()
|
||||||
|
|
||||||
job = ReadMeshJob(f)
|
job = ReadMeshJob(f)
|
||||||
|
@ -1087,7 +1087,7 @@ class CuraApplication(QtApplication):
|
||||||
node.setName(os.path.basename(filename))
|
node.setName(os.path.basename(filename))
|
||||||
|
|
||||||
extension = os.path.splitext(filename)[1]
|
extension = os.path.splitext(filename)[1]
|
||||||
if extension.lower() in self._non_sliceable_extensions:
|
if extension.lower() in self.non_sliceable_extensions:
|
||||||
self.changeLayerViewSignal.emit()
|
self.changeLayerViewSignal.emit()
|
||||||
sliceable_decorator = SliceableObjectDecorator()
|
sliceable_decorator = SliceableObjectDecorator()
|
||||||
sliceable_decorator.setBlockSlicing(True)
|
sliceable_decorator.setBlockSlicing(True)
|
||||||
|
@ -1099,7 +1099,6 @@ class CuraApplication(QtApplication):
|
||||||
sliceable_decorator.setSliceable(True)
|
sliceable_decorator.setSliceable(True)
|
||||||
node.addDecorator(sliceable_decorator)
|
node.addDecorator(sliceable_decorator)
|
||||||
|
|
||||||
|
|
||||||
scene = self.getController().getScene()
|
scene = self.getController().getScene()
|
||||||
|
|
||||||
op = AddSceneNodeOperation(node, scene.getRoot())
|
op = AddSceneNodeOperation(node, scene.getRoot())
|
||||||
|
|
|
@ -28,4 +28,6 @@ def getMetaData():
|
||||||
}
|
}
|
||||||
|
|
||||||
def register(app):
|
def register(app):
|
||||||
|
app.non_sliceable_extensions.append(".gcode")
|
||||||
|
app.non_sliceable_extensions.append(".g")
|
||||||
return { "mesh_reader": GCodeReader.GCodeReader() }
|
return { "mesh_reader": GCodeReader.GCodeReader() }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue