MachineSettingsPrinterTab.qml 13 KB

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