[Avida-cvs] [Avida2-svn] r230 - trunk/source/python/AvidaGui2

kaben@myxo.css.msu.edu kaben at myxo.css.msu.edu
Tue Jul 12 10:00:12 PDT 2005


Author: kaben
Date: 2005-07-12 13:00:12 -0400 (Tue, 12 Jul 2005)
New Revision: 230

Modified:
   trunk/source/python/AvidaGui2/pyHardwareCPUTrace.py
   trunk/source/python/AvidaGui2/pyOneOrg_ScopeCtrl.py
   trunk/source/python/AvidaGui2/pyOrganismScopeCtrl.py
   trunk/source/python/AvidaGui2/pyOrganismScopeView.py
Log:

Bug fix to organism view:
- viewer is now willing to display non-viable organisms.



Modified: trunk/source/python/AvidaGui2/pyHardwareCPUTrace.py
===================================================================
--- trunk/source/python/AvidaGui2/pyHardwareCPUTrace.py	2005-07-12 16:24:52 UTC (rev 229)
+++ trunk/source/python/AvidaGui2/pyHardwareCPUTrace.py	2005-07-12 17:00:12 UTC (rev 230)
@@ -55,8 +55,15 @@
     self.m_ihead_moves_info.append(len(self.m_ihead_moves))
 
   def recordGenotypeSummary(self, analyze_genotype):
+    print "pyHardwareCPUTrace.recordGenotypeSummary() ..."
     self.m_is_viable = analyze_genotype.GetViable()
     self.m_gestation_time = analyze_genotype.GetGestTime()
     self.m_fitness = analyze_genotype.GetFitness()
     self.m_size = analyze_genotype.GetLength()
+    if not self.m_is_viable:
+      self.m_gestation_time = len(self.m_genome_info)
+    print "  self.m_is_viable", self.m_is_viable
+    print "  self.m_gestation_time", self.m_gestation_time
+    print "  self.m_fitness", self.m_fitness
+    print "  self.m_size", self.m_size
 

Modified: trunk/source/python/AvidaGui2/pyOneOrg_ScopeCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOneOrg_ScopeCtrl.py	2005-07-12 16:24:52 UTC (rev 229)
+++ trunk/source/python/AvidaGui2/pyOneOrg_ScopeCtrl.py	2005-07-12 17:00:12 UTC (rev 230)
@@ -60,6 +60,7 @@
     self.m_execution_step_slider.emit(qt.SIGNAL("valueChanged(int)"),(execution_step,))
 
   def sliderValueChangedSlot(self, frame_number):
+    print "pyOneOrg_ScopeCtrl.sliderValueChangedSlot(", frame_number, ")."
     self.m_organism_scope_ctrl.showFrame(frame_number)
 
   def sliderMovedSlot(self, frame_number):

Modified: trunk/source/python/AvidaGui2/pyOrganismScopeCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOrganismScopeCtrl.py	2005-07-12 16:24:52 UTC (rev 229)
+++ trunk/source/python/AvidaGui2/pyOrganismScopeCtrl.py	2005-07-12 17:00:12 UTC (rev 230)
@@ -77,6 +77,8 @@
   def setDebugOrganismFileSlot(self, organism_filename):
     print "pyOrganismScopeCtrl.setDebugOrganismFileSlot"
     if self.m_avida:
+      self.reset()
+
       inst_set = self.m_avida.m_environment.GetInstSet()
       org_file = open(organism_filename.ascii())
       org_string = org_file.readline()

Modified: trunk/source/python/AvidaGui2/pyOrganismScopeView.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOrganismScopeView.py	2005-07-12 16:24:52 UTC (rev 229)
+++ trunk/source/python/AvidaGui2/pyOrganismScopeView.py	2005-07-12 17:00:12 UTC (rev 230)
@@ -117,7 +117,10 @@
       if self.m_frames.m_ihead_moves is not None:
         #self.m_ihead_move_items = [QCanvasSpline(self.m_canvas) for i in xrange(len(self.m_frames.m_ihead_moves))]
         self.m_ihead_move_items = [pyHeadPath(self.m_canvas) for i in xrange(len(self.m_frames.m_ihead_moves))]
-      self.emit(PYSIGNAL("gestationTimeChangedSig"),(self.m_frames.m_gestation_time,))
+      if self.m_frames.m_is_viable:
+        self.emit(PYSIGNAL("gestationTimeChangedSig"),(self.m_frames.m_gestation_time,))
+      else:
+        self.emit(PYSIGNAL("gestationTimeChangedSig"),(len(self.m_frames.m_genome_info),))
       self.updateCircle()
       self.showFrame(0)
 
@@ -189,6 +192,10 @@
 
     circle_pts = None
 
+    if frame_number < 0:
+      print "pyOrganismScopeView.showFrame() : bad frame_number", frame_number, "reset to zero."
+      frame_number = 0
+
     if self.m_frames is not None and frame_number < self.m_frames.m_gestation_time:
       self.m_current_frame_number = frame_number
       self.m_current_radius = self.m_circle_radii[frame_number]
@@ -266,6 +273,8 @@
         if old_ihead_move is None:
           # Update all ihead_move_items.
           for i in xrange(self.m_current_ihead_move):
+            if len(self.m_ihead_move_items) < i:
+              print "pyOrganismScopeView.showFrame(): i", i, ", len(self.m_ihead_move_items)", len(self.m_ihead_move_items)
             ihead_move_item = self.m_ihead_move_items[self.m_current_ihead_move]
             anchor_radius = float(m_current_radius - 10)
             anchor_radii_ratio = anchor_radius / self.m_current_radius




More information about the Avida-cvs mailing list