Fix starting Blender with Python 3.10

URL presets weren't working, raising a Python exception
when the splash screen was displayed.
This commit is contained in:
Campbell Barton 2021-10-11 12:53:52 +11:00
parent d2454487d1
commit fef4dc7269
1 changed files with 7 additions and 3 deletions

View File

@ -979,6 +979,12 @@ class WM_OT_url_open(Operator):
return {'FINISHED'}
# NOTE: needed for Python 3.10 since there are name-space issues with annotations.
# This can be moved into the class as a static-method once Python 3.9x is dropped.
def _wm_url_open_preset_type_items(_self, _context):
return [item for (item, _) in WM_OT_url_open_preset.preset_items]
class WM_OT_url_open_preset(Operator):
"""Open a preset website in the web browser"""
bl_idname = "wm.url_open_preset"
@ -987,9 +993,7 @@ class WM_OT_url_open_preset(Operator):
type: EnumProperty(
name="Site",
items=lambda self, _context: (
item for (item, _) in WM_OT_url_open_preset.preset_items
),
items=_wm_url_open_preset_type_items,
)
id: StringProperty(