Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove run function #42

Merged
merged 1 commit into from
Dec 9, 2024
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
2 changes: 1 addition & 1 deletion docs/backends.rst
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,4 @@ glfw if asyncio is enabled or Qt if a qt app is running.
On an interactive session without GUI support, one must call ``loop.run()`` to make
the canvases interactive. This enters the main loop, which prevents entering new
code. Once all canvases are closed, the loop returns. If you make new canvases
afterwards, you can call ``run()`` again. This is similar to ``plt.show()`` in Matplotlib.
afterwards, you can call ``loop.run()`` again. This is similar to ``plt.show()`` in Matplotlib.
4 changes: 2 additions & 2 deletions examples/cube_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
pass


from rendercanvas.qt import RenderCanvas, run
from rendercanvas.qt import RenderCanvas, loop
from rendercanvas.utils.cube import setup_drawing_sync


Expand All @@ -31,4 +31,4 @@


if __name__ == "__main__":
run()
loop.run()
4 changes: 2 additions & 2 deletions examples/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
A simple example to demonstrate events.
"""

from rendercanvas.auto import RenderCanvas, run
from rendercanvas.auto import RenderCanvas, loop


canvas = RenderCanvas(title="RenderCanvas events")
Expand All @@ -18,4 +18,4 @@ def process_event(event):


if __name__ == "__main__":
run()
loop.run()
1 change: 0 additions & 1 deletion rendercanvas/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,3 @@ def backends_by_trying_in_order():
module = select_backend()
RenderCanvas = module.RenderCanvas
loop = module.loop
run = loop.run # backwards compat
1 change: 0 additions & 1 deletion rendercanvas/glfw.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,4 +563,3 @@ def poll_glfw_briefly(poll_time=0.1):
# Make available under a name that is the same for all backends
loop = loop # default loop is AsyncioLoop
RenderCanvas = GlfwRenderCanvas
run = loop.run() # backwards compat
1 change: 0 additions & 1 deletion rendercanvas/jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,3 @@ def handle_event(self, event):
# Make available under a name that is the same for all backends
RenderCanvas = JupyterRenderCanvas
loop = loop
run = loop.run
1 change: 0 additions & 1 deletion rendercanvas/offscreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,3 @@ def _rc_call_later(self, delay, callback):


loop = StubLoop()
run = loop.run
1 change: 0 additions & 1 deletion rendercanvas/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,4 +585,3 @@ def closeEvent(self, event): # noqa: N802
# Make available under a name that is the same for all gui backends
RenderWidget = QRenderWidget
RenderCanvas = QRenderCanvas
run = loop.run # backwards compat
1 change: 0 additions & 1 deletion rendercanvas/stub.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,3 @@ def __init__(self, parent=None, **kwargs):
# Make available under a common name
RenderCanvas = StubRenderCanvas
loop = StubLoop()
run = loop.run
1 change: 0 additions & 1 deletion rendercanvas/wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,4 +525,3 @@ def Destroy(self): # noqa: N802 - this is a wx method
# Make available under a name that is the same for all gui backends
RenderWidget = WxRenderWidget
RenderCanvas = WxRenderCanvas
run = loop.run # backwards compat
2 changes: 0 additions & 2 deletions tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def check_canvas(self, canvas_class):

def get_loop_class(self):
assert "loop" in self.names
assert "run" in self.names

loop_statement = self.names["loop"]
assert isinstance(loop_statement, ast.Assign)
Expand Down Expand Up @@ -188,7 +187,6 @@ def test_auto_module():
m = Module("auto")
assert "RenderCanvas" in m.names
assert "loop" in m.names
assert "run" in m.names


# %% Test modules that only provide a loop
Expand Down
Loading