UMOCheckupMachineAction.qml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. import UM 1.2 as UM
  2. import Cura 1.0 as Cura
  3. import QtQuick 2.2
  4. import QtQuick.Controls 1.1
  5. import QtQuick.Layouts 1.1
  6. import QtQuick.Window 2.1
  7. Cura.MachineAction
  8. {
  9. anchors.fill: parent;
  10. Item
  11. {
  12. id: checkupMachineAction
  13. anchors.fill: parent;
  14. property int leftRow: (checkupMachineAction.width * 0.40) | 0
  15. property int rightRow: (checkupMachineAction.width * 0.60) | 0
  16. property bool heatupHotendStarted: false
  17. property bool heatupBedStarted: false
  18. property bool printerConnected: Cura.MachineManager.printerConnected
  19. UM.I18nCatalog { id: catalog; name: "cura"}
  20. Label
  21. {
  22. id: pageTitle
  23. width: parent.width
  24. text: catalog.i18nc("@title", "Check Printer")
  25. wrapMode: Text.WordWrap
  26. font.pointSize: 18;
  27. }
  28. Label
  29. {
  30. id: pageDescription
  31. anchors.top: pageTitle.bottom
  32. anchors.topMargin: UM.Theme.getSize("default_margin").height
  33. width: parent.width
  34. wrapMode: Text.WordWrap
  35. text: catalog.i18nc("@label", "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional");
  36. }
  37. Row
  38. {
  39. id: startStopButtons
  40. anchors.top: pageDescription.bottom
  41. anchors.topMargin: UM.Theme.getSize("default_margin").height
  42. anchors.horizontalCenter: parent.horizontalCenter
  43. width: childrenRect.width
  44. spacing: UM.Theme.getSize("default_margin").width
  45. Button
  46. {
  47. id: startCheckButton
  48. text: catalog.i18nc("@action:button","Start Printer Check");
  49. onClicked:
  50. {
  51. checkupMachineAction.heatupHotendStarted = false;
  52. checkupMachineAction.heatupBedStarted = false;
  53. manager.startCheck();
  54. startCheckButton.visible = false;
  55. }
  56. }
  57. }
  58. Item
  59. {
  60. id: checkupContent
  61. anchors.top: startStopButtons.bottom
  62. anchors.topMargin: UM.Theme.getSize("default_margin").height
  63. visible: manager.checkStarted
  64. width: parent.width
  65. height: 250
  66. //////////////////////////////////////////////////////////
  67. Label
  68. {
  69. id: connectionLabel
  70. width: checkupMachineAction.leftRow
  71. anchors.left: parent.left
  72. anchors.top: parent.top
  73. wrapMode: Text.WordWrap
  74. text: catalog.i18nc("@label","Connection: ")
  75. }
  76. Label
  77. {
  78. id: connectionStatus
  79. width: checkupMachineAction.rightRow
  80. anchors.left: connectionLabel.right
  81. anchors.top: parent.top
  82. wrapMode: Text.WordWrap
  83. text: checkupMachineAction.printerConnected ? catalog.i18nc("@info:status","Connected"): catalog.i18nc("@info:status","Not connected")
  84. }
  85. //////////////////////////////////////////////////////////
  86. Label
  87. {
  88. id: endstopXLabel
  89. width: checkupMachineAction.leftRow
  90. anchors.left: parent.left
  91. anchors.top: connectionLabel.bottom
  92. wrapMode: Text.WordWrap
  93. text: catalog.i18nc("@label","Min endstop X: ")
  94. visible: checkupMachineAction.printerConnected
  95. }
  96. Label
  97. {
  98. id: endstopXStatus
  99. width: checkupMachineAction.rightRow
  100. anchors.left: endstopXLabel.right
  101. anchors.top: connectionLabel.bottom
  102. wrapMode: Text.WordWrap
  103. text: manager.xMinEndstopTestCompleted ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked")
  104. visible: checkupMachineAction.printerConnected
  105. }
  106. //////////////////////////////////////////////////////////////
  107. Label
  108. {
  109. id: endstopYLabel
  110. width: checkupMachineAction.leftRow
  111. anchors.left: parent.left
  112. anchors.top: endstopXLabel.bottom
  113. wrapMode: Text.WordWrap
  114. text: catalog.i18nc("@label","Min endstop Y: ")
  115. visible: checkupMachineAction.printerConnected
  116. }
  117. Label
  118. {
  119. id: endstopYStatus
  120. width: checkupMachineAction.rightRow
  121. anchors.left: endstopYLabel.right
  122. anchors.top: endstopXLabel.bottom
  123. wrapMode: Text.WordWrap
  124. text: manager.yMinEndstopTestCompleted ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked")
  125. visible: checkupMachineAction.printerConnected
  126. }
  127. /////////////////////////////////////////////////////////////////////
  128. Label
  129. {
  130. id: endstopZLabel
  131. width: checkupMachineAction.leftRow
  132. anchors.left: parent.left
  133. anchors.top: endstopYLabel.bottom
  134. wrapMode: Text.WordWrap
  135. text: catalog.i18nc("@label","Min endstop Z: ")
  136. visible: checkupMachineAction.printerConnected
  137. }
  138. Label
  139. {
  140. id: endstopZStatus
  141. width: checkupMachineAction.rightRow
  142. anchors.left: endstopZLabel.right
  143. anchors.top: endstopYLabel.bottom
  144. wrapMode: Text.WordWrap
  145. text: manager.zMinEndstopTestCompleted ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked")
  146. visible: checkupMachineAction.printerConnected
  147. }
  148. ////////////////////////////////////////////////////////////
  149. Label
  150. {
  151. id: nozzleTempLabel
  152. width: checkupMachineAction.leftRow
  153. height: nozzleTempButton.height
  154. anchors.left: parent.left
  155. anchors.top: endstopZLabel.bottom
  156. wrapMode: Text.WordWrap
  157. text: catalog.i18nc("@label","Nozzle temperature check: ")
  158. visible: checkupMachineAction.printerConnected
  159. }
  160. Label
  161. {
  162. id: nozzleTempStatus
  163. width: (checkupMachineAction.rightRow * 0.4) | 0
  164. anchors.top: nozzleTempLabel.top
  165. anchors.left: nozzleTempLabel.right
  166. wrapMode: Text.WordWrap
  167. text: catalog.i18nc("@info:status","Not checked")
  168. visible: checkupMachineAction.printerConnected
  169. }
  170. Item
  171. {
  172. id: nozzleTempButton
  173. width: (checkupMachineAction.rightRow * 0.3) | 0
  174. height: childrenRect.height
  175. anchors.top: nozzleTempLabel.top
  176. anchors.left: bedTempStatus.right
  177. anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").width/2)
  178. visible: checkupMachineAction.printerConnected
  179. Button
  180. {
  181. text: checkupMachineAction.heatupHotendStarted ? catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating")
  182. onClicked:
  183. {
  184. if (checkupMachineAction.heatupHotendStarted)
  185. {
  186. manager.cooldownHotend()
  187. checkupMachineAction.heatupHotendStarted = false
  188. } else
  189. {
  190. manager.heatupHotend()
  191. checkupMachineAction.heatupHotendStarted = true
  192. }
  193. }
  194. }
  195. }
  196. Label
  197. {
  198. id: nozzleTemp
  199. anchors.top: nozzleTempLabel.top
  200. anchors.left: nozzleTempButton.right
  201. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  202. width: (checkupMachineAction.rightRow * 0.2) | 0
  203. wrapMode: Text.WordWrap
  204. text: manager.hotendTemperature + "°C"
  205. font.bold: true
  206. visible: checkupMachineAction.printerConnected
  207. }
  208. /////////////////////////////////////////////////////////////////////////////
  209. Label
  210. {
  211. id: bedTempLabel
  212. width: checkupMachineAction.leftRow
  213. height: bedTempButton.height
  214. anchors.left: parent.left
  215. anchors.top: nozzleTempLabel.bottom
  216. wrapMode: Text.WordWrap
  217. text: catalog.i18nc("@label","Build plate temperature check:")
  218. visible: checkupMachineAction.printerConnected && manager.hasHeatedBed
  219. }
  220. Label
  221. {
  222. id: bedTempStatus
  223. width: (checkupMachineAction.rightRow * 0.4) | 0
  224. anchors.top: bedTempLabel.top
  225. anchors.left: bedTempLabel.right
  226. wrapMode: Text.WordWrap
  227. text: manager.bedTestCompleted ? catalog.i18nc("@info:status","Not checked"): catalog.i18nc("@info:status","Checked")
  228. visible: checkupMachineAction.printerConnected && manager.hasHeatedBed
  229. }
  230. Item
  231. {
  232. id: bedTempButton
  233. width: (checkupMachineAction.rightRow * 0.3) | 0
  234. height: childrenRect.height
  235. anchors.top: bedTempLabel.top
  236. anchors.left: bedTempStatus.right
  237. anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").width/2)
  238. visible: checkupMachineAction.printerConnected && manager.hasHeatedBed
  239. Button
  240. {
  241. text: checkupMachineAction.heatupBedStarted ?catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating")
  242. onClicked:
  243. {
  244. if (checkupMachineAction.heatupBedStarted)
  245. {
  246. manager.cooldownBed()
  247. checkupMachineAction.heatupBedStarted = false
  248. } else
  249. {
  250. manager.heatupBed()
  251. checkupMachineAction.heatupBedStarted = true
  252. }
  253. }
  254. }
  255. }
  256. Label
  257. {
  258. id: bedTemp
  259. width: (checkupMachineAction.rightRow * 0.2) | 0
  260. anchors.top: bedTempLabel.top
  261. anchors.left: bedTempButton.right
  262. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  263. wrapMode: Text.WordWrap
  264. text: manager.bedTemperature + "°C"
  265. font.bold: true
  266. visible: checkupMachineAction.printerConnected && manager.hasHeatedBed
  267. }
  268. Label
  269. {
  270. id: resultText
  271. visible: false
  272. anchors.top: bedTemp.bottom
  273. anchors.topMargin: UM.Theme.getSize("default_margin").height
  274. anchors.left: parent.left
  275. width: parent.width
  276. wrapMode: Text.WordWrap
  277. text: catalog.i18nc("@label", "Everything is in order! You're done with your CheckUp.")
  278. }
  279. }
  280. }
  281. }