UM3InfoComponents.qml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. Item
  8. {
  9. id: base
  10. property bool isUM3: Cura.MachineManager.activeQualityDefinitionId == "ultimaker3"
  11. property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
  12. property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
  13. property bool authenticationRequested: printerConnected && Cura.MachineManager.printerOutputDevices[0].authenticationState == 2 // AuthState.AuthenticationRequested
  14. Row
  15. {
  16. objectName: "networkPrinterConnectButton"
  17. visible: isUM3
  18. spacing: UM.Theme.getSize("default_margin").width
  19. Button
  20. {
  21. height: UM.Theme.getSize("save_button_save_to_button").height
  22. tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer")
  23. text: catalog.i18nc("@action:button", "Request Access")
  24. style: UM.Theme.styles.sidebar_action_button
  25. onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication()
  26. visible: printerConnected && !printerAcceptsCommands && !authenticationRequested
  27. }
  28. Button
  29. {
  30. height: UM.Theme.getSize("save_button_save_to_button").height
  31. tooltip: catalog.i18nc("@info:tooltip", "Connect to a printer")
  32. text: catalog.i18nc("@action:button", "Connect")
  33. style: UM.Theme.styles.sidebar_action_button
  34. onClicked: connectActionDialog.show()
  35. visible: !printerConnected
  36. }
  37. }
  38. UM.Dialog
  39. {
  40. id: connectActionDialog
  41. Loader
  42. {
  43. anchors.fill: parent
  44. source: "DiscoverUM3Action.qml"
  45. }
  46. rightButtons: Button
  47. {
  48. text: catalog.i18nc("@action:button", "Close")
  49. iconName: "dialog-close"
  50. onClicked: connectActionDialog.reject()
  51. }
  52. }
  53. Column
  54. {
  55. objectName: "networkPrinterConnectionInfo"
  56. visible: isUM3
  57. spacing: UM.Theme.getSize("default_margin").width
  58. anchors.fill: parent
  59. Button
  60. {
  61. tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer")
  62. text: catalog.i18nc("@action:button", "Request Access")
  63. onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication()
  64. visible: printerConnected && !printerAcceptsCommands && !authenticationRequested
  65. }
  66. Row
  67. {
  68. visible: printerConnected
  69. spacing: UM.Theme.getSize("default_margin").width
  70. anchors.left: parent.left
  71. anchors.right: parent.right
  72. height: childrenRect.height
  73. Column
  74. {
  75. Repeater
  76. {
  77. model: Cura.ExtrudersModel { simpleNames: true }
  78. Label { text: model.name }
  79. }
  80. }
  81. Column
  82. {
  83. Repeater
  84. {
  85. id: nozzleColumn
  86. model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].hotendIds : null
  87. Label { text: nozzleColumn.model[index] }
  88. }
  89. }
  90. Column
  91. {
  92. Repeater
  93. {
  94. id: materialColumn
  95. model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].materialNames : null
  96. Label { text: materialColumn.model[index] }
  97. }
  98. }
  99. }
  100. Button
  101. {
  102. tooltip: catalog.i18nc("@info:tooltip", "Load the configuration of the printer into Cura")
  103. text: catalog.i18nc("@action:button", "Activate Configuration")
  104. visible: printerConnected
  105. onClicked: manager.loadConfigurationFromPrinter()
  106. }
  107. }
  108. UM.I18nCatalog{id: catalog; name:"cura"}
  109. }