1010import bpy
1111import bpy .utils .previews
1212
13- from ..tools .contextmanager .app import App as contextmanager_window
1413from ..tools .creator .app import Window as creator_window
1514from ..tools .loader .app import Window as loader_window
1615from ..tools .workfiles .app import Window as workfiles_window
@@ -134,7 +133,10 @@ def execute(self, context):
134133 self ._app .store_window (self .bl_idname , window )
135134 self ._window = window
136135
137- if not isinstance (self ._window , (QtWidgets .QDialog , ModuleType )):
136+ if not isinstance (
137+ self ._window ,
138+ (QtWidgets .QMainWindow , QtWidgets .QDialog , ModuleType )
139+ ):
138140 raise AttributeError (
139141 "`window` should be a `QDialog or module`. Got: {}" .format (
140142 str (type (window ))
@@ -178,14 +180,6 @@ def before_window_show(self):
178180 return
179181
180182
181- class LaunchContextManager (LaunchQtApp ):
182- """Launch Avalon Context Manager."""
183-
184- bl_idname = "wm.avalon_contextmanager"
185- bl_label = "Set Avalon Context..."
186- _window_class = contextmanager_window
187-
188-
189183class LaunchCreator (LaunchQtApp ):
190184 """Launch Avalon Creator."""
191185
@@ -242,13 +236,13 @@ class LaunchWorkFiles(LaunchQtApp):
242236 _window_class = workfiles_window
243237
244238 def execute (self , context ):
245- self . _init_kwargs = {
246- "root" : str ( Path (
247- os . environ . get ( "AVALON_WORKDIR" , "" ) ,
248- os . environ . get ( "AVALON_SCENEDIR" , "" ) ,
249- ))
250- }
251- return super (). execute ( context )
239+ result = super (). execute ( context )
240+ self . _window . set_context ({
241+ "asset" : api . Session [ "AVALON_ASSET" ] ,
242+ "silo" : api . Session [ "AVALON_SILO" ] ,
243+ "task" : api . Session [ "AVALON_TASK" ]
244+ })
245+ return result
252246
253247 def before_window_show (self ):
254248 self ._window .root = str (Path (
@@ -279,7 +273,11 @@ def draw(self, context):
279273 asset = api .Session ['AVALON_ASSET' ]
280274 task = api .Session ['AVALON_TASK' ]
281275 context_label = f"{ asset } , { task } "
282- layout .operator (LaunchContextManager .bl_idname , text = context_label )
276+ context_label_item = layout .row ()
277+ context_label_item .operator (
278+ LaunchWorkFiles .bl_idname , text = context_label
279+ )
280+ context_label_item .enabled = False
283281 layout .separator ()
284282 layout .operator (LaunchCreator .bl_idname , text = "Create..." )
285283 layout .operator (LaunchLoader .bl_idname , text = "Load..." )
@@ -302,7 +300,6 @@ def draw_avalon_menu(self, context):
302300
303301
304302classes = [
305- LaunchContextManager ,
306303 LaunchCreator ,
307304 LaunchLoader ,
308305 LaunchPublisher ,
0 commit comments