MachineSettingsPrinterTab.qml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. // Copyright (c) 2019 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 2.3
  5. import QtQuick.Layouts 1.3
  6. import UM 1.3 as UM
  7. import Cura 1.1 as Cura
  8. //
  9. // This the content in the "Printer" tab in the Machine Settings dialog.
  10. //
  11. Item
  12. {
  13. id: base
  14. UM.I18nCatalog { id: catalog; name: "cura" }
  15. property int columnWidth: ((parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2) | 0
  16. property int columnSpacing: 3 * screenScaleFactor
  17. property int propertyStoreIndex: manager ? manager.storeContainerIndex : 1 // definition_changes
  18. property int labelWidth: (columnWidth * 2 / 3 - UM.Theme.getSize("default_margin").width * 2) | 0
  19. property int controlWidth: (columnWidth / 3) | 0
  20. property var labelFont: UM.Theme.getFont("default")
  21. property string machineStackId: Cura.MachineManager.activeMachine.id
  22. property var forceUpdateFunction: manager.forceUpdate
  23. RowLayout
  24. {
  25. id: upperBlock
  26. anchors
  27. {
  28. top: parent.top
  29. left: parent.left
  30. right: parent.right
  31. margins: UM.Theme.getSize("default_margin").width
  32. }
  33. spacing: UM.Theme.getSize("default_margin").width
  34. // =======================================
  35. // Left-side column for "Printer Settings"
  36. // =======================================
  37. Column
  38. {
  39. Layout.fillWidth: true
  40. Layout.alignment: Qt.AlignTop
  41. spacing: base.columnSpacing
  42. Label // Title Label
  43. {
  44. text: catalog.i18nc("@title:label", "Printer Settings")
  45. font: UM.Theme.getFont("medium_bold")
  46. color: UM.Theme.getColor("text")
  47. renderType: Text.NativeRendering
  48. width: parent.width
  49. elide: Text.ElideRight
  50. }
  51. Cura.NumericTextFieldWithUnit // "X (Width)"
  52. {
  53. id: machineXWidthField
  54. containerStackId: machineStackId
  55. settingKey: "machine_width"
  56. settingStoreIndex: propertyStoreIndex
  57. labelText: catalog.i18nc("@label", "X (Width)")
  58. labelFont: base.labelFont
  59. labelWidth: base.labelWidth
  60. controlWidth: base.controlWidth
  61. unitText: catalog.i18nc("@label", "mm")
  62. maximum: 2000000
  63. forceUpdateOnChangeFunction: forceUpdateFunction
  64. }
  65. Cura.NumericTextFieldWithUnit // "Y (Depth)"
  66. {
  67. id: machineYDepthField
  68. containerStackId: machineStackId
  69. settingKey: "machine_depth"
  70. settingStoreIndex: propertyStoreIndex
  71. labelText: catalog.i18nc("@label", "Y (Depth)")
  72. labelFont: base.labelFont
  73. labelWidth: base.labelWidth
  74. controlWidth: base.controlWidth
  75. unitText: catalog.i18nc("@label", "mm")
  76. maximum: 2000000
  77. forceUpdateOnChangeFunction: forceUpdateFunction
  78. }
  79. Cura.NumericTextFieldWithUnit // "Z (Height)"
  80. {
  81. id: machineZHeightField
  82. containerStackId: machineStackId
  83. settingKey: "machine_height"
  84. settingStoreIndex: propertyStoreIndex
  85. labelText: catalog.i18nc("@label", "Z (Height)")
  86. labelFont: base.labelFont
  87. labelWidth: base.labelWidth
  88. controlWidth: base.controlWidth
  89. unitText: catalog.i18nc("@label", "mm")
  90. forceUpdateOnChangeFunction: forceUpdateFunction
  91. }
  92. Cura.ComboBoxWithOptions // "Build plate shape"
  93. {
  94. id: buildPlateShapeComboBox
  95. containerStackId: machineStackId
  96. settingKey: "machine_shape"
  97. settingStoreIndex: propertyStoreIndex
  98. labelText: catalog.i18nc("@label", "Build plate shape")
  99. labelFont: base.labelFont
  100. labelWidth: base.labelWidth
  101. controlWidth: base.controlWidth
  102. forceUpdateOnChangeFunction: forceUpdateFunction
  103. }
  104. Cura.SimpleCheckBox // "Origin at center"
  105. {
  106. id: originAtCenterCheckBox
  107. containerStackId: machineStackId
  108. settingKey: "machine_center_is_zero"
  109. settingStoreIndex: propertyStoreIndex
  110. labelText: catalog.i18nc("@label", "Origin at center")
  111. labelFont: base.labelFont
  112. labelWidth: base.labelWidth
  113. forceUpdateOnChangeFunction: forceUpdateFunction
  114. }
  115. Cura.SimpleCheckBox // "Heated bed"
  116. {
  117. id: heatedBedCheckBox
  118. containerStackId: machineStackId
  119. settingKey: "machine_heated_bed"
  120. settingStoreIndex: propertyStoreIndex
  121. labelText: catalog.i18nc("@label", "Heated bed")
  122. labelFont: base.labelFont
  123. labelWidth: base.labelWidth
  124. forceUpdateOnChangeFunction: forceUpdateFunction
  125. }
  126. Cura.SimpleCheckBox // "Heated build volume"
  127. {
  128. id: heatedVolumeCheckBox
  129. containerStackId: machineStackId
  130. settingKey: "machine_heated_build_volume"
  131. settingStoreIndex: propertyStoreIndex
  132. labelText: catalog.i18nc("@label", "Heated build volume")
  133. labelFont: base.labelFont
  134. labelWidth: base.labelWidth
  135. forceUpdateOnChangeFunction: forceUpdateFunction
  136. }
  137. Cura.ComboBoxWithOptions // "G-code flavor"
  138. {
  139. id: gcodeFlavorComboBox
  140. containerStackId: machineStackId
  141. settingKey: "machine_gcode_flavor"
  142. settingStoreIndex: propertyStoreIndex
  143. labelText: catalog.i18nc("@label", "G-code flavor")
  144. labelFont: base.labelFont
  145. labelWidth: base.labelWidth
  146. controlWidth: base.controlWidth
  147. forceUpdateOnChangeFunction: forceUpdateFunction
  148. // FIXME(Lipu): better document this.
  149. // This has something to do with UM2 and UM2+ regarding "has_material" and the gcode flavor settings.
  150. // I don't remember exactly what.
  151. afterOnEditingFinishedFunction: manager.updateHasMaterialsMetadata
  152. }
  153. }
  154. // =======================================
  155. // Right-side column for "Printhead Settings"
  156. // =======================================
  157. Column
  158. {
  159. Layout.fillWidth: true
  160. Layout.alignment: Qt.AlignTop
  161. spacing: base.columnSpacing
  162. Label // Title Label
  163. {
  164. text: catalog.i18nc("@title:label", "Printhead Settings")
  165. font: UM.Theme.getFont("medium_bold")
  166. color: UM.Theme.getColor("text")
  167. renderType: Text.NativeRendering
  168. width: parent.width
  169. elide: Text.ElideRight
  170. }
  171. Cura.PrintHeadMinMaxTextField // "X min"
  172. {
  173. id: machineXMinField
  174. settingStoreIndex: propertyStoreIndex
  175. labelText: catalog.i18nc("@label", "X min")
  176. labelFont: base.labelFont
  177. labelWidth: base.labelWidth
  178. controlWidth: base.controlWidth
  179. unitText: catalog.i18nc("@label", "mm")
  180. axisName: "x"
  181. axisMinOrMax: "min"
  182. minimum: Number.NEGATIVE_INFINITY
  183. maximum: 0
  184. forceUpdateOnChangeFunction: forceUpdateFunction
  185. }
  186. Cura.PrintHeadMinMaxTextField // "Y min"
  187. {
  188. id: machineYMinField
  189. settingStoreIndex: propertyStoreIndex
  190. labelText: catalog.i18nc("@label", "Y min")
  191. labelFont: base.labelFont
  192. labelWidth: base.labelWidth
  193. controlWidth: base.controlWidth
  194. unitText: catalog.i18nc("@label", "mm")
  195. axisName: "y"
  196. axisMinOrMax: "min"
  197. minimum: Number.NEGATIVE_INFINITY
  198. maximum: 0
  199. forceUpdateOnChangeFunction: forceUpdateFunction
  200. }
  201. Cura.PrintHeadMinMaxTextField // "X max"
  202. {
  203. id: machineXMaxField
  204. settingStoreIndex: propertyStoreIndex
  205. labelText: catalog.i18nc("@label", "X max")
  206. labelFont: base.labelFont
  207. labelWidth: base.labelWidth
  208. controlWidth: base.controlWidth
  209. unitText: catalog.i18nc("@label", "mm")
  210. axisName: "x"
  211. axisMinOrMax: "max"
  212. forceUpdateOnChangeFunction: forceUpdateFunction
  213. }
  214. Cura.PrintHeadMinMaxTextField // "Y max"
  215. {
  216. id: machineYMaxField
  217. containerStackId: machineStackId
  218. settingKey: "machine_head_with_fans_polygon"
  219. settingStoreIndex: propertyStoreIndex
  220. labelText: catalog.i18nc("@label", "Y max")
  221. labelFont: base.labelFont
  222. labelWidth: base.labelWidth
  223. controlWidth: base.controlWidth
  224. unitText: catalog.i18nc("@label", "mm")
  225. axisName: "y"
  226. axisMinOrMax: "max"
  227. forceUpdateOnChangeFunction: forceUpdateFunction
  228. }
  229. Cura.NumericTextFieldWithUnit // "Gantry Height"
  230. {
  231. id: machineGantryHeightField
  232. containerStackId: machineStackId
  233. settingKey: "gantry_height"
  234. settingStoreIndex: propertyStoreIndex
  235. labelText: catalog.i18nc("@label", "Gantry Height")
  236. labelFont: base.labelFont
  237. labelWidth: base.labelWidth
  238. controlWidth: base.controlWidth
  239. unitText: catalog.i18nc("@label", "mm")
  240. forceUpdateOnChangeFunction: forceUpdateFunction
  241. }
  242. Cura.ComboBoxWithOptions // "Number of Extruders"
  243. {
  244. id: numberOfExtrudersComboBox
  245. containerStackId: machineStackId
  246. settingKey: "machine_extruder_count"
  247. settingStoreIndex: propertyStoreIndex
  248. labelText: catalog.i18nc("@label", "Number of Extruders")
  249. labelFont: base.labelFont
  250. labelWidth: base.labelWidth
  251. controlWidth: base.controlWidth
  252. forceUpdateOnChangeFunction: forceUpdateFunction
  253. // FIXME(Lipu): better document this.
  254. // This has something to do with UM2 and UM2+ regarding "has_material" and the gcode flavor settings.
  255. // I don't remember exactly what.
  256. afterOnEditingFinishedFunction: manager.updateHasMaterialsMetadata
  257. setValueFunction: manager.setMachineExtruderCount
  258. optionModel: ListModel
  259. {
  260. id: extruderCountModel
  261. Component.onCompleted:
  262. {
  263. update()
  264. }
  265. function update()
  266. {
  267. clear()
  268. for (var i = 1; i <= Cura.MachineManager.activeMachine.maxExtruderCount; i++)
  269. {
  270. // Use String as value. JavaScript only has Number. PropertyProvider.setPropertyValue()
  271. // takes a QVariant as value, and Number gets translated into a float. This will cause problem
  272. // for integer settings such as "Number of Extruders".
  273. append({ text: String(i), value: String(i) })
  274. }
  275. }
  276. }
  277. Connections
  278. {
  279. target: Cura.MachineManager
  280. onGlobalContainerChanged: extruderCountModel.update()
  281. }
  282. }
  283. Cura.SimpleCheckBox // "Shared Heater"
  284. {
  285. id: sharedHeaterCheckBox
  286. containerStackId: machineStackId
  287. settingKey: "machine_extruders_share_heater"
  288. settingStoreIndex: propertyStoreIndex
  289. labelText: catalog.i18nc("@label", "Shared Heater")
  290. labelFont: base.labelFont
  291. labelWidth: base.labelWidth
  292. forceUpdateOnChangeFunction: forceUpdateFunction
  293. }
  294. }
  295. }
  296. RowLayout // Start and End G-code
  297. {
  298. id: lowerBlock
  299. spacing: UM.Theme.getSize("default_margin").width
  300. anchors
  301. {
  302. top: upperBlock.bottom
  303. bottom: parent.bottom
  304. left: parent.left
  305. right: parent.right
  306. margins: UM.Theme.getSize("default_margin").width
  307. }
  308. Cura.GcodeTextArea // "Start G-code"
  309. {
  310. Layout.fillWidth: true
  311. Layout.fillHeight: true
  312. labelText: catalog.i18nc("@title:label", "Start G-code")
  313. containerStackId: machineStackId
  314. settingKey: "machine_start_gcode"
  315. settingStoreIndex: propertyStoreIndex
  316. }
  317. Cura.GcodeTextArea // "End G-code"
  318. {
  319. Layout.fillWidth: true
  320. Layout.fillHeight: true
  321. labelText: catalog.i18nc("@title:label", "End G-code")
  322. containerStackId: machineStackId
  323. settingKey: "machine_end_gcode"
  324. settingStoreIndex: propertyStoreIndex
  325. }
  326. }
  327. }