1414
1515
1616class SidebarGUIPlugin (Extension ):
17-
1817 def __init__ (self ):
1918 super ().__init__ ()
20- self ._prepare_stage_view_id = "SolidView" # can be "SolidView" or "XRayView"
19+ self ._prepare_stage_view_id = "SolidView" # can be "SolidView" or "XRayView"
2120
2221 Application .getInstance ().pluginsLoaded .connect (self ._onPluginsLoaded )
2322 preferences = Application .getInstance ().getPreferences ()
@@ -43,11 +42,28 @@ def _onEngineCreated(self):
4342 Logger .log ("d" , "Registering replacement stages" )
4443
4544 engine = Application .getInstance ()._qml_engine
46- qmlRegisterSingletonType (SidebarGUIProxy , "Cura" , 1 , 0 , "SidebarGUIPlugin" , self .getProxy )
47-
48- sidebar_component_path = os .path .join (os .path .dirname (os .path .abspath (__file__ )), "resources" , "qml" , "SidebarStageMenu.qml" )
49- main_component_path = os .path .join (os .path .dirname (os .path .abspath (__file__ )), "resources" , "qml" , "StageMain.qml" )
50- monitor_menu_component_path = os .path .join (os .path .dirname (os .path .abspath (__file__ )), "resources" , "qml" , "MonitorStageMenu.qml" )
45+ qmlRegisterSingletonType (
46+ SidebarGUIProxy , "Cura" , 1 , 0 , "SidebarGUIPlugin" , self .getProxy
47+ )
48+
49+ sidebar_component_path = os .path .join (
50+ os .path .dirname (os .path .abspath (__file__ )),
51+ "resources" ,
52+ "qml" ,
53+ "SidebarStageMenu.qml" ,
54+ )
55+ main_component_path = os .path .join (
56+ os .path .dirname (os .path .abspath (__file__ )),
57+ "resources" ,
58+ "qml" ,
59+ "StageMain.qml" ,
60+ )
61+ monitor_menu_component_path = os .path .join (
62+ os .path .dirname (os .path .abspath (__file__ )),
63+ "resources" ,
64+ "qml" ,
65+ "MonitorStageMenu.qml" ,
66+ )
5167
5268 prepare_stage = self ._controller .getStage ("PrepareStage" )
5369 prepare_stage .addDisplayComponent ("menu" , sidebar_component_path )
@@ -66,7 +82,6 @@ def _onEngineCreated(self):
6682 monitor_stage = self ._controller .getStage ("MonitorStage" )
6783 monitor_stage .addDisplayComponent ("menu" , monitor_menu_component_path )
6884
69-
7085 def _onStageChanged (self ):
7186 active_stage_id = self ._controller .getActiveStage ().getPluginId ()
7287 view_id = ""
@@ -76,15 +91,19 @@ def _onStageChanged(self):
7691 elif active_stage_id == "PreviewStage" :
7792 view_id = "SimulationView"
7893
79- if view_id and (self ._controller .getActiveView () is None or view_id != self ._controller .getActiveView ().getPluginId ()):
94+ if view_id and (
95+ self ._controller .getActiveView () is None
96+ or view_id != self ._controller .getActiveView ().getPluginId ()
97+ ):
8098 self ._controller .setActiveView (view_id )
8199
82-
83100 def _onViewChanged (self ):
84101 active_stage_id = self ._controller .getActiveStage ().getPluginId ()
85102 active_view_id = self ._controller .getActiveView ().getPluginId ()
86103
87- if active_stage_id == "SmartSlicePlugin" : # SmartSlicePlugin view is provided by the SmartSlicePlugin plugin
104+ if (
105+ active_stage_id == "SmartSlicePlugin"
106+ ): # SmartSlicePlugin view is provided by the SmartSlicePlugin plugin
88107 return
89108
90109 if active_stage_id == "PrepareStage" :
@@ -95,14 +114,16 @@ def _onViewChanged(self):
95114 elif active_stage_id == "MonitorStage" :
96115 return
97116
98- if active_view_id in ["SimulationView" , "FastView" ]: # FastView is provided by the RAWMouse plugin
117+ if active_view_id in [
118+ "SimulationView" ,
119+ "FastView" ,
120+ ]: # FastView is provided by the RAWMouse plugin
99121 if active_stage_id != "PreviewStage" :
100122 self ._controller .setActiveStage ("PreviewStage" )
101123 else :
102124 if active_stage_id != "PrepareStage" :
103125 self ._controller .setActiveStage ("PrepareStage" )
104126
105-
106127 ## Hackish way to ensure the proxy is already created, which ensures that the sidebargui.qml is already created
107128 # as this caused some issues.
108129 def getProxy (self , engine , script_engine ):
0 commit comments