Skip to content

Commit

Permalink
Remove some refs to 'gui'
Browse files Browse the repository at this point in the history
  • Loading branch information
almarklein committed Nov 6, 2024
1 parent 2ea2598 commit df2e3df
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ by producing rgba images.
pip install rendercanvas
```

To have at least one GUI backend, we recommend:
To have at least one backend, we recommend:
```
pip install rendercanvas glfw
```
Expand Down
8 changes: 4 additions & 4 deletions docs/start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ Since most users will want to render something to screen, we recommend installin
pip install rendercanvas glfw
GUI libraries
-------------
Backends
--------

Multiple GUI backends are supported, see :doc:`the GUI API <gui>` for details:
Multiple backends are supported, including multiple GUI libraries, see :doc:`the GUI API <gui>` for details:

* `glfw <https://github.com/FlorianRhiem/pyGLFW>`_: a lightweight GUI for the desktop
* `glfw <https://github.com/FlorianRhiem/pyGLFW>`_: a lightweight canvas for the desktop
* `jupyter_rfb <https://jupyter-rfb.readthedocs.io>`_: only needed if you plan on using Jupyter
* qt (PySide6, PyQt6, PySide2, PyQt5)
* wx
2 changes: 1 addition & 1 deletion examples/qt_app_asyncio.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
An example demonstrating a qt app with a wgpu viz inside.
This is the same as the ``gui_qt_embed.py`` example, except this uses
This is the same as the ``qt_app.py`` example, except this uses
the asyncio compatible mode that was introduced in Pyside 6.6.
For more info see:
Expand Down
8 changes: 4 additions & 4 deletions rendercanvas/_gui_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Private gui utilities."""
"""Private utilities."""

import os
import sys
Expand All @@ -13,7 +13,7 @@
logger = logging.getLogger("rendercanvas")


# ===== GUI lib support
# ===== lib support

QT_MODULE_NAMES = ["PySide6", "PyQt6", "PySide2", "PyQt5"]

Expand Down Expand Up @@ -130,7 +130,7 @@ def proxy(*args, **kwargs):

def get_alt_x11_display():
"""Get (the pointer to) a process-global x11 display instance."""
# Ideally we'd get the real display object used by the GUI toolkit.
# Ideally we'd get the real display object used by the backend.
# But this is not always possible. In that case, using an alt display
# object can be used.
global _x11_display
Expand All @@ -147,7 +147,7 @@ def get_alt_x11_display():

def get_alt_wayland_display():
"""Get (the pointer to) a process-global Wayland display instance."""
# Ideally we'd get the real display object used by the GUI toolkit.
# Ideally we'd get the real display object used by the backend.
# This creates a global object, similar to what we do for X11.
# Unfortunately, this segfaults, so it looks like the real display object
# is needed? Leaving this here for reference.
Expand Down
2 changes: 1 addition & 1 deletion rendercanvas/_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def __init__(self, canvas, loop, *, mode="ondemand", min_fps=1, max_fps=30):
assert loop is not None

# Initialise the timer that runs our scheduling loop.
# Note that the gui may do a first draw earlier, starting the loop, and that's fine.
# Note that the backend may do a first draw earlier, starting the loop, and that's fine.
self._last_tick_time = -0.1
self._timer = loop.call_later(0.1, self._tick)

Expand Down
2 changes: 1 addition & 1 deletion rendercanvas/asyncio.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Implements an asyncio event loop."""

# This is used for GUI backends that don't have an event loop by themselves, like glfw.
# This is used for backends that don't have an event loop by themselves, like glfw.
# Would be nice to also allow a loop based on e.g. Trio. But we can likely fit that in
# when the time comes.

Expand Down
10 changes: 5 additions & 5 deletions rendercanvas/auto.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Automatic GUI backend selection.
Automatic backend selection.
Right now we only chose between GLFW, Qt and Jupyter. We might add support
for e.g. wx later. Or we might decide to stick with these three.
Expand All @@ -18,7 +18,7 @@


def _load_backend(backend_name):
"""Load a gui backend by name."""
"""Load a backend by name."""
if backend_name == "glfw":
from . import glfw as module
elif backend_name == "qt":
Expand Down Expand Up @@ -167,9 +167,9 @@ def backends_by_imported_modules():


def backends_by_trying_in_order():
"""Generate backend names by trying to import the GUI lib in order. This is the final fallback."""
"""Generate backend names by trying to import the corresponding lib in order. This is the final fallback."""

gui_lib_to_backend = {
lib_to_backend = {
"glfw": "glfw",
"PySide6": "qt",
"PyQt6": "qt",
Expand All @@ -178,7 +178,7 @@ def backends_by_trying_in_order():
# "wx": "wx",
}

for libname, backend_name in gui_lib_to_backend.items():
for libname, backend_name in lib_to_backend.items():
try:
importlib.import_module(libname)
except ModuleNotFoundError:
Expand Down
2 changes: 1 addition & 1 deletion rendercanvas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def present_image(self, image, **kwargs):
class BaseRenderCanvas(RenderCanvasInterface):
"""The base canvas class.
This class provides a uniform canvas API so render systems can be use
This class provides a uniform canvas API so render systems can use
code that is portable accross multiple GUI libraries and canvas targets.
Arguments:
Expand Down
4 changes: 2 additions & 2 deletions rendercanvas/glfw.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,11 @@ def _on_char(self, window, char):
def present_image(self, image, **kwargs):
raise NotImplementedError()
# AFAIK glfw does not have a builtin way to blit an image. It also does
# not really need one, since it's the most reliable GUI backend to
# not really need one, since it's the most reliable backend to
# render to the screen.


# Make available under a name that is the same for all gui backends
# Make available under a name that is the same for all backends
RenderCanvas = GlfwRenderCanvas


Expand Down
2 changes: 1 addition & 1 deletion rendercanvas/jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def present_image(self, image, **kwargs):
self._last_image = np.frombuffer(image, np.uint8).reshape(image.shape)


# Make available under a name that is the same for all gui backends
# Make available under a name that is the same for all backends
RenderCanvas = JupyterRenderCanvas


Expand Down
16 changes: 8 additions & 8 deletions tests/test_scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def active_sleep(self, delay):
self.draw_if_necessary()


def test_gui_scheduling_manual():
def test_scheduling_manual():
canvas = MyCanvas(min_fps=0.000001, max_fps=100, update_mode="manual")

# Booting ...
Expand All @@ -104,7 +104,7 @@ def test_gui_scheduling_manual():
assert canvas.draw_count == 1


def test_gui_scheduling_ondemand():
def test_scheduling_ondemand():
canvas = MyCanvas(min_fps=0.000001, max_fps=100, update_mode="ondemand")

# There's a small startup time, so no activity at first
Expand Down Expand Up @@ -135,7 +135,7 @@ def test_gui_scheduling_ondemand():
assert canvas.events_count == 0


def test_gui_scheduling_ondemand_always_request_draw():
def test_scheduling_ondemand_always_request_draw():
# Test that using ondemand mode with a request_draw() in the
# draw function, is equivalent to continuous mode.

Expand All @@ -145,15 +145,15 @@ def test_gui_scheduling_ondemand_always_request_draw():
def draw_func():
canvas.request_draw()

_test_gui_scheduling_continuous(canvas)
_test_scheduling_continuous(canvas)


def test_gui_scheduling_continuous():
def test_scheduling_continuous():
canvas = MyCanvas(max_fps=10, update_mode="continuous")
_test_gui_scheduling_continuous(canvas)
_test_scheduling_continuous(canvas)


def _test_gui_scheduling_continuous(canvas):
def _test_scheduling_continuous(canvas):
# There's a small startup time, so no activity at first
canvas.active_sleep(0.001)
assert canvas.draw_count == 0
Expand Down Expand Up @@ -182,7 +182,7 @@ def _test_gui_scheduling_continuous(canvas):
assert canvas.events_count == 0


def test_gui_scheduling_fastest():
def test_scheduling_fastest():
canvas = MyCanvas(max_fps=10, update_mode="fastest")

# There's a small startup time, so no activity at first
Expand Down

0 comments on commit df2e3df

Please sign in to comment.