→ summary
******************************************************************************************
Module Evolife.Graphics.Evolife_Window:
======================================
Evolife Window system
******************************************************************************************
--------------------------------------------------------------------------------------
Function Start:
==============
SimulationStep is a function that performs a simulation step
Obs is the observer that stores statistics
Capabilities (curves, genome display, trajectory display...)
= any string of letters from: CFGNTP
C = Curves
F = Field (2D seasonal display) (excludes R)
G = Genome display
I = Image (same as Field, but no slider)
L = Log Terminal
N = social network display
P = Photo (screenshot)
R = Region (2D ongoing display) (excludes F)
T = Trajectory display
Options is a dict:
- Run:True means that the simulation will run automatically
- Background:
- ExitOnEnd:True doesn’t pause when simulation stops
--------------------------------------------------------------------------------------
Arguments:
. SimulationStep
. Obs
. Capabilities
. Options
**************************************************************************************
Class Simulation_Control:
========================
Controls the simulation, either step by step, or in
a continuous mode.
**************************************************************************************
----------------------------------------------------------------------------------
Method Simulation_Control.__init__:
==================================
Stores Obs as observer
and SimulationStep as the function that processes one step of the simulation.
‘method’ can be ‘timer’ or ‘thread’ ('timer’ preferred)
----------------------------------------------------------------------------------
Arguments:
. SimulationStep
. Obs
. method
----------------------------------------------------------------------------------
Method Simulation_Control.RunButtonClick:
========================================
Entering in ‘Run’ mode
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Simulation_Control.StepButtonClick:
=========================================
Entering in ‘Step’ mode
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Simulation_Control.Simulation_stop:
=========================================
Stops the simulation thread or timer
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Simulation_Control.Simulation_launch:
===========================================
(re)starts the simulation thread or timer
----------------------------------------------------------------------------------
Arguments:
. continuous_mode
----------------------------------------------------------------------------------
Method Simulation_Control.Simulation_resume:
===========================================
calls Simulation_launch
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Simulation_Control.OneStep:
=================================
calls SimulationStep
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Simulation_Control.ReturnFromThread:
==========================================
to be overloaded
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Simulation_Control.DecisionToEnd:
=======================================
to be overloaded
----------------------------------------------------------------------------------
**************************************************************************************
Class Simulation_Control_Frame: inherits from Evolife.Graphics.Evolife_Window.Simulation_Control, Evolife.Graphics.Evolife_Graphic.Active_Frame
==============================
Minimal control panel with [Run] [Step] [Help] and [quit] buttons
**************************************************************************************
----------------------------------------------------------------------------------
Method Simulation_Control_Frame.__init__:
========================================
Creates a window with buttons that is also a Simulation_Control
----------------------------------------------------------------------------------
Arguments:
. SimulationStep
. Obs
----------------------------------------------------------------------------------
Method Simulation_Control_Frame.LocalButton:
===========================================
Creates a button
----------------------------------------------------------------------------------
Arguments:
. ParentFrame
. ButtonType
. Text
. Tip
. ClickFunction
. ShortCutKey
----------------------------------------------------------------------------------
Method Simulation_Control_Frame.EvolifeWebSite:
==============================================
opens Web browser with provided address
----------------------------------------------------------------------------------
Arguments:
. e
----------------------------------------------------------------------------------
Method Simulation_Control_Frame.HelpButtonClick:
===============================================
Displays a text file named: Help.txt
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Simulation_Control_Frame.QuitButtonClick:
===============================================
closes the window
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Simulation_Control_Frame.Raise:
=====================================
puts the window in front of display
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Simulation_Control_Frame.closeEvent:
==========================================
close satelite windows and stops the simulation
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Simulation_Control_Frame.SWDestroyed:
===========================================
A satellite window has been destroyed - removes it from the list
----------------------------------------------------------------------------------
Arguments:
. SW
----------------------------------------------------------------------------------
Method Simulation_Control_Frame.ReturnFromThread:
================================================
Processes graphic orders if in visible state
returns -1 if Observer says the simulation is over
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Simulation_Control_Frame.Process_graph_orders:
====================================================
Just let Observer know that display has taken place
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Simulation_Control_Frame.keyPressEvent:
=============================================
processes actions such as Run, Step, Help...
----------------------------------------------------------------------------------
Arguments:
. e
----------------------------------------------------------------------------------
Method Simulation_Control_Frame.EventInterpreter:
================================================
Sends event to observer (useful for mouse events)
----------------------------------------------------------------------------------
Arguments:
. Event
**************************************************************************************
Class Simulation_Display_Control_Frame: inherits from Evolife.Graphics.Evolife_Window.Simulation_Control_Frame
======================================
This class combines a control panel and a slider for controlling display period
**************************************************************************************
----------------------------------------------------------------------------------
Method Simulation_Display_Control_Frame.__init__:
================================================
Create Control frame + displayperiod slider
----------------------------------------------------------------------------------
Arguments:
. SimulationStep
. Obs
. Background
----------------------------------------------------------------------------------
Method Simulation_Display_Control_Frame.DisplayPeriodChanged:
============================================================
The displayed value varies exponentially with the slider’s position
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Simulation_Display_Control_Frame.DisplayPeriodSet
----------------------------------------------------------------------------------
Arguments:
. Period
. FlagForce
**************************************************************************************
Class Simulation_Frame: inherits from Evolife.Graphics.Evolife_Window.Simulation_Display_Control_Frame
======================
This class combines a control panel and a space to display curves
**************************************************************************************
----------------------------------------------------------------------------------
Method Simulation_Frame.__init__:
================================
Creates a plot area and displays it to the right of the control frame
----------------------------------------------------------------------------------
Arguments:
. SimulationStep
. Obs
. Background
----------------------------------------------------------------------------------
Method Simulation_Frame.LegendButtonClick:
=========================================
Displays a text file named:
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Simulation_Frame.Process_graph_orders:
============================================
Processes graph orders received from observer.
Displays PlotData by adding points to curves and by displaying them.
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Simulation_Frame.dump:
============================
store and print simulation results
----------------------------------------------------------------------------------
Arguments:
. verbose
----------------------------------------------------------------------------------
Method Simulation_Frame.closeEvent:
==================================
close parent closeEvent
----------------------------------------------------------------------------------
Arguments:
. event
**************************************************************************************
Class Evolife_Frame: inherits from Evolife.Graphics.Evolife_Window.Simulation_Frame
===================
Defines Evolife main window by modification of the generic Simulation Frame
**************************************************************************************
----------------------------------------------------------------------------------
Method Evolife_Frame.__init__:
=============================
Creation of the main window and active satelite windows
----------------------------------------------------------------------------------
Arguments:
. SimulationStep
. Obs
. Capabilities
. Options
----------------------------------------------------------------------------------
Method Evolife_Frame.keyPressEvent:
==================================
recognizes shortcuts to show satelite windows (Genomes, Trajectories, Field, Legend, Film...)
----------------------------------------------------------------------------------
Arguments:
. e
----------------------------------------------------------------------------------
Method Evolife_Frame.GenomeButtonClick
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Evolife_Frame.PhotoButtonClick:
=====================================
saves a snapshot of the simulation and goes to stepwise mode
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Evolife_Frame.FilmButtonClick:
====================================
Film mode is activated by pressing the ‘V’ key (video)
It results in images (snapshots) being saved each time Observer is ‘visible’
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Evolife_Frame.TrajectoryButtonClick:
==========================================
displays the ‘Trajectories’ window
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Evolife_Frame.NetworkButtonClick:
=======================================
displays the ‘Network’ window
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Evolife_Frame.FieldButtonClick:
=====================================
displays the ‘Field’ window
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Evolife_Frame.LogButtonClick:
===================================
[not implemented]
----------------------------------------------------------------------------------
Arguments:
. event
----------------------------------------------------------------------------------
Method Evolife_Frame.WindowActivation:
=====================================
Sets Satellite window’s geometry, icon and title
----------------------------------------------------------------------------------
Arguments:
. WindowName
----------------------------------------------------------------------------------
Method Evolife_Frame.checkButtonState:
=====================================
sets the availability of the ‘Network’, ‘Field’, ‘Image’, ‘Trajectories’ tick button on display
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Evolife_Frame.Process_graph_orders:
=========================================
Processes graph orders received from observer.
Parent class displays PlotData by adding points to curves and by displaying them.
In addition, gets orders for satelite windows from Oberver and processes them.
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Evolife_Frame.DecisionToEnd:
==================================
Exits if ‘ExitOnEnd’ is True
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Evolife_Frame.SWDestroyed
----------------------------------------------------------------------------------
Arguments:
. SW
----------------------------------------------------------------------------------
Method Evolife_Frame.closeEvent
----------------------------------------------------------------------------------
Arguments:
. event
Back to Evolife