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

welsberr at myxo.css.msu.edu welsberr at myxo.css.msu.edu
Thu Mar 26 18:26:11 PDT 2009


Author: welsberr
Date: 2009-03-26 21:26:11 -0400 (Thu, 26 Mar 2009)
New Revision: 3196

Modified:
   branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup_utils.py
   branches/developers/avida-edward/source/python/AvidaGui2/app_pyuic
   branches/developers/avida-edward/source/python/AvidaGui2/pyAncestorLegendView.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyGradientScaleView.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyGraphCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyMapLegendView.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyOneAna_GraphCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_GraphCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyTimeline.py
Log:
Avida-ED lives again! Base for plugin, multi-dish development

Modified: branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup_utils.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup_utils.py	2009-03-23 15:23:20 UTC (rev 3195)
+++ branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup_utils.py	2009-03-27 01:26:11 UTC (rev 3196)
@@ -90,6 +90,7 @@
       qt.PYSIGNAL("doInitializeAvidaPhaseISig"),
       (edu_main_controller.m_edu_workspace_ctrl.m_session_mdl.m_tempdir,))
 
+    # Place to put plugin loading:
 
   finally:
     s_splash.clear()

Modified: branches/developers/avida-edward/source/python/AvidaGui2/app_pyuic
===================================================================
(Binary files differ)

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyAncestorLegendView.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyAncestorLegendView.py	2009-03-23 15:23:20 UTC (rev 3195)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyAncestorLegendView.py	2009-03-27 01:26:11 UTC (rev 3196)
@@ -245,5 +245,7 @@
     if x >= 100:
       ix = int(x)
       x = float(ix)
-    return QString("%1").arg(x, 0, 'g', 2)
+      # QString("%1").arg(x, 0, 'g', 2)
+      mystring = '%.2g' % x
+    return QString(mystring)
 

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py	2009-03-23 15:23:20 UTC (rev 3195)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py	2009-03-27 01:26:11 UTC (rev 3196)
@@ -57,6 +57,8 @@
     self.m_one_organism_ctrl    = pyOneOrganismCtrl(self.m_widget_stack, "m_one_organism_ctrl")
     self.m_one_analyze_ctrl     = pyOneAnalyzeCtrl(self.m_widget_stack, "m_one_analyze_ctrl")
 
+    # Mapping cli and ctrl elements
+    #   Need to set up methods to do this kind of work 
     for (cli, ctrl) in (
       (self.m_nav_bar_ctrl.m_one_population_cli, self.m_one_population_ctrl),
       (self.m_nav_bar_ctrl.m_one_organism_cli,   self.m_one_organism_ctrl),

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyGradientScaleView.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyGradientScaleView.py	2009-03-23 15:23:20 UTC (rev 3195)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyGradientScaleView.py	2009-03-27 01:26:11 UTC (rev 3196)
@@ -268,12 +268,21 @@
     if x >= 100:
       ix = int(x)
       x = float(ix)
+
+    # FIXME: Early exit
+    # return QString("%1").arg(x, 0, 'f')
+
     if (x <= 10.0):
-      return QString("%1").arg(x, 0, 'f', 2)
+      # return QString("%1").arg(x, 0, 'f', 2)
+      my_string = '%.2f ' % x 
     elif (x < 100.0):
-      return QString("%1").arg(x, 0, 'f', 1)
+      # return QString("%1").arg(x, 0, 'f', 1)
+      my_string = '%.1f' % x
     elif (x < 10000.0):
-      return QString(str(ix))
+      # return QString(str(ix))
+      my_string = '%d' % ix
     else:
-      return QString("%1").arg(x, 0, 'g', 2)
+      # return QString("%1").arg(x, 0, 'g', 2)
+      my_string = '%.2g' % x
+    return QString(my_string)
 

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyGraphCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyGraphCtrl.py	2009-03-23 15:23:20 UTC (rev 3195)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyGraphCtrl.py	2009-03-27 01:26:11 UTC (rev 3196)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 from qt import *
-from qwt import *
+from Qwt5 import *
 
 class pyGraphCtrl(QwtPlot):
 

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyMapLegendView.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyMapLegendView.py	2009-03-23 15:23:20 UTC (rev 3195)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyMapLegendView.py	2009-03-27 01:26:11 UTC (rev 3196)
@@ -246,5 +246,7 @@
     if x >= 100:
       ix = int(x)
       x = float(ix)
-    return QString("%1").arg(x, 0, 'g', 2)
+      # QString("%1").arg(x, 0, 'g', 2)
+      mystring = '%.2g' % x
+    return QString(mystring)
 

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOneAna_GraphCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOneAna_GraphCtrl.py	2009-03-23 15:23:20 UTC (rev 3195)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOneAna_GraphCtrl.py	2009-03-27 01:26:11 UTC (rev 3196)
@@ -6,7 +6,7 @@
 from pyGraphCtrl import PrintFilter
 from pyButtonListDialog import pyButtonListDialog
 from qt import *
-from qwt import *
+from Qwt5 import *
 import os.path
 import heapq
 from descr import *
@@ -268,17 +268,18 @@
             str(row.m_petri_dish_dir_path), stat_1.file, 1, stat_1.index
         )
 
-        row.m_curve_1 = self.m_graph_ctrl.insertCurve(stat_1.name)
-        self.m_graph_ctrl.setCurveData(row.m_curve_1, self.m_curve_1_arrays[0],
+        row.m_curve_1 = QwtPlotCurve(stat_1.name)
+        row.m_curve_1.attach(self.m_graph_ctrl)
+        row.m_curve_1.setData(self.m_curve_1_arrays[0],
                                        self.m_curve_1_arrays[1])
         # set the pen
         if self.pen_styles[self.m_combo_box_1_style.currentItem()] is 'thick':
-          self.m_graph_ctrl.setCurvePen(row.m_curve_1, QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color, 3))
+          row.m_curve_1.setPen(QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color, 3))
         elif self.pen_styles[self.m_combo_box_1_style.currentItem()] is 'dotted':
-          self.m_graph_ctrl.setCurvePen(row.m_curve_1, QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color, 0, Qt.DotLine))
+          row.m_curve_1.setPen(QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color, 0, Qt.DotLine))
         else:
-          self.m_graph_ctrl.setCurvePen(row.m_curve_1, QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color))
-        self.m_graph_ctrl.setCurveYAxis(row.m_curve_1, QwtPlot.yLeft)
+          row.m_curve_1.setPen(QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color))
+        row.m_curve_1.setYAxis(QwtPlot.yLeft)
         if not self.m_combo_box_2.currentItem():
           self.m_graph_ctrl.enableYRightAxis(False)
           self.m_graph_ctrl.setTitle(stat_1.name + " vs. " + self.x_axis_title)
@@ -296,15 +297,23 @@
             str(row.m_petri_dish_dir_path), stat_2.file, 1, stat_2.index
         )
 
-        row.m_curve_2 = self.m_graph_ctrl.insertCurve(stat_2.name)
-        self.m_graph_ctrl.setCurveData(row.m_curve_2, self.m_curve_2_arrays[0], self.m_curve_2_arrays[1])
+        # row.m_curve_2 = self.m_graph_ctrl.insertCurve(stat_2.name)   # QWT 4.2
+        row.m_curve_2 = QwtPlotCurve("stat_2.name")   # Curve must now be attached
+        row.m_curve_2.attach(self.m_graph_ctrl)
+        # self.m_graph_ctrl.setCurveData(row.m_curve_2, self.m_curve_2_arrays[0], self.m_curve_2_arrays[1])  # Old QWT 4.2
+        row.m_curve_2.setData(self.m_curve_2_arrays[0], self.m_curve_2_arrays[1])
+        #self.m_graph_ctrl.setData(row.m_curve_2, self.m_curve_2_arrays[0], self.m_curve_2_arrays[1])
         if self.pen_styles[self.m_combo_box_2_style.currentItem()] is 'thick':
-          self.m_graph_ctrl.setCurvePen(row.m_curve_2, QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color,3))
+          # self.m_graph_ctrl.setCurvePen(row.m_curve_2, QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color,3))
+          row.m_curve_2.setPen(QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color,3))
         elif self.pen_styles[self.m_combo_box_2_style.currentItem()] is 'dotted':
-          self.m_graph_ctrl.setCurvePen(row.m_curve_2, QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color, 0, Qt.DotLine))
+          # self.m_graph_ctrl.setCurvePen(row.m_curve_2, QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color, 0, Qt.DotLine))
+          row.m_curve_2.setPen(QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color, 0, Qt.DotLine))
         else:
-          self.m_graph_ctrl.setCurvePen(row.m_curve_2, QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color))
-        self.m_graph_ctrl.setCurveYAxis(row.m_curve_2, QwtPlot.yRight)
+          # self.m_graph_ctrl.setCurvePen(row.m_curve_2, QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color))
+          row.m_curve_2.setPen(QPen(self.m_Colors[row.layout.m_combo_box_1_color.currentItem()].qt_color))
+        # self.m_graph_ctrl.setCurveYAxis(row.m_curve_2, QwtPlot.yRight)
+        row.m_curve_2.setYAxis(QwtPlot.yRight)
         if not self.m_combo_box_1.currentItem():
           self.m_graph_ctrl.setTitle(stat_2.name + " vs. " + self.x_axis_title)
 

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_GraphCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_GraphCtrl.py	2009-03-23 15:23:20 UTC (rev 3195)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_GraphCtrl.py	2009-03-27 01:26:11 UTC (rev 3196)
@@ -5,7 +5,7 @@
 from pyOnePop_GraphView import pyOnePop_GraphView
 from pyGraphCtrl import PrintFilter
 from qt import *
-from qwt import *
+from Qwt5 import *
 import os.path
 
 class pyOnePop_GraphCtrl(pyOnePop_GraphView):
@@ -60,12 +60,21 @@
         1,
         self.m_avida_stats_interface.m_entries[index].index
       )
-      self.m_graph_ctrl.m_curve = self.m_graph_ctrl.insertCurve(self.m_avida_stats_interface.m_entries[index].name)
-      self.m_graph_ctrl.setCurveData(self.m_graph_ctrl.m_curve, self.m_x_array, self.m_y_array)
-      self.m_graph_ctrl.setCurvePen(self.m_graph_ctrl.m_curve, QPen(Qt.red))
-      self.m_graph_ctrl.m_zoomer.setZoomBase(self.m_graph_ctrl.curve(self.m_graph_ctrl.m_curve).boundingRect())
+      # Old QWT 4.2
+      # self.m_graph_ctrl.m_curve = self.m_graph_ctrl.insertCurve(self.m_avida_stats_interface.m_entries[index].name)
+      # self.m_graph_ctrl.setCurveData(self.m_graph_ctrl.m_curve, self.m_x_array, self.m_y_array)
+      # self.m_graph_ctrl.setCurvePen(self.m_graph_ctrl.m_curve, QPen(Qt.red))
+      # self.m_graph_ctrl.m_zoomer.setZoomBase(self.m_graph_ctrl.curve(self.m_graph_ctrl.m_curve).boundingRect())
+      # self.m_graph_ctrl.setAxisAutoScale(QwtPlot.xBottom)
+      # self.m_graph_ctrl.setAxisAutoScale(QwtPlot.yLeft)
+
+      self.m_graph_ctrl.m_curve = QwtPlotCurve(self.m_avida_stats_interface.m_entries[index].name)
+      self.m_graph_ctrl.m_curve.setData(self.m_x_array, self.m_y_array)
+      self.m_graph_ctrl.m_curve.setPen(QPen(Qt.red))
+      self.m_graph_ctrl.m_zoomer.setZoomBase(self.m_graph_ctrl.m_curve.boundingRect())
       self.m_graph_ctrl.setAxisAutoScale(QwtPlot.xBottom)
       self.m_graph_ctrl.setAxisAutoScale(QwtPlot.yLeft)
+
     self.m_graph_ctrl.replot()
       
   def setAvidaSlot(self, avida):
@@ -97,10 +106,11 @@
         1
       )
       if hasattr(self.m_graph_ctrl, "m_curve"):
-        self.m_graph_ctrl.setCurveData(self.m_graph_ctrl.m_curve, self.m_x_array, self.m_y_array)
+        # self.m_graph_ctrl.setCurveData(self.m_graph_ctrl.m_curve, self.m_x_array, self.m_y_array)
+        self.m_graph_ctrl.m_curve.setData(self.m_x_array, self.m_y_array)
         # Quick hack: Cause the zoomer to limit zooming-out to the
         # boundaries of the displayed curve.
-        self.m_graph_ctrl.m_zoomer.setZoomBase(self.m_graph_ctrl.curve(self.m_graph_ctrl.m_curve).boundingRect())
+        self.m_graph_ctrl.m_zoomer.setZoomBase(self.m_graph_ctrl.m_curve.boundingRect())
         # Quick hack: If the user has zoomed-in on or -out from the graph,
         # autoscaling will have been disabled. This reenables it.
         self.m_graph_ctrl.setAxisAutoScale(QwtPlot.xBottom)

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyTimeline.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyTimeline.py	2009-03-23 15:23:20 UTC (rev 3195)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyTimeline.py	2009-03-27 01:26:11 UTC (rev 3196)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 from qt import Qt, QPainter, QPixmap, QWidget, QToolTip, QSize, QLabel
-from qwt import QwtThermo
+from Qwt5 import QwtThermo
 
 class TimelineFlagWidget(QWidget):
     "TimelineFlag widget"
@@ -59,7 +59,7 @@
     flags on the timeline."""
     def __init__(self, *args):
         QwtThermo.__init__(self, *args)
-        self.setOrientation(Qt.Horizontal, QwtThermo.Bottom)
+        self.setOrientation(Qt.Horizontal, QwtThermo.BottomScale)
         self.setPipeWidth(32)
         self.flags = []         # holds the events for this timeline
         self.clusters = []      # holds event clusters for overlapping events




More information about the Avida-cvs mailing list