→ summary
******************************************************************************************
Module Evolife.Graphics.Evolife_Graphic:
=======================================
EVOLIFE: Module Evolife_Graphic:
Windows that display Genomes, Labyrinth and Social networks for Evolife. Useful classes are:
- Genome_window: An image area that displays binary genomes
- Network_window: A drawing area that displays social links
- Field_window: A drawing area that displays agent movements
******************************************************************************************
**************************************************************************************
Class ViewEvent:
===============
returned information after click
**************************************************************************************
----------------------------------------------------------------------------------
Method ViewEvent.__init__
----------------------------------------------------------------------------------
Arguments:
. EmittingClass
. EventType
. Info
**************************************************************************************
Class AreaView: inherits from PyQt5.QtWidgets.QGraphicsView
==============
Standard canvas plus resizing capabilities
**************************************************************************************
----------------------------------------------------------------------------------
Method AreaView.__init__:
========================
Defining View: a window (QGraphicsView) that contains a plot area (QGraphicsScene)
----------------------------------------------------------------------------------
Arguments:
. AreaType
. parent
. image
. width
. height
. zoom
----------------------------------------------------------------------------------
Method AreaView.paintEvent:
==========================
calls Qt’s paintEvent
----------------------------------------------------------------------------------
Arguments:
. e
----------------------------------------------------------------------------------
Method AreaView.resizeEvent:
===========================
calls Qt’s resizeEvent
----------------------------------------------------------------------------------
Arguments:
. e
----------------------------------------------------------------------------------
Method AreaView.updateScene:
===========================
unused
----------------------------------------------------------------------------------
Arguments:
. L
----------------------------------------------------------------------------------
Method AreaView.photo:
=====================
takes a snapshot and saves it to a new file
----------------------------------------------------------------------------------
Arguments:
. Name
. FrameNumber
. outputDir
. extension
----------------------------------------------------------------------------------
Method AreaView.EventInterpreter:
================================
Does nothing here. To be overloaded
----------------------------------------------------------------------------------
Arguments:
. Event
**************************************************************************************
Class Active_Frame: inherits from Evolife.Graphics.Evolife_Graphic.AreaView
==================
An Active_frame reacts to basic keyboard control
**************************************************************************************
----------------------------------------------------------------------------------
Method Active_Frame.__init__:
============================
Creates a window (AreaView) with the appropriate AreaType (Draw_Area, Ground...)
----------------------------------------------------------------------------------
Arguments:
. AreaType
. parent
. control
. image
. width
. height
. zoom
----------------------------------------------------------------------------------
Method Active_Frame.keyPressEvent:
=================================
Definition of keyboard shortcuts
----------------------------------------------------------------------------------
Arguments:
. e
----------------------------------------------------------------------------------
Method Active_Frame.Raise:
=========================
puts the window on top of display
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Active_Frame.EventInterpreter
----------------------------------------------------------------------------------
Arguments:
. Event
**************************************************************************************
Class Satellite_window: inherits from Evolife.Graphics.Evolife_Graphic.Active_Frame
======================
Satellite windows are floating windows with zooming abilities
**************************************************************************************
----------------------------------------------------------------------------------
Method Satellite_window.__init__:
================================
calls the parents’ constructor with the appropriate area (QGraphicsScene) type
----------------------------------------------------------------------------------
Arguments:
. AreaType
. control
. Wtitle
. image
. width
. height
. zoom
----------------------------------------------------------------------------------
Method Satellite_window.dimension:
=================================
sets dimensions
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Satellite_window.keyPressEvent:
=====================================
adds resizing keys (+ and -) to Active_Frame’s shortcuts
----------------------------------------------------------------------------------
Arguments:
. e
----------------------------------------------------------------------------------
Method Satellite_window.image_display:
=====================================
display an image, with possible resizing of the window
----------------------------------------------------------------------------------
Arguments:
. Image
. windowResize
----------------------------------------------------------------------------------
Method Satellite_window.Zoom:
============================
increase the window’s size
----------------------------------------------------------------------------------
Arguments:
. ZoomFactor
----------------------------------------------------------------------------------
Method Satellite_window.DeZoom:
==============================
decrease the window’s size
----------------------------------------------------------------------------------
Arguments:
. DeZoomFactor
----------------------------------------------------------------------------------
Method Satellite_window.closeEvent:
==================================
destroys the window
----------------------------------------------------------------------------------
Arguments:
. event
**************************************************************************************
Class Image_window: inherits from Evolife.Graphics.Evolife_Graphic.Satellite_window
==================
Image_window: Merely contains an image area
**************************************************************************************
----------------------------------------------------------------------------------
Method Image_window.__init__:
============================
calls Satellite_window’s constructor
----------------------------------------------------------------------------------
Arguments:
. control
. Wtitle
. outputDir
**************************************************************************************
Class Genome_window: inherits from Evolife.Graphics.Evolife_Graphic.Satellite_window
===================
Genome_window: An image area that displays binary genomes
**************************************************************************************
----------------------------------------------------------------------------------
Method Genome_window.__init__:
=============================
calls Satellite_window’s constructor
and performs first display
----------------------------------------------------------------------------------
Arguments:
. control
. image
. genome
. gene_pattern
. outputDir
. zoom
----------------------------------------------------------------------------------
Method Genome_window.axes:
=========================
draws separation between genes
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Genome_window.genome_display:
===================================
genome gives, for each individual, the sequence of binary nucleotides
gene_pattern is a binary flag to signal gene alternation
----------------------------------------------------------------------------------
Arguments:
. genome
. gene_pattern
. Photo
. CurrentFrame
. Prefix
**************************************************************************************
Class Network_window: inherits from Evolife.Graphics.Evolife_Graphic.Satellite_window
====================
Network_window: A drawing area that displays social links
The population is displayed twice, on two horizontal axes.
Social links are displayed as ascending vectors from one individual
on the bottom line to another on the upper line.
**************************************************************************************
----------------------------------------------------------------------------------
Method Network_window.__init__:
==============================
calls Satellite_window’s constructor
----------------------------------------------------------------------------------
Arguments:
. control
. image
. outputDir
. width
. height
. zoom
----------------------------------------------------------------------------------
Method Network_window.axes:
==========================
Draws two horizontal axes; each axis represents the population;
social links are shown as vectors going from the lower line
to the upper one
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Network_window.Network_display:
=====================================
Social links are displayed as ascending vectors from one individual
on the bottom line to another on the upper line.
----------------------------------------------------------------------------------
Arguments:
. Layout
. network
. Photo
. CurrentFrame
. Prefix
----------------------------------------------------------------------------------
Method Network_window.Dump_network:
==================================
stores social links into a matrix written into a file
----------------------------------------------------------------------------------
Arguments:
. friends
. CurrentFrame
. Prefix
**************************************************************************************
Class Field_window: inherits from Evolife.Graphics.Evolife_Graphic.Satellite_window
==================
Field: A 2D widget that displays agent movements
**************************************************************************************
----------------------------------------------------------------------------------
Method Field_window.__init__
----------------------------------------------------------------------------------
Arguments:
. control
. Wtitle
. image
. outputDir
. width
. height
. zoom
----------------------------------------------------------------------------------
Method Field_window.Field_display:
=================================
displays agents at indicated positions
If Ongoing is false, agents that are not given positions are removed
Layout may come with two syntaxes:
- ((Agent1Id, Coordinates1), (Agent2Id, Coordinates2), ...)
- (Coordinates1, Coordinates2, ...)
The first format allows to move and erase agents
The second format is merely used to draw permanent blobs and lines
Coordinates have the following form:
(x, y, colour, size, ToX, ToY, segmentColour, segmentThickness, ‘shape=