mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 03:06:00 +08:00
Add export sub-menu
CURA-11561
This commit is contained in:
parent
cfb0b3ee81
commit
54af5bca3c
44
resources/qml/Menus/ExportMenu.qml
Normal file
44
resources/qml/Menus/ExportMenu.qml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// Copyright (c) 2024 Ultimaker B.V.
|
||||||
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.2
|
||||||
|
import QtQuick.Controls 2.1
|
||||||
|
|
||||||
|
import UM 1.5 as UM
|
||||||
|
import Cura 1.1 as Cura
|
||||||
|
|
||||||
|
import "../Dialogs"
|
||||||
|
|
||||||
|
Cura.Menu
|
||||||
|
{
|
||||||
|
id: exportMenu
|
||||||
|
property alias model: meshWriters.model
|
||||||
|
property bool selectionOnly: false
|
||||||
|
|
||||||
|
Instantiator
|
||||||
|
{
|
||||||
|
id: meshWriters
|
||||||
|
Cura.MenuItem
|
||||||
|
{
|
||||||
|
text: model.description
|
||||||
|
onTriggered:
|
||||||
|
{
|
||||||
|
var localDeviceId = "local_file"
|
||||||
|
var file_name = PrintInformation.jobName
|
||||||
|
var args = { "filter_by_machine": false, "limit_mimetypes": model.mime_type}
|
||||||
|
if(exportMenu.selectionOnly)
|
||||||
|
{
|
||||||
|
UM.OutputDeviceManager.requestWriteSelectionToDevice(localDeviceId, file_name, args)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UM.OutputDeviceManager.requestWriteToDevice(localDeviceId, file_name, args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
shortcut: model.shortcut
|
||||||
|
enabled: exportMenu.shouldBeVisible
|
||||||
|
}
|
||||||
|
onObjectAdded: function(index, object) { exportMenu.insertItem(index, object)}
|
||||||
|
onObjectRemoved: function(index, object) { exportMenu.removeItem(object)}
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@
|
|||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
|
|
||||||
import UM 1.6 as UM
|
import UM 1.7 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
Cura.Menu
|
Cura.Menu
|
||||||
@ -72,24 +72,24 @@ Cura.Menu
|
|||||||
|
|
||||||
Cura.MenuSeparator { }
|
Cura.MenuSeparator { }
|
||||||
|
|
||||||
Cura.MenuItem
|
UM.MeshWritersModel { id: meshWritersModel }
|
||||||
|
|
||||||
|
ExportMenu
|
||||||
{
|
{
|
||||||
id: saveAsMenu
|
id: exportMenu
|
||||||
text: catalog.i18nc("@title:menu menubar:file", "&Export...")
|
title: catalog.i18nc("@title:menu menubar:file", "&Export...")
|
||||||
onTriggered:
|
model: meshWritersModel
|
||||||
{
|
shouldBeVisible: model.count > 0
|
||||||
var localDeviceId = "local_file"
|
|
||||||
UM.OutputDeviceManager.requestWriteToDevice(localDeviceId, PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.MenuItem
|
ExportMenu
|
||||||
{
|
{
|
||||||
id: exportSelectionMenu
|
id: exportSelectionMenu
|
||||||
text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection...")
|
title: catalog.i18nc("@action:inmenu menubar:file", "Export Selection...")
|
||||||
|
model: meshWritersModel
|
||||||
|
shouldBeVisible: model.count > 0
|
||||||
enabled: UM.Selection.hasSelection
|
enabled: UM.Selection.hasSelection
|
||||||
icon.name: "document-save-as"
|
selectionOnly: true
|
||||||
onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.MenuSeparator { }
|
Cura.MenuSeparator { }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user