Pysics worker

Inheritance diagram of src.physics_worker.PhysicsWorker

Provides the PhysicsWorker class, which runs the core physics simulation in a separate thread to keep the UI responsive. :module: physics_worker :author: Le Bars, Yoann

class src.physics_worker.PhysicsWorker(args: CmdLineArgs, parent: QObject | None = None)[source]

Bases: QObject

Worker object to run the physics simulation in a separate thread. Emits signals with updated body data after each simulation step.

Variables:
  • _space (Space) – The physics simulation instance.

  • _iteration_count (int) – The current simulation iteration.

  • _max_iterations (int) – The total number of iterations to run.

cleanup()[source]

Cleans up resources held by the physics worker.

property initial_bodies: list[BodyProxy]

Provides read-only access to the initial list of body proxies.

This allows the UI thread to create visual representations of the bodies before the simulation’s event loop begins.

perform_single_step = <MagicMock name='mock()()' id='139674500329696'>
simulation_finished = <MagicMock name='mock()' id='139674500328016'>
start_simulation = <MagicMock name='mock()()' id='139674500329696'>
updated_body_data = <MagicMock name='mock()' id='139674500328016'>