UMOCheckupMachineAction.qml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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. //
  194. onClicked:
  195. {
  196. if (checkupMachineAction.heatupHotendStarted)
  197. {
  198. manager.cooldownHotend()
  199. checkupMachineAction.heatupHotendStarted = false
  200. } else
  201. {
  202. manager.heatupHotend()
  203. checkupMachineAction.heatupHotendStarted = true
  204. }
  205. }
  206. }
  207. }
  208. Label
  209. {
  210. id: nozzleTemp
  211. anchors.top: nozzleTempLabel.top
  212. anchors.left: nozzleTempButton.right
  213. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  214. width: checkupMachineAction.rightRow * 0.2
  215. wrapMode: Text.WordWrap
  216. text: manager.hotendTemperature + "°C"
  217. font.bold: true
  218. visible: checkupMachineAction.usbConnected
  219. }
  220. /////////////////////////////////////////////////////////////////////////////
  221. Label
  222. {
  223. id: bedTempLabel
  224. width: checkupMachineAction.leftRow
  225. height: bedTempButton.height
  226. anchors.left: parent.left
  227. anchors.top: nozzleTempLabel.bottom
  228. wrapMode: Text.WordWrap
  229. text: catalog.i18nc("@label","Bed temperature check:")
  230. visible: checkupMachineAction.usbConnected && manager.hasHeatedBed
  231. }
  232. Label
  233. {
  234. id: bedTempStatus
  235. width: checkupMachineAction.rightRow * 0.4
  236. anchors.top: bedTempLabel.top
  237. anchors.left: bedTempLabel.right
  238. wrapMode: Text.WordWrap
  239. text: manager.bedTestCompleted ? catalog.i18nc("@info:status","Not checked"): catalog.i18nc("@info:status","Checked")
  240. visible: checkupMachineAction.usbConnected && manager.hasHeatedBed
  241. }
  242. Item
  243. {
  244. id: bedTempButton
  245. width: checkupMachineAction.rightRow * 0.3
  246. height: childrenRect.height
  247. anchors.top: bedTempLabel.top
  248. anchors.left: bedTempStatus.right
  249. anchors.leftMargin: UM.Theme.getSize("default_margin").width/2
  250. visible: checkupMachineAction.usbConnected && manager.hasHeatedBed
  251. Button
  252. {
  253. text: checkupMachineAction.heatupBedStarted ?catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating")
  254. onClicked:
  255. {
  256. if (checkupMachineAction.heatupBedStarted)
  257. {
  258. manager.cooldownBed()
  259. checkupMachineAction.heatupBedStarted = false
  260. } else
  261. {
  262. manager.heatupBed()
  263. checkupMachineAction.heatupBedStarted = true
  264. }
  265. }
  266. }
  267. }
  268. Label
  269. {
  270. id: bedTemp
  271. width: checkupMachineAction.rightRow * 0.2
  272. anchors.top: bedTempLabel.top
  273. anchors.left: bedTempButton.right
  274. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  275. wrapMode: Text.WordWrap
  276. text: manager.bedTemperature + "°C"
  277. font.bold: true
  278. visible: checkupMachineAction.usbConnected && manager.hasHeatedBed
  279. }
  280. Label
  281. {
  282. id: resultText
  283. visible: false
  284. anchors.top: bedTemp.bottom
  285. anchors.topMargin: UM.Theme.getSize("default_margin").height
  286. anchors.left: parent.left
  287. width: parent.width
  288. wrapMode: Text.WordWrap
  289. text: catalog.i18nc("@label", "Everything is in order! You're done with your CheckUp.")
  290. }
  291. }
  292. }
  293. }