Skip to content

Commit

Permalink
fix nested enums
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids authored Nov 18, 2024
1 parent a135e21 commit 8a453a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/sipify.py
Original file line number Diff line number Diff line change
Expand Up @@ -2110,10 +2110,10 @@ def cpp_to_python_signature(cpp_function: str) -> str:
value_comment_indented += f'\n\n Available as ``{enum_mk_base}.{compat_name}`` in older QGIS releases.\n'
if CONTEXT.actual_class:
CONTEXT.output_python.append(
f"{enum_mk_base}.{compat_name} = {CONTEXT.actual_class}.{enum_qualname}.{enum_member}\n")
f"{enum_mk_base}.{compat_name} = {'.'.join(CONTEXT.classname)}.{enum_qualname}.{enum_member}\n")
if enum_old_name and compat_name != enum_member:
CONTEXT.output_python.append(
f"{enum_mk_base}.{enum_old_name}.{compat_name} = {CONTEXT.actual_class}.{enum_qualname}.{enum_member}\n")
f"{enum_mk_base}.{enum_old_name}.{compat_name} = {'.'.join(CONTEXT.classname)}.{enum_qualname}.{enum_member}\n")
CONTEXT.output_python.append(
f"{enum_mk_base}.{compat_name}.is_monkey_patched = True\n")
CONTEXT.output_python.append(
Expand All @@ -2135,7 +2135,7 @@ def cpp_to_python_signature(cpp_function: str) -> str:

if monkeypatch:
CONTEXT.output_python.append(
f"{CONTEXT.actual_class}.{compat_name} = {CONTEXT.actual_class}.{enum_qualname}.{enum_member}\n")
f"{CONTEXT.actual_class}.{compat_name} = {'.'.join(CONTEXT.classname)}.{enum_qualname}.{enum_member}\n")
CONTEXT.output_python.append(
f"{CONTEXT.actual_class}.{compat_name}.is_monkey_patched = True\n")
if CONTEXT.actual_class:
Expand Down Expand Up @@ -2168,7 +2168,7 @@ def cpp_to_python_signature(cpp_function: str) -> str:
enum_member_doc_string = "\n".join(enum_members_doc)
if CONTEXT.actual_class:
CONTEXT.output_python.append(
f'{CONTEXT.actual_class}.{enum_qualname}.__doc__ = """{CONTEXT.comment}\n\n{enum_member_doc_string}\n\n"""\n# --\n')
f'{".".join(CONTEXT.classname)}.{enum_qualname}.__doc__ = """{CONTEXT.comment}\n\n{enum_member_doc_string}\n\n"""\n# --\n')
else:
CONTEXT.output_python.append(
f'{enum_qualname}.__doc__ = """{CONTEXT.comment}\n\n{enum_member_doc_string}\n\n"""\n# --\n')
Expand Down

0 comments on commit 8a453a7

Please sign in to comment.