Skip to content

Commit d16d74d

Browse files
authored
Merge pull request #50 from meteozond/update-compatible-version-to-5.11
Fix compatibility with Cura 5.11
2 parents bbd6aa3 + c00565e commit d16d74d

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

SidebarGUIPlugin.py

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from UM.Application import Application
66
from UM.Extension import Extension
77
from UM.Logger import Logger
8+
from PyQt6.QtCore import QTimer
89

910
from .SidebarGUIProxy import SidebarGUIProxy
1011

@@ -79,6 +80,12 @@ def _onEngineCreated(self):
7980

8081
def _onStageChanged(self):
8182
active_stage_id = self._controller.getActiveStage().getPluginId()
83+
active_view = self._controller.getActiveView()
84+
85+
# Don't change view if PaintTool is active
86+
if active_view and active_view.getPluginId() == "PaintTool":
87+
return
88+
8289
view_id = ""
8390

8491
if active_stage_id == "PrepareStage":
@@ -93,28 +100,44 @@ def _onStageChanged(self):
93100
self._controller.setActiveView(view_id)
94101

95102
def _onViewChanged(self):
96-
active_stage_id = self._controller.getActiveStage().getPluginId()
97-
active_view_id = self._controller.getActiveView().getPluginId()
103+
active_stage = self._controller.getActiveStage()
104+
active_view = self._controller.getActiveView()
105+
106+
if not active_stage or not active_view:
107+
return
108+
109+
active_stage_id = active_stage.getPluginId()
110+
active_view_id = active_view.getPluginId()
111+
112+
# Force machine settings update when PaintTool is activated to fix rendering issue
113+
if active_view_id == "PaintTool":
114+
QTimer.singleShot(0, lambda: Application.getInstance().getMachineManager().forceUpdateAllSettings())
98115

99116
if (
100117
active_stage_id == "SmartSlicePlugin"
101118
): # SmartSlicePlugin view is provided by the SmartSlicePlugin plugin
102119
return
103120

104121
if active_stage_id == "PrepareStage":
105-
if active_view_id not in ["SolidView", "XRayView"]:
122+
if active_view_id not in ["SolidView", "XRayView", "PaintTool"]:
106123
self._controller.setActiveView("SolidView")
107124
return
108-
self._prepare_stage_view_id = active_view_id
125+
if active_view_id in ["SolidView", "XRayView"]:
126+
self._prepare_stage_view_id = active_view_id
109127
elif active_stage_id == "MonitorStage":
110128
return
129+
elif active_stage_id == "PreviewStage":
130+
# Ensure SimulationView is active when in PreviewStage
131+
if active_view_id != "SimulationView":
132+
self._controller.setActiveView("SimulationView")
133+
return
111134

112135
if active_view_id in [
113136
"SimulationView",
114137
"FastView",
115138
]: # FastView is provided by the RAWMouse plugin
116139
if active_stage_id != "PreviewStage":
117140
self._controller.setActiveStage("PreviewStage")
118-
else:
141+
elif active_view_id not in ["PaintTool"]:
119142
if active_stage_id != "PrepareStage":
120143
self._controller.setActiveStage("PrepareStage")

plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "Sidebar GUI",
33
"author": "fieldOfView",
4-
"version": "4.6.8",
4+
"version": "4.6.9",
55
"minimum_cura_version": "4.0",
6-
"maximum_cura_version": "5.10",
6+
"maximum_cura_version": "5.11",
77
"description": "Provides an alternative, setting-centric interface based around a fixed sidebar",
88
"api": "6.0.0",
99
"supported_sdk_versions": [

0 commit comments

Comments
 (0)