[Avida-cvs] [avida-svn] r759 - in branches/developers/avida-edward: . source/bindings/Boost.Python source/python/AvidaGui2

gerrishj@myxo.css.msu.edu gerrishj at myxo.css.msu.edu
Mon Jun 19 18:03:18 PDT 2006


Author: gerrishj
Date: 2006-06-19 21:03:18 -0400 (Mon, 19 Jun 2006)
New Revision: 759

Modified:
   branches/developers/avida-edward/CMakeLists.txt
   branches/developers/avida-edward/source/bindings/Boost.Python/CMakeLists.txt
   branches/developers/avida-edward/source/python/AvidaGui2/pyAvidaStatsInterface.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyImageFileDialog.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyOneAnalyzeCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyOnePopulationCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/to-do_list
Log:
You can now specify a default filename in the image file saving dialog.
Exporting comma-delimited defaults to txt extension.
Added additional dialox box cancel checks.
Save image defaults to population name and update in population view.
Static link PyAvidaRepairHacks anytime AVD_PY_MONOLITHIC is set, not just for MinGW.


Modified: branches/developers/avida-edward/CMakeLists.txt
===================================================================
--- branches/developers/avida-edward/CMakeLists.txt	2006-06-19 19:22:26 UTC (rev 758)
+++ branches/developers/avida-edward/CMakeLists.txt	2006-06-20 01:03:18 UTC (rev 759)
@@ -100,6 +100,9 @@
   "Enable Python interface to Avida. (EXPERIMENTAL)"
   OFF
 )
+
+# Monolithic build is required for the Python bindings on Windows with the
+# MinGW GCC toolchain
 OPTION(AVD_PY_MONOLITHIC
   "Monolithic Python interface. (ignored if AVD_PY_BINDINGS is OFF)"
   ON

Modified: branches/developers/avida-edward/source/bindings/Boost.Python/CMakeLists.txt
===================================================================
--- branches/developers/avida-edward/source/bindings/Boost.Python/CMakeLists.txt	2006-06-19 19:22:26 UTC (rev 758)
+++ branches/developers/avida-edward/source/bindings/Boost.Python/CMakeLists.txt	2006-06-20 01:03:18 UTC (rev 759)
@@ -205,11 +205,11 @@
   test_cpu-fixups.cc
 )
 
-IF(MINGW)
+IF(AVD_PY_MONOLITHIC)
   ADD_LIBRARY(PyAvidaRepairHacks STATIC ${PyAvida_Extra_Cpp_Files})
-ELSE(MINGW)
+ELSE(AVD_PY_MONOLITHIC)
   ADD_LIBRARY(PyAvidaRepairHacks SHARED ${PyAvida_Extra_Cpp_Files})
-ENDIF(MINGW)
+ENDIF(AVD_PY_MONOLITHIC)
 TARGET_LINK_LIBRARIES(PyAvidaRepairHacks main cpu event main tools yaktest)
 
 STRING(REGEX REPLACE ";" ";-I;" PyAvida_Includes "${ALL_INC_DIRS}")

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyAvidaStatsInterface.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyAvidaStatsInterface.py	2006-06-19 19:22:26 UTC (rev 758)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyAvidaStatsInterface.py	2006-06-20 01:03:18 UTC (rev 759)
@@ -50,11 +50,11 @@
   def export(self, path):
     "Export stats to a file"
     dialog_caption = "Export Analysis"
-    fd = QFileDialog.getSaveFileName("", "CSV (Excel compatible) (*.csv)", None,
+    fd = QFileDialog.getSaveFileName("", "CSV (Excel compatible) (*.txt);;CSV (Excel compatible) (*.csv)", None,
                                      "export as", dialog_caption)
     filename = str(fd)
-    if (filename[-4:].lower() != ".csv"):
-      filename += ".csv"
+    if (filename[-4:].lower() != ".txt"):
+      filename += ".txt"
 
     checks = []
     # dictionary indexed by stat name so we can lookup stats to export

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyImageFileDialog.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyImageFileDialog.py	2006-06-19 19:22:26 UTC (rev 758)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyImageFileDialog.py	2006-06-20 01:03:18 UTC (rev 759)
@@ -2,16 +2,16 @@
 
 class pyImageFileDialog(QFileDialog):
 
-  def saveImageDialog(self):
+  def saveImageDialog(self, default = ""):
     """Dialog that lets user select where to save images.
     Returns filename and filetype."""
     # Let user select file format
     dialog_caption = "Export Image"
-    fd = self.getSaveFileName("", "JPEG (*.jpg);;PNG (*.png)", None,
+    fd = self.getSaveFileName(default, "JPEG (*.jpg);;PNG (*.png)", None,
                               "Save As", dialog_caption)
     filename = str(fd)
     if filename == "":
-      return
+      return None, None
 
     if filename[-4:].lower() == ".jpg":
       type = "JPEG"

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOneAnalyzeCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOneAnalyzeCtrl.py	2006-06-19 19:22:26 UTC (rev 758)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOneAnalyzeCtrl.py	2006-06-20 01:03:18 UTC (rev 759)
@@ -96,4 +96,5 @@
     "Save image of graph"
     dlg = pyImageFileDialog()
     filename, type = dlg.saveImageDialog()
-    self.m_one_ana_graph_ctrl.m_graph_ctrl.saveImage(filename, type)
+    if filename:
+      self.m_one_ana_graph_ctrl.m_graph_ctrl.saveImage(filename, type)

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOnePopulationCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOnePopulationCtrl.py	2006-06-19 19:22:26 UTC (rev 758)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOnePopulationCtrl.py	2006-06-20 01:03:18 UTC (rev 759)
@@ -129,16 +129,32 @@
     dlg = pyButtonListDialog("Save Image", "Choose object to save",
                              ["Petri Dish", "Graph"])
     res = dlg.showDialog()
+    if len(res) == 0:
+      return
 
     img_dlg = pyImageFileDialog()
-    filename, type = img_dlg.saveImageDialog()
 
+    # get population name
+    name = str(self.m_one_pop_petri_dish_ctrl.PopulationTextLabel.text())
+
+    # get update
+    stats = update = None
+    if self.m_one_pop_petri_dish_ctrl.m_avida:
+      stats = self.m_one_pop_petri_dish_ctrl.m_avida.m_population.GetStats()
+    if stats: update = stats.GetUpdate()
+
     # Save the image
     if res[0] == "Petri Dish":
+      filename, type = img_dlg.saveImageDialog(
+        name + "-" + "petridish-update" + str(update))
       p = self.m_one_pop_petri_dish_ctrl.getPetriDishPixmap()
-      p.save(filename, type, 100)
+      if filename:
+        p.save(filename, type, 100)
     else:
-      self.m_one_pop_graph_ctrl.m_graph_ctrl.saveImage(filename, type)
+      filename, type = img_dlg.saveImageDialog(
+        name + "-" + "graph-update" + str(update))
+      if filename:
+        self.m_one_pop_graph_ctrl.m_graph_ctrl.saveImage(filename, type)
 
   def printSlot(self):
     "Let user choose what object to print and send signal to appropriate slot"

Modified: branches/developers/avida-edward/source/python/AvidaGui2/to-do_list
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/to-do_list	2006-06-19 19:22:26 UTC (rev 758)
+++ branches/developers/avida-edward/source/python/AvidaGui2/to-do_list	2006-06-20 01:03:18 UTC (rev 759)
@@ -96,10 +96,19 @@
 
 ************Josh*******************
 
-06-Jun-06 Change .csv to .txt extension in export dialog
-
 30-May-06 Fill out save image dialog with default filename that includes update and other info
+  19-Jun-06 Finished default filename for population mode.  Need to finish analyze mode
 
+12-Jun-06 Fix color printing in graph
+
+12-Jun-06 Add documentation about saving and exporting excel data and images
+
+12-Jun-06 Add ability to analyze more than one population.
+
+01-Apr-06 Get Windows automated builds working on Devolab machine
+
+08-Jun-06 Add printing/saving images to organism and population stats view.
+
 ************Other*****************
 a.	Under the sliders with ranges put a few values in grey that tell you the range min and max (non)
 
@@ -168,3 +177,4 @@
 16-Jan-06 Get Windows version working -- Finished 21-Feb-06
 29-Apr-06 Export Excel style (comma delimited) files -- Finished 06-Jun-06
 30-May-06 Printing of petri dish and of color scale -- Finished 06-Jun-06
+06-Jun-06 Change .csv to .txt extension in export dialog -- Finished 19-Jun-06




More information about the Avida-cvs mailing list