Skip to content

Commit

Permalink
Fix progress bars to work with Nengo 2.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
drasmuss authored and hunse committed Jun 12, 2018
1 parent 13956f6 commit 8aca22c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Release History
1.3.1 (unreleased)
==================

**Improvements**

- Supports recent Nengo versions, up to 2.8.0


1.3.0 (October 6, 2017)
Expand Down
15 changes: 11 additions & 4 deletions nengo_ocl/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from nengo.builder.operator import Reset
from nengo.builder.signal import SignalDict
from nengo.utils.compat import iteritems, StringIO, range, ResourceWarning
from nengo.utils.progress import ProgressTracker
from nengo.utils.progress import ProgressTracker, Progress
from nengo.utils.stdlib import groupby

from nengo_ocl.raggedarray import RaggedArray
Expand Down Expand Up @@ -541,9 +541,13 @@ def run_steps(self, N, progress_bar=True):
if progress_bar is None:
progress_bar = self.progress_bar
try:
progress = ProgressTracker(N, progress_bar, "Simulating")
progress = ProgressTracker(progress_bar, Progress(
"Simulating", "Simulation", N))
except TypeError:
progress = ProgressTracker(N, progress_bar)
try:
progress = ProgressTracker(N, progress_bar, "Simulating")
except TypeError:
progress = ProgressTracker(N, progress_bar)

with progress:
# -- we will go through N steps of the simulator
Expand All @@ -554,7 +558,10 @@ def run_steps(self, N, progress_bar=True):
self._plans.call_n_times(B)
self._probe()
N -= B
progress.step(n=B)
if hasattr(progress, 'total_progress'):
progress.total_progress.step(n=B)
else:
progress.step(n=B)

if self.profiling > 1:
self.print_profiling()
Expand Down
2 changes: 1 addition & 1 deletion nengo_ocl/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
]

# --- latest Nengo version at time of release
latest_nengo_version_info = (2, 7, 0) # (major, minor, patch)
latest_nengo_version_info = (2, 8, 0) # (major, minor, patch)
latest_nengo_version = '.'.join(str(v) for v in latest_nengo_version_info)

0 comments on commit 8aca22c

Please sign in to comment.