55from UM .Application import Application
66from UM .Extension import Extension
77from UM .Logger import Logger
8+ from PyQt6 .QtCore import QTimer
89
910from .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" :
@@ -102,16 +109,21 @@ def _onViewChanged(self):
102109 active_stage_id = active_stage .getPluginId ()
103110 active_view_id = active_view .getPluginId ()
104111
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 ())
115+
105116 if (
106117 active_stage_id == "SmartSlicePlugin"
107118 ): # SmartSlicePlugin view is provided by the SmartSlicePlugin plugin
108119 return
109120
110121 if active_stage_id == "PrepareStage" :
111- if active_view_id not in ["SolidView" , "XRayView" ]:
122+ if active_view_id not in ["SolidView" , "XRayView" , "PaintTool" ]:
112123 self ._controller .setActiveView ("SolidView" )
113124 return
114- 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
115127 elif active_stage_id == "MonitorStage" :
116128 return
117129 elif active_stage_id == "PreviewStage" :
@@ -126,6 +138,6 @@ def _onViewChanged(self):
126138 ]: # FastView is provided by the RAWMouse plugin
127139 if active_stage_id != "PreviewStage" :
128140 self ._controller .setActiveStage ("PreviewStage" )
129- else :
141+ elif active_view_id not in [ "PaintTool" ] :
130142 if active_stage_id != "PrepareStage" :
131143 self ._controller .setActiveStage ("PrepareStage" )
0 commit comments