PrintMonitor.qml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. outputDevice: connectedDevice
  24. }
  25. Rectangle
  26. {
  27. color: UM.Theme.getColor("sidebar_lining")
  28. width: parent.width
  29. height: childrenRect.height
  30. Flow
  31. {
  32. id: extrudersGrid
  33. spacing: UM.Theme.getSize("sidebar_lining_thin").width
  34. width: parent.width
  35. Repeater
  36. {
  37. id: extrudersRepeater
  38. model: activePrinter!=null ? activePrinter.extruders : null
  39. ExtruderBox
  40. {
  41. color: UM.Theme.getColor("sidebar")
  42. width: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 ? extrudersGrid.width : Math.round(extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2)
  43. extruderModel: modelData
  44. }
  45. }
  46. }
  47. }
  48. Rectangle
  49. {
  50. color: UM.Theme.getColor("sidebar_lining")
  51. width: parent.width
  52. height: UM.Theme.getSize("sidebar_lining_thin").width
  53. }
  54. HeatedBedBox
  55. {
  56. visible: {
  57. if(activePrinter != null && activePrinter.bedTemperature != -1)
  58. {
  59. return true
  60. }
  61. return false
  62. }
  63. printerModel: activePrinter
  64. }
  65. UM.SettingPropertyProvider
  66. {
  67. id: bedTemperature
  68. containerStack: Cura.MachineManager.activeMachine
  69. key: "material_bed_temperature"
  70. watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"]
  71. storeIndex: 0
  72. property var resolve: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine ? properties.resolve : "None"
  73. }
  74. UM.SettingPropertyProvider
  75. {
  76. id: machineExtruderCount
  77. containerStack: Cura.MachineManager.activeMachine
  78. key: "machine_extruder_count"
  79. watchedProperties: ["value"]
  80. }
  81. ManualPrinterControl
  82. {
  83. printerModel: activePrinter
  84. visible: activePrinter != null ? activePrinter.canControlManually : false
  85. }
  86. MonitorSection
  87. {
  88. label: catalog.i18nc("@label", "Active print")
  89. width: base.width
  90. visible: activePrinter != null
  91. }
  92. MonitorItem
  93. {
  94. label: catalog.i18nc("@label", "Job Name")
  95. value: activePrintJob != null ? activePrintJob.name : ""
  96. width: base.width
  97. visible: activePrinter != null
  98. }
  99. MonitorItem
  100. {
  101. label: catalog.i18nc("@label", "Printing Time")
  102. value: activePrintJob != null ? getPrettyTime(activePrintJob.timeTotal) : ""
  103. width: base.width
  104. visible: activePrinter != null
  105. }
  106. MonitorItem
  107. {
  108. label: catalog.i18nc("@label", "Estimated time left")
  109. value: activePrintJob != null ? getPrettyTime(activePrintJob.timeTotal - activePrintJob.timeElapsed) : ""
  110. visible:
  111. {
  112. if(activePrintJob == null)
  113. {
  114. return false
  115. }
  116. return (activePrintJob.state == "printing" ||
  117. activePrintJob.state == "resuming" ||
  118. activePrintJob.state == "pausing" ||
  119. activePrintJob.state == "paused")
  120. }
  121. width: base.width
  122. }
  123. }