Simulator classes are derived from either PySide.QtCore.QObject, PyQt.QtCore.QObject, so that the signals-and-slots mechanism can be used.
The tutorial section handles the simulator and target classes in more detail in the tutorial about creating custom StepFunc objects
A Simulator object holds together information about and functionality of cellular automaton simulators.
This class serves as the base for simulator objects.
If you ever derive from this class and you get an error like “PySide.QtCore.Signal object has no attribute ‘emit’”, then you have most likely forgotten to call super’s __init__.
The shape of the cellular space of this automaton.
It’s a tuple with the size of each dimension as entries.
This excludes any borders that have redundant cells in them.
The number of the current step, beginning with the initial configuration being step 0.
How many steps back the simulator can go.
Wether the simulator needs to run any kind of preparation before being able to perform steps
Dictionary fro different display options and their extra data.
colors32: list or dictionary of 32bit padded RGB values, like QImage::Format_RGB32 qcolors: list or dictionary of QColor values tiles: dictionary with ‘images’, an image map and ‘rects’, a dictionary of rects chars: list or dictionary of ascii/unicode values cboxes: list or dictionary of multiline ascii/unicode values hexcols: list or dictionary of colors usable in css-like color definitions.
Is emitted when the conf has changed as result of a step.
Is emitted when the configuration has changed, but there was no step.
Is emitted when continuous updating has been started.
Is emitted when continuous updating has been stopped.
Is emitted when a snapshot has been taken.
Is emitted when a snapshot is restored or a completely new configuration has been set.
The extra-attributes the target has to offer, such as histogram.
A proxy object to access the target_attrs.
Information about the last configuration change.
May be 1. a rectangle (x, y, w, h) that has been changed 2. None, if everything changed.
Returns a copy of the configuration space as a numpy array. Its shape matches up with shape, so it also does not include any borders.
Sets a new config for the simulator.
Set the config value at pos to value.
If value is None, flip the value instead.
Step the simulator once.
Duplicate the simulator.
Call this to notify views, that continuous updates have been started.
Call this to notify views, that continuous updates have been stopped.
Get a lightweight snapshot of this simulator, that can be restored again later on.
This emits the snapshot_taken signal.
Restore the simulator to an earlier state.
This emits the sanpshot_restored signal.
Reset the simulator by using the same generator that was initially used, if it’s still available, or set a new configurator for the future and reset the configuration with it once.
See also cagen.config
This Simulator takes a StepFunc instance and packs it in an interface compatible with SimulatorInterface.
Return the config, sans borders.
Delegate the stepping to the StepFunc.step() method, then emit updated.
Step the simulator using the weave.inline version of the code.
Step the simulator using the pure python code version.
This Simulator has a few special options available only if you have an elementary step func with a rule number.
The rule number of the target.
The module isn’t dependent on Qt, as the lightweight_signal module supplies a simple compatible Signal implementation.
File: lightweight_signal.py Author: Thiago Marcos P. Santos Created: August 28, 2008
Purpose: A signal/slot implementation
This code was taken from http://code.activestate.com/recipes/576477/ It’s supposed to serve as a drop-in replacement for PyQt/PySide Signals.
Modifications have been made to it to make them behave more like Signals from Qt4.
A lightweight Signal class when Qt is not installed.
Create the Signal object. The type signatures are ignored.
Emit the signal, call all slots that are connected.
Connect this signal to a slot.
Disconnect this signal from a slot.