[Avida-cvs] [avida-svn] r784 - branches/developers/avida-edward/source/python/AvidaGui2

jclune@myxo.css.msu.edu jclune at myxo.css.msu.edu
Wed Jun 28 00:40:28 PDT 2006


Author: jclune
Date: 2006-06-28 03:40:28 -0400 (Wed, 28 Jun 2006)
New Revision: 784

Modified:
   branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyAvida.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyPetriDishCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py
Log:
Ancestor cells (but not necessarily full petri dishes) are now outlined.

Modified: branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup.py	2006-06-28 02:14:32 UTC (rev 783)
+++ branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup.py	2006-06-28 07:40:28 UTC (rev 784)
@@ -10,6 +10,6 @@
 def Interactive():
   import IPython
   import __builtin__
-  ipython_shell = IPython.Shell.IPShell(argv=["-c", "import iqt; import AvidaGui2; from AvidaGui2.Avida_ED_startup_utils import *; AvidaCore.cConfig.InitGroupList(); avida_ed = AvidaEd();print 'Fooooooooooooooooooooooooo!'"])
+  ipython_shell = IPython.Shell.IPShell(argv=["-c", "import iqt; import AvidaGui2; from AvidaGui2.Avida_ED_startup_utils import *; AvidaCore.cConfig.InitGroupList(); avida_ed = AvidaEd();"])
   ipython_shell.mainloop()
 

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyAvida.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyAvida.py	2006-06-28 02:14:32 UTC (rev 783)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyAvida.py	2006-06-28 07:40:28 UTC (rev 784)
@@ -46,7 +46,6 @@
 
     self.m_avida_threaded_driver = pyAvidaThreadedDriver(self.m_environment)
     self.m_avida_threaded_driver.construct()
-    print "I am making a population!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
     self.m_population = self.m_avida_threaded_driver.GetPopulation()
     print "Population made"
     self.m_avida_thread_mdtr = pyMdtr()

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py	2006-06-28 02:14:32 UTC (rev 783)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py	2006-06-28 07:40:28 UTC (rev 784)
@@ -439,6 +439,7 @@
     # If the user clicks the repopulate button pretend that they double
     # click the default empty petri dish from the freezer
 
+    print " RESTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARTING"
     file_name = os.path.join(self.m_session_mdl.m_current_freezer, 
       "@default.empty")
     thawed_item = pyReadFreezer(file_name)
@@ -447,6 +448,7 @@
     self.m_session_mdl.m_session_mdtr.emit(
       PYSIGNAL("freezerItemDoubleClicked"), (file_name, ))
 
+
   def addStatusBarWidgetSlot(self, *args):
     widget = args[0]
     pt = QPoint()

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py	2006-06-28 02:14:32 UTC (rev 783)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py	2006-06-28 07:40:28 UTC (rev 784)
@@ -22,7 +22,6 @@
     self.m_session_mdl = session_mdl
 
   def contentsDropEvent(self, e):
-    print "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
     descr(e)
     freezer_item_name = QString()
     if e.source() is self:

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py	2006-06-28 02:14:32 UTC (rev 783)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py	2006-06-28 07:40:28 UTC (rev 784)
@@ -63,7 +63,6 @@
     self.m_map_profile = pyMapProfile(self.m_session_mdl)
     for i in range(self.m_map_profile.getSize()):
       self.m_mode_combobox.insertItem(self.m_map_profile.getModeName(i))
-    print "emiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiting"
     self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("initializeWithDefaultPetriDishSig"),())
 
  
@@ -248,10 +247,6 @@
             return
 
       self.RenameDishSlot(dish_name)
-      print "8888888888888888888888888888888888888888888888888888888888888888"
-#      self.m_session_mdl.m_session_mdtr.emit(
-#           PYSIGNAL("doInitializeAvidaPhaseISig"),
-#           (self.m_session_mdl.m_tempdir,))
       #self.MakeConfigVisibleSlot()
       self.finishedPetriDish = False
       self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("FillDishSig"), 
@@ -266,6 +261,7 @@
         self.m_session_mdl.m_session_mdtr.emit(
           PYSIGNAL("restartPopulationSig"), (self.m_session_mdl, ))
 
+
   def finishedPetriDishSlot(self):
     descr()
     self.finishedPetriDish = True

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py	2006-06-28 02:14:32 UTC (rev 783)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py	2006-06-28 07:40:28 UTC (rev 784)
@@ -442,7 +442,8 @@
     # (ie saved)
 
     self.full_petri_dict["SETTINGS"] = self.Form2Dictionary()
-    write_object = pyWriteGenesisEvent(self.full_petri_dict, 
+    write_object = pyWriteGenesisEvent(self.full_petri_dict,
+      self.m_session_mdl, 
       self.m_session_mdl.m_current_workspace,
       self.m_session_mdl.m_current_freezer, self.m_session_mdl.m_tempdir,
       self.m_session_mdl.m_tempdir_out)

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyPetriDishCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyPetriDishCtrl.py	2006-06-28 02:14:32 UTC (rev 783)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyPetriDishCtrl.py	2006-06-28 07:40:28 UTC (rev 784)
@@ -65,7 +65,15 @@
     self.m_change_list = None
     self.m_org_clicked_on_item = None
     self.m_occupied_cells_ids = []
+    self.m_avida_has_started = False
 
+    self.connect(
+      self.m_session_mdl.m_session_mdtr, PYSIGNAL("doStartAvidaSig"),
+      self.doStartAvidaSlot)
+#    if you read this, delete this chunk of comments
+#    self.connect(
+#      self.m_session_mdl.m_session_mdtr, PYSIGNAL("doInitializeAvidaPhaseISig"),
+#      self.doSetAvidaHasStartedFalseSlot)
     self.connect( self.m_session_mdl.m_session_mdtr, PYSIGNAL("setAvidaSig"), 
       self.setAvidaSlot)
     self.connect( self.m_canvas_view, PYSIGNAL("orgClickedOnSig"), 
@@ -91,10 +99,8 @@
     self.connect(self.m_petri_dish_ctrl_v_scrollBar, SIGNAL("prevLine()"), 
                  self.vbarScrollPrevLineSlot)    
 
-#  def resizeEvent (self, event):
-#    print "JUST RESIZED----------------------------------------------------->"
-#    print self.width()
-#    print self.height()
+  def doStartAvidaSlot (self):
+    self.m_avida_has_started = True
 
 
 
@@ -138,6 +144,11 @@
     else:
       self.m_world_w = 30
       self.m_world_h = 30
+
+    self.m_avida_has_started = False
+    print "SEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEET"
+
+
       
     self.m_initial_target_zoom = int(self.m_target_dish_width / self.m_world_w)
     self.emit(PYSIGNAL("zoomSig"), (self.m_initial_target_zoom,))
@@ -164,11 +175,21 @@
     self.m_occupied_cells_ids = []
 
     if self.m_avida is not None:
-      print "COULD PAINT CELLS HERE"
-      cell_info_item = self.updateCellItem(465)
-      #cell_info_item.setPen(QPen(QColor(Qt.gray)))
+      print "ABOUT TO OUTLINE CELLS"
+      m_founding_cells_dict = self.m_session_mdl.m_founding_cells_dict
 
+      for k, v in m_founding_cells_dict.iteritems():
+        print k
+        cell_info_item = self.updateCellItem(int(k))
+        cell_info_item.setPen(QPen(QColor(Qt.gray)))
 
+      print "CELLS OUTLINED"
+
+#      cell_info_item = self.updateCellItem(475)
+#      cell_info_item.setPen(QPen(QColor(Qt.gray)))
+#      why doesn't this work?
+#      cell_info_item.setBrush(QBrush(QColor((Qt.gray))))
+
     self.m_thread_work_cell_item_index = 0
     self.m_cs_min_value = 0
     self.m_cs_value_range = 0
@@ -206,11 +227,16 @@
           self.updateCellItems(self.m_last_m_org_clicked_on_item.m_population_cell.GetID())
 
   def updateCellItem(self, cell_id):
-    #print "Kabennnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
     if self.m_cell_info[cell_id] is None:
       self.m_cell_info[cell_id] = self.createNewCellItem(cell_id)
     cell_info_item = self.m_cell_info[cell_id]
     self.m_indexer(cell_info_item, self.m_cs_min_value, self.m_cs_value_range)
+    #the following could be moved to a one off function at the beginning of a run
+    #for speed efficiency. currenly it is checked every time a cell is updated
+    if ( (cell_info_item.pen().color() == QColor((Qt.gray))) & self.m_avida_has_started == True):
+      print "77777777777777777777777777777777777777777777777777777" 
+      cell_info_item.setPen(QPen(Qt.NoPen))
+
     cell_info_item.updateColorUsingFunctor(self.m_color_lookup_functor)
 
     if self.m_org_clicked_on_item:

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py	2006-06-28 02:14:32 UTC (rev 783)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py	2006-06-28 07:40:28 UTC (rev 784)
@@ -62,7 +62,7 @@
     self.m_session_mdl.saved_empty_dish = False
     self.m_session_mdl.saved_full_dish = False
     self.m_session_mdl.new_empty_dish = True
-    self.m_session_mdl.new_full_dish = True
+    self.m_session_mdl.new_full_dish = True  
 
     # flag to see if user has chosen a workspace for this session
 
@@ -73,6 +73,9 @@
     self.m_session_mdl.m_current_workspace = "default.workspace"
     self.m_session_mdl.m_current_freezer = os.path.join(self.m_session_mdl.m_current_workspace, "freezer")
 
+    # set a global variable for the location of starting cells
+    self.m_session_mdl.m_founding_cells_dict = None
+
     # BDB -- hack to overcome problem with program crashing when Core ends
 
     self.m_session_mdl.m_update_to_pause = -99

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py	2006-06-28 02:14:32 UTC (rev 783)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py	2006-06-28 07:40:28 UTC (rev 784)
@@ -7,9 +7,11 @@
 
 class pyWriteGenesisEvent:
 
-  def __init__(self, in_dict = None, workspace_dir = None, freeze_dir = None,
+  def __init__(self, in_dict = None, session_mdl = None, workspace_dir = None, freeze_dir = None,
     tmp_in_dir = None, tmp_out_dir = None):
   
+    self.m_session_mdl = session_mdl
+
     settings_dict = in_dict["SETTINGS"]
 	
     # Copies default event file and add to the 
@@ -44,6 +46,9 @@
           self.start_cell_location = self.find_location(world_x, world_y, 
              num_ancestors, i)
           cells_dict[str(self.start_cell_location)] = str(i)
+          print "CELL DICT IS ", self.m_session_mdl.m_founding_cells_dict
+          #this variable is used in pyPetriDishCtrl.py to outline the founding organisms
+          self.m_session_mdl.m_founding_cells_dict = cells_dict
 
           # Read the genome from the organism file 
 
@@ -54,6 +59,7 @@
           org_file.close
           organisms_dict[str(i)] = org_string
 
+
     self.modifyEventFile(cells_dict, organisms_dict, 
       os.path.join(tmp_in_dir, "events.cfg"), tmp_out_dir)
     
@@ -211,5 +217,11 @@
 
     x = spots[org_num * 2]
     y = spots[(org_num * 2) + 1]
-    
+
+    print "THE NUMBER OF ANCESTORS IS ", num_ancestors
+
+    print "At the end of find_location -------------------------------------------------"    
+    print "returning " , int((round(world_y * y) * world_x) + round(world_x * x)) % (world_x * world_y)
+    print "done printing"
+    print "for some reason this text is not printing"
     return int((round(world_y * y) * world_x) + round(world_x * x)) % (world_x * world_y)




More information about the Avida-cvs mailing list