Skip to content

Commit 286520d

Browse files
authored
Merge pull request #52 from meteozond/fix-x-ray
Fix x-ray
2 parents 5f06061 + a007215 commit 286520d

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

SidebarGUIProxy.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ def getExtruderHasQualityForMaterial(self, extruder_stack: "ExtruderStack") -> b
9595

9696
return containers_metadata != []
9797

98+
@pyqtSlot(str)
99+
def setActiveView(self, view_id: str) -> None:
100+
"""Set the active view from QML."""
101+
controller = Application.getInstance().getController()
102+
if controller:
103+
Logger.log("d", f"SidebarGUI: Setting active view to {view_id}")
104+
controller.setActiveView(view_id)
105+
98106
@pyqtSlot("QVariant", result=bool)
99107
def checkRectangleOnScreen(self, rectangle):
100108
# Check if rectangle is not outside the currently available screens

resources/qml/PrepareStageLegend40.qml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Cura.ExpandableComponent
6262
return viewString.substr(0, viewString.indexOf("("));
6363
}
6464

65-
CheckBox
65+
UM.CheckBox
6666
{
6767
id: xrayViewCheckBox
6868
checked: parent.activeView == "XRayView"
@@ -71,17 +71,17 @@ Cura.ExpandableComponent
7171
{
7272
if(checked && parent.activeView != "XRayView")
7373
{
74-
UM.Controller.setActiveView("XRayView")
74+
SidebarGUIPlugin.setActiveView("XRayView")
7575
}
7676
else if(! checked && parent.activeView != "SolidView")
7777
{
78-
UM.Controller.setActiveView("SolidView")
78+
SidebarGUIPlugin.setActiveView("SolidView")
7979
}
8080
}
8181
text: catalog.i18nc("@label", "X-Ray view")
82-
style: UM.Theme.styles.checkbox
8382
width: parent.width
8483
}
84+
}
8585

8686
Label
8787
{

resources/qml/PrepareStageLegend50.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ Cura.ExpandableComponent
7070
{
7171
if(checked && parent.activeView != "XRayView")
7272
{
73-
UM.Controller.setActiveView("XRayView")
73+
SidebarGUIPlugin.setActiveView("XRayView")
7474
}
7575
else if(! checked && parent.activeView != "SolidView")
7676
{
77-
UM.Controller.setActiveView("SolidView")
77+
SidebarGUIPlugin.setActiveView("SolidView")
7878
}
7979
}
8080
text: catalog.i18nc("@label", "X-Ray view")

0 commit comments

Comments
 (0)