UM3InfoComponents.qml 4.5 KB

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