[Avida-SVN] r2705 - branches/developers/avida-edward/source/python/AvidaGui2

kaben at myxo.css.msu.edu kaben at myxo.css.msu.edu
Thu Jul 3 21:25:22 PDT 2008


Author: kaben
Date: 2008-07-04 00:25:21 -0400 (Fri, 04 Jul 2008)
New Revision: 2705

Modified:
   branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceView.ui
   branches/developers/avida-edward/source/python/AvidaGui2/pyOneAnalyzeCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyOneOrg_ScopeCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyOneOrganismCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyOnePopulationCtrl.py
Log:
Avida-ED Control Menu: Fixed bug where the Control menu controlled the Petri Dish View no matter what view you're in.
Gave each of the population, organism, and analysis views their own version of the Control Menu. The analysis view Control Menu contains a single disabled menu item reading "No controls available in Analysis View". The organism view Control Menu contains menu items "Start/Pause", "Next Instruction", "Previous Instruction", "Go To Start", and "Go To End".


Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py	2008-07-03 04:57:30 UTC (rev 2704)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py	2008-07-04 04:25:21 UTC (rev 2705)
@@ -72,7 +72,7 @@
     #for ctrl in self.m_ctrl_to_cli_dict.keys():
     #  ctrl.construct(self.m_session_mdl)
     self.m_one_population_ctrl.construct(self.m_session_mdl)
-    self.m_one_organism_ctrl.construct(self.m_session_mdl)
+    self.m_one_organism_ctrl.construct(self.m_session_mdl, self)
     self.m_one_analyze_ctrl.construct(self.m_session_mdl)
         
     self.connect(
@@ -89,11 +89,8 @@
 
     # self.connect(
     #   self.fileOpenFreezerAction,SIGNAL("activated()"),self.freezerOpenSlot)
-    self.connect(
-      self.controlNext_UpdateAction,SIGNAL("activated()"),
-      self.next_UpdateActionSlot)
-    self.connect(
-      self.controlStartAction,SIGNAL("activated()"),self.startActionSlot)
+    self.connect(self.popview_controlNext_UpdateAction,SIGNAL("activated()"), self.next_UpdateActionSlot)
+    self.connect(self.popview_controlStartAction,SIGNAL("activated()"),self.startActionSlot)
 
     # Next three connects  are for where a user selects a veiwer from 
     # the View menu
@@ -128,7 +125,7 @@
     #   PYSIGNAL("doNextUpdateSig"),
     #   self.updatePBClickedSlot)
 
-    self.connect(self.controlRestart_ExpAction,SIGNAL("activated()"),
+    self.connect(self.popview_controlRestart_ExpAction,SIGNAL("activated()"),
       self.Restart_ExpActionSlot)
     self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("addStatusBarWidgetSig"), self.addStatusBarWidgetSlot)
     self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("removeStatusBarWidgetSig"), self.removeStatusBarWidgetSlot)
@@ -179,8 +176,8 @@
         controller = self.m_cli_to_ctrl_dict[item]
         old_controller = self.m_widget_stack.visibleWidget()
         if old_controller is not None:
-          old_controller.aboutToBeLowered()
-        controller.aboutToBeRaised()
+          old_controller.aboutToBeLowered(self)
+        controller.aboutToBeRaised(self)
         self.m_widget_stack.raiseWidget(controller)
 
   # @kgn : desperate hacks to get drag & drop working.
@@ -245,8 +242,19 @@
   def __init__(self, parent = None, name = None, fl = 0):
     pyEduWorkspaceView.__init__(self,parent,name,fl)
     self.help_screen = None
-    # print "pyEduWorkspaceCtrl.__init__(): Not implemented yet"
 
+    self.popview_controlStartAction.setVisible(False)
+    self.popview_controlNext_UpdateAction.setVisible(False)
+    self.popview_controlRestart_ExpAction.setVisible(False)
+
+    self.orgview_controlStartAction.setVisible(False)
+    self.orgview_controlNext_InstructionAction.setVisible(False)
+    self.orgview_controlPrevious_InstructionAction.setVisible(False)
+    self.orgview_controlGo_To_StartAction.setVisible(False)
+    self.orgview_controlGo_To_EndAction.setVisible(False)
+
+    self.anaview_controlNo_controls_available_in_Analysis_ViewAction.setVisible(False)
+
   # public slot
 
   def fileNew(self):
@@ -743,13 +751,13 @@
     pass
     
   def doPauseAvidaSlot(self):
-    self.controlStartAction.setText("Start")
-    self.controlStartAction.setMenuText("Start")
+    self.popview_controlStartAction.setText("Start")
+    self.popview_controlStartAction.setMenuText("Start")
     self.startStatus = True
     
   def doStartAvidaSlot(self):
-    self.controlStartAction.setText("Pause")
-    self.controlStartAction.setMenuText("Pause")
+    self.popview_controlStartAction.setText("Pause")
+    self.popview_controlStartAction.setMenuText("Pause")
     self.startStatus = False
     
   def startQuitProcessSlot(self):

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceView.ui
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceView.ui	2008-07-03 04:57:30 UTC (rev 2704)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceView.ui	2008-07-04 04:25:21 UTC (rev 2705)
@@ -214,9 +214,15 @@
         <action name="editSelect_AllAction_2"/>
     </item>
     <item text="&amp;Control" name="Control">
-        <action name="controlStartAction"/>
-        <action name="controlNext_UpdateAction"/>
-        <action name="controlRestart_ExpAction"/>
+        <action name="popview_controlStartAction"/>
+        <action name="popview_controlNext_UpdateAction"/>
+        <action name="popview_controlRestart_ExpAction"/>
+        <action name="orgview_controlStartAction"/>
+        <action name="orgview_controlNext_InstructionAction"/>
+        <action name="orgview_controlPrevious_InstructionAction"/>
+        <action name="orgview_controlGo_To_StartAction"/>
+        <action name="orgview_controlGo_To_EndAction"/>
+        <action name="anaview_controlNo_controls_available_in_Analysis_ViewAction"/>
     </item>
     <item text="&amp;View" name="View">
         <action name="viewPopulationAction"/>
@@ -350,6 +356,12 @@
         <property type="0">-1</property>
         <property type="1">pyFreezerView</property>
         <property type="0">-1</property>
+        <property type="1">pyFreezerView</property>
+        <property type="0">-1</property>
+        <property type="1">pyFreezerView</property>
+        <property type="0">-1</property>
+        <property type="1">pyFreezerView</property>
+        <property type="0">-1</property>
         <property type="pyFreezerView"></property>
         <property type="-1">1</property>
     </customwidget>
@@ -447,6 +459,12 @@
         <property type="0">-1</property>
         <property type="1">pyNavBarView</property>
         <property type="0">-1</property>
+        <property type="1">pyNavBarView</property>
+        <property type="0">-1</property>
+        <property type="1">pyNavBarView</property>
+        <property type="0">-1</property>
+        <property type="1">pyNavBarView</property>
+        <property type="0">-1</property>
         <property type="pyNavBarView"></property>
         <property type="-1">1</property>
     </customwidget>
@@ -803,7 +821,7 @@
     </action>
     <action>
         <property name="name">
-            <cstring>controlStartAction</cstring>
+            <cstring>popview_controlStartAction</cstring>
         </property>
         <property name="text">
             <string>Start</string>
@@ -814,7 +832,7 @@
     </action>
     <action>
         <property name="name">
-            <cstring>controlNext_UpdateAction</cstring>
+            <cstring>popview_controlNext_UpdateAction</cstring>
         </property>
         <property name="text">
             <string>Next Update</string>
@@ -853,7 +871,7 @@
     </action>
     <action>
         <property name="name">
-            <cstring>controlRestart_ExpAction</cstring>
+            <cstring>popview_controlRestart_ExpAction</cstring>
         </property>
         <property name="text">
             <string>Start New Experiment</string>
@@ -1017,6 +1035,97 @@
             <string>Known Bugs...</string>
         </property>
     </action>
+    <action>
+        <property name="name">
+            <cstring>orgview_controlStartAction</cstring>
+        </property>
+        <property name="text">
+            <string>Start</string>
+        </property>
+        <property name="menuText">
+            <string>Start</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>orgview_controlNext_InstructionAction</cstring>
+        </property>
+        <property name="text">
+            <string>Next Instruction</string>
+        </property>
+        <property name="menuText">
+            <string>Next Instruction</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>orgview_controlPrevious_InstructionAction</cstring>
+        </property>
+        <property name="text">
+            <string>Previous Instruction</string>
+        </property>
+        <property name="menuText">
+            <string>Previous Instruction</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>controlAction</cstring>
+        </property>
+        <property name="text">
+            <string>Go To Start</string>
+        </property>
+        <property name="menuText">
+            <string>Go To Start</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>orgview_controlGo_To_StartAction</cstring>
+        </property>
+        <property name="text">
+            <string>Go To Start</string>
+        </property>
+        <property name="menuText">
+            <string>Go To Start</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>orgview_controlGo_To_EndAction</cstring>
+        </property>
+        <property name="text">
+            <string>Go To End</string>
+        </property>
+        <property name="menuText">
+            <string>Go To End</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>controlnew_itemAction</cstring>
+        </property>
+        <property name="text">
+            <string>new item</string>
+        </property>
+        <property name="menuText">
+            <string>new item</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>anaview_controlNo_controls_available_in_Analysis_ViewAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="text">
+            <string>No controls available in Analysis View</string>
+        </property>
+        <property name="menuText">
+            <string>No controls available in Analysis View</string>
+        </property>
+    </action>
 </actions>
 <images>
     <image name="image0">

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOneAnalyzeCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOneAnalyzeCtrl.py	2008-07-03 04:57:30 UTC (rev 2704)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOneAnalyzeCtrl.py	2008-07-04 04:25:21 UTC (rev 2705)
@@ -37,7 +37,7 @@
   def testMe(self):
     descr("99999999999999999999999999999999999999999999999999999999999")
 
-  def aboutToBeLowered(self):
+  def aboutToBeLowered(self, workspace_ctrl):
     """Disconnects menu items from One-Analyze Graph controller."""
     descr()
     self.disconnect(
@@ -53,7 +53,10 @@
       self.m_session_mdl.m_session_mdtr,
       PYSIGNAL("exportAnalyzeSig"),
       self.m_one_ana_graph_ctrl.exportSlot)
-  def aboutToBeRaised(self):
+
+    workspace_ctrl.anaview_controlNo_controls_available_in_Analysis_ViewAction.setVisible(False)
+
+  def aboutToBeRaised(self, workspace_ctrl):
     """Connects items to One-Analyze Graph controller."""
     descr()
     self.connect(
@@ -69,6 +72,9 @@
       PYSIGNAL("exportAnalyzeSig"),
       self.m_one_ana_graph_ctrl.exportSlot)
 
+    workspace_ctrl.anaview_controlNo_controls_available_in_Analysis_ViewAction.setVisible(True)
+
+
   def dragEnterEvent( self, e ):
     freezer_item_list = QString()
     # freezer_item_list is a string...a tab delimited list of file names 

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOneOrg_ScopeCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOneOrg_ScopeCtrl.py	2008-07-03 04:57:30 UTC (rev 2704)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOneOrg_ScopeCtrl.py	2008-07-04 04:25:21 UTC (rev 2705)
@@ -107,11 +107,13 @@
     descr("pyOneOrg_ScopeCtrl.pauseSlot().")
     self.m_analyze_controls_ctrl.m_widget_stack.raiseWidget(self.m_analyze_controls_ctrl.m_play_page)
     self.m_timer.stop()
+    self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("orgScopePausedSig"), ())
 
   def playSlot(self):
     descr("pyOneOrg_ScopeCtrl.playSlot().")
     self.m_analyze_controls_ctrl.m_widget_stack.raiseWidget(self.m_analyze_controls_ctrl.m_pause_page)
     self.m_timer.start(self.m_timer_interval, False)
+    self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("orgScopeStartedSig"), ())
 
   def backSlot(self):
     #print "pyOneOrg_ScopeCtrl.backSlot()."

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOneOrganismCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOneOrganismCtrl.py	2008-07-03 04:57:30 UTC (rev 2704)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOneOrganismCtrl.py	2008-07-04 04:25:21 UTC (rev 2705)
@@ -1,11 +1,12 @@
 # -*- coding: utf-8 -*-
 
-from descr import descr, info
+from descr import *
 
 from qt import *
 from pyOneOrganismView import pyOneOrganismView
 from pyButtonListDialog import pyButtonListDialog
 from pyImageFileDialog import pyImageFileDialog
+from pyMdtr import *
 
 import os.path
 
@@ -14,8 +15,10 @@
   def __init__(self,parent = None,name = None,fl = 0):
     pyOneOrganismView.__init__(self,parent,name,fl)
 
-  def construct(self, session_mdl):
+  def construct(self, session_mdl, workspace_ctrl):
+    self.workspace_ctrl = workspace_ctrl
     self.m_session_mdl = session_mdl
+    self.startStatus = False
     self.m_one_org_scope_ctrl.construct(self.m_session_mdl)
     self.m_organism_configure_ctrl.construct(self.m_session_mdl)
 
@@ -24,34 +27,55 @@
     self.connect(self.m_organism_scope_toggle, SIGNAL("clicked()"),
       self.ToggleScopeSlot)
 
+    self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("orgScopeStartedSig"), self.orgScopeStartedSlot)
+    self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("orgScopePausedSig"), self.orgScopePausedSlot)
+
+    self.connect(self.workspace_ctrl.orgview_controlStartAction,SIGNAL("activated()"),self.startActionSlot)
+    self.connect(self.workspace_ctrl.orgview_controlNext_InstructionAction,SIGNAL("activated()"),self.m_one_org_scope_ctrl.advanceSlot)
+    self.connect(self.workspace_ctrl.orgview_controlPrevious_InstructionAction,SIGNAL("activated()"),self.m_one_org_scope_ctrl.backSlot)
+    self.connect(self.workspace_ctrl.orgview_controlGo_To_StartAction,SIGNAL("activated()"),self.m_one_org_scope_ctrl.rewindSlot)
+    self.connect(self.workspace_ctrl.orgview_controlGo_To_EndAction,SIGNAL("activated()"),self.m_one_org_scope_ctrl.cueSlot)
+
     self.m_organism_configure_ctrl.SetRandomGeneratedRadioButton(True);
     self.m_organism_configure_ctrl.ChangeMutationSliderSlot();
     self.m_organism_configure_ctrl.setAnalysisNeeded(False)
 
-  def aboutToBeLowered(self):
+  def startActionSlot(self):
+    if self.startStatus:
+      self.m_one_org_scope_ctrl.playSlot()
+    else:
+      self.m_one_org_scope_ctrl.pauseSlot()
+  def orgScopeStartedSlot(self):
+    self.workspace_ctrl.orgview_controlStartAction.setText("Pause")
+    self.workspace_ctrl.orgview_controlStartAction.setMenuText("Pause")
+    self.startStatus = False
+  def orgScopePausedSlot(self):
+    self.workspace_ctrl.orgview_controlStartAction.setText("Start")
+    self.workspace_ctrl.orgview_controlStartAction.setMenuText("Start")
+    self.startStatus = True
+
+  def aboutToBeLowered(self, workspace_ctrl):
     """Disconnects menu items from organism viewer controller."""
-    descr()
-    self.disconnect(
-      self.m_session_mdl.m_session_mdtr,
-      PYSIGNAL("saveImagesSig"),
-      self.saveImagesSlot)
-    self.disconnect(
-      self.m_session_mdl.m_session_mdtr,
-      PYSIGNAL("printSig"),
-      self.printOrgSlot)
+    self.disconnect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("saveImagesSig"), self.saveImagesSlot)
+    self.disconnect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("printSig"), self.printOrgSlot)
 
-  def aboutToBeRaised(self):
+    self.workspace_ctrl.orgview_controlStartAction.setVisible(False)
+    self.workspace_ctrl.orgview_controlNext_InstructionAction.setVisible(False)
+    self.workspace_ctrl.orgview_controlPrevious_InstructionAction.setVisible(False)
+    self.workspace_ctrl.orgview_controlGo_To_StartAction.setVisible(False)
+    self.workspace_ctrl.orgview_controlGo_To_EndAction.setVisible(False)
+
+  def aboutToBeRaised(self, workspace_ctrl):
     """Connects menu items from organism viewer controller."""
-    descr()
-    self.connect(
-      self.m_session_mdl.m_session_mdtr,
-      PYSIGNAL("saveImagesSig"),
-      self.saveImagesSlot)
-    self.connect(
-      self.m_session_mdl.m_session_mdtr,
-      PYSIGNAL("printSig"),
-      self.printOrgSlot)
+    self.workspace_ctrl = workspace_ctrl
+    self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("saveImagesSig"), self.saveImagesSlot)
+    self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("printSig"), self.printOrgSlot)
 
+    self.workspace_ctrl.orgview_controlStartAction.setVisible(True)
+    self.workspace_ctrl.orgview_controlNext_InstructionAction.setVisible(True)
+    self.workspace_ctrl.orgview_controlPrevious_InstructionAction.setVisible(True)
+    self.workspace_ctrl.orgview_controlGo_To_StartAction.setVisible(True)
+    self.workspace_ctrl.orgview_controlGo_To_EndAction.setVisible(True)
 
   def generatePixmaps(self, objects):
     pixmap = QPixmap()

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOnePopulationCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOnePopulationCtrl.py	2008-07-03 04:57:30 UTC (rev 2704)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOnePopulationCtrl.py	2008-07-04 04:25:21 UTC (rev 2705)
@@ -36,7 +36,7 @@
     self.connect(self.m_session_mdl.m_session_mdtr,
       PYSIGNAL("restartPopulationSig"), self.restartPopulationSlot)
 
-  def aboutToBeLowered(self):
+  def aboutToBeLowered(self, workspace_ctrl):
     """Disconnects menu items from One-Pop Graph controller."""
     descr()
     self.disconnect(
@@ -60,7 +60,11 @@
       PYSIGNAL("exportAnalyzeSig"),
       self.m_one_pop_graph_ctrl.exportSlot)
 
-  def aboutToBeRaised(self):
+    workspace_ctrl.popview_controlStartAction.setVisible(False)
+    workspace_ctrl.popview_controlNext_UpdateAction.setVisible(False)
+    workspace_ctrl.popview_controlRestart_ExpAction.setVisible(False)
+
+  def aboutToBeRaised(self, workspace_ctrl):
     """Connects menu items to One-Pop Graph controller."""
     descr()
     self.connect(
@@ -84,6 +88,10 @@
       PYSIGNAL("exportAnalyzeSig"),
       self.m_one_pop_graph_ctrl.exportSlot)
 
+    workspace_ctrl.popview_controlStartAction.setVisible(True)
+    workspace_ctrl.popview_controlNext_UpdateAction.setVisible(True)
+    workspace_ctrl.popview_controlRestart_ExpAction.setVisible(True)
+
   def dragEnterEvent( self, e ):
 
     freezer_item_list = QString()




More information about the Avida-cvs mailing list