UM3InfoComponents.qml 4.2 KB

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