MachineSettingsExtruderTab.qml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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.5 as UM
  6. import Cura 1.1 as Cura
  7. //
  8. // This component contains the content for the "Welcome" page of the welcome on-boarding process.
  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: 210 * 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 extruderStackId: ""
  24. property int extruderPosition: 0
  25. property var forceUpdateFunction: manager.forceUpdate
  26. function updateMaterialDiameter()
  27. {
  28. manager.updateMaterialForDiameter(extruderPosition)
  29. }
  30. Item
  31. {
  32. id: upperBlock
  33. anchors.top: parent.top
  34. anchors.left: parent.left
  35. anchors.right: parent.right
  36. anchors.margins: UM.Theme.getSize("default_margin").width
  37. height: childrenRect.height
  38. // =======================================
  39. // Left-side column "Nozzle Settings"
  40. // =======================================
  41. Column
  42. {
  43. anchors.top: parent.top
  44. anchors.left: parent.left
  45. width: parent.width / 2
  46. spacing: base.columnSpacing
  47. UM.Label // Title Label
  48. {
  49. text: catalog.i18nc("@title:label", "Nozzle Settings")
  50. font: UM.Theme.getFont("medium_bold")
  51. }
  52. Cura.NumericTextFieldWithUnit // "Nozzle size"
  53. {
  54. id: extruderNozzleSizeField
  55. visible: !Cura.MachineManager.activeMachine.hasVariants
  56. containerStackId: base.extruderStackId
  57. settingKey: "machine_nozzle_size"
  58. settingStoreIndex: propertyStoreIndex
  59. labelText: catalog.i18nc("@label", "Nozzle size")
  60. labelFont: base.labelFont
  61. labelWidth: base.labelWidth
  62. controlWidth: base.controlWidth
  63. unitText: catalog.i18nc("@label", "mm")
  64. forceUpdateOnChangeFunction: forceUpdateFunction
  65. }
  66. Cura.NumericTextFieldWithUnit // "Compatible material diameter"
  67. {
  68. id: extruderCompatibleMaterialDiameterField
  69. containerStackId: base.extruderStackId
  70. settingKey: "material_diameter"
  71. settingStoreIndex: propertyStoreIndex
  72. labelText: catalog.i18nc("@label", "Compatible material diameter")
  73. labelFont: base.labelFont
  74. labelWidth: base.labelWidth
  75. controlWidth: base.controlWidth
  76. unitText: catalog.i18nc("@label", "mm")
  77. forceUpdateOnChangeFunction: forceUpdateFunction
  78. // Other modules won't automatically respond after the user changes the value, so we need to force it.
  79. afterOnEditingFinishedFunction: updateMaterialDiameter
  80. }
  81. Cura.NumericTextFieldWithUnit // "Nozzle offset X"
  82. {
  83. id: extruderNozzleOffsetXField
  84. containerStackId: base.extruderStackId
  85. settingKey: "machine_nozzle_offset_x"
  86. settingStoreIndex: propertyStoreIndex
  87. labelText: catalog.i18nc("@label", "Nozzle offset X")
  88. labelFont: base.labelFont
  89. labelWidth: base.labelWidth
  90. controlWidth: base.controlWidth
  91. unitText: catalog.i18nc("@label", "mm")
  92. minimum: Number.NEGATIVE_INFINITY
  93. forceUpdateOnChangeFunction: forceUpdateFunction
  94. }
  95. Cura.NumericTextFieldWithUnit // "Nozzle offset Y"
  96. {
  97. id: extruderNozzleOffsetYField
  98. containerStackId: base.extruderStackId
  99. settingKey: "machine_nozzle_offset_y"
  100. settingStoreIndex: propertyStoreIndex
  101. labelText: catalog.i18nc("@label", "Nozzle offset Y")
  102. labelFont: base.labelFont
  103. labelWidth: base.labelWidth
  104. controlWidth: base.controlWidth
  105. unitText: catalog.i18nc("@label", "mm")
  106. minimum: Number.NEGATIVE_INFINITY
  107. forceUpdateOnChangeFunction: forceUpdateFunction
  108. }
  109. Cura.NumericTextFieldWithUnit // "Cooling Fan Number"
  110. {
  111. id: extruderNozzleCoolingFanNumberField
  112. containerStackId: base.extruderStackId
  113. settingKey: "machine_extruder_cooling_fan_number"
  114. settingStoreIndex: propertyStoreIndex
  115. labelText: catalog.i18nc("@label", "Cooling Fan Number")
  116. labelFont: base.labelFont
  117. labelWidth: base.labelWidth
  118. controlWidth: base.controlWidth
  119. unitText: ""
  120. decimals: 0
  121. forceUpdateOnChangeFunction: forceUpdateFunction
  122. }
  123. }
  124. // =======================================
  125. // Right-side column "Nozzle Settings"
  126. // =======================================
  127. Column
  128. {
  129. anchors.top: parent.top
  130. anchors.right: parent.right
  131. width: parent.width / 2
  132. spacing: base.columnSpacing
  133. UM.Label // Title Label
  134. {
  135. text: catalog.i18nc("@title:label", " ")
  136. font: UM.Theme.getFont("medium_bold")
  137. }
  138. Cura.NumericTextFieldWithUnit
  139. {
  140. id: extruderChangeDurationFieldId
  141. containerStackId: base.extruderStackId
  142. settingKey: "machine_extruder_change_duration"
  143. settingStoreIndex: propertyStoreIndex
  144. labelText: catalog.i18nc("@label", "Extruder Change duration")
  145. labelFont: base.labelFont
  146. labelWidth: base.labelWidth
  147. controlWidth: base.controlWidth
  148. unitText: catalog.i18nc("@label", "s")
  149. forceUpdateOnChangeFunction: forceUpdateFunction
  150. }
  151. Cura.NumericTextFieldWithUnit
  152. {
  153. id: extruderStartCodeDurationFieldId
  154. containerStackId: base.extruderStackId
  155. settingKey: "machine_extruder_start_code_duration"
  156. settingStoreIndex: propertyStoreIndex
  157. labelText: catalog.i18nc("@label", "Extruder Start G-code duration")
  158. labelFont: base.labelFont
  159. labelWidth: base.labelWidth
  160. controlWidth: base.controlWidth
  161. unitText: catalog.i18nc("@label", "s")
  162. forceUpdateOnChangeFunction: forceUpdateFunction
  163. }
  164. Cura.NumericTextFieldWithUnit
  165. {
  166. id: extruderEndCodeDurationFieldId
  167. containerStackId: base.extruderStackId
  168. settingKey: "machine_extruder_end_code_duration"
  169. settingStoreIndex: propertyStoreIndex
  170. labelText: catalog.i18nc("@label", "Extruder End G-code duration")
  171. labelFont: base.labelFont
  172. labelWidth: base.labelWidth
  173. controlWidth: base.controlWidth
  174. unitText: catalog.i18nc("@label", "s")
  175. forceUpdateOnChangeFunction: forceUpdateFunction
  176. }
  177. }
  178. }
  179. Item // Extruder Start and End G-code
  180. {
  181. id: lowerBlock
  182. anchors.top: upperBlock.bottom
  183. anchors.bottom: parent.bottom
  184. anchors.left: parent.left
  185. anchors.right: parent.right
  186. anchors.margins: UM.Theme.getSize("default_margin").width
  187. Column
  188. {
  189. anchors.top: parent.top
  190. anchors.left: parent.left
  191. anchors.bottom: buttonLearnMore.top
  192. anchors.bottomMargin: UM.Theme.getSize("default_margin").height
  193. width: parent.width / 2
  194. spacing: base.columnSpacing
  195. Cura.GcodeTextArea // "Extruder Prestart G-code"
  196. {
  197. anchors.top: parent.top
  198. anchors.left: parent.left
  199. height: (parent.height / 2) - UM.Theme.getSize("default_margin").height
  200. width: base.columnWidth - UM.Theme.getSize("default_margin").width
  201. labelText: catalog.i18nc("@title:label", "Extruder Prestart G-code")
  202. containerStackId: base.extruderStackId
  203. settingKey: "machine_extruder_prestart_code"
  204. settingStoreIndex: propertyStoreIndex
  205. }
  206. Cura.GcodeTextArea // "Extruder Start G-code"
  207. {
  208. anchors.bottom: parent.bottom
  209. anchors.left: parent.left
  210. height: (parent.height / 2) - UM.Theme.getSize("default_margin").height
  211. width: base.columnWidth - UM.Theme.getSize("default_margin").width
  212. labelText: catalog.i18nc("@title:label", "Extruder Start G-code")
  213. containerStackId: base.extruderStackId
  214. settingKey: "machine_extruder_start_code"
  215. settingStoreIndex: propertyStoreIndex
  216. }
  217. }
  218. Cura.GcodeTextArea // "Extruder End G-code"
  219. {
  220. anchors.top: parent.top
  221. anchors.bottom: buttonLearnMore.top
  222. anchors.bottomMargin: UM.Theme.getSize("default_margin").height
  223. anchors.right: parent.right
  224. width: base.columnWidth - UM.Theme.getSize("default_margin").width
  225. labelText: catalog.i18nc("@title:label", "Extruder End G-code")
  226. containerStackId: base.extruderStackId
  227. settingKey: "machine_extruder_end_code"
  228. settingStoreIndex: propertyStoreIndex
  229. }
  230. Cura.TertiaryButton
  231. {
  232. id: buttonLearnMore
  233. text: catalog.i18nc("@button", "Learn more")
  234. iconSource: UM.Theme.getIcon("LinkExternal")
  235. isIconOnRightSide: true
  236. onClicked: Qt.openUrlExternally("https://github.com/Ultimaker/Cura/wiki/Start-End-G%E2%80%90Code")
  237. anchors.bottom: parent.bottom
  238. anchors.right: parent.right
  239. }
  240. }
  241. }