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

baerb at myxo.css.msu.edu baerb at myxo.css.msu.edu
Fri Sep 1 14:34:35 PDT 2006


Author: baerb
Date: 2006-09-01 17:34:34 -0400 (Fri, 01 Sep 2006)
New Revision: 921

Modified:
   branches/developers/avida-edward/source/python/AvidaGui2/pyFreezeDialogCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyNavBarCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_StatsCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyOnePopulationCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyOrganismScopeCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyWarnAboutTrashView.ui
   branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py
   branches/developers/avida-edward/source/python/AvidaGui2/to-do_list
Log:

Fixed problem with wrong error messages

Fixed problem with creating m_cell_num_ancestor_name_dict



Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyFreezeDialogCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyFreezeDialogCtrl.py	2006-09-01 20:30:53 UTC (rev 920)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyFreezeDialogCtrl.py	2006-09-01 21:34:34 UTC (rev 921)
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 
 from qt import *
+from descr import *
 from pyFreezeDialogView import pyFreezeDialogView
 from pyBeforeStartingCtrl import pyBeforeStartingCtrl
 import shutil, os, os.path
@@ -42,6 +43,13 @@
       self.FullRadioButton.setEnabled(True)
       self.EmptyRadioButton.setChecked(False)
       self.FullRadioButton.setChecked(True)
+
+    # See if the freeze selected organizim should be enabled
+
+    if len(session_mdl.m_current_cell_genome) == 0:
+      self.OrganismRadioButton.setEnabled(False)
+    else:
+      self.OrganismRadioButton.setEnabled(True)
     while (found_valid_name == False and dialog_result > 0):
       self.exec_loop()
       dialog_result = self.result()
@@ -81,9 +89,16 @@
 
         # Save selected organism
 
-        else:
-          # BDB -- code for saving selected organism needs to be added here
-          pass
+        elif self.OrganismRadioButton.isChecked():
+          if (tmp_name.endswith(".organism") == False):
+            tmp_name = tmp_name + ".organism"
+          tmp_name = os.path.join(session_mdl.m_current_freezer, tmp_name)
+          if os.path.exists(tmp_name):
+            found_valid_name = False
+            self.MainMessageTextLabel.setText("Organism Exists, Please Enter a Different Name")
+          else:
+            found_valid_name = True
+            return tmp_name
 
   def isEmpty(self):
     if self.EmptyRadioButton.isChecked():
@@ -91,3 +106,9 @@
     else:
       return False
 
+  def isOrganism(self):
+    if self.OrganismRadioButton.isChecked():
+      return True
+    else:
+      return False
+

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py	2006-09-01 20:30:53 UTC (rev 920)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py	2006-09-01 21:34:34 UTC (rev 921)
@@ -43,7 +43,7 @@
     # Check if item is icon
 
     if (pyNewIconView.canDecode(e)):
-      warningNoMethodName("You can not drag an ancestor back into the freezer")
+      info("You can not drag an ancestor back into the freezer")
 
     
   def FreezeOrganism(self, freezer_item_name):

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyNavBarCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyNavBarCtrl.py	2006-09-01 20:30:53 UTC (rev 920)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyNavBarCtrl.py	2006-09-01 21:34:34 UTC (rev 921)
@@ -8,6 +8,7 @@
 
   def __init__(self,parent = None,name = None,fl = 0):
     pyNavBarView.__init__(self,parent,name,fl)
+    self.setAcceptDrops( True )
 
   def construct(self, session_mdl):
     self.m_list_view.setSelectionMode(QListView.Single)
@@ -21,3 +22,4 @@
     self.m_one_population_cli.setPixmap(0, self.image0)
     self.m_one_organism_cli.setPixmap(0, self.image1)
     self.m_one_analyze_cli.setPixmap(0, self.image2)
+

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py	2006-09-01 20:30:53 UTC (rev 920)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py	2006-09-01 21:34:34 UTC (rev 921)
@@ -243,6 +243,8 @@
       self.PopulationTextLabel.setText(dishName)
     
   def petriDropped(self, e):
+    if (e.source is self):
+      return
 
     current_page = self.m_petri_dish_widget_stack.visibleWidget()
     current_page_int = self.m_petri_dish_widget_stack.id(current_page)
@@ -258,7 +260,13 @@
     freezer_item_list = QString()
     if ( QTextDrag.decode( e, freezer_item_list ) ) :
       freezer_item_list = str(e.encodedData("text/plain"))
+      
+      # Check that this is not an organism from the petri dish acidently
+      # dropped onto itself
 
+      if freezer_item_list.startswith("organism."):
+        return
+
       # Do a quick look at the list and be sure the user is not mixing up
       # petri dish files and organisms
 
@@ -272,7 +280,7 @@
       else:
         list_has_dishes = False
       if (list_has_orgs and list_has_dishes):
-        warningNoMethodName("You can not drag both petri dishes and organisms at the same time")
+        info("You can not drag both petri dishes and organisms at the same time")
         return
 
       # if the user only has organism let the Ancestor box drop method handle
@@ -283,6 +291,7 @@
           PYSIGNAL("petriDishDroppedAncestorSig"), (e,))
         return
 
+      descr("BDB -- freezer_item_list = " + str(freezer_item_list))
       freezer_item_names = freezer_item_list.split("\t")[1:]
       if (len(freezer_item_names) == 1):
         freezer_item_name = freezer_item_names[0]
@@ -300,6 +309,9 @@
         thawed_item = pyReadFreezer(freezer_item_name_temp)
         self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("doDefrostDishSig"),  
           (os.path.splitext((os.path.split(str(freezer_item_name))[1]))[0], thawed_item,))
+      else:
+        # pass
+        info("You can only drag one dish at a time into this viewer")
 
   def SetMapModeAndGraphModeToDefaultsSlot(self):
     descr()

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_StatsCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_StatsCtrl.py	2006-09-01 20:30:53 UTC (rev 920)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_StatsCtrl.py	2006-09-01 21:34:34 UTC (rev 921)
@@ -221,6 +221,7 @@
       # PAINT the stats fields empty
 
       self.m_org_name.setText('empty cell')
+      self.m_session_mdl.m_current_cell_genome = ""
       self.m_org_fitness.setText('-')
       self.m_org_merit.setText('-')
       self.m_org_genome_length.setText('-')
@@ -256,6 +257,7 @@
 
     # print info about the org clicked on 
 
+    self.m_session_mdl.m_current_cell_genome = str(organism.GetGenome().AsString())
     m_org_name = str(genotype.GetName())
     hyphen_position = m_org_name.find('-')
     m_org_name = m_org_name[hyphen_position+1:]   

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOnePopulationCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOnePopulationCtrl.py	2006-09-01 20:30:53 UTC (rev 920)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOnePopulationCtrl.py	2006-09-01 21:34:34 UTC (rev 921)
@@ -117,7 +117,7 @@
     # Check if item is icon
 
     if (pyNewIconView.canDecode(e)):
-      warningNoMethodNames("You can not drop Ancestors here")
+      info("You can not drop Ancestors here")
 
   def freezerItemDoubleClickedSlot(self, freezer_item_name):
    if self.isVisible():

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOrganismScopeCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOrganismScopeCtrl.py	2006-09-01 20:30:53 UTC (rev 920)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOrganismScopeCtrl.py	2006-09-01 21:34:34 UTC (rev 921)
@@ -93,7 +93,7 @@
       freezer_item_names = freezer_item_list.split("\t")[1:]
       descr("BDB -- if decode true" + freezer_item_list)
       if (len(freezer_item_names) > 1):
-         warningNoMethodName("Only one organism can be dragged here")
+         info("Only one organism can be dragged here")
       else:
         freezer_item_name = freezer_item_names[0]
         if os.path.exists(freezer_item_name) == False:
@@ -103,7 +103,7 @@
             e.accept()
             self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("setDebugOrganismFileSig"), (freezer_item_name,))
           else:
-            warningNoMethodName("Only organisms can be dragged here")
+            info("Only organisms can be dragged here")
 
   def setAvidaSlot(self, avida):
     print "pyOrganismScopeCtrl.setAvidaSlot() ..."

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py	2006-09-01 20:30:53 UTC (rev 920)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py	2006-09-01 21:34:34 UTC (rev 921)
@@ -551,7 +551,10 @@
 
     if (file_name_len > 0):
       is_empty_dish = m_pop_up_freezer_file_name.isEmpty()
-      if (not is_empty_dish):
+      is_organism = m_pop_up_freezer_file_name.isOrganism()
+      if is_organism:
+        tmp_dict = {1:self.m_session_mdl.m_current_cell_genome} 
+      elif (not is_empty_dish):
         os.mkdir(file_name)
 
         # Copy the average and count files from the teporary output directory
@@ -633,11 +636,9 @@
   # exist before sending out the signal to process
 
   def dropEvent( self, e ):
-    descr("BDB")
     freezer_item_list = QString()
     if ( QTextDrag.decode( e, freezer_item_list ) ) :
       freezer_item_list = str(e.encodedData("text/plain"))
-      descr("BDB -- if decode true" + freezer_item_list)
       errors = False
       for freezer_item_name in freezer_item_list.split("\t")[1:]:
         if os.path.exists(freezer_item_name) == False:
@@ -648,19 +649,17 @@
         self.petriDroppedSlot(e)
 
   def petriDroppedSlot(self, e):
-    descr("BDB")
     # Try to decode to the data you understand...
     freezer_item_list = QString()
     if ( QTextDrag.decode( e, freezer_item_list ) and not self.DishDisabled) :
       freezer_item_list = str(e.encodedData("text/plain"))
       freezer_item_names = freezer_item_list.split("\t")[1:]
-      descr("BDB -- if decode true" + freezer_item_list)
       if (len(freezer_item_names) > 1):
-         warningNoMethodName("Only one petri dish can be dragged here")
+         info("Only one petri dish can be dragged here")
       else:
         freezer_item_name = freezer_item_names[0]
         if freezer_item_name[-8:] == 'organism':
-          warningNoMethodName("Organisms should be placed in the Ancestor Box")
+          info("Organisms should be placed in the Ancestor Box")
           return
         elif freezer_item_name[-4:] == 'full':
           freezer_item_name_temp = os.path.join(freezer_item_name, 'petri_dish')
@@ -679,18 +678,15 @@
           (self.m_session_mdl.m_tempdir,))
 
   def petriAncestorDroppedSlot(self, e):
-    descr("BDB")
     # Try to decode to the data you understand...
     freezer_item_list = QString()
     if ( QTextDrag.decode( e, freezer_item_list ) and not self.DishDisabled) :
       freezer_item_list = str(e.encodedData("text/plain"))
       freezer_item_names = freezer_item_list.split("\t")[1:]
-      descr("BDB -- if decode true" + freezer_item_list)
       for freezer_item_name in freezer_item_list.split("\t")[1:]:
         if freezer_item_name[-8:] == 'organism':
           core_name = freezer_item_name[:-9]
           core_name = os.path.basename(str(freezer_item_name[:-9]))
-          descr("BDB: core_name = " + core_name)
 
           # Read the genome from the organism file
 
@@ -704,7 +700,7 @@
           tmp_name = self.AncestorIconView.addGenomeToDict(core_name, org_string)
           tmp_item = pyNewIconViewItem(self.AncestorIconView, tmp_name)
         else:
-          warningNoMethodName("Dishes should not be dragged into Ancestor Box")
+          info("Dishes should not be dragged into Ancestor Box")
 
       # initialize Avida (which repaints the dish)
 

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py	2006-09-01 20:30:53 UTC (rev 920)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py	2006-09-01 21:34:34 UTC (rev 921)
@@ -69,10 +69,16 @@
 #    self.m_session_mdl.m_ancestors_dict = None
     self.m_session_mdl.m_ancestors_dict = {'1': 'default'}
 
+    self.m_session_mdl.m_cell_num_ancestor_name_dict = {}
+
     # set a global variable for locking the ancestor lineage map mode max range
     self.m_session_mdl.m_max_lineages_ever = 0
     self.m_session_mdl.m_lock_max_lineages_ever = False
 
+    # set a global variable for the current cell's genome
+
+    self.m_session_mdl.m_current_cell_genome = ""
+
     # 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/pyWarnAboutTrashView.ui
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyWarnAboutTrashView.ui	2006-09-01 20:30:53 UTC (rev 920)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyWarnAboutTrashView.ui	2006-09-01 21:34:34 UTC (rev 921)
@@ -47,7 +47,7 @@
                         <enum>StrongFocus</enum>
                     </property>
                     <property name="text">
-                        <string>Yes, and delete all future items</string>
+                        <string>Yes, don't ask again</string>
                     </property>
                     <property name="toolTip" stdset="0">
                         <string>&lt;p&gt;Don't quit; return to the program&lt;/P&gt;</string>
@@ -105,5 +105,10 @@
         <slot>reject()</slot>
     </connection>
 </connections>
+<tabstops>
+    <tabstop>DeletePushButton</tabstop>
+    <tabstop>IgnorePushButton</tabstop>
+    <tabstop>DeleteAllPushButton</tabstop>
+</tabstops>
 <layoutdefaults spacing="6" margin="11"/>
 </UI>

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py	2006-09-01 20:30:53 UTC (rev 920)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py	2006-09-01 21:34:34 UTC (rev 921)
@@ -41,8 +41,10 @@
         ancestor_link_dict = {}
       self.m_session_mdl.m_founding_cells_dict = cells_dict
       self.m_session_mdl.m_cell_num_ancestor_name_dict = {}
-      for tmp_cell, tmp_lin_lab in ancestor_link_dict.iteritems():
-        session_mdl.m_cell_num_ancestor_name_dict[tmp_cell] = session_mdl.m_ancestors_dict[ancestor_link_dict[tmp_cell]]
+      for tmp_cell, org_in_cell in cells_dict.iteritems():
+        linage_lable_in_cell = ancestor_link_dict[org_in_cell]
+        ann_name_in_cell = session_mdl.m_ancestors_dict[linage_lable_in_cell]
+        session_mdl.m_cell_num_ancestor_name_dict[tmp_cell] = ann_name_in_cell
 
 
     #if it is not a full petri dish

Modified: branches/developers/avida-edward/source/python/AvidaGui2/to-do_list
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/to-do_list	2006-09-01 20:30:53 UTC (rev 920)
+++ branches/developers/avida-edward/source/python/AvidaGui2/to-do_list	2006-09-01 21:34:34 UTC (rev 921)
@@ -9,6 +9,8 @@
 
 11-Jul-06 Fix problem where user drags in in a new population, clicks on freeze and then clicks cancel the program loads the new population without saving.
 
+31-Aug-06 E-Mail Josh about state of resize at beginning of run
+
 Priority Medium
 
 29-Apr-06 Change configuration on fly -- work with Kaben on the underlieing problem
@@ -21,6 +23,12 @@
 
 13-Jul-06 Single click on dish/creature to rename it.
 
+31-Aug-06 What to do when user double clicks organism in population viewer.
+
+31-Aug-06 Remove full path name
+
+31-Aug-06 Make active/deactive more clear on petri dish configuration
+
 Priority Low
 
 -Under the sliders with ranges put a few values in grey that tell you the range min and max 
@@ -55,6 +63,8 @@
 
 09-Aug-06 Deactivate Ancestor Icon Drag when there is a full population
 
+31-Aug-06 Turn on drag accept on for left side of genoscope
+
 ************Jeff*******************
 
 Priority High
@@ -202,6 +212,8 @@
 
 09-Aug-06 Rename duplicate Ancestors names when they are droppeed into Ancestor View -- 16-Aug-06
 
+31-Aug-06 Talk to Jeff about how to get information from selected org to freeze org  -- 31-Aug-06
+
 August - 06
 
  - Fixed problems with IconView to get trash can to work 
@@ -212,6 +224,12 @@
 
  - fixed a few spelling errors in instruction descriptions
 
+ - Got mutiple drag to work out of freezer
+
+September - 06
+
+ - Got freeze selected organism to work when clicking snowflake
+
 ************Kaben******************
 
 * 23-Jan-06 Get program to run on all Macs -- Finished 27-Jan-06
@@ -278,4 +296,4 @@
 -fix the problem that the gray outline of ancestors is going away if they are clicked on then off again pre-run
 -made the highlight of the clicked on cell twice as thick
 -ancestor map mode now loads the names of the organisms and has the size of the name label correctly, scrolling also works, but the color of the ancestor is not being painted correctly (and the layout needs to be improved)
---make tasks reflect parent tasks (not real time) in org report (pending group decision) (1/26/06)
\ No newline at end of file
+--make tasks reflect parent tasks (not real time) in org report (pending group decision) (1/26/06)




More information about the Avida-cvs mailing list