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

baerb@myxo.css.msu.edu baerb at myxo.css.msu.edu
Fri Jul 22 13:07:29 PDT 2005


Author: baerb
Date: 2005-07-22 16:07:29 -0400 (Fri, 22 Jul 2005)
New Revision: 254

Modified:
   trunk/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
   trunk/source/python/AvidaGui2/pyFreezerCtrl.py
   trunk/source/python/AvidaGui2/pyOneAna_GraphCtrl.py
   trunk/source/python/AvidaGui2/pyOneAna_PetriDishCtrl.py
   trunk/source/python/AvidaGui2/pyOneAnalyzeCtrl.py
   trunk/source/python/AvidaGui2/pyOnePopulationCtrl.py
   trunk/source/python/AvidaGui2/pyPetriConfigureCtrl.py
   trunk/source/python/AvidaGui2/pyQuitDialogCtrl.py
   trunk/source/python/AvidaGui2/pySessionCtrl.py
   trunk/source/python/AvidaGui2/pyTemporaryReloads.py
Log:
The basic part of restart is working -- though there are a number of annoying
problems.



Modified: trunk/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyEduWorkspaceCtrl.py	2005-07-22 20:06:59 UTC (rev 253)
+++ trunk/source/python/AvidaGui2/pyEduWorkspaceCtrl.py	2005-07-22 20:07:29 UTC (rev 254)
@@ -271,13 +271,22 @@
     
   def startQuitProcessSlot(self):
 
+    # Be sure that the session is paused before quitting (to reduce confusion
+    # if the user decides to save before quiting)
+
+    self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("doPauseAvidaSig"), ())
+
+
     # Check if there unsaved petri dishes if there are ask the user if they 
     # want to save them, just quit the program or cancel the quit.  If there
     # are no unsaved populations just quit.
     # (actually only works with one population will need to expand to
     # two populations in the future)
 
-    if (not self.m_one_population_ctrl.m_session_mdl.saved_full_dish):
+    print "BDB: self.m_one_population_ctrl.m_session_mdl.saved_full_dish = " + str(self.m_one_population_ctrl.m_session_mdl.saved_full_dish)
+    print "BDB: self.m_one_population_ctrl.m_session_mdl.new_full_dish = " + str(self.m_one_population_ctrl.m_session_mdl.new_full_dish)
+    if (not self.m_one_population_ctrl.m_session_mdl.saved_full_dish and
+        not self.m_one_population_ctrl.m_session_mdl.new_full_dish):
       m_quit_avida_ed = pyQuitDialogCtrl()
       quit_return = m_quit_avida_ed.showDialog()
       if quit_return == m_quit_avida_ed.QuitFlag:

Modified: trunk/source/python/AvidaGui2/pyFreezerCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyFreezerCtrl.py	2005-07-22 20:06:59 UTC (rev 253)
+++ trunk/source/python/AvidaGui2/pyFreezerCtrl.py	2005-07-22 20:07:29 UTC (rev 254)
@@ -16,9 +16,6 @@
     self.connect(self.m_list_view, 
       SIGNAL("doubleClicked(QListViewItem*, const QPoint &, int)"),
       self.clicked_itemSlot)
-    # self.connect(self.m_list_view, 
-    #   SIGNAL("clicked(QListViewItem*, const QPoint &, int )"),
-    #   self.clicked_itemSlot)
     self.connect(self.m_list_view, 
       SIGNAL("pressed(QListViewItem*, const QPoint &, int )"),
       self.pressed_itemSlot)
@@ -28,8 +25,6 @@
     self.connect(self.m_session_mdl.m_session_mdtr,
       PYSIGNAL("doRefreshFreezerInventorySig"),
       self.createFreezerIndexSlot)
-    self.connect(self, PYSIGNAL("freezerItemDoubleClicked"),
-      self.m_session_mdl.m_session_mdtr, PYSIGNAL("freezerItemDoubleClicked"))
     self.createFreezerIndexSlot()
 
 
@@ -66,7 +61,8 @@
         tmp_item = QListViewItem(organism_item)
         tmp_item.setText(0,organism_name)
 
-# if mouse is pressed on list item prepare its info to be dragged        
+  # if mouse is pressed on list item prepare its info to be dragged        
+
   def pressed_itemSlot(self, item):
 
     if item != None and item.depth() > 0:

Modified: trunk/source/python/AvidaGui2/pyOneAna_GraphCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOneAna_GraphCtrl.py	2005-07-22 20:06:59 UTC (rev 253)
+++ trunk/source/python/AvidaGui2/pyOneAna_GraphCtrl.py	2005-07-22 20:07:29 UTC (rev 254)
@@ -50,7 +50,8 @@
     self.m_petri_dish_dir_path = ' '
     self.m_petri_dish_dir_exists_flag = False
 
-    self.connect( self.m_session_mdl.m_session_mdtr, PYSIGNAL("freezerItemDoubleClickedOnInOneAnaSig"),
+    self.connect( self.m_session_mdl.m_session_mdtr, 
+      PYSIGNAL("freezerItemDoubleClickedOnInOneAnaSig"),
       self.freezerItemDoubleClickedOn)  
 
 

Modified: trunk/source/python/AvidaGui2/pyOneAna_PetriDishCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOneAna_PetriDishCtrl.py	2005-07-22 20:06:59 UTC (rev 253)
+++ trunk/source/python/AvidaGui2/pyOneAna_PetriDishCtrl.py	2005-07-22 20:07:29 UTC (rev 254)
@@ -12,9 +12,11 @@
 
   def construct(self, session_mdl):
     self.m_session_mdl = session_mdl     
-    self.connect( self.m_session_mdl.m_session_mdtr, PYSIGNAL("freezerItemDroppedInOneAnalyzeSig"),
+    self.connect( self.m_session_mdl.m_session_mdtr, 
+      PYSIGNAL("freezerItemDroppedInOneAnalyzeSig"),
       self.freezerItemDropped)  
-    self.connect( self.m_session_mdl.m_session_mdtr, PYSIGNAL("freezerItemDoubleClickedOnInOneAnaSig"),
+    self.connect( self.m_session_mdl.m_session_mdtr, 
+      PYSIGNAL("freezerItemDoubleClickedOnInOneAnaSig"),
       self.freezerItemDoubleClickedOn)  
 
 
@@ -26,6 +28,5 @@
       self.m_one_ana_pop_name.setText(os.path.splitext((os.path.split(str(freezer_item_name))[1]))[0])
 
   def freezerItemDoubleClickedOn(self, freezer_item_name):
-    print freezer_item_name
     self.m_one_ana_pop_name.setText(os.path.split(os.path.splitext(os.path.split(freezer_item_name)[0])[0])[1])
 

Modified: trunk/source/python/AvidaGui2/pyOneAnalyzeCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOneAnalyzeCtrl.py	2005-07-22 20:06:59 UTC (rev 253)
+++ trunk/source/python/AvidaGui2/pyOneAnalyzeCtrl.py	2005-07-22 20:07:29 UTC (rev 254)
@@ -15,10 +15,13 @@
     self.m_one_ana_graph_ctrl.construct(self.m_session_mdl)
     self.m_one_ana_petri_ctrl.construct(self.m_session_mdl) 
     self.connect( self, PYSIGNAL("freezerItemDroppedInOneAnalyzeSig"),
-      self.m_session_mdl.m_session_mdtr, PYSIGNAL("freezerItemDroppedInOneAnalyzeSig"))
+      self.m_session_mdl.m_session_mdtr, 
+      PYSIGNAL("freezerItemDroppedInOneAnalyzeSig"))
     self.connect( self, PYSIGNAL("freezerItemDoubleClickedOnInOneAnaSig"),
-      self.m_session_mdl.m_session_mdtr, PYSIGNAL("freezerItemDoubleClickedOnInOneAnaSig"))
-    self.connect( self.m_session_mdl.m_session_mdtr, PYSIGNAL("freezerItemDoubleClicked"),
+      self.m_session_mdl.m_session_mdtr, 
+      PYSIGNAL("freezerItemDoubleClickedOnInOneAnaSig"))
+    self.connect( self.m_session_mdl.m_session_mdtr, 
+      PYSIGNAL("freezerItemDoubleClicked"),
       self.freezerItemDoubleClicked)
 
   def dropEvent( self, e ):
@@ -34,7 +37,8 @@
       print "that was not a valid path(3)"
     else:
       if self.isVisible():
-         self.emit(PYSIGNAL("freezerItemDoubleClickedOnInOneAnaSig"), (freezer_item_name,))
+        self.emit(PYSIGNAL("freezerItemDoubleClickedOnInOneAnaSig"), 
+          (freezer_item_name,))
       
 
 

Modified: trunk/source/python/AvidaGui2/pyOnePopulationCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOnePopulationCtrl.py	2005-07-22 20:06:59 UTC (rev 253)
+++ trunk/source/python/AvidaGui2/pyOnePopulationCtrl.py	2005-07-22 20:07:29 UTC (rev 254)
@@ -44,13 +44,11 @@
        (freezer_item_name,))
 
   def restartPopulationSlot(self, session_mdl):
-    print "pyOnePopulationCtrl.py:restartPopulationSlot called"
     self.m_one_pop_petri_dish_ctrl.restart(self.m_session_mdl)
     self.m_one_pop_graph_ctrl.restart()
     self.m_one_pop_stats_ctrl.restart()
-    self.m_session_mdl.m_session_mdtr.emit(
-      PYSIGNAL("doInitializeAvidaPhaseIISig"), (os.path.join(self.m_session_mdl.m_tempdir, "genesis.avida"),))
-    # session_mdl.m_session_mdtr.emit(PYSIGNAL("doStartAvidaSig"), ())
+    # self.m_session_mdl.m_session_mdtr.emit(
+    #   PYSIGNAL("doInitializeAvidaPhaseISig"), (self.m_session_mdl.m_tempdir,))
 
 
 

Modified: trunk/source/python/AvidaGui2/pyPetriConfigureCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyPetriConfigureCtrl.py	2005-07-22 20:06:59 UTC (rev 253)
+++ trunk/source/python/AvidaGui2/pyPetriConfigureCtrl.py	2005-07-22 20:07:29 UTC (rev 254)
@@ -55,10 +55,12 @@
     self.connect(self.m_session_mdl.m_session_mdtr, 
       PYSIGNAL("freezeDishPhaseIISig"), self.FreezePetriSlot)
     self.connect(self.m_session_mdl.m_session_mdtr,
-      PYSIGNAL("doDefrostDishSig"), self.FillDishSlot)
+      PYSIGNAL("FillDishSig"), self.FillDishSlot)
     self.connect(self.m_session_mdl.m_session_mdtr, 
       PYSIGNAL("doInitializeAvidaPhaseISig"), self.DisablePetriConfigureSlot)
     self.connect(self.m_session_mdl.m_session_mdtr, 
+      PYSIGNAL("doEnablePetriDishSig"), self.EnablePetriConfigureSlot)
+    self.connect(self.m_session_mdl.m_session_mdtr, 
       PYSIGNAL("doInitializeAvidaPhaseISig"), self.CreateFilesFromPetriSlot)
     self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("setAvidaSig"), 
       self.setAvidaSlot)
@@ -98,10 +100,12 @@
     self.disconnect(self.m_session_mdl.m_session_mdtr, 
       PYSIGNAL("freezeDishPhaseIISig"), self.FreezePetriSlot)
     self.disconnect(self.m_session_mdl.m_session_mdtr,
-      PYSIGNAL("doDefrostDishSig"), self.FillDishSlot)
+      PYSIGNAL("FillDishSig"), self.FillDishSlot)
     self.disconnect(self.m_session_mdl.m_session_mdtr, 
       PYSIGNAL("doInitializeAvidaPhaseISig"), self.DisablePetriConfigureSlot)
     self.disconnect(self.m_session_mdl.m_session_mdtr, 
+      PYSIGNAL("doEnablePetriDishSig"), self.EnablePetriConfigureSlot)
+    self.disconnect(self.m_session_mdl.m_session_mdtr, 
       PYSIGNAL("doInitializeAvidaPhaseISig"), self.CreateFilesFromPetriSlot)
     self.disconnect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("setAvidaSig"), 
       self.setAvidaSlot)
@@ -159,13 +163,6 @@
   
   def FillDishSlot(self, dish_name, petri_dict):
     
-    # If the petri dish is already filled prompt the user if they want to freeze
-    # the existing dish
-
-    if self.DishDisabled:
-      self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("freezeDishPhaseISig"),
-        (True, False, ))
-      return
     self.full_petri_dict = petri_dict.dictionary
     settings_dict =  petri_dict.dictionary["SETTINGS"]
     self.AncestorComboBox.removeItem (0)
@@ -212,12 +209,16 @@
        self.DeathTextLabel2.setEnabled(True)
        self.DeathTextLabel3.setEnabled(True)
        self.LifeSpanSpinBox.setEnabled(True)
-    self.m_session_mdl.saved_empty_dish = True
+    self.m_session_mdl.new_empty_dish = True
+    self.m_session_mdl.m_session_mdtr.emit(
+      PYSIGNAL("finishedPetriDishSig"), ())
+
        
   def DisablePetriConfigureSlot(self):
 
     # Turn off the controls 
 
+    print "BDB: running DisablePetriConfigureSlot"
     self.AncestorComboBox.setEnabled(False)
     self.StopAtSpinBox.setEnabled(False)
     self.StopManuallyRadioButton.setEnabled(False)
@@ -250,7 +251,8 @@
   def EnablePetriConfigureSlot(self):
 
     # Turn on the controls 
-
+    
+    print "BDB: running EnablePetriConfigureSlot"
     self.AncestorComboBox.setEnabled(True)
     self.StopAtSpinBox.setEnabled(True)
     self.StopManuallyRadioButton.setEnabled(True)
@@ -277,8 +279,6 @@
     self.DeathTextLabel2.setEnabled(True)
     self.DeathTextLabel3.setEnabled(True)
     self.DishDisabled = False
-    self.m_session_mdl.m_session_mdtr.emit(
-      PYSIGNAL("doEnablePetriDishSig"), ())
 
 
   def CreateFilesFromPetriSlot(self, out_dir = None):

Modified: trunk/source/python/AvidaGui2/pyQuitDialogCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyQuitDialogCtrl.py	2005-07-22 20:06:59 UTC (rev 253)
+++ trunk/source/python/AvidaGui2/pyQuitDialogCtrl.py	2005-07-22 20:07:29 UTC (rev 254)
@@ -9,12 +9,16 @@
 # return the name of a file to save information to be frozen
 
 class pyQuitDialogCtrl (pyQuitDialogView):
-  def __init__(self):
+  def __init__(self, textChange = None):
     pyQuitDialogView.__init__(self)
     self.connect(self.QuitPushButton, SIGNAL("clicked()"), self.DownQuitSlot)
     self.FreezeQuitFlag = 0
     self.QuitFlag = 1
     self.CancelFlag = 2
+    if (textChange):
+      self.setCaption(textChange)
+      self.SaveToFreezerPushButton.setText("Freeze and " + textChange)
+      self.QuitPushButton.setText(textChange)
     
   def DownQuitSlot(self):
     self.QuitPushButton.setDown(True)

Modified: trunk/source/python/AvidaGui2/pySessionCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pySessionCtrl.py	2005-07-22 20:06:59 UTC (rev 253)
+++ trunk/source/python/AvidaGui2/pySessionCtrl.py	2005-07-22 20:07:29 UTC (rev 254)
@@ -61,6 +61,8 @@
     self.m_session_mdl = pyMdl()
     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.m_current_workspace = "default.workspace"
     self.m_session_mdl.m_current_freezer = os.path.join(self.m_session_mdl.m_current_workspace, "freezer")
 
@@ -122,10 +124,20 @@
       PYSIGNAL("fromLiveCtrlPauseAvidaSig"),
       self.doPause)
 
+    self.connect(
+      self.m_session_mdl.m_session_mdtr,
+      PYSIGNAL("restartPopulationSig"),
+      self.restartPopulationSlot)
+
     self.doPause()
 
     return self
 
+  def restartPopulationSlot(self): 
+    print "BDB restartPopulationSlot Called"
+    self.sessionInitialized = False
+    self.m_should_update = False
+
   def setAvidaSlot(self, avida):
     "print *** pySessionCtrl setAvidaSlot ***"
     if (avida == None):
@@ -201,9 +213,10 @@
   def avidaUpdatedSlot(self):
 
     # When there is a new update assume that the session has an unsaved 
-    # state
+    # state and the dish is no longer new
 
     self.m_session_mdl.saved_full_dish = False
+    self.m_session_mdl.new_full_dish = False
 
   def unitTest(self, recurse = False):
     return pyUnitTestSuiteRecurser("pySessionCtrl", globals(), recurse).construct().runTest().lastResult()

Modified: trunk/source/python/AvidaGui2/pyTemporaryReloads.py
===================================================================
--- trunk/source/python/AvidaGui2/pyTemporaryReloads.py	2005-07-22 20:06:59 UTC (rev 253)
+++ trunk/source/python/AvidaGui2/pyTemporaryReloads.py	2005-07-22 20:07:29 UTC (rev 254)
@@ -41,6 +41,8 @@
 ]
 
 nontest_module_names = [
+  "AvidaGui2.pyQuitDialogView",
+  "AvidaGui2.pyQuitDialogCtrl",
   "AvidaGui2.pyAnalyzeControlsView",
   "AvidaGui2.pyAnalyzeControlsCtrl",
   "AvidaGui2.pyAvidaStatsInterface",
@@ -70,8 +72,6 @@
   "AvidaGui2.pyPetriDishView",
   "AvidaGui2.pyPetriDishCtrl",
   "AvidaGui2.pyPopulationCellItem",
-  "AvidaGui2.pyQuitDialogView",
-  "AvidaGui2.pyQuitDialogCtrl",
   "AvidaGui2.pyReadFreezer",
   "AvidaGui2.pyTimelineView",
   "AvidaGui2.pyTimelineCtrl",




More information about the Avida-cvs mailing list