Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions rendercanvas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
# ruff: noqa: F401

from ._version import __version__, version_info
from . import _coreutils
from ._enums import CursorShape, EventType, UpdateMode
from .base import BaseRenderCanvas, BaseLoop
from . import contexts
from . import core
from . import utils
from . import contexts
from .base import BaseRenderCanvas, BaseLoop
from .core.enums import CursorShape, EventType, UpdateMode


__all__ = ["BaseLoop", "BaseRenderCanvas", "CursorShape", "EventType", "UpdateMode"]
7 changes: 6 additions & 1 deletion rendercanvas/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
import importlib
from typing import cast

from ._coreutils import logger, QT_MODULE_NAMES, get_imported_qt_lib, asyncio_is_running
from .core.coreutils import (
logger,
QT_MODULE_NAMES,
get_imported_qt_lib,
asyncio_is_running,
)
from .base import BaseRenderCanvas, BaseLoop


Expand Down
12 changes: 6 additions & 6 deletions rendercanvas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
import weakref
from typing import TYPE_CHECKING

from ._enums import (
from .core.enums import (
EventTypeEnum,
UpdateModeEnum,
CursorShape,
CursorShapeEnum,
)
from . import contexts
from ._size import SizeInfo
from ._events import EventEmitter
from ._loop import BaseLoop
from ._scheduler import Scheduler
from ._coreutils import logger, log_exception
from .core.size import SizeInfo
from .core.events import EventEmitter
from .core.loop import BaseLoop
from .core.scheduler import Scheduler
from .core.coreutils import logger, log_exception


if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion rendercanvas/contexts/wgpucontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np

from .basecontext import BaseContext
from .._coreutils import logger, log_exception
from ..core.coreutils import logger, log_exception


__all__ = ["WgpuContext", "WgpuContextToBitmap", "WgpuContextToScreen"]
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions rendercanvas/_events.py → rendercanvas/core/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from collections import defaultdict, deque
from typing import Callable

from ._coreutils import log_exception
from ._enums import EventType
from .coreutils import log_exception
from .enums import EventType


valid_event_types = set(EventType)
Expand Down
8 changes: 4 additions & 4 deletions rendercanvas/_loop.py → rendercanvas/core/loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from inspect import iscoroutinefunction
from typing import TYPE_CHECKING

from ._enums import LoopState
from ._coreutils import logger, log_exception, call_later_from_thread, close_agen
from .utils.asyncs import sleep
from .utils import asyncadapter
from .enums import LoopState
from .coreutils import logger, log_exception, call_later_from_thread, close_agen
from ..utils.asyncs import sleep
from ..utils import asyncadapter

if TYPE_CHECKING:
from typing import Any, Callable, Coroutine
Expand Down
4 changes: 2 additions & 2 deletions rendercanvas/_scheduler.py → rendercanvas/core/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import time
import weakref

from ._enums import UpdateMode
from .utils.asyncs import precise_sleep, Event
from .enums import UpdateMode
from ..utils.asyncs import precise_sleep, Event


class Scheduler:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion rendercanvas/glfw.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from .base import BaseRenderCanvas, BaseCanvasGroup
from .asyncio import loop
from ._coreutils import SYSTEM_IS_WAYLAND, weakbind, logger
from .core.coreutils import SYSTEM_IS_WAYLAND, weakbind, logger


# Make sure that glfw is new enough
Expand Down
2 changes: 1 addition & 1 deletion rendercanvas/jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import time

from .base import BaseCanvasGroup, BaseRenderCanvas
from ._events import EventType
from .core.events import EventType
from .asyncio import loop

import numpy as np
Expand Down
4 changes: 2 additions & 2 deletions rendercanvas/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


from .base import WrapperRenderCanvas, BaseCanvasGroup, BaseRenderCanvas, BaseLoop
from ._coreutils import (
from .core.coreutils import (
logger,
get_alt_x11_display,
get_alt_wayland_display,
Expand Down Expand Up @@ -311,7 +311,7 @@ def _get_surface_ids(self):
}
elif sys.platform.startswith("linux"):
if False:
# We fall back to XWayland, see _coreutils.py
# We fall back to XWayland, see coreutils.py
return {
"platform": "wayland",
"window": int(self.winId()),
Expand Down
2 changes: 1 addition & 1 deletion rendercanvas/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import queue

from .base import BaseLoop
from ._coreutils import logger, call_later_from_thread
from .core.coreutils import logger, call_later_from_thread


class RawLoop(BaseLoop):
Expand Down
1 change: 1 addition & 0 deletions rendercanvas/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Public utilities."""
2 changes: 1 addition & 1 deletion rendercanvas/utils/asyncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import sys

from .._coreutils import IS_WIN, IS_PYODIDE, call_later_from_thread
from ..core.coreutils import IS_WIN, IS_PYODIDE, call_later_from_thread


USE_THREADED_TIMER = IS_WIN
Expand Down
4 changes: 2 additions & 2 deletions rendercanvas/wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import wx

from ._coreutils import (
from .core.coreutils import (
logger,
get_alt_x11_display,
get_alt_wayland_display,
Expand Down Expand Up @@ -259,7 +259,7 @@ def _get_surface_ids(self):
}
elif sys.platform.startswith("linux"):
if False:
# We fall back to XWayland, see _coreutils.py
# We fall back to XWayland, see coreutils.py
return {
"platform": "wayland",
"window": int(self.GetHandle()),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def test_base_module():
canvas_class = m.names["BaseRenderCanvas"]
m.check_canvas(canvas_class)

m = Module("_loop")
m = Module("core/loop")

loop_class = m.names["BaseLoop"]
m.check_loop(loop_class)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import time

from rendercanvas._events import EventEmitter, EventType
from rendercanvas.core.events import EventEmitter, EventType
from testutils import run_tests
import pytest

Expand Down
2 changes: 1 addition & 1 deletion tests/test_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from testutils import run_tests
from rendercanvas._size import SizeInfo
from rendercanvas.core.size import SizeInfo
from rendercanvas.base import BaseRenderCanvas


Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def test_weakbind():
weakbind = rendercanvas._coreutils.weakbind
weakbind = rendercanvas.core.coreutils.weakbind

xx = []

Expand Down Expand Up @@ -43,7 +43,7 @@ def bar(self):
def test_call_later_thread():
leeway = 0.05 if os.getenv("CI") else 0

t = rendercanvas._coreutils.CallLaterThread()
t = rendercanvas.core.coreutils.CallLaterThread()

results = []

Expand Down