Skip to content

Commit afb8fd1

Browse files
committed
Experimental support for Smart Slice plugin
1 parent 8765751 commit afb8fd1

2 files changed

Lines changed: 27 additions & 7 deletions

File tree

SidebarGUIPlugin.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class SidebarGUIPlugin(Extension):
1717

1818
def __init__(self):
1919
super().__init__()
20-
2120
self._prepare_stage_view_id = "SolidView" # can be "SolidView" or "XRayView"
2221

2322
Application.getInstance().pluginsLoaded.connect(self._onPluginsLoaded)
@@ -58,6 +57,12 @@ def _onEngineCreated(self):
5857
preview_stage.addDisplayComponent("menu", sidebar_component_path)
5958
preview_stage.addDisplayComponent("main", main_component_path)
6059

60+
# SmartSlicePlugin stage is provided by the SmartSlicePlugin plugin
61+
if "SmartSlicePlugin" in self._controller.getAllStages():
62+
smartslice_stage = self._controller.getStage("SmartSlicePlugin")
63+
smartslice_stage.addDisplayComponent("menu", sidebar_component_path)
64+
smartslice_stage.addDisplayComponent("main", main_component_path)
65+
6166
monitor_stage = self._controller.getStage("MonitorStage")
6267
monitor_stage.addDisplayComponent("menu", monitor_menu_component_path)
6368

@@ -79,13 +84,15 @@ def _onViewChanged(self):
7984
active_stage_id = self._controller.getActiveStage().getPluginId()
8085
active_view_id = self._controller.getActiveView().getPluginId()
8186

87+
if active_stage_id == "SmartSlicePlugin": # SmartSlicePlugin view is provided by the SmartSlicePlugin plugin
88+
return
89+
8290
if active_stage_id == "PrepareStage":
8391
if active_view_id not in ["SolidView", "XRayView"]:
8492
self._controller.setActiveView("SolidView")
8593
return
8694
self._prepare_stage_view_id = active_view_id
87-
88-
if active_stage_id == "MonitorStage":
95+
elif active_stage_id == "MonitorStage":
8996
return
9097

9198
if active_view_id in ["SimulationView", "FastView"]: # FastView is provided by the RAWMouse plugin

resources/qml/PrepareStageLegend.qml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,21 @@ Cura.ExpandableComponent
3939
onActiveViewChanged:
4040
{
4141
xrayViewCheckBox.checked = (activeView == "XRayView")
42-
xrayViewCheckBox.visible = (activeView != "FastView")
43-
fastViewLabel.visible = (activeView == "FastView")
42+
xrayViewCheckBox.visible = (activeView != "FastView" && activeView != "SmartSliceView")
43+
switch(activeView)
44+
{
45+
case "FastView":
46+
externalViewLabel.visible = true
47+
externalViewLabel.text = catalog.i18nc("@label", "Fast View")
48+
break;
49+
case "SmartSliceView":
50+
externalViewLabel.visible = true
51+
externalViewLabel.text = catalog.i18nc("@label", "Smart Slice")
52+
break;
53+
default:
54+
externalViewLabel.visible = false
55+
break;
56+
}
4457
}
4558

4659
property string activeView:
@@ -53,6 +66,7 @@ Cura.ExpandableComponent
5366
{
5467
id: xrayViewCheckBox
5568
checked: parent.activeView == "XRayView"
69+
visible: !externalViewLabel.visible
5670
onClicked:
5771
{
5872
if(checked && parent.activeView != "XRayView")
@@ -71,8 +85,7 @@ Cura.ExpandableComponent
7185

7286
Label
7387
{
74-
id: fastViewLabel
75-
text: catalog.i18nc("@label", "Fast View")
88+
id: externalViewLabel
7689

7790
height: UM.Theme.getSize("layerview_row").height
7891
width: parent.width

0 commit comments

Comments
 (0)