[Bf-extensions-cvs] [96143b1] master: Storypencil: Remove deprecated context function

Antonio Vazquez noreply at git.blender.org
Tue Nov 29 16:58:14 CET 2022


Commit: 96143b1a8b037ea3c81f065f557025db9fe1ace3
Author: Antonio Vazquez
Date:   Fri Nov 25 17:04:42 2022 +0100
Branches: master
https://developer.blender.org/rBAC96143b1a8b037ea3c81f065f557025db9fe1ace3

Storypencil: Remove deprecated context function

===================================================================

M	storypencil/synchro.py

===================================================================

diff --git a/storypencil/synchro.py b/storypencil/synchro.py
index a089411..94ebe02 100644
--- a/storypencil/synchro.py
+++ b/storypencil/synchro.py
@@ -144,8 +144,6 @@ class STORYPENCIL_OT_AddSecondaryWindowOperator(Operator):
 
     def configure_new_secondary_window(self, context, new_window):
         wrk_name = context.scene.storypencil_edit_workspace.name
-        override_context = context.copy()
-        override_context["window"] = new_window
         # Open the 2D workspace
         blendpath = os.path.dirname(bpy.app.binary_path)
         version = bpy.app.version
@@ -159,8 +157,8 @@ class STORYPENCIL_OT_AddSecondaryWindowOperator(Operator):
             if wk.name == wrk_name:
                 new_window.workspace = wk
                 return
-        bpy.ops.workspace.append_activate(
-            override_context, idname=wk_name, filepath=template_path)
+        with context.temp_override(window=new_window):
+            bpy.ops.workspace.append_activate(context, idname=wk_name, filepath=template_path)
 
 
 class STORYPENCIL_OT_WindowBringFront(Operator):
@@ -172,13 +170,12 @@ class STORYPENCIL_OT_WindowBringFront(Operator):
     win_id: bpy.props.StringProperty()
 
     def execute(self, context):
-        c = context.copy()
         win = get_window_from_id(context.window_manager, self.win_id)
         if not win:
             return {'CANCELLED'}
-        c["window"] = win
-        bpy.ops.wm.window_fullscreen_toggle(c)
-        bpy.ops.wm.window_fullscreen_toggle(c)
+        with context.temp_override(window=win):
+            bpy.ops.wm.window_fullscreen_toggle()
+            bpy.ops.wm.window_fullscreen_toggle()
         return {'FINISHED'}
 
 
@@ -191,12 +188,11 @@ class STORYPENCIL_OT_WindowCloseOperator(Operator):
     win_id: bpy.props.StringProperty()
 
     def execute(self, context):
-        c = context.copy()
         win = get_window_from_id(context.window_manager, self.win_id)
         if not win:
             return {'CANCELLED'}
-        c["window"] = win
-        bpy.ops.wm.window_close(c)
+        with context.temp_override(window=win):
+            bpy.ops.wm.window_close()
         return {'FINISHED'}



More information about the Bf-extensions-cvs mailing list