MachineSettingsPrinterTab.qml 13 KB

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