Skip to content

Commit 5f06061

Browse files
committed
Revert "Use CuraApplication.callLater instead of QTimer"
This reverts commit d73e6e9.
1 parent d73e6e9 commit 5f06061

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

SidebarGUIPlugin.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
# The SidebarGUIPlugin is released under the terms of the AGPLv3 or higher.
33

44
import os.path
5-
from cura.CuraApplication import CuraApplication
5+
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

@@ -15,16 +16,16 @@ def __init__(self):
1516

1617
self._prepare_stage_view_id = "SolidView" # can be "SolidView" or "XRayView"
1718

18-
CuraApplication.getInstance().pluginsLoaded.connect(self._onPluginsLoaded)
19-
preferences = CuraApplication.getInstance().getPreferences()
19+
Application.getInstance().pluginsLoaded.connect(self._onPluginsLoaded)
20+
preferences = Application.getInstance().getPreferences()
2021
preferences.addPreference("sidebargui/expand_extruder_configuration", False)
2122
preferences.addPreference("sidebargui/expand_legend", True)
2223
preferences.addPreference("sidebargui/docked_sidebar", True)
2324
preferences.addPreference("sidebargui/settings_window_left", 65535)
2425
preferences.addPreference("sidebargui/settings_window_top", 65535)
2526
preferences.addPreference("sidebargui/settings_window_height", 0)
2627

27-
self._controller = CuraApplication.getInstance().getController()
28+
self._controller = Application.getInstance().getController()
2829
self._controller.activeStageChanged.connect(self._onStageChanged)
2930
self._controller.activeViewChanged.connect(self._onViewChanged)
3031

@@ -33,12 +34,12 @@ def __init__(self):
3334
def _onPluginsLoaded(self):
3435
# delayed connection to engineCreatedSignal to force this plugin to receive that signal
3536
# AFTER the original stages are created
36-
CuraApplication.getInstance().engineCreatedSignal.connect(self._onEngineCreated)
37+
Application.getInstance().engineCreatedSignal.connect(self._onEngineCreated)
3738

3839
def _onEngineCreated(self):
3940
Logger.log("d", "Registering replacement stages")
4041

41-
engine = CuraApplication.getInstance()._qml_engine
42+
engine = Application.getInstance()._qml_engine
4243
engine.rootContext().setContextProperty("SidebarGUIPlugin", self._proxy)
4344

4445
sidebar_component_path = os.path.join(
@@ -110,9 +111,7 @@ def _onViewChanged(self):
110111

111112
# Force machine settings update when PaintTool is activated to fix rendering issue
112113
if active_view_id == "PaintTool":
113-
CuraApplication.getInstance().callLater(
114-
CuraApplication.getInstance().getMachineManager().forceUpdateAllSettings()
115-
)
114+
QTimer.singleShot(0, lambda: Application.getInstance().getMachineManager().forceUpdateAllSettings())
116115

117116
if (
118117
active_stage_id == "SmartSlicePlugin"

0 commit comments

Comments
 (0)