UMOCheckupMachineAction.qml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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
  15. property int rightRow: checkupMachineAction.width * 0.60
  16. property bool heatupHotendStarted: false
  17. property bool heatupBedStarted: false
  18. property bool usbConnected: Cura.USBPrinterManager.connectedPrinterList.rowCount() > 0
  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. Item
  38. {
  39. id: startStopButtons
  40. anchors.top: pageDescription.bottom
  41. anchors.topMargin: UM.Theme.getSize("default_margin").height
  42. anchors.horizontalCenter: parent.horizontalCenter
  43. height: childrenRect.height
  44. width: startCheckButton.width + skipCheckButton.width + UM.Theme.getSize("default_margin").height < checkupMachineAction.width ? startCheckButton.width + skipCheckButton.width + UM.Theme.getSize("default_margin").height : checkupMachineAction.width
  45. Button
  46. {
  47. id: startCheckButton
  48. anchors.top: parent.top
  49. anchors.left: parent.left
  50. text: catalog.i18nc("@action:button","Start Printer Check");
  51. onClicked:
  52. {
  53. checkupMachineAction.heatupHotendStarted = false
  54. checkupMachineAction.heatupBedStarted = false
  55. manager.startCheck()
  56. }
  57. }
  58. Button
  59. {
  60. id: skipCheckButton
  61. anchors.top: parent.width < checkupMachineAction.width ? parent.top : startCheckButton.bottom
  62. anchors.topMargin: parent.width < checkupMachineAction.width ? 0 : UM.Theme.getSize("default_margin").height/2
  63. anchors.left: parent.width < checkupMachineAction.width ? startCheckButton.right : parent.left
  64. anchors.leftMargin: parent.width < checkupMachineAction.width ? UM.Theme.getSize("default_margin").width : 0
  65. text: catalog.i18nc("@action:button", "Skip Printer Check");
  66. onClicked: manager.setFinished()
  67. }
  68. }
  69. Item
  70. {
  71. id: checkupContent
  72. anchors.top: startStopButtons.bottom
  73. anchors.topMargin: UM.Theme.getSize("default_margin").height
  74. visible: manager.checkStarted
  75. width: parent.width
  76. height: 250
  77. //////////////////////////////////////////////////////////
  78. Label
  79. {
  80. id: connectionLabel
  81. width: checkupMachineAction.leftRow
  82. anchors.left: parent.left
  83. anchors.top: parent.top
  84. wrapMode: Text.WordWrap
  85. text: catalog.i18nc("@label","Connection: ")
  86. }
  87. Label
  88. {
  89. id: connectionStatus
  90. width: checkupMachineAction.rightRow
  91. anchors.left: connectionLabel.right
  92. anchors.top: parent.top
  93. wrapMode: Text.WordWrap
  94. text: checkupMachineAction.usbConnected ? catalog.i18nc("@info:status","Connected"): catalog.i18nc("@info:status","Not connected")
  95. }
  96. //////////////////////////////////////////////////////////
  97. Label
  98. {
  99. id: endstopXLabel
  100. width: checkupMachineAction.leftRow
  101. anchors.left: parent.left
  102. anchors.top: connectionLabel.bottom
  103. wrapMode: Text.WordWrap
  104. text: catalog.i18nc("@label","Min endstop X: ")
  105. visible: checkupMachineAction.usbConnected
  106. }
  107. Label
  108. {
  109. id: endstopXStatus
  110. width: checkupMachineAction.rightRow
  111. anchors.left: endstopXLabel.right
  112. anchors.top: connectionLabel.bottom
  113. wrapMode: Text.WordWrap
  114. text: manager.xMinEndstopTestCompleted ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked")
  115. visible: checkupMachineAction.usbConnected
  116. }
  117. //////////////////////////////////////////////////////////////
  118. Label
  119. {
  120. id: endstopYLabel
  121. width: checkupMachineAction.leftRow
  122. anchors.left: parent.left
  123. anchors.top: endstopXLabel.bottom
  124. wrapMode: Text.WordWrap
  125. text: catalog.i18nc("@label","Min endstop Y: ")
  126. visible: checkupMachineAction.usbConnected
  127. }
  128. Label
  129. {
  130. id: endstopYStatus
  131. width: checkupMachineAction.rightRow
  132. anchors.left: endstopYLabel.right
  133. anchors.top: endstopXLabel.bottom
  134. wrapMode: Text.WordWrap
  135. text: manager.yMinEndstopTestCompleted ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked")
  136. visible: checkupMachineAction.usbConnected
  137. }
  138. /////////////////////////////////////////////////////////////////////
  139. Label
  140. {
  141. id: endstopZLabel
  142. width: checkupMachineAction.leftRow
  143. anchors.left: parent.left
  144. anchors.top: endstopYLabel.bottom
  145. wrapMode: Text.WordWrap
  146. text: catalog.i18nc("@label","Min endstop Z: ")
  147. visible: checkupMachineAction.usbConnected
  148. }
  149. Label
  150. {
  151. id: endstopZStatus
  152. width: checkupMachineAction.rightRow
  153. anchors.left: endstopZLabel.right
  154. anchors.top: endstopYLabel.bottom
  155. wrapMode: Text.WordWrap
  156. text: manager.zMinEndstopTestCompleted ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked")
  157. visible: checkupMachineAction.usbConnected
  158. }
  159. ////////////////////////////////////////////////////////////
  160. Label
  161. {
  162. id: nozzleTempLabel
  163. width: checkupMachineAction.leftRow
  164. height: nozzleTempButton.height
  165. anchors.left: parent.left
  166. anchors.top: endstopZLabel.bottom
  167. wrapMode: Text.WordWrap
  168. text: catalog.i18nc("@label","Nozzle temperature check: ")
  169. visible: checkupMachineAction.usbConnected
  170. }
  171. Label
  172. {
  173. id: nozzleTempStatus
  174. width: checkupMachineAction.rightRow * 0.4
  175. anchors.top: nozzleTempLabel.top
  176. anchors.left: nozzleTempLabel.right
  177. wrapMode: Text.WordWrap
  178. text: catalog.i18nc("@info:status","Not checked")
  179. visible: checkupMachineAction.usbConnected
  180. }
  181. Item
  182. {
  183. id: nozzleTempButton
  184. width: checkupMachineAction.rightRow * 0.3
  185. height: childrenRect.height
  186. anchors.top: nozzleTempLabel.top
  187. anchors.left: bedTempStatus.right
  188. anchors.leftMargin: UM.Theme.getSize("default_margin").width/2
  189. visible: checkupMachineAction.usbConnected
  190. Button
  191. {
  192. text: checkupMachineAction.heatupHotendStarted ? catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating")
  193. onClicked:
  194. {
  195. if (checkupMachineAction.heatupHotendStarted)
  196. {
  197. manager.cooldownHotend()
  198. checkupMachineAction.heatupHotendStarted = false
  199. } else
  200. {
  201. manager.heatupHotend()
  202. checkupMachineAction.heatupHotendStarted = true
  203. }
  204. }
  205. }
  206. }
  207. Label
  208. {
  209. id: nozzleTemp
  210. anchors.top: nozzleTempLabel.top
  211. anchors.left: nozzleTempButton.right
  212. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  213. width: checkupMachineAction.rightRow * 0.2
  214. wrapMode: Text.WordWrap
  215. text: manager.hotendTemperature + "°C"
  216. font.bold: true
  217. visible: checkupMachineAction.usbConnected
  218. }
  219. /////////////////////////////////////////////////////////////////////////////
  220. Label
  221. {
  222. id: bedTempLabel
  223. width: checkupMachineAction.leftRow
  224. height: bedTempButton.height
  225. anchors.left: parent.left
  226. anchors.top: nozzleTempLabel.bottom
  227. wrapMode: Text.WordWrap
  228. text: catalog.i18nc("@label","Bed temperature check:")
  229. visible: checkupMachineAction.usbConnected && manager.hasHeatedBed
  230. }
  231. Label
  232. {
  233. id: bedTempStatus
  234. width: checkupMachineAction.rightRow * 0.4
  235. anchors.top: bedTempLabel.top
  236. anchors.left: bedTempLabel.right
  237. wrapMode: Text.WordWrap
  238. text: manager.bedTestCompleted ? catalog.i18nc("@info:status","Not checked"): catalog.i18nc("@info:status","Checked")
  239. visible: checkupMachineAction.usbConnected && manager.hasHeatedBed
  240. }
  241. Item
  242. {
  243. id: bedTempButton
  244. width: checkupMachineAction.rightRow * 0.3
  245. height: childrenRect.height
  246. anchors.top: bedTempLabel.top
  247. anchors.left: bedTempStatus.right
  248. anchors.leftMargin: UM.Theme.getSize("default_margin").width/2
  249. visible: checkupMachineAction.usbConnected && manager.hasHeatedBed
  250. Button
  251. {
  252. text: checkupMachineAction.heatupBedStarted ?catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating")
  253. onClicked:
  254. {
  255. if (checkupMachineAction.heatupBedStarted)
  256. {
  257. manager.cooldownBed()
  258. checkupMachineAction.heatupBedStarted = false
  259. } else
  260. {
  261. manager.heatupBed()
  262. checkupMachineAction.heatupBedStarted = true
  263. }
  264. }
  265. }
  266. }
  267. Label
  268. {
  269. id: bedTemp
  270. width: checkupMachineAction.rightRow * 0.2
  271. anchors.top: bedTempLabel.top
  272. anchors.left: bedTempButton.right
  273. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  274. wrapMode: Text.WordWrap
  275. text: manager.bedTemperature + "°C"
  276. font.bold: true
  277. visible: checkupMachineAction.usbConnected && manager.hasHeatedBed
  278. }
  279. Label
  280. {
  281. id: resultText
  282. visible: false
  283. anchors.top: bedTemp.bottom
  284. anchors.topMargin: UM.Theme.getSize("default_margin").height
  285. anchors.left: parent.left
  286. width: parent.width
  287. wrapMode: Text.WordWrap
  288. text: catalog.i18nc("@label", "Everything is in order! You're done with your CheckUp.")
  289. }
  290. }
  291. }
  292. }