ExportMenu.qml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (c) 2024 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 2.1
  5. import UM 1.5 as UM
  6. import Cura 1.1 as Cura
  7. import "../Dialogs"
  8. Cura.Menu
  9. {
  10. id: exportMenu
  11. property alias model: meshWriters.model
  12. property bool selectionOnly: false
  13. Instantiator
  14. {
  15. id: meshWriters
  16. Cura.MenuItem
  17. {
  18. text: model.description
  19. onTriggered:
  20. {
  21. var localDeviceId = "local_file"
  22. var file_name = PrintInformation.jobName
  23. var args = { "filter_by_machine": false, "limit_mimetypes": model.mime_type}
  24. if(exportMenu.selectionOnly)
  25. {
  26. UM.OutputDeviceManager.requestWriteSelectionToDevice(localDeviceId, file_name, args)
  27. }
  28. else
  29. {
  30. UM.OutputDeviceManager.requestWriteToDevice(localDeviceId, file_name, args)
  31. }
  32. }
  33. shortcut: model.shortcut
  34. enabled: exportMenu.shouldBeVisible
  35. }
  36. onObjectAdded: function(index, object) { exportMenu.insertItem(index, object)}
  37. onObjectRemoved: function(index, object) { exportMenu.removeItem(object)}
  38. }
  39. }