PrintMonitor.qml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import QtQuick.Controls 1.1
  5. import QtQuick.Controls.Styles 1.1
  6. import QtQuick.Layouts 1.1
  7. import UM 1.2 as UM
  8. import Cura 1.0 as Cura
  9. import "PrinterOutput"
  10. Column
  11. {
  12. id: printMonitor
  13. property var connectedDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
  14. property var activePrinter: connectedDevice != null ? connectedDevice.activePrinter : null
  15. property var activePrintJob: activePrinter != null ? activePrinter.activePrintJob: null
  16. Cura.ExtrudersModel
  17. {
  18. id: extrudersModel
  19. simpleNames: true
  20. }
  21. OutputDeviceHeader
  22. {
  23. width: parent.width
  24. outputDevice: connectedDevice
  25. }
  26. Rectangle
  27. {
  28. color: UM.Theme.getColor("sidebar_lining")
  29. width: parent.width
  30. height: childrenRect.height
  31. Flow
  32. {
  33. id: extrudersGrid
  34. spacing: UM.Theme.getSize("sidebar_lining_thin").width
  35. width: parent.width
  36. Repeater
  37. {
  38. id: extrudersRepeater
  39. model: activePrinter!=null ? activePrinter.extruders : null
  40. ExtruderBox
  41. {
  42. color: UM.Theme.getColor("sidebar")
  43. width: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 ? extrudersGrid.width : Math.round(extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2)
  44. extruderModel: modelData
  45. }
  46. }
  47. }
  48. }
  49. Rectangle
  50. {
  51. color: UM.Theme.getColor("sidebar_lining")
  52. width: parent.width
  53. height: UM.Theme.getSize("sidebar_lining_thin").width
  54. }
  55. HeatedBedBox
  56. {
  57. visible: {
  58. if(activePrinter != null && activePrinter.bedTemperature != -1)
  59. {
  60. return true
  61. }
  62. return false
  63. }
  64. printerModel: activePrinter
  65. }
  66. UM.SettingPropertyProvider
  67. {
  68. id: bedTemperature
  69. containerStackId: Cura.MachineManager.activeMachineId
  70. key: "material_bed_temperature"
  71. watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"]
  72. storeIndex: 0
  73. property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? properties.resolve : "None"
  74. }
  75. UM.SettingPropertyProvider
  76. {
  77. id: machineExtruderCount
  78. containerStackId: Cura.MachineManager.activeMachineId
  79. key: "machine_extruder_count"
  80. watchedProperties: ["value"]
  81. }
  82. ManualPrinterControl
  83. {
  84. printerModel: activePrinter
  85. visible: activePrinter != null ? activePrinter.canControlManually : false
  86. }
  87. MonitorSection
  88. {
  89. label: catalog.i18nc("@label", "Active print")
  90. width: base.width
  91. visible: activePrinter != null
  92. }
  93. MonitorItem
  94. {
  95. label: catalog.i18nc("@label", "Job Name")
  96. value: activePrintJob != null ? activePrintJob.name : ""
  97. width: base.width
  98. visible: activePrinter != null
  99. }
  100. MonitorItem
  101. {
  102. label: catalog.i18nc("@label", "Printing Time")
  103. value: activePrintJob != null ? getPrettyTime(activePrintJob.timeTotal) : ""
  104. width: base.width
  105. visible: activePrinter != null
  106. }
  107. MonitorItem
  108. {
  109. label: catalog.i18nc("@label", "Estimated time left")
  110. value: activePrintJob != null ? getPrettyTime(activePrintJob.timeTotal - activePrintJob.timeElapsed) : ""
  111. visible:
  112. {
  113. if(activePrintJob == null)
  114. {
  115. return false
  116. }
  117. return (activePrintJob.state == "printing" ||
  118. activePrintJob.state == "resuming" ||
  119. activePrintJob.state == "pausing" ||
  120. activePrintJob.state == "paused")
  121. }
  122. width: base.width
  123. }
  124. }