[Avida-cvs] [Avida2-svn] r69 - trunk/source/python/AvidaGui2
jclune at myxo.css.msu.edu
jclune at myxo.css.msu.edu
Thu Mar 24 10:28:37 PST 2005
Author: jclune
Date: 2005-03-24 13:28:37 -0500 (Thu, 24 Mar 2005)
New Revision: 69
Modified:
trunk/source/python/AvidaGui2/pyEduWorkspaceView.ui
trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
trunk/source/python/AvidaGui2/pyOnePop_PetriDishView.py
trunk/source/python/AvidaGui2/pyOnePop_StatsCtrl.py
trunk/source/python/AvidaGui2/pyPetriConfigureView.py
trunk/source/python/AvidaGui2/pyPetriDishCtrl.py
Log:
Adding my stats code that serves up information about the population to the viewer. Graphing should now work again as well.
Modified: trunk/source/python/AvidaGui2/pyEduWorkspaceView.ui
===================================================================
--- trunk/source/python/AvidaGui2/pyEduWorkspaceView.ui 2005-03-24 17:10:58 UTC (rev 68)
+++ trunk/source/python/AvidaGui2/pyEduWorkspaceView.ui 2005-03-24 18:28:37 UTC (rev 69)
@@ -17,10 +17,30 @@
<rect>
<x>0</x>
<y>0</y>
- <width>636</width>
- <height>460</height>
+ <width>1024</width>
+ <height>768</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>1024</width>
+ <height>768</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>1024</width>
+ <height>768</height>
+ </size>
+ </property>
<property name="caption">
<string>pyEduWorkspaceView</string>
</property>
@@ -144,7 +164,7 @@
<container>0</container>
<sizepolicy>
<hordata>3</hordata>
- <verdata>3</verdata>
+ <verdata>0</verdata>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -154,6 +174,8 @@
<property type="3">-1</property>
<property type="1">pyFreezerView</property>
<property type="3">-1</property>
+ <property type="1">pyFreezerView</property>
+ <property type="4">-1</property>
<property type="pyFreezerView"></property>
<property type="-1">1</property>
</customwidget>
@@ -167,7 +189,7 @@
<container>0</container>
<sizepolicy>
<hordata>3</hordata>
- <verdata>3</verdata>
+ <verdata>0</verdata>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -177,6 +199,8 @@
<property type="3">-1</property>
<property type="1">pyNavBarView</property>
<property type="3">-1</property>
+ <property type="1">pyNavBarView</property>
+ <property type="4">-1</property>
<property type="pyNavBarView"></property>
<property type="-1">1</property>
</customwidget>
Modified: trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py 2005-03-24 17:10:58 UTC (rev 68)
+++ trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py 2005-03-24 18:28:37 UTC (rev 69)
@@ -13,7 +13,6 @@
def construct(self, session_mdl):
self.m_session_mdl = session_mdl
-
self.m_petri_dish_ctrl.construct(self.m_session_mdl)
self.m_gradient_scale_ctrl.construct(self.m_session_mdl)
self.m_live_controls_ctrl.construct(self.m_session_mdl)
Modified: trunk/source/python/AvidaGui2/pyOnePop_PetriDishView.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOnePop_PetriDishView.py 2005-03-24 17:10:58 UTC (rev 68)
+++ trunk/source/python/AvidaGui2/pyOnePop_PetriDishView.py 2005-03-24 18:28:37 UTC (rev 69)
@@ -2,8 +2,8 @@
# Form implementation generated from reading ui file 'pyOnePop_PetriDishView.ui'
#
-# Created: Tue Mar 8 11:55:58 2005
-# by: The PyQt User Interface Compiler (pyuic) 3.14
+# Created: Mon Mar 21 13:54:16 2005
+# by: The PyQt User Interface Compiler (pyuic) 3.13
#
# WARNING! All changes made in this file will be lost!
@@ -261,13 +261,13 @@
layout179 = QHBoxLayout(None,0,6,"layout179")
self.pixmapLabel1 = QLabel(self,"pixmapLabel1")
- self.pixmapLabel1.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.pixmapLabel1.sizePolicy().hasHeightForWidth()))
+ self.pixmapLabel1.setSizePolicy(QSizePolicy(0,0,0,0,self.pixmapLabel1.sizePolicy().hasHeightForWidth()))
self.pixmapLabel1.setPixmap(self.image0)
self.pixmapLabel1.setScaledContents(1)
layout179.addWidget(self.pixmapLabel1)
self.textLabel3 = QLabel(self,"textLabel3")
- self.textLabel3.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Preferred,0,0,self.textLabel3.sizePolicy().hasHeightForWidth()))
+ self.textLabel3.setSizePolicy(QSizePolicy(3,5,0,0,self.textLabel3.sizePolicy().hasHeightForWidth()))
textLabel3_font = QFont(self.textLabel3.font())
textLabel3_font.setPointSize(11)
self.textLabel3.setFont(textLabel3_font)
@@ -298,11 +298,11 @@
layout91 = QHBoxLayout(None,0,6,"layout91")
self.m_petri_dish_ctrl = pyPetriDishCtrl(self.WStackPage,"m_petri_dish_ctrl")
- self.m_petri_dish_ctrl.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.MinimumExpanding,5,0,self.m_petri_dish_ctrl.sizePolicy().hasHeightForWidth()))
+ self.m_petri_dish_ctrl.setSizePolicy(QSizePolicy(3,3,5,0,self.m_petri_dish_ctrl.sizePolicy().hasHeightForWidth()))
layout91.addWidget(self.m_petri_dish_ctrl)
self.m_gradient_scale_ctrl = pyGradientScaleCtrl(self.WStackPage,"m_gradient_scale_ctrl")
- self.m_gradient_scale_ctrl.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Minimum,1,0,self.m_gradient_scale_ctrl.sizePolicy().hasHeightForWidth()))
+ self.m_gradient_scale_ctrl.setSizePolicy(QSizePolicy(0,1,1,0,self.m_gradient_scale_ctrl.sizePolicy().hasHeightForWidth()))
self.m_gradient_scale_ctrl.setMinimumSize(QSize(50,50))
self.m_gradient_scale_ctrl.setBackgroundMode(pyGradientScaleCtrl.PaletteDark)
layout91.addWidget(self.m_gradient_scale_ctrl)
@@ -311,26 +311,26 @@
layout1 = QHBoxLayout(None,0,6,"layout1")
self.textLabel11 = QLabel(self.WStackPage,"textLabel11")
- self.textLabel11.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Minimum,0,0,self.textLabel11.sizePolicy().hasHeightForWidth()))
+ self.textLabel11.setSizePolicy(QSizePolicy(0,1,0,0,self.textLabel11.sizePolicy().hasHeightForWidth()))
layout1.addWidget(self.textLabel11)
self.m_update_label = QLabel(self.WStackPage,"m_update_label")
- self.m_update_label.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Minimum,0,0,self.m_update_label.sizePolicy().hasHeightForWidth()))
+ self.m_update_label.setSizePolicy(QSizePolicy(0,1,0,0,self.m_update_label.sizePolicy().hasHeightForWidth()))
layout1.addWidget(self.m_update_label)
self.m_mode_combobox = QComboBox(0,self.WStackPage,"m_mode_combobox")
- self.m_mode_combobox.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Fixed,0,0,self.m_mode_combobox.sizePolicy().hasHeightForWidth()))
+ self.m_mode_combobox.setSizePolicy(QSizePolicy(1,0,0,0,self.m_mode_combobox.sizePolicy().hasHeightForWidth()))
m_mode_combobox_font = QFont(self.m_mode_combobox.font())
m_mode_combobox_font.setPointSize(11)
self.m_mode_combobox.setFont(m_mode_combobox_font)
layout1.addWidget(self.m_mode_combobox)
self.textLabel10 = QLabel(self.WStackPage,"textLabel10")
- self.textLabel10.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Minimum,0,0,self.textLabel10.sizePolicy().hasHeightForWidth()))
+ self.textLabel10.setSizePolicy(QSizePolicy(0,1,0,0,self.textLabel10.sizePolicy().hasHeightForWidth()))
layout1.addWidget(self.textLabel10)
self.m_zoom_spinbox = QSpinBox(self.WStackPage,"m_zoom_spinbox")
- self.m_zoom_spinbox.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.m_zoom_spinbox.sizePolicy().hasHeightForWidth()))
+ self.m_zoom_spinbox.setSizePolicy(QSizePolicy(0,0,0,0,self.m_zoom_spinbox.sizePolicy().hasHeightForWidth()))
layout1.addWidget(self.m_zoom_spinbox)
layout10.addLayout(layout1)
@@ -339,7 +339,7 @@
layout229.addItem(spacer169_2)
self.m_live_controls_ctrl = pyLiveControlsCtrl(self.WStackPage,"m_live_controls_ctrl")
- self.m_live_controls_ctrl.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.m_live_controls_ctrl.sizePolicy().hasHeightForWidth()))
+ self.m_live_controls_ctrl.setSizePolicy(QSizePolicy(0,0,0,0,self.m_live_controls_ctrl.sizePolicy().hasHeightForWidth()))
self.m_live_controls_ctrl.setMinimumSize(QSize(0,50))
layout229.addWidget(self.m_live_controls_ctrl)
spacer169 = QSpacerItem(10,10,QSizePolicy.MinimumExpanding,QSizePolicy.Minimum)
@@ -352,7 +352,7 @@
WStackPageLayout_2 = QHBoxLayout(self.WStackPage_2,11,6,"WStackPageLayout_2")
self.m_petri_configure_ctrl = pyPetriConfigureCtrl(self.WStackPage_2,"m_petri_configure_ctrl")
- self.m_petri_configure_ctrl.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.MinimumExpanding,0,0,self.m_petri_configure_ctrl.sizePolicy().hasHeightForWidth()))
+ self.m_petri_configure_ctrl.setSizePolicy(QSizePolicy(3,3,0,0,self.m_petri_configure_ctrl.sizePolicy().hasHeightForWidth()))
self.m_petri_configure_ctrl.setAcceptDrops(1)
WStackPageLayout_2.addWidget(self.m_petri_configure_ctrl)
self.m_petri_dish_widget_stack.addWidget(self.WStackPage_2,1)
Modified: trunk/source/python/AvidaGui2/pyOnePop_StatsCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOnePop_StatsCtrl.py 2005-03-24 17:10:58 UTC (rev 68)
+++ trunk/source/python/AvidaGui2/pyOnePop_StatsCtrl.py 2005-03-24 18:28:37 UTC (rev 69)
@@ -30,4 +30,76 @@
self.avidaUpdatedSlot)
def avidaUpdatedSlot(self):
- pass
\ No newline at end of file
+ stats = self.m_avida.m_population.GetStats()
+
+ #STATISTICS WINDOW
+ avg_merit = stats.GetAveMerit()
+ self.m_avg_merit.setText(QString("%1").arg(avg_merit))
+
+ dom_merit = stats.GetDomMerit()
+ self.m_dom_merit.setText(QString("%1").arg(dom_merit))
+
+ num_orgs = stats.GetNumCreatures()
+ self.m_num_orgs.setText(QString("%1").arg(num_orgs))
+
+ avg_gest = stats.GetAveGestation()
+ self.m_avg_gest.setText(QString("%1").arg(avg_gest))
+
+ #TASK OUTLOOK
+
+ #if num_orgs_doing_a_given_task is above this number, we say the pop is doing this task
+ m_org_threshold = 1
+
+ num_not = stats.GetTaskLastCount(0)
+ if num_not > m_org_threshold:
+ self.m_num_not.setText(QString("yes"))
+ else:
+ self.m_num_not.setText(QString("no"))
+
+ num_nand = stats.GetTaskLastCount(1)
+ if num_nand > m_org_threshold:
+ self.m_num_nand.setText(QString("yes"))
+ else:
+ self.m_num_nand.setText(QString("no"))
+
+ num_and = stats.GetTaskLastCount(2)
+ if num_and > m_org_threshold:
+ self.m_num_and.setText(QString("yes"))
+ else:
+ self.m_num_and.setText(QString("no"))
+
+ num_ornot = stats.GetTaskLastCount(3)
+ if num_ornot > m_org_threshold:
+ self.m_num_ornot.setText(QString("yes"))
+ else:
+ self.m_num_ornot.setText(QString("no"))
+
+ num_or = stats.GetTaskLastCount(4)
+ if num_or > m_org_threshold:
+ self.m_num_or.setText(QString("yes"))
+ else:
+ self.m_num_or.setText(QString("no"))
+
+ num_andnot = stats.GetTaskLastCount(5)
+ if num_andnot > m_org_threshold:
+ self.m_num_andnot.setText(QString("yes"))
+ else:
+ self.m_num_andnot.setText(QString("no"))
+
+ num_nor = stats.GetTaskLastCount(6)
+ if num_nor > m_org_threshold:
+ self.m_num_nor.setText(QString("yes"))
+ else:
+ self.m_num_nor.setText(QString("no"))
+
+ num_xor = stats.GetTaskLastCount(7)
+ if num_xor > m_org_threshold:
+ self.m_num_xor.setText(QString("yes"))
+ else:
+ self.m_num_xor.setText(QString("no"))
+
+ num_equals = stats.GetTaskLastCount(8)
+ if num_equals > m_org_threshold:
+ self.m_num_equals.setText(QString("yes"))
+ else:
+ self.m_num_equals.setText(QString("no"))
Modified: trunk/source/python/AvidaGui2/pyPetriConfigureView.py
===================================================================
--- trunk/source/python/AvidaGui2/pyPetriConfigureView.py 2005-03-24 17:10:58 UTC (rev 68)
+++ trunk/source/python/AvidaGui2/pyPetriConfigureView.py 2005-03-24 18:28:37 UTC (rev 69)
@@ -2,8 +2,8 @@
# Form implementation generated from reading ui file 'pyPetriConfigureView.ui'
#
-# Created: Thu Mar 17 15:21:49 2005
-# by: The PyQt User Interface Compiler (pyuic) 3.14
+# Created: Mon Mar 21 13:53:44 2005
+# by: The PyQt User Interface Compiler (pyuic) 3.13
#
# WARNING! All changes made in this file will be lost!
@@ -97,7 +97,7 @@
layout94 = QHBoxLayout(None,0,6,"layout94")
self.DeathButtonGroup = QButtonGroup(self,"DeathButtonGroup")
- self.DeathButtonGroup.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.MinimumExpanding,1,0,self.DeathButtonGroup.sizePolicy().hasHeightForWidth()))
+ self.DeathButtonGroup.setSizePolicy(QSizePolicy(3,3,1,0,self.DeathButtonGroup.sizePolicy().hasHeightForWidth()))
self.DeathButtonGroup.setFrameShadow(QButtonGroup.Plain)
self.DeathButtonGroup.setLineWidth(0)
self.DeathButtonGroup.setFlat(1)
Modified: trunk/source/python/AvidaGui2/pyPetriDishCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyPetriDishCtrl.py 2005-03-24 17:10:58 UTC (rev 68)
+++ trunk/source/python/AvidaGui2/pyPetriDishCtrl.py 2005-03-24 18:28:37 UTC (rev 69)
@@ -57,6 +57,83 @@
self.m_cell_info[x][y].setPen(QPen(QColor(x*255/world_w, y*255/world_h, x*y*255/(world_w*world_h))))
self.m_cell_info[x][y].show()
+
+
+ def mousePressEvent(self,e):
+ if e.button() != Qt.LeftButton:
+ return
+ print "mouse pressed"
+ a = e.x()
+ b = e.y()
+
+ world_w = cConfig.GetWorldX()
+ world_h = cConfig.GetWorldY()
+
+ print "world_w is %d, world_h is %d" %(world_w,world_h)
+
+
+ print "e.x is %f, e.y is %f" %(a,b)
+
+
+ clicked_map_cell_w = round(float(e.x())/2.0)
+ clicked_map_cell_h = round(float(e.y())/2.0)
+
+ print "clicked_map_cell_w is %f, clicked_map_cell_h is %f" %(clicked_map_cell_w,clicked_map_cell_h)
+
+
+ #get the cell number in avida that corresponds to this coordinate
+ world_w_mid = world_w/2
+ world_h_mid = world_h/2
+ bottom_left_cell = ((((world_h+1)-world_w_mid)*world_w) - world_w_mid)
+
+ if clicked_map_cell_h == world_h_mid: #if it is on the y midpoint line that gets split...
+ if clicked_map_cell_w >= world_w_mid: #and it is after the origin (first avida cell)
+ clickedCellNum = clicked_map_cell_w - world_w_mid
+ else:
+ clickedCellNum = ((world_h_mid-1)*world_w)+ bottom_left_cell + clicked_map_cell_w
+ elif clicked_map_cell_h > world_h_mid: #if above the split
+ print "here"
+ clickedCellNum = ( (clicked_map_cell_h - (world_h_mid + 1))*world_w ) + world_h_mid + clicked_map_cell_w
+ elif clicked_map_cell_h < world_h_mid: #if below the spilt
+ clickedCellNum = ( bottom_left_cell + ( ((clicked_map_cell_h - 1)* world_w) + clicked_map_cell_w) )
+ else:
+ print "ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
+
+ print "clickedCellNum is %f" %(clickedCellNum)
+
+# clickedCell = self.m_avida.m_population.GetCell(int(clickedCellNum))
+# print "clickedCell.IsOccupied() returns "
+
+
+
+ #get the cell number in avida that corresponds to this coordinate
+# world_w_mid = world_w/2
+# world_h_mid = world_h/2
+
+# if clicked_map_cell_h == world_h_mid: #if it is on the y midpoint line that gets split...
+# if clicked_map_cell_w >= world_w_mid: #and it is after the origin (first avida cell)
+# clickedCellNum = clicked_map_cell_w - world_w_mid
+# else:
+# clickedCellNum = (world_h*world_w)+BOTTOMLEFT+clicked_map_cell_w
+# elif clicked_map_cell_h > world_h_mid: #if above the split
+# clickedCellNum = ( (clicked_map_cell_h - (world_h_mid + 1))*world_w ) + clicked_map_cell_w
+# elif clicked_map_cell_h < world_h_mid: #if below the spilt
+# clickedCellNum = ( ( ( (world_h+1)-world_w_mid)*world_w) - world_w_mid) + clicked_map_cell_w
+# else:
+# print "ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
+
+ clickedCellNum = 20000
+ print "clickedCellNum is %f" %(clickedCellNum)
+
+
+ #the line below does not work, delete
+ #clickedCell = self.m_avida.m_population.GetCell(int(clicked_map_cell_w) + world_w*int(clicked_map_cell_h))
+ clickedCell = self.m_avida.m_population.GetCell(int(clickedCellNum))
+ print "clickedCell.IsOccupied() returns "
+ print clickedCell.IsOccupied()
+
+
+
def construct(self, session_mdl):
self.m_session_mdl = session_mdl
self.m_avida = None
More information about the Avida-cvs
mailing list