Skip to content

Commit 4f0ab67

Browse files
authored
Merge pull request #2 from JaedanC/dev
Shortened names. Updated for breaking changes in last imgui updates
2 parents 11f404c + 6581aa8 commit 4f0ab67

15 files changed

Lines changed: 216 additions & 244 deletions

src/config.py

Lines changed: 92 additions & 92 deletions
Large diffs are not rendered by default.

src/core/core.pyx

Lines changed: 32 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import cython
77
import array
88
from collections import namedtuple
99
from cython.operator import dereference
10-
from typing import Callable, Any, Sequence, Tuple, NamedTuple
10+
from typing import Callable, Any, Sequence, Tuple, NamedTuple, Optional
1111

1212
cimport ccimgui
1313
from libcpp cimport bool
@@ -8594,25 +8594,12 @@ def show_font_selector(label: str):
85948594
# [End Function]
85958595

85968596
# [Function]
8597-
# ?use_template(False)
8598-
# ?active(False)
8599-
# ?invisible(False)
8600-
# ?custom_comment_only(False)
8601-
# ?returns(None)
8602-
# def show_id_stack_tool_window():
8603-
# """
8604-
# Implied p_open = null
8605-
# """
8606-
# ccimgui.ImGui_ShowIDStackToolWindow()
8607-
# [End Function]
8608-
8609-
# [Function]
8610-
# ?use_template(False)
8597+
# ?use_template(True)
86118598
# ?active(True)
86128599
# ?invisible(False)
86138600
# ?custom_comment_only(False)
86148601
# ?returns(None)
8615-
def show_id_stack_tool_window_ex(p_open: Bool=None):
8602+
def show_id_stack_tool_window(p_open: Bool=None):
86168603
"""
86178604
Create stack tool window. hover items with mouse to query information about the source of their unique id.
86188605
"""
@@ -8621,6 +8608,21 @@ def show_id_stack_tool_window_ex(p_open: Bool=None):
86218608
)
86228609
# [End Function]
86238610

8611+
# [Function]
8612+
# ?use_template(False)
8613+
# ?active(False)
8614+
# ?invisible(True)
8615+
# ?custom_comment_only(False)
8616+
# ?returns(None)
8617+
# def show_id_stack_tool_window_ex(p_open: Bool=None):
8618+
# """
8619+
# Create stack tool window. hover items with mouse to query information about the source of their unique id.
8620+
# """
8621+
# ccimgui.ImGui_ShowIDStackToolWindowEx(
8622+
# Bool.ptr(p_open)
8623+
# )
8624+
# [End Function]
8625+
86248626
# [Function]
86258627
# ?use_template(False)
86268628
# ?active(True)
@@ -18428,21 +18430,6 @@ cdef class ImGuiIO:
1842818430
# )
1842918431
# [End Method]
1843018432

18431-
# [Method]
18432-
# ?use_template(False)
18433-
# ?active(False)
18434-
# ?invisible(False)
18435-
# ?custom_comment_only(False)
18436-
# ?returns(None)
18437-
# def clear_input_characters(self: ImGuiIO):
18438-
# """
18439-
# [internal] clear the text input buffer manually
18440-
# """
18441-
# ccimgui.ImGuiIO_ClearInputCharacters(
18442-
# self._ptr
18443-
# )
18444-
# [End Method]
18445-
1844618433
# [Method]
1844718434
# ?use_template(False)
1844818435
# ?active(False)
@@ -19264,30 +19251,32 @@ cdef class ImGuiListClipper:
1926419251

1926519252
# [Method]
1926619253
# ?use_template(False)
19267-
# ?active(False)
19254+
# ?active(True)
1926819255
# ?invisible(False)
19269-
# ?custom_comment_only(False)
19256+
# ?custom_comment_only(True)
1927019257
# ?returns(None)
19271-
# def include_item_by_index(self: ImGuiListClipper, item_index: int):
19272-
# """
19273-
# Call IncludeItemByIndex() or IncludeItemsByIndex() *BEFORE* first call to Step() if you need a range of items to not be clipped, regardless of their visibility.
19274-
# (Due to alignment / padding of certain items it is possible that an extra item may be included on either end of the display range).
19275-
# """
19276-
# ccimgui.ImGuiListClipper_IncludeItemByIndex(
19277-
# self._ptr,
19278-
# item_index
19279-
# )
19258+
def include_item_by_index(self: ImGuiListClipper, item_index: int):
19259+
"""
19260+
Call IncludeItemByIndex() or IncludeItemsByIndex() *BEFORE* first call to Step() if you need a range of items to not be clipped, regardless of their visibility.
19261+
(Due to alignment / padding of certain items it is possible that an extra item may be included on either end of the display range).
19262+
"""
19263+
ccimgui.ImGuiListClipper_IncludeItemByIndex(
19264+
self._ptr,
19265+
item_index
19266+
)
1928019267
# [End Method]
1928119268

1928219269
# [Method]
1928319270
# ?use_template(False)
1928419271
# ?active(True)
1928519272
# ?invisible(False)
19286-
# ?custom_comment_only(False)
19273+
# ?custom_comment_only(True)
1928719274
# ?returns(None)
1928819275
def include_items_by_index(self: ImGuiListClipper, item_begin: int, item_end: int):
1928919276
"""
1929019277
Item_end is exclusive e.g. use (42, 42+1) to make item 42 never clipped.
19278+
19279+
[#6424](https://github.com/ocornut/imgui/issues/6424) JaedanC Easteregg. This is my suggestion!
1929119280
"""
1929219281
ccimgui.ImGuiListClipper_IncludeItemsByIndex(
1929319282
self._ptr,

src/core/core_generated.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import cython
77
import array
88
from collections import namedtuple
99
from cython.operator import dereference
10-
from typing import Callable, Any, Sequence, Tuple, NamedTuple
10+
from typing import Callable, Any, Sequence, Tuple, NamedTuple, Optional
1111

1212
cimport ccimgui
1313
from libcpp cimport bool

src/core/core_template.pyx

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import cython
77
import array
88
from collections import namedtuple
99
from cython.operator import dereference
10-
from typing import Callable, Any, Sequence, Tuple, NamedTuple
10+
from typing import Callable, Any, Sequence, Tuple, NamedTuple, Optional
1111

1212
cimport ccimgui
1313
from libcpp cimport bool
@@ -8594,22 +8594,24 @@ def show_font_selector(label: str):
85948594
# [End Function]
85958595

85968596
# [Function]
8597-
# ?use_template(False)
8598-
# ?active(False)
8597+
# ?use_template(True)
8598+
# ?active(True)
85998599
# ?invisible(False)
86008600
# ?custom_comment_only(False)
86018601
# ?returns(None)
8602-
def show_id_stack_tool_window():
8602+
def show_id_stack_tool_window(p_open: Bool=None):
86038603
"""
8604-
Implied p_open = null
8604+
Create stack tool window. hover items with mouse to query information about the source of their unique id.
86058605
"""
8606-
ccimgui.ImGui_ShowIDStackToolWindow()
8606+
ccimgui.ImGui_ShowIDStackToolWindowEx(
8607+
Bool.ptr(p_open)
8608+
)
86078609
# [End Function]
86088610

86098611
# [Function]
86108612
# ?use_template(False)
8611-
# ?active(True)
8612-
# ?invisible(False)
8613+
# ?active(False)
8614+
# ?invisible(True)
86138615
# ?custom_comment_only(False)
86148616
# ?returns(None)
86158617
def show_id_stack_tool_window_ex(p_open: Bool=None):
@@ -18428,21 +18430,6 @@ cdef class ImGuiIO:
1842818430
)
1842918431
# [End Method]
1843018432

18431-
# [Method]
18432-
# ?use_template(False)
18433-
# ?active(False)
18434-
# ?invisible(False)
18435-
# ?custom_comment_only(False)
18436-
# ?returns(None)
18437-
def clear_input_characters(self: ImGuiIO):
18438-
"""
18439-
[internal] clear the text input buffer manually
18440-
"""
18441-
ccimgui.ImGuiIO_ClearInputCharacters(
18442-
self._ptr
18443-
)
18444-
# [End Method]
18445-
1844618433
# [Method]
1844718434
# ?use_template(False)
1844818435
# ?active(False)
@@ -19264,9 +19251,9 @@ cdef class ImGuiListClipper:
1926419251

1926519252
# [Method]
1926619253
# ?use_template(False)
19267-
# ?active(False)
19254+
# ?active(True)
1926819255
# ?invisible(False)
19269-
# ?custom_comment_only(False)
19256+
# ?custom_comment_only(True)
1927019257
# ?returns(None)
1927119258
def include_item_by_index(self: ImGuiListClipper, item_index: int):
1927219259
"""
@@ -19283,11 +19270,13 @@ cdef class ImGuiListClipper:
1928319270
# ?use_template(False)
1928419271
# ?active(True)
1928519272
# ?invisible(False)
19286-
# ?custom_comment_only(False)
19273+
# ?custom_comment_only(True)
1928719274
# ?returns(None)
1928819275
def include_items_by_index(self: ImGuiListClipper, item_begin: int, item_end: int):
1928919276
"""
1929019277
Item_end is exclusive e.g. use (42, 42+1) to make item 42 never clipped.
19278+
19279+
[#6424](https://github.com/ocornut/imgui/issues/6424) JaedanC Easteregg. This is my suggestion!
1929119280
"""
1929219281
ccimgui.ImGuiListClipper_IncludeItemsByIndex(
1929319282
self._ptr,

src/model/dear_bindings/argument.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
from ..comments import Comments, parse_comment
44
from . import safe_python_name
55
from .interfaces import IArgument, IType
6-
from .db_type import DearBindingsTypeNew
6+
from .db_type import _Type
77
import re
88

99

10-
class DearBindingsArgumentNew(IArgument):
10+
class Argument(IArgument):
1111
def from_json(argument_json: dict) -> IArgument:
1212
"""Argument
1313
{
@@ -28,7 +28,7 @@ def from_json(argument_json: dict) -> IArgument:
2828
"""
2929
name = safe_python_name(argument_json["name"])
3030
assert not argument_json.get("is_varargs"), "Python does not support is_varargs: {}".format(name)
31-
_type: IType = DearBindingsTypeNew.from_json(argument_json["type"])
31+
_type: IType = _Type.from_json(argument_json["type"])
3232
comments: Comments = parse_comment(argument_json)
3333

3434
default_lookup = {
@@ -56,7 +56,7 @@ def from_json(argument_json: dict) -> IArgument:
5656
if _type.with_no_const_or_sign() == "float":
5757
default_value = default_value.replace("f", "")
5858

59-
return DearBindingsArgumentNew(name, _type, comments, default_value)
59+
return Argument(name, _type, comments, default_value)
6060

6161
def __init__(self, name: str, _type: IType, comments: Comments = None, default_value=None):
6262
self.name = name

src/model/dear_bindings/binding.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
from ..template import Template
55
from . import pythonise_string
66
from .interfaces import *
7-
from .db_type import DearBindingsTypeNew, Kinds, Kind
8-
from .enum import DearBindingsEnumNew
9-
from .function import DearBindingsFunctionNew
10-
from .struct import DearBindingsStructNew
11-
from .typedef import DearBindingsTypedefNew
7+
from .db_type import _Type, Kinds, Kind
8+
from .enum import _Enum
9+
from .function import Function
10+
from .struct import Struct
11+
from .typedef import Typedef
1212

1313

1414
PYX_TEMPLATE_MARKER = "# ---- Start Generated Content ----\n\n"
@@ -85,19 +85,19 @@ def __recurse_list(_list: list, func: Callable, *args, **kwargs):
8585
return _json
8686

8787

88-
class DearBindingNew(IBinding):
88+
class Binding(IBinding):
8989
def from_json(cimgui_json, pxd_header: str, definitions: List[Tuple[str, bool]]):
9090
cimgui_json = deep_json_filter(cimgui_json, passes_conditional, definitions)
9191
cimgui_json = deep_json_filter(cimgui_json, ignore_anonymous)
9292

93-
enums = [DearBindingsEnumNew.from_json(e) for e in cimgui_json["enums"]]
94-
typedefs = [DearBindingsTypedefNew.from_json(e) for e in cimgui_json["typedefs"]]
95-
structs = [DearBindingsStructNew.from_json(e) for e in cimgui_json["structs"]]
93+
enums = [_Enum.from_json(e) for e in cimgui_json["enums"]]
94+
typedefs = [Typedef.from_json(e) for e in cimgui_json["typedefs"]]
95+
structs = [Struct.from_json(e) for e in cimgui_json["structs"]]
9696
functions = []
9797

9898
methods: List[IFunction] = []
9999
for function in cimgui_json["functions"]:
100-
function = DearBindingsFunctionNew.from_json(function)
100+
function = Function.from_json(function)
101101
if len(function.get_arguments()) > 0 and function.get_arguments()[0].get_name() == "self":
102102
methods.append(function)
103103
continue
@@ -112,7 +112,7 @@ def from_json(cimgui_json, pxd_header: str, definitions: List[Tuple[str, bool]])
112112
method.set_python_name(method.get_python_name().replace(class_name + "_", "", 1))
113113
struct_lookup[class_name].add_method(method)
114114

115-
return DearBindingNew(enums, typedefs, structs, functions, pxd_header)
115+
return Binding(enums, typedefs, structs, functions, pxd_header)
116116

117117
def __init__(
118118
self,
@@ -215,7 +215,7 @@ def to_pyx(self, pxd_library_name: str, include_base: bool) -> str:
215215
import array
216216
from collections import namedtuple
217217
from cython.operator import dereference
218-
from typing import Callable, Any, Sequence, Tuple, NamedTuple
218+
from typing import Callable, Any, Sequence, Tuple, NamedTuple, Optional
219219
220220
cimport ccimgui
221221
from libcpp cimport bool
@@ -1026,7 +1026,7 @@ def follow_type(self, _type: IType) -> IType:
10261026

10271027
for enum in self.enums:
10281028
if enum.get_name() == _type.with_no_const_or_asterisk():
1029-
return DearBindingsTypeNew(
1029+
return _Type(
10301030
"int",
10311031
Kind(Kinds.Builtin, "int")
10321032
)

src/model/dear_bindings/db_type.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def to_pxd(self):
144144
)
145145

146146

147-
class DearBindingsTypeNew(IType):
147+
class _Type(IType):
148148
def from_json(type_json: dict):
149149
"""Pointer
150150
{
@@ -282,7 +282,7 @@ def from_json(type_json: dict):
282282
declaration: str = type_json["declaration"]
283283
is_function_pointer = "type_details" in type_json
284284
kind: Kind = Kind.from_json(type_json["description"], is_function_pointer)
285-
return DearBindingsTypeNew(declaration, kind)
285+
return _Type(declaration, kind)
286286

287287
def __init__(self, declaration: str, kind: Kind):
288288
self.declaration = declaration

src/model/dear_bindings/enum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ def to_pyi(self) -> str:
2828
return pythonise_string(self.name_omitted_imgui_prefix()).upper()
2929

3030

31-
class DearBindingsEnumNew(IEnum):
31+
class _Enum(IEnum):
3232
def from_json(enum_json: dict) -> IEnum:
3333
name = enum_json["name"]
3434
elements = [Element.from_json(e) for e in enum_json["elements"]]
3535
comments = parse_comment(enum_json)
36-
return DearBindingsEnumNew(name, elements, comments)
36+
return _Enum(name, elements, comments)
3737

3838
def __init__(self, name: str, elements: List[IEnumElement], comments: Comments):
3939
self.name = name

src/model/dear_bindings/function.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
from typing import List
33
from ..comments import Comments, parse_comment
44
from .interfaces import IFunction, IType, IArgument
5-
from .db_type import DearBindingsTypeNew
6-
from .argument import DearBindingsArgumentNew
5+
from .db_type import _Type
6+
from .argument import Argument
77

88

9-
class DearBindingsFunctionNew(IFunction):
9+
class Function(IFunction):
1010
def from_json(function_json: dict) -> IFunction:
1111
"""Function
1212
{
@@ -53,15 +53,15 @@ def from_json(function_json: dict) -> IFunction:
5353
},
5454
"""
5555
name: str = function_json["name"]
56-
return_type: IType = DearBindingsTypeNew.from_json(function_json["return_type"])
56+
return_type: IType = _Type.from_json(function_json["return_type"])
5757
# Ignore any Cython unsupported arguments
5858
arguments: List[IArgument] = []
5959
for argument in function_json["arguments"]:
6060
if argument["is_varargs"] or argument.get("type", {}).get("declaration") == "va_list":
6161
continue
62-
arguments.append(DearBindingsArgumentNew.from_json(argument))
62+
arguments.append(Argument.from_json(argument))
6363
comments: Comments = parse_comment(function_json)
64-
return DearBindingsFunctionNew(name, return_type, arguments, comments)
64+
return Function(name, return_type, arguments, comments)
6565

6666
def __init__(self, name: str, return_type: IType, arguments: List[IArgument], comments: Comments = None):
6767
self.name = name

0 commit comments

Comments
 (0)