Skip to content

Commit bdaa9c5

Browse files
committed
prep for QT 6 with next major Cura release
1 parent 30c3c38 commit bdaa9c5

File tree

4 files changed

+114
-80
lines changed

4 files changed

+114
-80
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog of Cura-DuetRRFPlugin
22

3+
## unreleased
4+
* upgrade to QtControls 2, because Cura will upgrade to Qt 6 which removes QtControls 1.
5+
36
## v1.2.5: 2022-02-11
47
* bump compatibility for Cura 4.13 / API 7.9, oldest supported release is now 4.11 / 7.7
58
* embed QOI thumbnail images of the sliced scene into the uploaded gcode file

DuetRRFOutputDevice.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def requestWrite(self, node, fileName=None, *args, **kwargs):
177177
self._dialog.accepted.connect(self._onFilenameAccepted)
178178
self._dialog.show()
179179
self._dialog.findChild(QObject, "nameField").setProperty('text', self._fileName)
180-
self._dialog.findChild(QObject, "nameField").select(0, len(self._fileName) - 6)
180+
self._dialog.findChild(QObject, "nameField").select(0, len(self._fileName) - len(".gcode"))
181181
self._dialog.findChild(QObject, "nameField").setProperty('focus', True)
182182

183183
def _onFilenameChanged(self):

resources/qml/DuetRRFAction.qml

+68-57
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import QtQuick 2.2
2-
import QtQuick.Controls 1.1
3-
import QtQuick.Layouts 1.1
4-
import QtQuick.Window 2.1
1+
import QtQuick 2.10
2+
import QtQuick.Controls 2.3
3+
import QtQuick.Layouts 1.2
4+
import QtQuick.Window 2.2
55

6-
import UM 1.2 as UM
7-
import Cura 1.0 as Cura
6+
import UM 1.5 as UM
7+
import Cura 1.1 as Cura
88

99

1010
Cura.MachineAction
@@ -32,81 +32,92 @@ Cura.MachineAction
3232
}
3333

3434
Column {
35-
anchors.fill: parent;
35+
anchors.fill: parent
3636

3737
Item { width: parent.width; }
38-
Label { text: catalog.i18nc("@label", "Duet Address (URL)"); }
38+
UM.Label {
39+
text: catalog.i18nc("@label", "Duet Address (URL)")
40+
}
3941
TextField {
40-
id: urlField;
41-
text: manager.printerSettingUrl;
42-
maximumLength: 1024;
43-
anchors.left: parent.left;
44-
anchors.right: parent.right;
42+
id: urlField
43+
text: manager.printerSettingUrl
44+
selectByMouse: true
45+
maximumLength: 1024
46+
anchors.left: parent.left
47+
anchors.right: parent.right
4548
onTextChanged: {
46-
base.validUrl = manager.validUrl(urlField.text);
49+
base.validUrl = manager.validUrl(urlField.text)
4750
}
4851
}
4952

5053
Item { width: parent.width; }
51-
Label { text: catalog.i18nc("@label", "Duet Password (if you used M551)"); }
54+
UM.Label {
55+
text: catalog.i18nc("@label", "Duet Password (if you used M551)")
56+
}
5257
TextField {
53-
id: duet_passwordField;
54-
text: manager.printerSettingDuetPassword;
55-
maximumLength: 1024;
56-
anchors.left: parent.left;
57-
anchors.right: parent.right;
58+
id: duet_passwordField
59+
text: manager.printerSettingDuetPassword
60+
selectByMouse: true
61+
maximumLength: 1024
62+
anchors.left: parent.left
63+
anchors.right: parent.right
5864
}
5965

6066
Item { width: parent.width; }
61-
Label { text: catalog.i18nc("@label", "HTTP Basic Auth: user (if you run a reverse proxy)"); }
67+
UM.Label {
68+
text: catalog.i18nc("@label", "HTTP Basic Auth: user (if you run a reverse proxy)")
69+
}
6270
TextField {
63-
id: http_userField;
64-
text: manager.printerSettingHTTPUser;
65-
maximumLength: 1024;
66-
anchors.left: parent.left;
67-
anchors.right: parent.right;
71+
id: http_userField
72+
text: manager.printerSettingHTTPUser
73+
selectByMouse: true
74+
maximumLength: 1024
75+
anchors.left: parent.left
76+
anchors.right: parent.right
6877
}
6978

7079
Item { width: parent.width; }
71-
Label { text: catalog.i18nc("@label", "HTTP Basic Auth: password (if you run a reverse proxy)"); }
80+
UM.Label {
81+
text: catalog.i18nc("@label", "HTTP Basic Auth: password (if you run a reverse proxy)")
82+
}
7283
TextField {
73-
id: http_passwordField;
74-
text: manager.printerSettingHTTPPassword;
75-
maximumLength: 1024;
76-
anchors.left: parent.left;
77-
anchors.right: parent.right;
84+
id: http_passwordField
85+
text: manager.printerSettingHTTPPassword
86+
selectByMouse: true
87+
maximumLength: 1024
88+
anchors.left: parent.left
89+
anchors.right: parent.right
7890
}
7991

8092
Item { width: parent.width; }
81-
Label {
82-
visible: !base.validUrl;
83-
text: catalog.i18nc("@error", "URL not valid. Example: http://192.168.1.42/");
84-
color: "red";
93+
UM.Label {
94+
visible: !base.validUrl
95+
text: catalog.i18nc("@error", "URL not valid. Example: http://192.168.1.42/")
96+
color: "red"
8597
}
8698

87-
Item {
88-
width: saveButton.implicitWidth
89-
height: saveButton.implicitHeight
90-
}
91-
92-
Button {
93-
id: saveButton;
94-
text: catalog.i18nc("@action:button", "Save Config");
95-
width: screenScaleFactor * 100;
96-
onClicked: {
97-
manager.saveConfig(urlField.text, duet_passwordField.text, http_userField.text, http_passwordField.text);
98-
actionDialog.reject();
99+
Row {
100+
anchors.horizontalCenter: parent.horizontalCenter
101+
width: childrenRect.width
102+
spacing: UM.Theme.getSize("default_margin").width
103+
104+
Cura.PrimaryButton {
105+
id: saveButton
106+
text: catalog.i18nc("@action:button", "Save Config")
107+
onClicked: {
108+
manager.saveConfig(urlField.text, duet_passwordField.text, http_userField.text, http_passwordField.text)
109+
actionDialog.reject()
110+
}
111+
enabled: base.validUrl
99112
}
100-
enabled: base.validUrl;
101-
}
102113

103-
Button {
104-
id: deleteButton;
105-
text: catalog.i18nc("@action:button", "Delete Config");
106-
width: screenScaleFactor * 100;
107-
onClicked: {
108-
manager.deleteConfig();
109-
actionDialog.reject();
114+
Cura.SecondaryButton {
115+
id: deleteButton
116+
text: catalog.i18nc("@action:button", "Delete config")
117+
onClicked: {
118+
manager.deleteConfig()
119+
actionDialog.reject()
120+
}
110121
}
111122
}
112123
}

resources/qml/UploadFilename.qml

+42-22
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import QtQuick 2.1
2-
import QtQuick.Controls 1.1
1+
import QtQuick 2.10
2+
import QtQuick.Controls 2.1
33
import QtQuick.Dialogs 1.2
4-
import QtQuick.Window 2.1
4+
import QtQuick.Window 2.2
55

6-
import UM 1.1 as UM
6+
import UM 1.5 as UM
7+
import Cura 1.1 as Cura
78

89
UM.Dialog
910
{
@@ -29,37 +30,56 @@ UM.Dialog
2930
nameField.focus = true;
3031
}
3132

33+
margin: UM.Theme.getSize("default_margin").width
34+
buttonSpacing: UM.Theme.getSize("default_margin").width
35+
3236
Column {
3337
anchors.fill: parent;
3438

39+
UM.Label {
40+
text: "Enter the filename for uploading, use forward slashes (/) as directory separator if needed:"
41+
width: parent.width
42+
wrapMode: Text.WordWrap
43+
}
44+
3545
TextField {
36-
objectName: "nameField";
37-
id: nameField;
38-
width: parent.width;
39-
text: base.object;
40-
maximumLength: 100;
41-
onTextChanged: base.textChanged(text);
46+
objectName: "nameField"
47+
id: nameField
48+
width: parent.width
49+
text: base.object
50+
maximumLength: 100
51+
selectByMouse: true
52+
onTextChanged: base.textChanged(text)
4253
Keys.onReturnPressed: { if (base.validName) base.accept(); }
4354
Keys.onEnterPressed: { if (base.validName) base.accept(); }
44-
Keys.onEscapePressed: base.reject();
55+
Keys.onEscapePressed: base.reject()
4556
}
4657

47-
Label {
48-
visible: !base.validName;
49-
text: base.validationError;
58+
UM.Label {
59+
visible: !base.validName
60+
text: base.validationError
61+
}
62+
}
63+
64+
Item
65+
{
66+
ButtonGroup {
67+
buttons: [cancelButton, okButton]
68+
checkedButton: okButton
5069
}
5170
}
5271

5372
rightButtons: [
54-
Button {
55-
text: catalog.i18nc("@action:button", "Cancel");
56-
onClicked: base.reject();
73+
Cura.PrimaryButton {
74+
id: okButton
75+
text: catalog.i18nc("@action:button", "OK")
76+
onClicked: base.accept()
77+
enabled: base.validName
5778
},
58-
Button {
59-
text: catalog.i18nc("@action:button", "OK");
60-
onClicked: base.accept();
61-
enabled: base.validName;
62-
isDefault: true;
79+
Cura.SecondaryButton {
80+
id: cancelButton
81+
text: catalog.i18nc("@action:button", "Cancel")
82+
onClicked: base.reject()
6383
}
6484
]
6585
}

0 commit comments

Comments
 (0)