Skip to content

Commit 47c81fb

Browse files
1 parent b44488b commit 47c81fb

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

Diff for: docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@
7979
# The short X.Y version.
8080
#
8181
# This should match the version in pyproject.toml
82-
version = "2.1.1"
82+
version = "2.1.2"
8383
# The full version, including alpha/beta/rc tags.
84-
release = "2.1.1"
84+
release = "2.1.2"
8585

8686
# The language for content autogenerated by Sphinx. Refer to documentation
8787
# for a list of supported languages.

Diff for: pydistsim/gui/drawing.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ def create_animation(
484484
dpi: int = 100,
485485
milliseconds_per_frame: int = 300,
486486
frame_limit: int = 2000,
487+
reset_on_start: bool = True,
487488
**kwargs,
488489
) -> animation.FuncAnimation:
489490
"""
@@ -516,6 +517,7 @@ def create_animation(
516517
:param dpi: dots per inch
517518
:param milliseconds_per_frame: milliseconds per frame
518519
:param frame_limit: limit of frames, default is 2000
520+
:param reset_on_start: control if the simulation will restart on animation start
519521
:param kwargs: additional keyword arguments to pass to the :func:`draw_current_state` function
520522
:return: animation object
521523
"""
@@ -530,7 +532,7 @@ def draw_frame(frame_index):
530532
if exception_occurred:
531533
return
532534

533-
if frame_index == 0:
535+
if frame_index == 0 and reset_on_start:
534536
sim.reset()
535537

536538
draw_current_state(sim, ax, dpi=dpi, **kwargs)
@@ -554,7 +556,7 @@ def should_continue():
554556
logger.warning("Frame limit reached.")
555557
return False
556558

557-
if not sim.is_halted():
559+
if not (sim.is_halted() and sim.get_current_algorithm() is None):
558560
logger.debug(f"Frame {frame_index}, simulation still running.")
559561
return True
560562

Diff for: pydistsim/logging.py

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class LogLevels(StrEnum):
2121
WARNING = "WARNING"
2222
ERROR = "ERROR"
2323
CRITICAL = "CRITICAL"
24+
TRACE = "TRACE"
2425

2526

2627
class LevelFilter:

Diff for: pydistsim/simulation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def run(self, steps=0):
103103
algorithm.add_observers(*self.observers)
104104
self._run_algorithm(algorithm)
105105
self.notify_observers(ObservableEvents.sim_state_changed, self)
106-
if self.stepsLeft <= 0:
106+
if self.stepsLeft <= 0 and steps != 0:
107107
break
108108

109109
def run_step(self):

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "PyDistSim"
10-
version = "2.1.1" # Should match version at pydistsim/docs/conf.py
10+
version = "2.1.2" # Should match version at pydistsim/docs/conf.py
1111
authors = [
1212
{ name="Agustin Recoba", email="[email protected]" }, # Fork author
1313
{ name="Damir Arbula", email="[email protected]" }, # Original author

0 commit comments

Comments
 (0)