diff --git a/src/gi-stubs/repository/GLib.pyi b/src/gi-stubs/repository/GLib.pyi index 46b70958..53fe4d89 100644 --- a/src/gi-stubs/repository/GLib.pyi +++ b/src/gi-stubs/repository/GLib.pyi @@ -6,6 +6,7 @@ from typing import Sequence from typing import Tuple from typing import Type from typing import TypeVar +from typing import Union from gi.repository import GObject @@ -3586,6 +3587,7 @@ class UriParamsIter(GObject.GPointer): ) -> None: ... def next(self) -> Tuple[bool, str, str]: ... +# override class Variant(GObject.GPointer): """ :Constructors: @@ -3764,6 +3766,10 @@ class Variant(GObject.GPointer): # override def unpack(self) -> Any: ... def unref(self) -> None: ... + # override + def __getitem__(self, key: Any) -> Any: ... + # override + def __len__(self) -> int: ... class VariantBuilder(GObject.GBoxed): """ diff --git a/src/gi-stubs/repository/GdkX11.pyi b/src/gi-stubs/repository/GdkX11.pyi new file mode 100644 index 00000000..6d7d957c --- /dev/null +++ b/src/gi-stubs/repository/GdkX11.pyi @@ -0,0 +1,485 @@ +from typing import Any +from typing import Callable +from typing import Literal +from typing import Optional +from typing import Sequence +from typing import Tuple +from typing import Type +from typing import TypeVar +from typing import Union + +from gi.repository import Gdk +from gi.repository import GObject +from gi.repository import Pango +from gi.repository import xlib + +_lock = ... # FIXME Constant +_namespace: str = "GdkX11" +_version: str = "4.0" + +def x11_device_get_id(device: X11DeviceXI2) -> int: ... +def x11_device_manager_lookup( + device_manager: X11DeviceManagerXI2, device_id: int +) -> Optional[X11DeviceXI2]: ... +def x11_free_compound_text(ctext: int) -> None: ... +def x11_free_text_list(list: str) -> None: ... +def x11_get_server_time(surface: X11Surface) -> int: ... +def x11_get_xatom_by_name_for_display(display: X11Display, atom_name: str) -> int: ... +def x11_get_xatom_name_for_display(display: X11Display, xatom: int) -> str: ... +def x11_lookup_xdisplay(xdisplay: xlib.Display) -> X11Display: ... +def x11_set_sm_client_id(sm_client_id: Optional[str] = None) -> None: ... + +class X11AppLaunchContext(Gdk.AppLaunchContext): + """ + :Constructors: + + :: + + X11AppLaunchContext(**properties) + + Object GdkX11AppLaunchContext + + Properties from GdkAppLaunchContext: + display -> GdkDisplay: display + + Signals from GAppLaunchContext: + launch-failed (gchararray) + launch-started (GAppInfo, GVariant) + launched (GAppInfo, GVariant) + + Signals from GObject: + notify (GParam) + """ + + class Props: + display: Gdk.Display + + props: Props = ... + def __init__(self, display: Gdk.Display = ...): ... + +class X11AppLaunchContextClass(GObject.GPointer): ... + +class X11DeviceManagerXI2(GObject.Object): + """ + :Constructors: + + :: + + X11DeviceManagerXI2(**properties) + + Object GdkX11DeviceManagerXI2 + + Properties from GdkX11DeviceManagerXI2: + display -> GdkDisplay: display + opcode -> gint: opcode + major -> gint: major + minor -> gint: minor + + Signals from GObject: + notify (GParam) + """ + + class Props: + display: Gdk.Display + major: int + minor: int + opcode: int + + props: Props = ... + def __init__( + self, + display: Gdk.Display = ..., + major: int = ..., + minor: int = ..., + opcode: int = ..., + ): ... + +class X11DeviceManagerXI2Class(GObject.GPointer): ... + +class X11DeviceXI2(Gdk.Device): + """ + :Constructors: + + :: + + X11DeviceXI2(**properties) + + Object GdkX11DeviceXI2 + + Properties from GdkX11DeviceXI2: + device-id -> gint: device-id + + Signals from GdkDevice: + changed () + tool-changed (GdkDeviceTool) + + Properties from GdkDevice: + display -> GdkDisplay: display + name -> gchararray: name + source -> GdkInputSource: source + has-cursor -> gboolean: has-cursor + n-axes -> guint: n-axes + vendor-id -> gchararray: vendor-id + product-id -> gchararray: product-id + seat -> GdkSeat: seat + num-touches -> guint: num-touches + tool -> GdkDeviceTool: tool + direction -> PangoDirection: direction + has-bidi-layouts -> gboolean: has-bidi-layouts + caps-lock-state -> gboolean: caps-lock-state + num-lock-state -> gboolean: num-lock-state + scroll-lock-state -> gboolean: scroll-lock-state + modifier-state -> GdkModifierType: modifier-state + + Signals from GObject: + notify (GParam) + """ + + class Props: + device_id: int + caps_lock_state: bool + direction: Pango.Direction + display: Gdk.Display + has_bidi_layouts: bool + has_cursor: bool + modifier_state: Gdk.ModifierType + n_axes: int + name: str + num_lock_state: bool + num_touches: int + product_id: Optional[str] + scroll_lock_state: bool + seat: Gdk.Seat + source: Gdk.InputSource + tool: Gdk.DeviceTool + vendor_id: Optional[str] + + props: Props = ... + def __init__( + self, + device_id: int = ..., + display: Gdk.Display = ..., + has_cursor: bool = ..., + name: str = ..., + num_touches: int = ..., + product_id: str = ..., + seat: Gdk.Seat = ..., + source: Gdk.InputSource = ..., + vendor_id: str = ..., + ): ... + +class X11DeviceXI2Class(GObject.GPointer): ... + +class X11Display(Gdk.Display): + """ + :Constructors: + + :: + + X11Display(**properties) + + Object GdkX11Display + + Signals from GdkX11Display: + xevent (gpointer) -> gboolean + + Signals from GdkDisplay: + opened () + closed (gboolean) + seat-added (GdkSeat) + seat-removed (GdkSeat) + setting-changed (gchararray) + + Properties from GdkDisplay: + composited -> gboolean: composited + rgba -> gboolean: rgba + shadow-width -> gboolean: shadow-width + input-shapes -> gboolean: input-shapes + dmabuf-formats -> GdkDmabufFormats: dmabuf-formats + + Signals from GObject: + notify (GParam) + """ + + class Props: + composited: bool + dmabuf_formats: Gdk.DmabufFormats + input_shapes: bool + rgba: bool + shadow_width: bool + + props: Props = ... + def error_trap_pop(self) -> int: ... + def error_trap_pop_ignored(self) -> None: ... + def error_trap_push(self) -> None: ... + def get_default_group(self) -> Gdk.Surface: ... + def get_egl_display(self) -> None: ... + def get_egl_version(self) -> Tuple[bool, int, int]: ... + def get_glx_version(self) -> Tuple[bool, int, int]: ... + def get_primary_monitor(self) -> Gdk.Monitor: ... + def get_screen(self) -> X11Screen: ... + def get_startup_notification_id(self) -> str: ... + def get_user_time(self) -> int: ... + def get_xcursor(self, cursor: Gdk.Cursor) -> int: ... + def get_xdisplay(self) -> xlib.Display: ... + def get_xrootwindow(self) -> int: ... + def get_xscreen(self) -> xlib.Screen: ... + def grab(self) -> None: ... + @staticmethod + def open(display_name: Optional[str] = None) -> Optional[Gdk.Display]: ... + def set_cursor_theme(self, theme: Optional[str], size: int) -> None: ... + @staticmethod + def set_program_class(display: Gdk.Display, program_class: str) -> None: ... + def set_startup_notification_id(self, startup_id: str) -> None: ... + def set_surface_scale(self, scale: int) -> None: ... + def string_to_compound_text(self, str: str) -> Tuple[int, str, int, bytes]: ... + def text_property_to_text_list( + self, encoding: str, format: int, text: int, length: int, list: str + ) -> int: ... + def ungrab(self) -> None: ... + def utf8_to_compound_text(self, str: str) -> Tuple[bool, str, int, bytes]: ... + +class X11DisplayClass(GObject.GPointer): ... + +class X11Drag(Gdk.Drag): + """ + :Constructors: + + :: + + X11Drag(**properties) + + Object GdkX11Drag + + Signals from GdkDrag: + cancel (GdkDragCancelReason) + drop-performed () + dnd-finished () + + Properties from GdkDrag: + content -> GdkContentProvider: content + device -> GdkDevice: device + display -> GdkDisplay: display + formats -> GdkContentFormats: formats + selected-action -> GdkDragAction: selected-action + actions -> GdkDragAction: actions + surface -> GdkSurface: surface + + Signals from GObject: + notify (GParam) + """ + + class Props: + actions: Gdk.DragAction + content: Gdk.ContentProvider + device: Gdk.Device + display: Gdk.Display + formats: Gdk.ContentFormats + selected_action: Gdk.DragAction + surface: Gdk.Surface + + props: Props = ... + def __init__( + self, + actions: Gdk.DragAction = ..., + content: Gdk.ContentProvider = ..., + device: Gdk.Device = ..., + formats: Gdk.ContentFormats = ..., + selected_action: Gdk.DragAction = ..., + surface: Gdk.Surface = ..., + ): ... + +class X11DragClass(GObject.GPointer): ... + +class X11GLContext(Gdk.GLContext): + """ + :Constructors: + + :: + + X11GLContext(**properties) + + Object GdkX11GLContext + + Properties from GdkGLContext: + allowed-apis -> GdkGLAPI: allowed-apis + api -> GdkGLAPI: api + shared-context -> GdkGLContext: shared-context + + Properties from GdkDrawContext: + display -> GdkDisplay: display + surface -> GdkSurface: surface + + Signals from GObject: + notify (GParam) + """ + + class Props: + allowed_apis: Gdk.GLAPI + api: Gdk.GLAPI + shared_context: Optional[Gdk.GLContext] + display: Optional[Gdk.Display] + surface: Optional[Gdk.Surface] + + props: Props = ... + def __init__( + self, + allowed_apis: Gdk.GLAPI = ..., + shared_context: Gdk.GLContext = ..., + display: Gdk.Display = ..., + surface: Gdk.Surface = ..., + ): ... + +class X11GLContextClass(GObject.GPointer): ... + +class X11Monitor(Gdk.Monitor): + """ + :Constructors: + + :: + + X11Monitor(**properties) + + Object GdkX11Monitor + + Signals from GdkMonitor: + invalidate () + + Properties from GdkMonitor: + description -> gchararray: description + display -> GdkDisplay: display + manufacturer -> gchararray: manufacturer + model -> gchararray: model + connector -> gchararray: connector + scale-factor -> gint: scale-factor + scale -> gdouble: scale + geometry -> GdkRectangle: geometry + width-mm -> gint: width-mm + height-mm -> gint: height-mm + refresh-rate -> gint: refresh-rate + subpixel-layout -> GdkSubpixelLayout: subpixel-layout + valid -> gboolean: valid + + Signals from GObject: + notify (GParam) + """ + + class Props: + connector: Optional[str] + description: Optional[str] + display: Gdk.Display + geometry: Gdk.Rectangle + height_mm: int + manufacturer: Optional[str] + model: Optional[str] + refresh_rate: int + scale: float + scale_factor: int + subpixel_layout: Gdk.SubpixelLayout + valid: bool + width_mm: int + + props: Props = ... + def __init__(self, display: Gdk.Display = ...): ... + def get_output(self) -> int: ... + def get_workarea(self) -> Gdk.Rectangle: ... + +class X11MonitorClass(GObject.GPointer): ... + +class X11Screen(GObject.Object): + """ + :Constructors: + + :: + + X11Screen(**properties) + + Object GdkX11Screen + + Signals from GdkX11Screen: + window-manager-changed () + + Signals from GObject: + notify (GParam) + """ + + def get_current_desktop(self) -> int: ... + def get_monitor_output(self, monitor_num: int) -> int: ... + def get_number_of_desktops(self) -> int: ... + def get_screen_number(self) -> int: ... + def get_window_manager_name(self) -> str: ... + def get_xscreen(self) -> xlib.Screen: ... + def supports_net_wm_hint(self, property_name: str) -> bool: ... + +class X11ScreenClass(GObject.GPointer): ... + +class X11Surface(Gdk.Surface): + """ + :Constructors: + + :: + + X11Surface(**properties) + + Object GdkX11Surface + + Signals from GdkSurface: + layout (gint, gint) + render (CairoRegion) -> gboolean + event (gpointer) -> gboolean + enter-monitor (GdkMonitor) + leave-monitor (GdkMonitor) + + Properties from GdkSurface: + cursor -> GdkCursor: cursor + display -> GdkDisplay: display + frame-clock -> GdkFrameClock: frame-clock + mapped -> gboolean: mapped + width -> gint: width + height -> gint: height + scale-factor -> gint: scale-factor + scale -> gdouble: scale + + Signals from GObject: + notify (GParam) + """ + + class Props: + cursor: Optional[Gdk.Cursor] + display: Gdk.Display + frame_clock: Gdk.FrameClock + height: int + mapped: bool + scale: float + scale_factor: int + width: int + + props: Props = ... + def __init__( + self, + cursor: Optional[Gdk.Cursor] = ..., + display: Gdk.Display = ..., + frame_clock: Gdk.FrameClock = ..., + ): ... + def get_desktop(self) -> int: ... + def get_group(self) -> Optional[Gdk.Surface]: ... + def get_xid(self) -> int: ... + @staticmethod + def lookup_for_display(display: X11Display, window: int) -> X11Surface: ... + def move_to_current_desktop(self) -> None: ... + def move_to_desktop(self, desktop: int) -> None: ... + def set_frame_sync_enabled(self, frame_sync_enabled: bool) -> None: ... + def set_group(self, leader: Gdk.Surface) -> None: ... + def set_skip_pager_hint(self, skips_pager: bool) -> None: ... + def set_skip_taskbar_hint(self, skips_taskbar: bool) -> None: ... + def set_theme_variant(self, variant: str) -> None: ... + def set_urgency_hint(self, urgent: bool) -> None: ... + def set_user_time(self, timestamp: int) -> None: ... + def set_utf8_property(self, name: str, value: Optional[str] = None) -> None: ... + +class X11SurfaceClass(GObject.GPointer): ... + +class X11DeviceType(GObject.GEnum): + FLOATING = 2 + LOGICAL = 0 + PHYSICAL = 1 diff --git a/src/gi-stubs/repository/_Gtk4.pyi b/src/gi-stubs/repository/_Gtk4.pyi index 3ebc385e..c9034d02 100644 --- a/src/gi-stubs/repository/_Gtk4.pyi +++ b/src/gi-stubs/repository/_Gtk4.pyi @@ -1,11 +1,13 @@ from typing import Any from typing import Callable +from typing import Iterator from typing import Literal from typing import Optional from typing import Sequence from typing import Tuple from typing import Type from typing import TypeVar +from typing import Union import cairo from gi.repository import Gdk @@ -19,6 +21,18 @@ from gi.repository import Pango _SomeSurface = TypeVar("_SomeSurface", bound=cairo.Surface) +# override +CellRendererT = TypeVar( + "CellRendererT", + CellRendererCombo, + CellRendererPixbuf, + CellRendererProgress, + CellRendererSpin, + CellRendererSpinner, + CellRendererText, + CellRendererToggle, +) + ACCESSIBLE_ATTRIBUTE_BACKGROUND: str = "bg-color" ACCESSIBLE_ATTRIBUTE_FAMILY: str = "family-name" ACCESSIBLE_ATTRIBUTE_FOREGROUND: str = "fg-color" @@ -3346,14 +3360,20 @@ class Builder(GObject.Object): ): ... def add_from_file(self, filename: str) -> bool: ... def add_from_resource(self, resource_path: str) -> bool: ... - def add_from_string(self, buffer): ... # FIXME Function + # override + def add_from_string( + self, buffer: str, length: int = ... + ) -> bool: ... # FIXME Function def add_objects_from_file( self, filename: str, object_ids: Sequence[str] ) -> bool: ... def add_objects_from_resource( self, resource_path: str, object_ids: Sequence[str] ) -> bool: ... - def add_objects_from_string(self, buffer, object_ids): ... # FIXME Function + # override + def add_objects_from_string( + self, buffer: str, object_ids: list[str] + ) -> int: ... # FIXME Function def create_closure( self, function_name: str, @@ -18577,6 +18597,7 @@ class ListItemClass(GObject.GPointer): ... class ListItemFactory(GObject.Object): ... class ListItemFactoryClass(GObject.GPointer): ... +# override class ListStore( GObject.Object, Buildable, TreeDragDest, TreeDragSource, TreeModel, TreeSortable ): @@ -18606,11 +18627,21 @@ class ListStore( parent: GObject.Object = ... priv: ListStorePrivate = ... - def append(self, row=None): ... # FIXME Function + + def __init__(self, *args: Any) -> None: ... + def append( + self, row: Union[list[Any], Tuple[Any, ...], None] = None + ) -> TreeIter: ... # FIXME Function def clear(self) -> None: ... - def insert(self, position, row=None): ... # FIXME Function - def insert_after(self, sibling, row=None): ... # FIXME Function - def insert_before(self, sibling, row=None): ... # FIXME Function + def insert( + self, position: int, row: Union[list[Any], Tuple[Any, ...], None] = None + ) -> TreeIter: ... # FIXME Function + def insert_after( + self, sibling: TreeIter, row: Union[list[Any], Tuple[Any, ...], None] = None + ) -> TreeIter: ... # FIXME Function + def insert_before( + self, sibling: TreeIter, row: Union[list[Any], Tuple[Any, ...], None] = None + ) -> TreeIter: ... # FIXME Function def insert_with_values( self, position: int, columns: Sequence[int], values: Sequence[Any] ) -> TreeIter: ... @@ -18626,12 +18657,18 @@ class ListStore( ) -> None: ... @classmethod def new(cls, types: Sequence[Type]) -> ListStore: ... - def prepend(self, row=None): ... # FIXME Function + def prepend( + self, row: Union[list[Any], Tuple[Any, ...], None] = None + ) -> TreeIter: ... # FIXME Function def remove(self, iter: TreeIter) -> bool: ... def reorder(self, new_order: Sequence[int]) -> None: ... - def set(self, treeiter, *args): ... # FIXME Function + def set( + self, treeiter: TreeIter, *args: dict[int, Any] + ) -> None: ... # FIXME Function def set_column_types(self, types: Sequence[Type]) -> None: ... - def set_value(self, treeiter, column, value): ... # FIXME Function + def set_value( + self, treeiter: TreeIter, column: int, value: Any + ) -> None: ... # FIXME Function def swap(self, a: TreeIter, b: TreeIter) -> None: ... class ListStoreClass(GObject.GPointer): @@ -29458,9 +29495,14 @@ class TextBuffer(GObject.Object): def begin_user_action(self) -> None: ... def copy_clipboard(self, clipboard: Gdk.Clipboard) -> None: ... def create_child_anchor(self, iter: TextIter) -> TextChildAnchor: ... - def create_mark(self, mark_name, where, left_gravity=False): ... # FIXME Function # override - def create_tag(self, tag_name: str, **properties) -> None: ... + def create_mark( + self, mark_name: Optional[str], where: TextIter, left_gravity: bool = False + ) -> TextMark: ... # FIXME Function + # override + def create_tag( + self, tag_name: Optional[str] = None, **properties: Any + ) -> TextTag: ... def cut_clipboard( self, clipboard: Gdk.Clipboard, default_editable: bool ) -> None: ... @@ -29527,8 +29569,14 @@ class TextBuffer(GObject.Object): def get_text( self, start: TextIter, end: TextIter, include_hidden_chars: bool ) -> str: ... - def insert(self, iter, text, length=-1): ... # FIXME Function - def insert_at_cursor(self, text, length=-1): ... # FIXME Function + # override + def insert( + self, iter: TextIter, text: str, length: int = ... + ) -> None: ... # FIXME Function + # override + def insert_at_cursor( + self, text: str, length: int = ... + ) -> None: ... # FIXME Function def insert_child_anchor(self, iter: TextIter, anchor: TextChildAnchor) -> None: ... def insert_interactive( self, iter: TextIter, text: str, len: int, default_editable: bool @@ -31162,6 +31210,7 @@ class TreeListRowSorterClass(GObject.GPointer): parent_class: SorterClass = ... +# override class TreeModel(GObject.GInterface): """ Interface GtkTreeModel @@ -31170,12 +31219,14 @@ class TreeModel(GObject.GInterface): notify (GParam) """ - def filter_new(self, root: Optional[TreePath] = None) -> TreeModel: ... + def filter_new(self, root: Optional[TreePath] = None) -> TreeModelFilter: ... def foreach(self, func: Callable[..., bool], *user_data: Any) -> None: ... - def get(self, treeiter, *columns): ... # FIXME Function + def get( + self, treeiter: TreeIter, *columns: list[str] + ) -> Tuple[Any, ...]: ... # FIXME Function def get_column_type(self, index_: int) -> Type: ... def get_flags(self) -> TreeModelFlags: ... - def get_iter(self, path): ... # FIXME Function + def get_iter(self, path: Union[str, TreePath]) -> TreeIter: ... # FIXME Function def get_iter_first(self) -> Optional[TreeIter]: ... # CHECK Wrapped function def get_iter_from_string( self, path_string: str @@ -31189,23 +31240,37 @@ class TreeModel(GObject.GInterface): ) -> Optional[TreeIter]: ... # CHECK Wrapped function def iter_has_child(self, iter: TreeIter) -> bool: ... def iter_n_children(self, iter: Optional[TreeIter] = None) -> int: ... - def iter_next(self, aiter): ... # FIXME Function + def iter_next(self, aiter: TreeIter) -> Optional[TreeIter]: ... # FIXME Function def iter_nth_child( self, parent: Optional[TreeIter], n: int ) -> Optional[TreeIter]: ... # CHECK Wrapped function def iter_parent( self, child: TreeIter ) -> Optional[TreeIter]: ... # CHECK Wrapped function - def iter_previous(self, aiter): ... # FIXME Function + def iter_previous( + self, aiter: TreeIter + ) -> Optional[TreeIter]: ... # FIXME Function def ref_node(self, iter: TreeIter) -> None: ... - def row_changed(self, path, iter): ... # FIXME Function - def row_deleted(self, path): ... # FIXME Function - def row_has_child_toggled(self, path, iter): ... # FIXME Function - def row_inserted(self, path, iter): ... # FIXME Function - def rows_reordered(self, path, iter, new_order): ... # FIXME Function - def set_row(self, treeiter, row): ... # FIXME Function - def sort_new_with_model(self): ... # FIXME Function + def row_changed(self, path: TreePath, iter: TreeIter) -> None: ... # FIXME Function + def row_deleted(self, path: TreePath) -> None: ... # FIXME Function + def row_has_child_toggled( + self, path: TreePath, iter: TreeIter + ) -> None: ... # FIXME Function + def row_inserted( + self, path: TreePath, iter: TreeIter + ) -> None: ... # FIXME Function + def rows_reordered( + self, path: TreePath, iter: Optional[TreeIter], new_order: list[str] + ) -> None: ... # FIXME Function + def set_row(self, treeiter: TreeIter, row: list[Any]) -> None: ... # FIXME Function + def sort_new_with_model(self) -> None: ... # FIXME Function def unref_node(self, iter: TreeIter) -> None: ... + def __getitem__( + self, item: Union[TreeIter, TreePath, str, int] + ) -> TreeModelRow: ... + def __delitem__(self, item: Union[TreeIter, TreePath, str, int]) -> None: ... + def __iter__(self) -> TreeModelRowIter: ... + def __len__(self) -> int: ... class TreeModelFilter(GObject.Object, TreeDragSource, TreeModel): """ @@ -31262,7 +31327,12 @@ class TreeModelFilter(GObject.Object, TreeDragSource, TreeModel): ) -> None: ... def set_value(self, iter, column, value): ... # FIXME Function def set_visible_column(self, column: int) -> None: ... - def set_visible_func(self, func, data=None): ... # FIXME Function + # override + def set_visible_func( + self, + func: Callable[[TreeModelFilter, TreeIter, Any], bool], + data: Optional[Any] = ..., + ) -> None: ... class TreeModelFilterClass(GObject.GPointer): """ @@ -31315,7 +31385,10 @@ class TreeModelIface(GObject.GPointer): ref_node: Callable[[TreeModel, TreeIter], None] = ... unref_node: Callable[[TreeModel, TreeIter], None] = ... +# override class TreeModelRow: + iter: TreeIter + model: TreeModel next = ... # FIXME Constant parent = ... # FIXME Constant path = ... # FIXME Constant @@ -31324,9 +31397,14 @@ class TreeModelRow: def get_next(self): ... # FIXME Function def get_parent(self): ... # FIXME Function def get_previous(self): ... # FIXME Function - def iterchildren(self): ... # FIXME Function + def iterchildren(self) -> Iterator[TreeModelRow]: ... # FIXME Function + def __getitem__(self, key: int) -> Any: ... + def __setitem__(self, key: int, value: Any) -> None: ... -class TreeModelRowIter: ... +# override +class TreeModelRowIter: + def next(self) -> TreeModelRow: ... + def __next__(self) -> TreeModelRow: ... class TreeModelSort(GObject.Object, TreeDragSource, TreeModel, TreeSortable): """ @@ -31431,6 +31509,7 @@ class TreePath(GObject.GBoxed): class TreeRowData(GObject.GBoxed): ... +# override class TreeRowReference(GObject.GBoxed): """ :Constructors: @@ -31441,6 +31520,7 @@ class TreeRowReference(GObject.GBoxed): new_proxy(proxy:GObject.Object, model:Gtk.TreeModel, path:Gtk.TreePath) -> Gtk.TreeRowReference or None """ + def __init__(self, model: TreeModel, path: TreePath) -> None: ... def copy(self) -> TreeRowReference: ... @staticmethod def deleted(proxy: GObject.Object, path: TreePath) -> None: ... @@ -31484,14 +31564,21 @@ class TreeSelection(GObject.Object): def __init__(self, mode: SelectionMode = ...): ... def count_selected_rows(self) -> int: ... def get_mode(self) -> SelectionMode: ... - def get_selected(self): ... # FIXME Function - def get_selected_rows(self): ... # FIXME Function + # override + def get_selected( + self, + ) -> Tuple[TreeModel, Optional[TreeIter]]: ... # FIXME Function + # override + def get_selected_rows( + self, + ) -> Optional[Tuple[TreeModel, list[TreePath]]]: ... # FIXME Function def get_tree_view(self) -> TreeView: ... def iter_is_selected(self, iter: TreeIter) -> bool: ... def path_is_selected(self, path: TreePath) -> bool: ... def select_all(self) -> None: ... def select_iter(self, iter: TreeIter) -> None: ... - def select_path(self, path): ... # FIXME Function + # override + def select_path(self, path: TreePath) -> None: ... # FIXME Function def select_range(self, start_path: TreePath, end_path: TreePath) -> None: ... def selected_foreach(self, func: Callable[..., None], *data: Any) -> None: ... def set_mode(self, type: SelectionMode) -> None: ... @@ -31517,9 +31604,13 @@ class TreeSortable(GObject.GInterface): def has_default_sort_func(self) -> bool: ... def set_default_sort_func(self, sort_func, user_data=None): ... # FIXME Function def set_sort_column_id(self, sort_column_id: int, order: SortType) -> None: ... + # override def set_sort_func( - self, sort_column_id, sort_func, user_data=None - ): ... # FIXME Function + self, + sort_column_id: int, + sort_func: Callable[[TreeModel, TreeIter, TreeIter, Any], Any], + user_data: Optional[Any] = None, + ) -> None: ... # FIXME Function def sort_column_changed(self) -> None: ... class TreeSortableIface(GObject.GPointer): @@ -31539,6 +31630,7 @@ class TreeSortableIface(GObject.GPointer): set_default_sort_func: Callable[..., None] = ... has_default_sort_func: Callable[[TreeSortable], bool] = ... +# override class TreeStore( GObject.Object, Buildable, TreeDragDest, TreeDragSource, TreeModel, TreeSortable ): @@ -31568,7 +31660,13 @@ class TreeStore( parent: GObject.Object = ... priv: TreeStorePrivate = ... - def append(self, parent, row=None): ... # FIXME Function + + # override + def __init__(self, *column_types: Any) -> None: ... + # override + def append( + self, parent: Optional[TreeIter], row: Optional[list[Any]] = None + ) -> TreeIter: ... def clear(self) -> None: ... def insert(self, parent, position, row=None): ... # FIXME Function def insert_after(self, parent, sibling, row=None): ... # FIXME Function @@ -31908,7 +32006,7 @@ class TreeView(Widget, Accessible, Buildable, ConstraintTarget, Scrollable): def get_path_at_pos( self, x: int, y: int ) -> Optional[ - Tuple[TreePath, TreeViewColumn, int, int] + Tuple[Optional[TreePath], Optional[TreeViewColumn], int, int] ]: ... # CHECK Wrapped function def get_reorderable(self) -> bool: ... def get_rubber_banding(self) -> bool: ... @@ -31926,8 +32024,8 @@ class TreeView(Widget, Accessible, Buildable, ConstraintTarget, Scrollable): def get_visible_rect(self) -> Gdk.Rectangle: ... def insert_column(self, column: TreeViewColumn, position: int) -> int: ... def insert_column_with_attributes( - self, position, title, cell, **kwargs - ): ... # FIXME Function + self, position: int, title: str, cell: CellRenderer, **kwargs: Any + ) -> None: ... # FIXME Function def insert_column_with_data_func( self, position: int, @@ -31954,14 +32052,24 @@ class TreeView(Widget, Accessible, Buildable, ConstraintTarget, Scrollable): ) -> None: ... def row_expanded(self, path: TreePath) -> bool: ... def scroll_to_cell( - self, path, column=None, use_align=False, row_align=0.0, col_align=0.0 - ): ... # FIXME Function + self, + path: Optional[TreePath], + column: Optional[TreeViewColumn] = None, + use_align: bool = False, + row_align: float = 0.0, + col_align: float = 0.0, + ) -> None: ... # FIXME Function def scroll_to_point(self, tree_x: int, tree_y: int) -> None: ... def set_activate_on_single_click(self, single: bool) -> None: ... def set_column_drag_function( self, func: Optional[Callable[..., bool]] = None, *user_data: Any ) -> None: ... - def set_cursor(self, path, column=None, start_editing=False): ... # FIXME Function + def set_cursor( + self, + path: TreePath, + column: Optional[TreeViewColumn] = None, + start_editing: bool = False, + ) -> None: ... # FIXME Function def set_cursor_on_cell( self, path: TreePath, @@ -32033,6 +32141,7 @@ class TreeViewClass(GObject.GPointer): start_interactive_search: Callable[[TreeView], bool] = ... _reserved: list[None] = ... +# override class TreeViewColumn(GObject.InitiallyUnowned, Buildable, CellLayout): """ :Constructors: @@ -32115,6 +32224,12 @@ class TreeViewColumn(GObject.InitiallyUnowned, Buildable, CellLayout): visible: bool = ..., widget: Optional[Widget] = ..., ): ... + def __init__( + self, + title: str = ..., + cell_renderer: Optional[CellRenderer] = None, + **attributes: Any, + ): ... def add_attribute( self, cell_renderer: CellRenderer, attribute: str, column: int ) -> None: ... @@ -32163,9 +32278,13 @@ class TreeViewColumn(GObject.InitiallyUnowned, Buildable, CellLayout): def queue_resize(self) -> None: ... def set_alignment(self, xalign: float) -> None: ... def set_attributes(self, cell_renderer, **attributes): ... # FIXME Function + # override def set_cell_data_func( - self, cell_renderer, func, func_data=None - ): ... # FIXME Function + self, + cell_renderer: CellRendererT, + func: Callable[[TreeViewColumn, CellRendererT, TreeModel, TreeIter, Any], Any], + func_data: Optional[object] = None, + ) -> None: ... def set_clickable(self, clickable: bool) -> None: ... def set_expand(self, expand: bool) -> None: ... def set_fixed_width(self, fixed_width: int) -> None: ... diff --git a/src/gi-stubs/repository/_GtkSource5.pyi b/src/gi-stubs/repository/_GtkSource5.pyi index 3e7b4e84..62c21538 100644 --- a/src/gi-stubs/repository/_GtkSource5.pyi +++ b/src/gi-stubs/repository/_GtkSource5.pyi @@ -6,6 +6,7 @@ from typing import Sequence from typing import Tuple from typing import Type from typing import TypeVar +from typing import Union from gi.repository import Gdk from gi.repository import GdkPixbuf @@ -4448,6 +4449,7 @@ class TagClass(GObject.GPointer): parent_class: Gtk.TextTagClass = ... _reserved: list[None] = ... +# override class View( Gtk.TextView, Gtk.Accessible, @@ -4546,7 +4548,6 @@ class View( indent -> gint: indent tabs -> PangoTabArray: tabs cursor-visible -> gboolean: cursor-visible - buffer -> GtkTextBuffer: buffer overwrite -> gboolean: overwrite accepts-tab -> gboolean: accepts-tab im-module -> gchararray: im-module @@ -4630,7 +4631,7 @@ class View( tab_width: int accepts_tab: bool bottom_margin: int - buffer: Gtk.TextBuffer + buffer: Buffer cursor_visible: bool editable: bool extra_menu: Gio.MenuModel @@ -4691,6 +4692,7 @@ class View( props: Props = ... parent_instance: Gtk.TextView = ... + def __init__( self, auto_indent: bool = ..., @@ -4775,6 +4777,7 @@ class View( def do_show_completion(self) -> None: ... def get_auto_indent(self) -> bool: ... def get_background_pattern(self) -> BackgroundPatternType: ... + def get_buffer(self) -> Buffer: ... def get_completion(self) -> Completion: ... def get_enable_snippets(self) -> bool: ... def get_gutter(self, window_type: Gtk.TextWindowType) -> Gutter: ... diff --git a/tools/generate.py b/tools/generate.py index ef5e79ef..07670201 100755 --- a/tools/generate.py +++ b/tools/generate.py @@ -336,7 +336,20 @@ def _build(parent: ObjectT, namespace: str, overrides: dict[str, str]) -> str: ns = set() ret = _gi_build_stub(parent, namespace, dir(parent), ns, overrides, None, "") - typings = "from typing import Any, Callable, Literal, Optional, Tuple, Type, TypeVar, Sequence" + typing_imports = [ + "Any", + "Callable", + "Literal", + "Optional", + "Sequence", + "Tuple", + "Type", + "TypeVar", + "Union", + ] + typings = [ + f"from typing import {typing_import}" for typing_import in typing_imports + ] typevars: list[str] = [] imports: list[str] = [] @@ -348,7 +361,7 @@ def _build(parent: ObjectT, namespace: str, overrides: dict[str, str]) -> str: imports += [f"from gi.repository import {n}" for n in sorted(ns)] return ( - typings + "\n".join(typings) + "\n\n" + "\n".join(imports) + "\n" diff --git a/tools/update_all.py b/tools/update_all.py index 03c62ad1..ff6cd0bd 100755 --- a/tools/update_all.py +++ b/tools/update_all.py @@ -28,6 +28,7 @@ def __init__(self, name: str, version: str, *, output: str | None = None) -> Non Lib("Gdk", "3.0", output="_Gdk3"), Lib("Gdk", "4.0", output="_Gdk4"), Lib("GdkPixbuf", "2.0"), + Lib("GdkX11", "4.0"), Lib("Geoclue", "2.0"), Lib("Ggit", "1.0"), Lib("Gio", "2.0"), @@ -64,6 +65,7 @@ def __init__(self, name: str, version: str, *, output: str | None = None) -> Non Lib("Secret", "1"), Lib("Soup", "2.4", output="_Soup2"), Lib("Soup", "3.0", output="_Soup3"), + Lib("Spelling", "1"), Lib("Vte", "2.91"), Lib("WebKit", "6.0", output="_WebKit6"), Lib("XApp", "1.0"),