Skip to content

Commit

Permalink
Update code to be compatible with current dependencies versions (pygl…
Browse files Browse the repository at this point in the history
…et pinned to 1.5 and matplotlib 3.6)
  • Loading branch information
tbaptista committed Feb 8, 2023
1 parent 880ee12 commit 53662fd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
9 changes: 9 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
v1.0.0-rc-1, 2023-02-07
* Fix compatibility with pyglet 1.5
* Pin pyglet version to 1.5
* Fix compatibility with matplotlib 3.6

v1.0.0-beta.22, 2018-04-13
* Fix compatibility with matplotlib 2.2.0
* Updates to Julia Set example

v1.0.0-beta.21, 2017-02-07
* Add reset method to simulators.FunctionIterator
* Small code style changes
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ are still in development (check link above).
Note that due to its main purpose (education), most of the code is written with
a focus on readability, rather than performance.

| Copyright (c) 2015-2017 Tiago Baptista - [email protected]
| Copyright (c) 2015-2023 Tiago Baptista - [email protected]
| Licensed under the Apache License, Version 2.0 (see LICENSE.txt)
Dependencies
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
'Topic :: Scientific/Engineering :: Artificial Life',
],
packages=['simcx'],
install_requires = ['pyglet', 'matplotlib', 'numpy', 'scipy', 'pyafai'],
install_requires=['pyglet<2', 'matplotlib', 'numpy', 'scipy', 'pyafai'],

)
)
10 changes: 5 additions & 5 deletions simcx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ def __init__(self, sim: Simulator, **kwargs):
def _create_canvas(self):
self.canvas = FigureCanvas(self.figure)
data = StringIO()
self.canvas.print_raw(data, dpi=self.dpi)
self.canvas.print_raw(data)
self.image = pyglet.image.ImageData(self.width, self.height,
'RGBA', data.getvalue(),
-4 * self.width)

def update_image(self):
data = StringIO()
self.canvas.print_raw(data, dpi=self.dpi)
self.canvas.print_raw(data)
self.image.set_data('RGBA', -4 * self.width, data.getvalue())


Expand Down Expand Up @@ -136,8 +136,7 @@ def __init__(self, width=500, height=500, interval=0.05,

if multi_sampling:
# Enable multi sampling if available on the hardware
platform = pyglet.window.get_platform()
display = platform.get_default_display()
display = pyglet.canvas.get_display()
screen = display.get_default_screen()
template = pyglet.gl.Config(sample_buffers=1, samples=4,
double_buffer=True)
Expand All @@ -163,7 +162,7 @@ def __init__(self, width=500, height=500, interval=0.05,
self._visuals = []
self._pos = []

self._fps_display = pyglet.clock.ClockDisplay()
self._fps_display = pyglet.window.FPSDisplay(window=self)

pyglet.clock.schedule_interval(self._update, self._interval)

Expand Down Expand Up @@ -330,6 +329,7 @@ def grab_frame(self, **savefig_kwargs):
def run():
pyglet.app.run()


# import sub-modules
from . import simulators
from . import visuals
Expand Down
2 changes: 1 addition & 1 deletion simcx/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# limitations under the License.
# -----------------------------------------------------------------------------

__version__ = '1.0.0-beta.22'
__version__ = '1.0.0-rc.1'

0 comments on commit 53662fd

Please sign in to comment.