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

jclune@myxo.css.msu.edu jclune at myxo.css.msu.edu
Fri Jun 17 14:27:53 PDT 2005


Author: jclune
Date: 2005-06-17 17:27:53 -0400 (Fri, 17 Jun 2005)
New Revision: 210

Modified:
   trunk/source/python/AvidaGui2/pyAvidaStatsInterface.py
   trunk/source/python/AvidaGui2/pyEduWorkspaceView.ui
   trunk/source/python/AvidaGui2/pyFreezerCtrl.py
   trunk/source/python/AvidaGui2/pyMapProfile.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/pyOnePop_GraphCtrl.py
   trunk/source/python/AvidaGui2/pyOnePop_GraphView.ui
   trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
   trunk/source/python/AvidaGui2/pyOnePop_StatsCtrl.py
   trunk/source/python/AvidaGui2/pyOnePopulationCtrl.py
   trunk/source/python/AvidaGui2/pyPetriCanvasView.py
   trunk/source/python/AvidaGui2/pyPetriConfigureCtrl.py
   trunk/source/python/AvidaGui2/pyPetriDishCtrl.py
   trunk/source/python/AvidaGui2/pyPopulationCellItem.py
Log:
1) double clicking on freezer items now does the same as drag and drop
2) the petri dish is now centered for any world size or zoom level
3) analyze mode and petri dish mode are decoupled
4) dragging organisms now provides a "under construction"  message instead of crashing


Modified: trunk/source/python/AvidaGui2/pyAvidaStatsInterface.py
===================================================================
--- trunk/source/python/AvidaGui2/pyAvidaStatsInterface.py	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyAvidaStatsInterface.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -5,7 +5,7 @@
   def __init__(self):
     self.m_entries = (
       ('None',                          None,            0, None),
-      ('Average Merit',                 'average.dat',   2, lambda s: s.GetAveMerit()),
+      ('Average Metabolic Rate',                 'average.dat',   2, lambda s: s.GetAveMerit()),
       ('Average Fitness',               'average.dat',   4, lambda s: s.GetAveFitness()),
       ('Average Gestation Time',        'average.dat',   3, lambda s: s.GetAveGestation()),
       ('Average Genome Length',                  'average.dat',   6, lambda s: s.GetAveSize()),

Modified: trunk/source/python/AvidaGui2/pyEduWorkspaceView.ui
===================================================================
--- trunk/source/python/AvidaGui2/pyEduWorkspaceView.ui	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyEduWorkspaceView.ui	2005-06-17 21:27:53 UTC (rev 210)
@@ -45,6 +45,9 @@
     <property name="caption">
         <string>Avida-ED</string>
     </property>
+    <property name="acceptDrops">
+        <bool>true</bool>
+    </property>
     <vbox>
         <property name="name">
             <cstring>unnamed</cstring>
@@ -100,6 +103,9 @@
                             <height>200</height>
                         </size>
                     </property>
+                    <property name="acceptDrops">
+                        <bool>true</bool>
+                    </property>
                 </widget>
             </widget>
             <widget class="QWidgetStack">
@@ -205,6 +211,10 @@
         <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>
@@ -242,6 +252,10 @@
         <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>

Modified: trunk/source/python/AvidaGui2/pyFreezerCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyFreezerCtrl.py	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyFreezerCtrl.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -20,14 +20,18 @@
     self.connect(self.m_list_view, 
       SIGNAL("pressed(QListViewItem*, const QPoint &, int )"),
       self.pressed_itemSlot)
+    self.setAcceptDrops(1)
 
   def construct(self, session_mdl):
     self.m_session_mdl = session_mdl
     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()
 
+
   def createFreezerIndexSlot(self):
     empty_item = self.m_list_view.firstChild()
     while empty_item.firstChild():
@@ -110,6 +114,8 @@
       thawed_item = pyReadFreezer(file_name)
       self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("doDefrostDishSig"),
         (item.text(0), thawed_item,))
+      self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("freezerItemDoubleClicked"),
+        (file_name,))
 
 
   class itemDrag(QTextDrag):
@@ -117,7 +123,13 @@
         QStoredDrag.__init__(self, 'item name (QString)', parent, name)
         self.setText(item_name)
 
+  def dropEvent( self, e ):
+    freezer_item_name = QString()
+    print "dropEvent in freezer"
+    if ( QTextDrag.decode( e, freezer_item_name ) ) : #freezer_item_name is a string...the file name 
+      if os.path.exists(str(freezer_item_name)) == False:
+        print "that was not a valid path (1)" 
+      else: 
+        self.emit(PYSIGNAL("petriDishDroppedInPopViewSig"), (e,))
 
 
-
-

Modified: trunk/source/python/AvidaGui2/pyMapProfile.py
===================================================================
--- trunk/source/python/AvidaGui2/pyMapProfile.py	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyMapProfile.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -172,7 +172,7 @@
         gradualLinScaleUpdater(RangeReport(NullRng, self.m_session_mdl)),
         None
         ),
-      ('Merit',
+      ('Metabolic Rate',
         continuousIndexer(MeritIdx),
         gradualLinScaleUpdater(RangeReport(MeritRng, self.m_session_mdl)),
         sigmoidColorLookup

Modified: trunk/source/python/AvidaGui2/pyOneAna_GraphCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOneAna_GraphCtrl.py	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyOneAna_GraphCtrl.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -50,6 +50,10 @@
     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.freezerItemDoubleClickedOn)  
+
+
     # set up the combo boxes with plot options
     for entry in self.m_avida_stats_interface.m_entries:
       self.m_combo_box_1.insertItem(entry[0])
@@ -199,6 +203,7 @@
        self.m_graph_ctrl.setTitle(self.m_avida_stats_interface.m_entries[0][0])
        self.m_graph_ctrl.setAxisTitle(QwtPlot.yLeft, self.m_avida_stats_interface.m_entries[0][0])
 
+
     self.m_graph_ctrl.replot()
       
   def printGraphSlot(self):
@@ -209,10 +214,6 @@
         filter.setOptions(QwtPlotPrintFilter.PrintAll & ~QwtPlotPrintFilter.PrintCanvasBackground)
       self.m_graph_ctrl.printPlot(printer, filter)
 
-
-#  def gotIt( self, e):
-#    print "got it"
-
   def petriDropped(self, e): 
       # a check in pyOneAnalyzeCtrl.py makes sure this is a valid path
       self.m_petri_dish_dir_exists_flag = True
@@ -249,10 +250,11 @@
       str = decode( e ) 
       if str:
         print " in if str"
-#jmc delete
-#        self.setText( str )
-#        self.setMinimumSize(self.minimumSize().expandedTo(self.sizeHint()))
-        return
 
+  def freezerItemDoubleClickedOn(self, freezer_item_name): 
+    # a check in pyOneAnalyzeCtrl.py makes sure this is a valid path
+    self.m_petri_dish_dir_exists_flag = True
+    self.m_petri_dish_dir_path = os.path.split(freezer_item_name)[0]
+    self.modeActivatedSlot()
+     
 
-

Modified: trunk/source/python/AvidaGui2/pyOneAna_PetriDishCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOneAna_PetriDishCtrl.py	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyOneAna_PetriDishCtrl.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -14,6 +14,8 @@
     self.m_session_mdl = session_mdl     
     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.freezerItemDoubleClickedOn)  
 
 
   def freezerItemDropped(self, e):
@@ -22,3 +24,8 @@
     freezer_item_name = QString()
     if ( QTextDrag.decode( e, freezer_item_name ) ) :
       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-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyOneAnalyzeCtrl.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -14,24 +14,27 @@
     self.m_session_mdl = session_mdl
     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"))
-    print "self" 
-    print self
+    self.connect( self, 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.freezerItemDoubleClicked)
 
   def dropEvent( self, e ):
     freezer_item_name = QString()
-    print "something was dropped"
     if ( QTextDrag.decode( e, freezer_item_name ) ) :
       if os.path.exists( str(freezer_item_name)) == False:
         print "that was not a valid path(3)" 
       else: 
         self.emit(PYSIGNAL("freezerItemDroppedInOneAnalyzeSig"), (e,))
 
+  def freezerItemDoubleClicked(self, freezer_item_name):
+    if os.path.exists( str(freezer_item_name)) == False:
+      print "that was not a valid path(3)"
+    else:
+      if self.isVisible():
+         self.emit(PYSIGNAL("freezerItemDoubleClickedOnInOneAnaSig"), (freezer_item_name,))
+      
 
-#  def dragEnterEvent( self, e ):
-#      # Check if you want the drag...
-#        if (secret.canDecode( e ) or
-#            QTextDrag.canDecode( e ) or
-#            QImageDrag.canDecode( e ) or
-#            QUriDrag.canDecode( e )):
-#    e.accept()
+

Modified: trunk/source/python/AvidaGui2/pyOnePop_GraphCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOnePop_GraphCtrl.py	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyOnePop_GraphCtrl.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -86,7 +86,8 @@
         self.m_y_array[line_id] = line.GetWord(coly - 1).AsDouble()
 
   def modeActivatedSlot(self, index):
-    self.m_graph_ctrl.setTitle(self.m_avida_stats_interface.m_entries[index][0])
+#    self.m_graph_ctrl.setTitle(self.m_avida_stats_interface.m_entries[index][0])
+    self.m_graph_title.setText(self.m_avida_stats_interface.m_entries[index][0])
     self.m_graph_ctrl.clear()
     if index:
       self.load(

Modified: trunk/source/python/AvidaGui2/pyOnePop_GraphView.ui
===================================================================
--- trunk/source/python/AvidaGui2/pyOnePop_GraphView.ui	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyOnePop_GraphView.ui	2005-06-17 21:27:53 UTC (rev 210)
@@ -54,7 +54,7 @@
                 </property>
                 <widget class="QLayoutWidget">
                     <property name="name">
-                        <cstring>layout210</cstring>
+                        <cstring>layout7</cstring>
                     </property>
                     <hbox>
                         <property name="name">
@@ -65,21 +65,21 @@
                                 <cstring>spacer152</cstring>
                             </property>
                             <property name="orientation">
-                                <enum>Vertical</enum>
+                                <enum>Horizontal</enum>
                             </property>
                             <property name="sizeType">
-                                <enum>Minimum</enum>
+                                <enum>Expanding</enum>
                             </property>
                             <property name="sizeHint">
                                 <size>
-                                    <width>1</width>
-                                    <height>32</height>
+                                    <width>40</width>
+                                    <height>15</height>
                                 </size>
                             </property>
                         </spacer>
                         <widget class="QLabel">
                             <property name="name">
-                                <cstring>textLabel9_2</cstring>
+                                <cstring>m_graph_title</cstring>
                             </property>
                             <property name="sizePolicy">
                                 <sizepolicy>
@@ -91,73 +91,31 @@
                             </property>
                             <property name="font">
                                 <font>
-                                    <pointsize>11</pointsize>
+                                    <pointsize>12</pointsize>
+                                    <bold>1</bold>
                                 </font>
                             </property>
                             <property name="text">
-                                <string></string>
+                                <string>None</string>
                             </property>
                         </widget>
-                        <widget class="QLayoutWidget">
+                        <spacer>
                             <property name="name">
-                                <cstring>layout178</cstring>
+                                <cstring>spacer8</cstring>
                             </property>
-                            <vbox>
-                                <property name="name">
-                                    <cstring>unnamed</cstring>
-                                </property>
-                                <spacer>
-                                    <property name="name">
-                                        <cstring>spacer126</cstring>
-                                    </property>
-                                    <property name="orientation">
-                                        <enum>Vertical</enum>
-                                    </property>
-                                    <property name="sizeType">
-                                        <enum>Minimum</enum>
-                                    </property>
-                                    <property name="sizeHint">
-                                        <size>
-                                            <width>1</width>
-                                            <height>1</height>
-                                        </size>
-                                    </property>
-                                </spacer>
-                                <widget class="QToolButton">
-                                    <property name="name">
-                                        <cstring>toolButton31_2</cstring>
-                                    </property>
-                                    <property name="font">
-                                        <font>
-                                            <pointsize>10</pointsize>
-                                        </font>
-                                    </property>
-                                    <property name="text">
-                                        <string></string>
-                                    </property>
-                                    <property name="iconSet">
-                                        <iconset>image0</iconset>
-                                    </property>
-                                </widget>
-                                <spacer>
-                                    <property name="name">
-                                        <cstring>spacer126_2</cstring>
-                                    </property>
-                                    <property name="orientation">
-                                        <enum>Vertical</enum>
-                                    </property>
-                                    <property name="sizeType">
-                                        <enum>Minimum</enum>
-                                    </property>
-                                    <property name="sizeHint">
-                                        <size>
-                                            <width>1</width>
-                                            <height>1</height>
-                                        </size>
-                                    </property>
-                                </spacer>
-                            </vbox>
-                        </widget>
+                            <property name="orientation">
+                                <enum>Horizontal</enum>
+                            </property>
+                            <property name="sizeType">
+                                <enum>Expanding</enum>
+                            </property>
+                            <property name="sizeHint">
+                                <size>
+                                    <width>40</width>
+                                    <height>15</height>
+                                </size>
+                            </property>
+                        </spacer>
                     </hbox>
                 </widget>
                 <widget class="pyGraphCtrl">
@@ -257,7 +215,7 @@
             <horstretch>0</horstretch>
             <verstretch>0</verstretch>
         </sizepolicy>
-        <pixmap>image1</pixmap>
+        <pixmap>image0</pixmap>
         <property type="0">3</property>
         <property type="1">pyGraphCtrl</property>
         <property type="3">-1</property>
@@ -275,15 +233,14 @@
         <property type="0">-1</property>
         <property type="1">pyGraphCtrl</property>
         <property type="0">-1</property>
+        <property type="1">pyGraphCtrl</property>
+        <property type="0">-1</property>
         <property type="pyGraphCtrl"></property>
         <property type="-1">1</property>
     </customwidget>
 </customwidgets>
 <images>
     <image name="image0">
-        <data format="PNG" length="528">89504e470d0a1a0a0000000d494844520000000f0000000e0806000000f08a46ef000001d749444154789c8592cd6a53511485bf9b5c098969a3adb645c1e24f1a9d288a139180c1d0a9e044a18238a8934ed4e2d41770208a5121fa04fa06058722c46141090d0435850493e6aff626b9e72c076dd33411ba6071e0ecb3ce62efbd90c4205bad96969f3c55a552d1706d980106d06eb7957991e5883b85319683e04802a0d3e928f332cb4c608edfb53c53735142a1d0bec7b1588c542a45381c76fa62dff7f5e65596e39ca356dee2d8d418963d6721ac0c5e6f8b5223cfdd07b74824128e238977afdf2bd63dc546b983acc0d91581248c8495c5f37da6a7c7215a63e1e16d82972f5e5577fd30ed3f86dd16f63b8295c5588b91a5d6dce4686492466f9dc0cdf91b14367ee0197f48b80dbbf3a19130b20868793dcabfea04a2d1a8b3f4688192f79dae35fb5ca5edd358db77b7b2f47a066fabbb37edc25a4199e79f383d769e4dbfc3df6e1383b0560870022eae13c2c8303931ce89b303ab02c8e5bee9e3872f6c7a75aea5cf100c06fbb566a34deeeb1a13e10bb8ee21aecf4f32929a9595cfba776749d56a752461f97c5e8bf79fe9f1e25b158b45b9c3a949a7534e28e42a12898c242a1e8f3b3327a3aa55eaccce!
 ce3a2362806432e9fcef1ee0d29504eb3f6b3b533d20fcc35c5d5d55a9549224fe01033d5afa3250e5560000000049454e44ae426082</data>
-    </image>
-    <image name="image1">
         <data format="PNG" length="1002">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003b149444154789cad945f4c5b551cc73fe7dc4b7b4bcba0762d45c43114323599ee6192609c51d883892ce083f1718b3ebb185f8dc91e972cf39d2d2a2f1af664b6f1e0fe3863a0718969700eb0c52142da0242a1bd6d696f7bcff101585203ceb8fd9ece39f99dcff9fe7edf939f88c562ec465f5f9fe609442c161362173c3e3eae7b7a7ac8e7f36432196cdbfe4f907c3e4f2291201e8fe338cec3737357e9e8e828aded1e229d650e1f2d51754b082110124c13a4dc5ea341eb9dc284c0558a853f3ce8cb0677ef500fde7d39d2596679e326597b8e9abb85d7a770ab16ab6983ec5a05b487a70e36f0f4e10afe408d6a558310980108478dba4a1e8233990c5d474b64ed39aa3a8fe5f3317fbf81dbd70bccfeb205947632fd74f6589c1c6ea2f70d03a58ba0c1f2c9bdc1b66de3b8256a6e11cbe7e3ee1d181b590124fe2693aeee08d223c82c3a2c24b7b874bec8f26288774f7bd054504aef0dde6e99c0eb83f9fb266323cb80a27fb0958141836044605a2ee5523393371cc646fee2da37195aa35d0c0c5b4859ac03d7e91712dcaac5adab3650a3ff9d08ef7dd8404bb48869e5d958b5b87dadc4c9a1464e9f0d0326df7!
 ebd86bd2e310cb1bf62d384d59441f2d70a070e1c60e09489929b988681bdd9cc97170bcc4c65595f71f8e0e3301337fc24a7732467831875a47f289652b0be5e4151e6d07316c1b0c0340d8ab92023e76d66a6b2840e36d2fb7a13fee632475e6edc367ea98a90fb98b7dd6310ca0328a44761582e1bab41befabcc0ec940d28bc5e93b68e064cab84e1d9beaeb48934eac1f53b01c1b000fca496aa54b61a99fcde61662a4b4b4b23d1680be9d426173e4df3602a48ea411989a4fd590f52a8fd156b05ed9d350e3defe3cfdf4b4c7ce770ea7d3fb9f520afbe1620daeee5c26735d20b9b9cfb6811a754a439e4e5c5639a4caa1e5caf586bfc0197b78702005cb9b4cae4cd3267ce8638fe964bd72b393e39d74928d242617303a756a37f284447770dcdbffc6384a05a85de1306e9a52057c7527c7131c3c42d3f475eb2303c82d4fc3276d6811db37efeb148723082d9b08f79f97c1e5729109a9a28307cc622d2d6cdf52b2b24efe548dedb00142009862cfa879ee1a71f6cec928353511472fbf4389148b0b0e0c108081412458dfe21c9f11351e67e7358595468246d1d1e5e38a6e9e851bc39d84ab502a669331dafec0d8ec7e3e8cb06e1a881d727d1ae40180a434a8c9db129a54126ad48a7358c2b4c5352c8c374bcccdab2bb37d8719cba79fab8211f9df218e05!
 82c261e95f8bfc04f1a1e8bc5c4dfe0a19017a725d8c60000000049454e44a!
 e426082<
/data>
     </image>
 </images>

Modified: trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -26,8 +26,9 @@
     self.connect(self.m_petri_dish_ctrl, PYSIGNAL("freezeDishPhaseIISig"), self.m_petri_configure_ctrl.FreezePetriSlot)
     self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("setAvidaSig"), self.setAvidaSlot)
     self.connect(self.m_petri_dish_toggle, SIGNAL("clicked()"), self.ToggleDishSlot)
-    self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("doDefrostDishSig"), self.RenameDishSlot)
-    self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("doDefrostDishSig"), self.MakeConfigVisiableSlot)
+    self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("doDefrostDishSig"), self.shouldIDefrost)
+#    self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("doDefrostDishSig"), self.RenameDishSlot)
+#    self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("doDefrostDishSig"), self.MakeConfigVisiableSlot)
     self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("doDisablePetriDishSig"), self.SetDishDisabledSlot)
     self.connect(self.m_zoom_spinbox, SIGNAL("valueChanged(int)"), self.m_petri_dish_ctrl.zoomSlot)
     self.connect(self.m_petri_dish_ctrl, PYSIGNAL("zoomSig"), self.m_zoom_spinbox.setValue)
@@ -138,7 +139,10 @@
     print "*** Entered petriDropped"
     freezer_item_name = QString()
     if ( QTextDrag.decode( e, freezer_item_name ) ) :
-      if freezer_item_name[-4:] == 'full':
+      if freezer_item_name[-8:] == 'organism':
+        print "we can't yet deal with organims in the population view"
+        return
+      elif freezer_item_name[-4:] == 'full':
         freezer_item_name_temp = os.path.join(str(freezer_item_name), 'petri_dish')
       else:
         freezer_item_name_temp = str(freezer_item_name)
@@ -149,3 +153,8 @@
       current_page = self.m_petri_dish_widget_stack.visibleWidget()
       current_page_int = self.m_petri_dish_widget_stack.id(current_page)
       self.MakeConfigVisiableSlot()
+
+  def shouldIDefrost(self, dishName):
+    if self.isVisible():
+      self.RenameDishSlot(dishName)
+      self.MakeConfigVisiableSlot()

Modified: trunk/source/python/AvidaGui2/pyOnePop_StatsCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOnePop_StatsCtrl.py	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyOnePop_StatsCtrl.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -1,11 +1,12 @@
 
 # -*- coding: utf-8 -*-
 
+from AvidaCore import cInitFile, cString
 from qt import *
 from pyOnePop_StatsView import pyOnePop_StatsView
 from pyOrgSquareCtrl import pyOrgSquareCtrl
+import os
 
-
 class pyOnePop_StatsCtrl(pyOnePop_StatsView):
 
   def __init__(self,parent = None,name = None,fl = 0):
@@ -21,6 +22,10 @@
     self.connect(
       self.m_session_mdl.m_session_mdtr, PYSIGNAL("orgClickedOnSig"),
       self.updateOrgReportSlot)
+    self.connect( self.m_session_mdl.m_session_mdtr, PYSIGNAL("petriDishDroppedInPopViewSig"),
+      self.petriDropped)  
+    self.connect( self.m_session_mdl.m_session_mdtr, PYSIGNAL("freezerItemDoubleClickedOnInOnePopSig"),
+      self.freezerItemDoubleClickedOn)  
     self.m_clicked_cell_number = -99
 
   def setAvidaSlot(self, avida):
@@ -255,5 +260,89 @@
     self.m_num_equals_clickedOrg.setText(str(num_equals_clickedOrg))
 
 
+  def petriDropped(self, e):
+    # Try to decode to the data you understand...
+    freezer_item_name = QString()
+    if ( QTextDrag.decode( e, freezer_item_name ) ) :
+      if freezer_item_name[-4:] == 'full':
+        full_petri_dir = str(freezer_item_name)
+        self.loadStats(full_petri_dir)
+      else:
+        return
+#        (os.path.splitext((os.path.split(str(freezer_item_name))[1]))[0], thawed_item,))
 
+  def loadStats(self, full_petri_dir):
+    full_petri_average_file_name = os.path.join(str(full_petri_dir), 'average.dat')
+    full_petri_count_file_name = os.path.join(str(full_petri_dir), 'count.dat')
+    full_petri_task_file_name = os.path.join(str(full_petri_dir), 'tasks.dat')
+ 
+    #check to see if the average.dat file exists, if so, read it  
+    if os.path.isfile(full_petri_average_file_name):
+      pass
+    else:
+      print "error: there is no average.dat file in the directory to load from"
+      return
+    petri_average_file_raw = open(full_petri_average_file_name,'r')
+    petri_average_file = petri_average_file_raw.readlines()
+    length = (len(petri_average_file))
+    average_last_line =  petri_average_file[length-1]
+    average_last_line_array = average_last_line.split()
 
+    #check to see if the count.dat file exists, if so, read it  
+    if os.path.isfile(full_petri_count_file_name):
+      pass
+    else:
+      print "error: there is no count.dat file in the directory to load from"
+      return
+    petri_count_file_raw = open(full_petri_count_file_name,'r')
+    petri_count_file = petri_count_file_raw.readlines()
+    length = (len(petri_count_file))
+    count_last_line =  petri_count_file[length-1]
+    count_last_line_array = count_last_line.split()
+
+    #check to see if the task.dat file exists, if so, read it  
+    if os.path.isfile(full_petri_task_file_name):
+      pass
+    else:
+      print "error: there is no task.dat file in the directory to load from"
+      return
+    petri_task_file_raw = open(full_petri_task_file_name,'r')
+    petri_task_file = petri_task_file_raw.readlines()
+    length = (len(petri_task_file))
+    task_last_line =  petri_task_file[length-1]
+    task_last_line_array = task_last_line.split()
+
+    #report the stats on the defrosted petri dish    
+    self.m_avg_fitness.setText(average_last_line_array[3])
+    self.m_num_orgs.setText(QString("%1").arg(count_last_line_array[2]))
+    self.m_avg_gest.setText(QString("%1").arg(average_last_line_array[2]))
+    self.m_avg_merit.setText(QString("%1").arg(average_last_line_array[1]))
+#    self.m_avg_age.setText(QString("%1").arg(avg_age))
+#   not setting age here because they will all come out of the freezer at age 0
+    self.m_avg_genome_length.setText(QString("%1").arg(average_last_line_array[5]))
+ 
+    #report the task counts for the defrosted dish
+    self.m_num_not.setText(task_last_line_array[1])
+    self.m_num_nand.setText(task_last_line_array[2])
+    self.m_num_and.setText(task_last_line_array[3])
+    self.m_num_ornot.setText(task_last_line_array[4])
+    self.m_num_or.setText(task_last_line_array[5])
+    self.m_num_andnot.setText(task_last_line_array[6])
+    self.m_num_nor.setText(task_last_line_array[7])
+    self.m_num_xor.setText(task_last_line_array[8])
+    self.m_num_equals.setText(task_last_line_array[9])
+
+
+#    petri_average_file.Load()    
+#    update_number = petri_average_file.GetNumLines()
+#    print "this pop at update number"
+#    print update_number
+
+#    y_array = zeros(init_file.GetNumLines(), Float)
+
+  def freezerItemDoubleClickedOn(self, freezer_item_name):
+    freezer_item_dir = os.path.split(str(freezer_item_name))[0]
+    if freezer_item_dir[-4:] == 'full':
+      self.loadStats(freezer_item_dir)
+    else:
+      return

Modified: trunk/source/python/AvidaGui2/pyOnePopulationCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOnePopulationCtrl.py	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyOnePopulationCtrl.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -16,7 +16,12 @@
     self.m_one_pop_graph_ctrl.construct(self.m_session_mdl)
     self.m_one_pop_stats_ctrl.construct(self.m_session_mdl)
     self.m_one_pop_timeline_ctrl.hide()
-    self.connect( self, PYSIGNAL("petriDishDroppedInPopViewSig"), self.m_session_mdl.m_session_mdtr, PYSIGNAL("petriDishDroppedInPopViewSig"))
+    self.connect( self, PYSIGNAL("petriDishDroppedInPopViewSig"),
+      self.m_session_mdl.m_session_mdtr, PYSIGNAL("petriDishDroppedInPopViewSig"))   
+    self.connect( self, PYSIGNAL("freezerItemDoubleClickedOnInOnePopSig"), 
+      self.m_session_mdl.m_session_mdtr, PYSIGNAL("freezerItemDoubleClickedOnInOnePopSig"))
+    self.connect( self.m_session_mdl.m_session_mdtr, PYSIGNAL("freezerItemDoubleClicked"),
+      self.freezerItemDoubleClicked)
 
   def dropEvent( self, e ):
     freezer_item_name = QString()
@@ -26,4 +31,9 @@
         print "that was not a valid path (1)" 
       else: 
         self.emit(PYSIGNAL("petriDishDroppedInPopViewSig"), (e,))
-        print "emitted"
+
+  def freezerItemDoubleClicked(self, freezer_item_name):
+   if  self.isVisible():
+       self.emit(PYSIGNAL("freezerItemDoubleClickedOnInOnePopSig"), (freezer_item_name,))
+
+ 
\ No newline at end of file

Modified: trunk/source/python/AvidaGui2/pyPetriCanvasView.py
===================================================================
--- trunk/source/python/AvidaGui2/pyPetriCanvasView.py	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyPetriCanvasView.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -3,7 +3,7 @@
 from qtcanvas import QCanvasView
 
 class pyPetriCanvasView(QCanvasView):
-  def __init__(self,parent,name,f):
+  def __init__(self,parent,name,f =2):
     QCanvasView.__init__(self,parent,name,f)
   def contentsMousePressEvent(self,e): # QMouseEvent e
     if e.button() != Qt.LeftButton: return
@@ -20,5 +20,3 @@
       self.emit(PYSIGNAL("orgClickedOnSig"), (org_clicked_on_item,))
       if org_clicked_on_item:
         self.emit(PYSIGNAL("orgClickedOnSig"), (org_clicked_on_item,))
-#the_item.brush().color()
-#the_item.m_population_cell.GetID()
\ No newline at end of file

Modified: trunk/source/python/AvidaGui2/pyPetriConfigureCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyPetriConfigureCtrl.py	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyPetriConfigureCtrl.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -298,9 +298,6 @@
     freezer_item_name = QString()
     print "dropEvent"
     if ( QTextDrag.decode( e, freezer_item_name ) ) :
-      print "in here"
-      print freezer_item_name
-#      if os.path.exists(str('default.workspace/freezer/' + str(string) + '.full/')) == False:
       if os.path.exists(str(freezer_item_name)) == False:
         print "that was not a valid path (2)" 
       else: 

Modified: trunk/source/python/AvidaGui2/pyPetriDishCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyPetriDishCtrl.py	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyPetriDishCtrl.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -51,7 +51,8 @@
     self.m_org_clicked_on_item = None
     self.m_occupied_cells_ids = []
 
-    self.m_target_dish_width = 270
+#    self.m_target_dish_width = 270
+    self.m_target_dish_width = 350
     self.m_target_dish_scaling = 5.
     self.m_map_cell_width = 5
 
@@ -98,6 +99,7 @@
     self.m_canvas = QCanvas(self.m_map_cell_width * self.m_world_w, self.m_map_cell_width * self.m_world_h)
     self.m_canvas.setBackgroundColor(Qt.darkGray)
     self.m_canvas_view.setCanvas(self.m_canvas)
+
     if self.m_background_rect: del self.m_background_rect
     self.m_background_rect = QCanvasRectangle(
       0, 0,
@@ -180,5 +182,12 @@
     if self.m_canvas_view:
       m = QWMatrix()
       m.scale(zoom_factor/self.m_target_dish_scaling, zoom_factor/self.m_target_dish_scaling)
+      trans_h = (self.m_canvas_view.size().height() - (self.m_map_cell_width * self.m_world_h)*
+        (zoom_factor/self.m_target_dish_scaling))/2
+
+      if zoom_factor == 0:
+        m.translate(trans_h/(1/self.m_target_dish_scaling),trans_h/(1/self.m_target_dish_scaling))
+      else:
+        m.translate(trans_h/(zoom_factor/self.m_target_dish_scaling),trans_h/(zoom_factor/self.m_target_dish_scaling))    
       self.m_canvas_view.setWorldMatrix(m)
-
+ 
\ No newline at end of file

Modified: trunk/source/python/AvidaGui2/pyPopulationCellItem.py
===================================================================
--- trunk/source/python/AvidaGui2/pyPopulationCellItem.py	2005-06-13 19:03:17 UTC (rev 209)
+++ trunk/source/python/AvidaGui2/pyPopulationCellItem.py	2005-06-17 21:27:53 UTC (rev 210)
@@ -11,6 +11,8 @@
     return 271828
 
   def __init__(self, population_cell, x, y, w, h, canvas):
+ #   x = x + 5
+ #   y = y + 5
     QCanvasRectangle.__init__(self, x, y, w, h, canvas)
     self.m_population_cell = population_cell
     self.m_index = 0




More information about the Avida-cvs mailing list