Skip to content

Commit 8183dc7

Browse files
committed
Fix compatibility with Cura 5.1
1 parent 0dcf141 commit 8183dc7

7 files changed

Lines changed: 230 additions & 9 deletions

File tree

__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def register(app):
2727

2828
def __matchVersion():
2929
cura_version = Application.getInstance().getVersion()
30-
if cura_version == "master":
30+
if cura_version == "master" or cura_version == "dev":
3131
Logger.log("d", "Running Cura from source; skipping version check")
3232
return True
3333
if cura_version.startswith("Arachne_engine"):

plugin.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
"author": "fieldOfView",
44
"version": "4.3.1-DEV",
55
"minimum_cura_version": "4.0",
6-
"maximum_cura_version": "5.0",
6+
"maximum_cura_version": "5.1",
77
"description": "Provides an alternative, setting-centric interface based around a fixed sidebar",
88
"api": "6.0.0",
99
"supported_sdk_versions": [
10-
"6.0.0", "6.1.0", "6.2.0", "6.3.0", "7.0.0", "7.1.0", "7.2.0", "7.3.0", "7.4.0", "7.5.0", "7.6.0", "7.7.0", "7.8.0", "7.9.0", "8.0.0"
10+
"6.0.0", "6.1.0", "6.2.0", "6.3.0",
11+
"7.0.0", "7.1.0", "7.2.0", "7.3.0", "7.4.0", "7.5.0", "7.6.0", "7.7.0", "7.8.0", "7.9.0",
12+
"8.0.0", "8.1.0"
1113
],
1214
"i18n-catalog": "cura"
1315
}

resources/qml/MonitorStageMenu.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Item
2626
isLE44 = (CuraSDKVersion <= "7.0.0")
2727
isLE46 = (CuraSDKVersion <= "7.2.0")
2828
isLE410 = (CuraSDKVersion <= "7.6.0")
29-
isLE413 = (CuraSDKVersion <= "7.9.0") && UM.Application.version != "master"
29+
isLE413 = (CuraSDKVersion <= "7.9.0") && UM.Application.version != "master" && UM.Application.version != "dev"
3030

3131
// adjust message stack position for sidebar
3232
var messageStack

resources/qml/PrintSetupSummary.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Cura.RoundedRectangle
9292
source:
9393
{
9494
var isLE410 = (CuraSDKVersion <= "7.6.0")
95-
var isLE413 = (CuraSDKVersion <= "7.9.0") && UM.Application.version != "master"
95+
var isLE413 = (CuraSDKVersion <= "7.9.0") && UM.Application.version != "master" && UM.Application.version != "dev"
9696
if(isLE410) {
9797
return "ExtruderTabs40.qml";
9898
} else if (isLE413) {
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
// Copyright (c) 2022 Aldo Hoeben / fieldOfView
2+
// SidebarGUIPlugin is released under the terms of the AGPLv3 or higher.
3+
4+
import QtQuick 2.10
5+
import QtQuick.Controls 2.3
6+
import QtQuick.Layouts 1.3
7+
8+
import UM 1.3 as UM
9+
import Cura 1.1 as Cura
10+
11+
Item
12+
{
13+
width: parent.width
14+
height: UM.Theme.getSize("setting_control").height + UM.Theme.getSize("default_margin").height
15+
16+
anchors
17+
{
18+
top: parent.top
19+
left: parent.left
20+
leftMargin: parent.padding
21+
right: parent.right
22+
rightMargin: parent.padding
23+
}
24+
25+
Button
26+
{
27+
id: intentSelection
28+
onClicked: menu.opened ? menu.close() : menu.open()
29+
30+
anchors.left: parent.left
31+
anchors.leftMargin: UM.Theme.getSize("narrow_margin").width + UM.Theme.getSize("default_margin").width
32+
anchors.right: modeToggleSwitch.left
33+
anchors.rightMargin: UM.Theme.getSize("default_margin").width
34+
height: textLabel.contentHeight + 2 * UM.Theme.getSize("narrow_margin").height
35+
hoverEnabled: true
36+
visible: printSetupSelector.contentItem.currentModeIndex == Cura.PrintSetupSelectorContents.Mode.Custom
37+
38+
baselineOffset: 0 // If we don't do this, there is a binding loop. WHich is a bit weird, since we override the contentItem anyway...
39+
40+
contentItem: RowLayout
41+
{
42+
spacing: 0
43+
anchors.left: parent.left
44+
anchors.right: customisedSettings.left
45+
anchors.leftMargin: UM.Theme.getSize("default_margin").width
46+
47+
Label
48+
{
49+
id: textLabel
50+
text: Cura.MachineManager.activeQualityDisplayNameMap["main"]
51+
font: UM.Theme.getFont("default")
52+
color: UM.Theme.getColor("text")
53+
Layout.margins: 0
54+
Layout.maximumWidth: Math.floor(parent.width * 0.7) // Always leave >= 30% for the rest of the row.
55+
height: contentHeight
56+
verticalAlignment: Text.AlignVCenter
57+
renderType: Text.NativeRendering
58+
elide: Text.ElideRight
59+
}
60+
61+
Label
62+
{
63+
text: activeQualityDetailText()
64+
font: UM.Theme.getFont("default")
65+
color: UM.Theme.getColor("text_detail")
66+
Layout.margins: 0
67+
Layout.fillWidth: true
68+
69+
height: contentHeight
70+
verticalAlignment: Text.AlignVCenter
71+
renderType: Text.NativeRendering
72+
elide: Text.ElideRight
73+
74+
function activeQualityDetailText()
75+
{
76+
var resultMap = Cura.MachineManager.activeQualityDisplayNameMap
77+
var resultSuffix = resultMap["suffix"]
78+
var result = ""
79+
80+
if (Cura.MachineManager.isActiveQualityExperimental)
81+
{
82+
resultSuffix += " (Experimental)"
83+
}
84+
85+
if (Cura.MachineManager.isActiveQualitySupported)
86+
{
87+
if (Cura.MachineManager.activeQualityLayerHeight > 0)
88+
{
89+
if (resultSuffix)
90+
{
91+
result += " - " + resultSuffix
92+
}
93+
result += " - "
94+
result += Cura.MachineManager.activeQualityLayerHeight + "mm"
95+
}
96+
}
97+
98+
return result
99+
}
100+
}
101+
}
102+
103+
background: Rectangle
104+
{
105+
id: backgroundItem
106+
border.color: intentSelection.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
107+
border.width: UM.Theme.getSize("default_lining").width
108+
radius: UM.Theme.getSize("default_radius").width
109+
color: UM.Theme.getColor("main_background")
110+
}
111+
112+
UM.SimpleButton
113+
{
114+
id: customisedSettings
115+
116+
visible: Cura.MachineManager.hasUserSettings
117+
width: UM.Theme.getSize("print_setup_icon").width
118+
height: UM.Theme.getSize("print_setup_icon").height
119+
120+
anchors.verticalCenter: parent.verticalCenter
121+
anchors.right: downArrow.left
122+
anchors.rightMargin: UM.Theme.getSize("default_margin").width
123+
124+
color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button");
125+
iconSource: UM.Theme.getIcon("StarFilled")
126+
127+
onClicked:
128+
{
129+
forceActiveFocus();
130+
Cura.Actions.manageProfiles.trigger()
131+
}
132+
onEntered:
133+
{
134+
var content = catalog.i18nc("@tooltip", "Some setting/override values are different from the values stored in the profile.\n\nClick to open the profile manager.")
135+
base.showTooltip(intent, Qt.point(-UM.Theme.getSize("default_margin").width, 0), content)
136+
}
137+
onExited: base.hideTooltip()
138+
}
139+
UM.ColorImage
140+
{
141+
id: downArrow
142+
143+
source: UM.Theme.getIcon("ChevronSingleDown")
144+
width: UM.Theme.getSize("standard_arrow").width
145+
height: UM.Theme.getSize("standard_arrow").height
146+
147+
anchors
148+
{
149+
right: parent.right
150+
verticalCenter: parent.verticalCenter
151+
rightMargin: UM.Theme.getSize("default_margin").width
152+
}
153+
154+
color: UM.Theme.getColor("setting_control_button")
155+
}
156+
}
157+
158+
Cura.QualitiesWithIntentMenu
159+
{
160+
id: menu
161+
y: intentSelection.y + intentSelection.height
162+
x: intentSelection.x
163+
width: intentSelection.width
164+
}
165+
166+
ModeToggleSwitch
167+
{
168+
id: modeToggleSwitch
169+
anchors.right: dockButton.left
170+
anchors.rightMargin: UM.Theme.getSize("default_margin").width
171+
}
172+
173+
UM.SimpleButton
174+
{
175+
id: dockButton
176+
anchors
177+
{
178+
verticalCenter: modeToggleSwitch.verticalCenter
179+
180+
right: collapseButton.left
181+
rightMargin: UM.Theme.getSize("thin_margin").width
182+
}
183+
iconSource: Qt.resolvedUrl(settingsDocked ? "../icons/settings_undock.svg" : "../icons/settings_dock.svg")
184+
width: UM.Theme.getSize("default_arrow").width + 2 * UM.Theme.getSize("default_lining").width
185+
height: width
186+
color: UM.Theme.getColor("small_button_text")
187+
188+
onClicked:
189+
{
190+
UM.Preferences.setValue("sidebargui/docked_sidebar", !UM.Preferences.getValue("sidebargui/docked_sidebar"))
191+
stageMenu.settingsDocked = UM.Preferences.getValue("sidebargui/docked_sidebar")
192+
}
193+
}
194+
195+
UM.SimpleButton
196+
{
197+
id: collapseButton
198+
anchors
199+
{
200+
verticalCenter: modeToggleSwitch.verticalCenter
201+
202+
right: parent.right
203+
rightMargin: UM.Theme.getSize("default_margin").width
204+
}
205+
iconSource: UM.Theme.getIcon("Cancel")
206+
width: UM.Theme.getSize("default_arrow").width + 2 * UM.Theme.getSize("default_lining").width
207+
height: width
208+
color: UM.Theme.getColor("small_button_text")
209+
210+
onClicked:
211+
{
212+
UM.Preferences.setValue("view/settings_visible", false)
213+
stageMenu.settingsVisible = false
214+
}
215+
}
216+
}

resources/qml/SidebarContents.qml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ Cura.RoundedRectangle
3434
source:
3535
{
3636
var isGE44 = (CuraSDKVersion >= "7.0.0");
37-
var isGE50 = (CuraSDKVersion >= "8.0.0") || UM.Application.version == "master";
38-
if(isGE50) {
37+
var isGE50 = (CuraSDKVersion >= "8.0.0");
38+
var isGE51 = (CuraSDKVersion >= "8.1.0") || UM.Application.version == "master" || UM.Application.version == "dev";
39+
if (isGE51) {
40+
return "ProfileSelector51.qml";
41+
} else if(isGE50) {
3942
return "ProfileSelector50.qml";
4043
} else if(isGE44) {
4144
return "ProfileSelector44.qml";
@@ -84,7 +87,7 @@ Cura.RoundedRectangle
8487
source:
8588
{
8689
var isLE410 = (CuraSDKVersion <= "7.6.0")
87-
var isLE413 = (CuraSDKVersion <= "7.9.0") && UM.Application.version != "master"
90+
var isLE413 = (CuraSDKVersion <= "7.9.0") && UM.Application.version != "master" && UM.Application.version != "dev"
8891
if(isLE410) {
8992
return "ExtruderTabs40.qml";
9093
} else if (isLE413) {

resources/qml/SidebarStageMenu.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Item
3232
isLE44 = (CuraSDKVersion <= "7.0.0")
3333
isLE46 = (CuraSDKVersion <= "7.2.0")
3434
isLE410 = (CuraSDKVersion <= "7.6.0")
35-
isLE413 = (CuraSDKVersion <= "7.9.0") && UM.Application.version != "master"
35+
isLE413 = (CuraSDKVersion <= "7.9.0") && UM.Application.version != "master" && UM.Application.version != "dev"
3636
if(is40)
3737
{
3838
CuraApplication.log("SidebarGUIPlugin patching interface for Cura 4.0")

0 commit comments

Comments
 (0)