[Avida-cvs] [Avida2-svn] r214 - in branches/brysonda: documentation/content/using source/main source/python/AvidaGui2 source/support
brysonda@myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Tue Jun 21 07:49:28 PDT 2005
Author: brysonda
Date: 2005-06-21 10:49:28 -0400 (Tue, 21 Jun 2005)
New Revision: 214
Removed:
branches/brysonda/source/python/AvidaGui2/pySessionDumbCtrl.py
branches/brysonda/source/python/AvidaGui2/pySessionDumbView.py
branches/brysonda/source/python/AvidaGui2/pySessionDumbViewBase.ui
Modified:
branches/brysonda/documentation/content/using/genesis.html
branches/brysonda/source/main/config.cc
branches/brysonda/source/main/config.hh
branches/brysonda/source/main/organism.cc
branches/brysonda/source/python/AvidaGui2/Avida_ED_startup_utils.py
branches/brysonda/source/python/AvidaGui2/pyAvidaStatsInterface.py
branches/brysonda/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
branches/brysonda/source/python/AvidaGui2/pyEduWorkspaceView.ui
branches/brysonda/source/python/AvidaGui2/pyFreezerCtrl.py
branches/brysonda/source/python/AvidaGui2/pyMainControllerFactory.py
branches/brysonda/source/python/AvidaGui2/pyMapProfile.py
branches/brysonda/source/python/AvidaGui2/pyOneAna_GraphCtrl.py
branches/brysonda/source/python/AvidaGui2/pyOneAna_PetriDishCtrl.py
branches/brysonda/source/python/AvidaGui2/pyOneAnalyzeCtrl.py
branches/brysonda/source/python/AvidaGui2/pyOnePop_GraphCtrl.py
branches/brysonda/source/python/AvidaGui2/pyOnePop_GraphView.ui
branches/brysonda/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
branches/brysonda/source/python/AvidaGui2/pyOnePop_StatsCtrl.py
branches/brysonda/source/python/AvidaGui2/pyOnePopulationCtrl.py
branches/brysonda/source/python/AvidaGui2/pyPetriCanvasView.py
branches/brysonda/source/python/AvidaGui2/pyPetriConfigureCtrl.py
branches/brysonda/source/python/AvidaGui2/pyPetriDishCtrl.py
branches/brysonda/source/python/AvidaGui2/pyPopulationCellItem.py
branches/brysonda/source/python/AvidaGui2/pySessionControllerFactory.py
branches/brysonda/source/python/AvidaGui2/pySessionCtrl.py
branches/brysonda/source/python/AvidaGui2/pyTemporaryReloads.py
branches/brysonda/source/support/genesis.smt
Log:
Merge in r212 from trunk.
Modified: branches/brysonda/documentation/content/using/genesis.html
===================================================================
--- branches/brysonda/documentation/content/using/genesis.html 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/documentation/content/using/genesis.html 2005-06-21 14:49:28 UTC (rev 214)
@@ -161,6 +161,11 @@
At -1, no tasks are required. Ideally, this should be incorporated
into the environment configuration file. NOTE: A task can fire without
triggering a reaction. To add a required reaction see below.
+<tr><td valign=top><b><tt>IMMUNITY_TASK</tt></b>
+ <td>Allows user to set the ID number for a task which, if it occures,
+ provides immunity from the required task (above) -- divide will
+ proceede even if the required task is not done if immunity task is done.
+ Defaults to -1, no immunity task present.
<tr><td valign=top><b><tt>REQUIRED_REACTION</tt></b>
<td>Allows the user to set the ID number for a reaction that <i>must</i>
occur for a divide to be successful. At -1, no reactions are required.
Modified: branches/brysonda/source/main/config.cc
===================================================================
--- branches/brysonda/source/main/config.cc 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/main/config.cc 2005-06-21 14:49:28 UTC (rev 214)
@@ -192,6 +192,7 @@
int cConfig::alloc_method;
int cConfig::divide_method;
int cConfig::required_task;
+int cConfig::immunity_task;
int cConfig::required_reaction;
int cConfig::lineage_creation_method;
int cConfig::generation_inc_method;
@@ -321,6 +322,8 @@
"Is a an allocate required before a divide? (0/1)");
div_group->Add(required_task, "-1", "REQUIRED_TASK",
"Task ID required for successful divide.");
+ div_group->Add(immunity_task, "-1", "REQUIRED_TASK",
+ "Task providing immunity from the required task.");
div_group->Add(required_reaction, "-1", "REQUIRED_REACTION",
"Reaction ID required for successful divide.");
div_group->Add(die_prob, "0", "DIE_PROB",
Modified: branches/brysonda/source/main/config.hh
===================================================================
--- branches/brysonda/source/main/config.hh 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/main/config.hh 2005-06-21 14:49:28 UTC (rev 214)
@@ -242,6 +242,7 @@
static int two_fold_cost_sex;
static int same_length_sex;
static int required_task;
+ static int immunity_task;
static int required_reaction;
static int lineage_creation_method;
static int generation_inc_method;
@@ -384,6 +385,7 @@
static int GetTwoFoldCostSex() { return two_fold_cost_sex; }
static int GetSameLengthSex() { return same_length_sex; }
static int GetRequiredTask() { return required_task; }
+ static int GetImmunityTask() { return immunity_task; }
static int GetRequiredReaction() { return required_reaction; }
static int GetLineageCreationMethod() { return lineage_creation_method; }
static int GetGenerationIncMethod() { return generation_inc_method; }
Modified: branches/brysonda/source/main/organism.cc
===================================================================
--- branches/brysonda/source/main/organism.cc 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/main/organism.cc 2005-06-21 14:49:28 UTC (rev 214)
@@ -243,12 +243,16 @@
{
// Make sure required task (if any) has been performed...
const int required_task = cConfig::GetRequiredTask();
+ const int immunity_task = cConfig::GetImmunityTask();
if (required_task != -1 &&
- phenotype.GetCurTaskCount()[required_task] == 0) {
- Fault(FAULT_LOC_DIVIDE, FAULT_TYPE_ERROR,
- cStringUtil::Stringf("Lacks required task (%d)",
- cConfig::GetRequiredTask()));
- return false; // (divide fails)
+ phenotype.GetCurTaskCount()[required_task] == 0) {
+ if (immunity_task==-1 ||
+ phenotype.GetCurTaskCount()[immunity_task] == 0) {
+ Fault(FAULT_LOC_DIVIDE, FAULT_TYPE_ERROR,
+ cStringUtil::Stringf("Lacks required task (%d)",
+ cConfig::GetRequiredTask()));
+ return false; // (divide fails)
+ }
}
const int required_reaction = cConfig::GetRequiredReaction();
Modified: branches/brysonda/source/python/AvidaGui2/Avida_ED_startup_utils.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/Avida_ED_startup_utils.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/Avida_ED_startup_utils.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -60,7 +60,7 @@
# 'avida_ed.m_edu_workspace_ctrl'
#
session_ctrl = edu_main_controller.m_main_controller_factory.m_main_controllers_list[1]
- edu_main_controller.m_edu_workspace_ctrl = session_ctrl.m_session_controller_factory.m_session_controllers_list[2]
+ edu_main_controller.m_edu_workspace_ctrl = session_ctrl.m_session_controller_factory.m_session_controllers_list[1]
finally:
s_splash.clear()
Modified: branches/brysonda/source/python/AvidaGui2/pyAvidaStatsInterface.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyAvidaStatsInterface.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyAvidaStatsInterface.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -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: branches/brysonda/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyEduWorkspaceCtrl.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyEduWorkspaceCtrl.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -115,8 +115,6 @@
self.m_ctrl_to_cli_dict[ctrl].setState(QCheckListItem.On)
def close(self, also_delete = False):
- # XXX trying to temporarily prevent closing this window.
- # print "pyEduWorkspaceCtrl.close(): Cowardly refusing to close."
self.emit(PYSIGNAL("quitAvidaPhaseISig"), ())
return False
@@ -266,13 +264,11 @@
pass
def doPauseAvidaSlot(self):
- print "called pyEduWorkspaceCtryl.doPauseAvidaSlot"
self.controlStartAction.text = "Start"
self.controlStartAction.menuText = "Start"
self.startStatus = True
def doStartAvidaSlot(self):
- print "called pyEduWorkspaceCtryl.doStartAvidaSlot"
self.controlStartAction.text = "Pause"
self.controlStartAction.menuText = "Pause"
self.startStatus = False
Modified: branches/brysonda/source/python/AvidaGui2/pyEduWorkspaceView.ui
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyEduWorkspaceView.ui 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyEduWorkspaceView.ui 2005-06-21 14:49:28 UTC (rev 214)
@@ -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: branches/brysonda/source/python/AvidaGui2/pyFreezerCtrl.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyFreezerCtrl.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyFreezerCtrl.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -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: branches/brysonda/source/python/AvidaGui2/pyMainControllerFactory.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyMainControllerFactory.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyMainControllerFactory.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -2,8 +2,10 @@
import qt
class pyMainControllerFactory(qt.QObject):
+
def __init__(self):
qt.QObject.__init__(self, None, self.__class__.__name__)
+
def construct(self, main_mdl):
self.m_main_mdl = main_mdl
self.m_controller_creators_dict = {}
@@ -14,12 +16,15 @@
self.connect(self.m_main_mdl.m_main_mdtr.m_main_controller_factory_mdtr,
qt.PYSIGNAL("deleteControllerSig"), self.deleteControllerSlot)
return self
+
def addControllerCreator(self, creator_key, creator):
self.m_controller_creators_dict[creator_key] = creator
+
def newMainControllerSlot(self, creator_key, *args):
new_controller = self.m_controller_creators_dict[creator_key]()
new_controller.construct(self.m_main_mdl, *args)
self.m_main_controllers_list.append(new_controller)
+
def deleteControllerSlot(self, controller):
self.m_main_controllers_list.remove(controller)
Modified: branches/brysonda/source/python/AvidaGui2/pyMapProfile.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyMapProfile.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyMapProfile.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -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: branches/brysonda/source/python/AvidaGui2/pyOneAna_GraphCtrl.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyOneAna_GraphCtrl.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyOneAna_GraphCtrl.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -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])
@@ -101,15 +105,6 @@
def load(self, filename, colx, coly):
- # Brian's old code, delete
- # init_file_name_str = os.path.join(self.m_session_mdl.m_current_freezer, str(self.m_petri_dish_dir_path) + '.full', filename)
- # init_file = cInitFile(cString(init_file_name_str))
- #
- # print "loading"
- # if not init_file.IsOpen():
- # print "the file you are looking for does not exist"
- # return
-
init_file = cInitFile(cString(os.path.join(str(self.m_petri_dish_dir_path), filename)))
init_file.Load()
init_file.Compress()
@@ -151,7 +146,7 @@
print "index_1[2] is"
print self.m_avida_stats_interface.m_entries[index_1][2]
self.m_curve_1_arrays = self.load(
- os.path.join(self.m_session_mdl.m_tempdir_out, self.m_avida_stats_interface.m_entries[index_1][1]),
+ self.m_avida_stats_interface.m_entries[index_1][1],
1,
self.m_avida_stats_interface.m_entries[index_1][2]
)
@@ -173,7 +168,7 @@
self.m_graph_ctrl.enableYRightAxis(True)
self.m_graph_ctrl.setAxisAutoScale(QwtPlot.yRight)
self.m_curve_2_arrays = self.load(
- os.path.join(self.m_session_mdl.m_tempdir_out, self.m_avida_stats_interface.m_entries[index_2][1]),
+ self.m_avida_stats_interface.m_entries[index_2][1],
1,
self.m_avida_stats_interface.m_entries[index_2][2]
)
@@ -208,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):
@@ -218,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
@@ -258,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: branches/brysonda/source/python/AvidaGui2/pyOneAna_PetriDishCtrl.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyOneAna_PetriDishCtrl.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyOneAna_PetriDishCtrl.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -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: branches/brysonda/source/python/AvidaGui2/pyOneAnalyzeCtrl.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyOneAnalyzeCtrl.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyOneAnalyzeCtrl.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -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: branches/brysonda/source/python/AvidaGui2/pyOnePop_GraphCtrl.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyOnePop_GraphCtrl.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyOnePop_GraphCtrl.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -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: branches/brysonda/source/python/AvidaGui2/pyOnePop_GraphView.ui
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyOnePop_GraphView.ui 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyOnePop_GraphView.ui 2005-06-21 14:49:28 UTC (rev 214)
@@ -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: branches/brysonda/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -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: branches/brysonda/source/python/AvidaGui2/pyOnePop_StatsCtrl.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyOnePop_StatsCtrl.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyOnePop_StatsCtrl.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -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: branches/brysonda/source/python/AvidaGui2/pyOnePopulationCtrl.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyOnePopulationCtrl.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyOnePopulationCtrl.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -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: branches/brysonda/source/python/AvidaGui2/pyPetriCanvasView.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyPetriCanvasView.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyPetriCanvasView.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -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: branches/brysonda/source/python/AvidaGui2/pyPetriConfigureCtrl.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyPetriConfigureCtrl.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyPetriConfigureCtrl.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -51,7 +51,7 @@
self.connect(self.StopAtRadioButton, SIGNAL("clicked()"),
self.ChangeStopSpinBoxSlot)
self.connect(self.SavePetriPushButton, SIGNAL("clicked()"),
- PYSIGNAL("freezeDishPhaseISig"))
+ self.m_session_mdl.m_session_mdtr, PYSIGNAL("freezeDishPhaseISig"))
self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("freezeDishPhaseIISig"),
self.FreezePetriSlot)
self.connect(self.m_session_mdl.m_session_mdtr,
@@ -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: branches/brysonda/source/python/AvidaGui2/pyPetriDishCtrl.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyPetriDishCtrl.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyPetriDishCtrl.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -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: branches/brysonda/source/python/AvidaGui2/pyPopulationCellItem.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyPopulationCellItem.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyPopulationCellItem.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -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
Modified: branches/brysonda/source/python/AvidaGui2/pySessionControllerFactory.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pySessionControllerFactory.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pySessionControllerFactory.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -6,6 +6,7 @@
class pySessionControllerFactory(qt.QObject):
def __init__(self):
qt.QObject.__init__(self, None, self.__class__.__name__)
+
def construct(self, m_session_mdl):
self.m_session_mdl = m_session_mdl
self.m_controller_creators_dict = {}
@@ -15,12 +16,15 @@
self.connect(self.m_session_mdl.m_session_mdtr,
qt.PYSIGNAL("deleteControllerSig"), self.deleteControllerSlot)
return self
+
def addControllerCreator(self, creator_key, creator):
self.m_controller_creators_dict[creator_key] = creator
+
def newSessionControllerSlot(self, creator_key, *args):
new_controller = self.m_controller_creators_dict[creator_key]()
new_controller.construct(self.m_session_mdl, *args)
self.m_session_controllers_list.append(new_controller)
+
def deleteControllerSlot(self, controller):
self.m_session_controllers_list.remove(controller)
Modified: branches/brysonda/source/python/AvidaGui2/pySessionCtrl.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pySessionCtrl.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pySessionCtrl.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -3,7 +3,7 @@
from pyAvidaCoreData import *
from pyMdtr import *
from pySessionControllerFactory import *
-from pySessionDumbCtrl import *
+# from pySessionDumbCtrl import *
from AvidaCore import cString
@@ -25,6 +25,21 @@
for name in dirs:
os.rmdir(os.path.join(root, name))
os.removedirs(self.m_session_mdl.m_tempdir)
+ self.disconnect(
+ self.m_session_mdl.m_session_mdtr, PYSIGNAL("setAvidaSig"),
+ self.setAvidaSlot)
+ print "pySessionCtrl.__del__() sending setAvidaSig(None) ..."
+#
+# Why does the following command give error:
+#
+# "'NoneType' object has no attribute 'm_avida_thread_mdtr'" in <bound
+# method pySessionCtrl.__del__ of <AvidaGui2.pySessionCtrl.pySessionCtrl
+# object at 0xd734d20>> ignored
+#
+# self.m_session_mdl.m_session_mdtr.emit(
+# PYSIGNAL("setAvidaSig"),
+# (None,))
+
print 'pySessionCtrl.__del__() done.'
def construct(self, main_mdl):
@@ -36,13 +51,21 @@
...But I'd say it's okay for the moment, since we can't run more than one instance of Avida concurrently (yet)...
""")
+ # Variables tracking the state of the session
+
+ self.sessionInitialized = False
+ self.m_should_update = False
+
# Create "model" for storing state data.
class pyMdl: pass
self.m_session_mdl = pyMdl()
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")
- # Create a temporary subdirectory for general use in this session.
+ # Create a temporary subdirectory for general use in this session. Add a
+ # subdirectory to that for output files -- these files will only get
+ # put into named directories when frozen
+
self.m_session_mdl.m_tempdir = tempfile.mkdtemp('','AvidaEd-pid%d-'%os.getpid())
self.m_session_mdl.m_tempdir_out = os.path.join(self.m_session_mdl.m_tempdir, "output")
os.mkdir(self.m_session_mdl.m_tempdir_out)
@@ -57,21 +80,96 @@
# Connect various session controller creators to the controller
# factory.
self.m_session_controller_factory.addControllerCreator("pyEduSessionMenuBarHdlr", pyEduSessionMenuBarHdlr)
- self.m_session_controller_factory.addControllerCreator("pySessionDumbCtrl", pySessionDumbCtrl)
+ # self.m_session_controller_factory.addControllerCreator("pySessionDumbCtrl", pySessionDumbCtrl)
self.m_session_controller_factory.addControllerCreator("pyEduWorkspaceCtrl", pyEduWorkspaceCtrl)
self.m_session_mdl.m_session_mdtr.emit(
qt.PYSIGNAL("newSessionControllerSig"), ("pyEduSessionMenuBarHdlr",))
## XXX Temporary. Cause instantiation of a dumb gui for testing. @kgn
- self.m_session_mdl.m_session_mdtr.emit(
- qt.PYSIGNAL("newSessionControllerSig"), ("pySessionDumbCtrl",))
+ # self.m_session_mdl.m_session_mdtr.emit(
+ # qt.PYSIGNAL("newSessionControllerSig"), ("pySessionDumbCtrl",))
self.m_session_mdl.m_session_mdtr.emit(
qt.PYSIGNAL("newSessionControllerSig"), ("pyEduWorkspaceCtrl",))
self.connect(self.m_session_mdl.m_session_mdtr, qt.PYSIGNAL("doOrphanSessionSig"), self.doOrphanSessionSlot)
+
+ self.m_avida = None
+ self.connect(
+ self.m_session_mdl.m_session_mdtr, PYSIGNAL("setAvidaSig"),
+ self.setAvidaSlot)
+
+ self.connect(
+ self.m_session_mdl.m_session_mdtr,
+ PYSIGNAL("doStartSig"),
+ self.doStart)
+
+ self.connect(
+ self.m_session_mdl.m_session_mdtr,
+ PYSIGNAL("doPauseSig"),
+ self.doPause)
+
+ self.connect(
+ self.m_session_mdl.m_session_mdtr,
+ PYSIGNAL("fromLiveCtrlStartAvidaSig"),
+ self.doStart)
+
+ self.connect(
+ self.m_session_mdl.m_session_mdtr,
+ PYSIGNAL("fromLiveCtrlPauseAvidaSig"),
+ self.doPause)
+
+ self.doPause()
+
return self
+
+ def setAvidaSlot(self, avida):
+ "print *** pySessionCtrl setAvidaSlot ***"
+ if (avida == None):
+ print "*** Avida = None"
+ old_avida = self.m_avida
+ self.m_avida = avida
+ if old_avida and hasattr(old_avida, "m_avida_thread_mdtr"):
+ print "pySessionCtrl.setAvidaSlot(): disconnecting old_avida ..."
+ self.disconnect(
+ old_avida.m_avida_thread_mdtr, PYSIGNAL("AvidaUpdatedSig"),
+ self.avidaUpdatedSlot)
+ self.disconnect(
+ self.m_session_mdl.m_session_mdtr, PYSIGNAL("doStartAvidaSig"),
+ old_avida.m_avida_thread_mdtr, PYSIGNAL("doStartAvidaSig"))
+ self.disconnect(
+ self.m_session_mdl.m_session_mdtr, PYSIGNAL("doPauseAvidaSig"),
+ old_avida.m_avida_thread_mdtr, PYSIGNAL("doPauseAvidaSig"))
+ self.disconnect(
+ self, PYSIGNAL("doUpdateAvidaSig"),
+ old_avida.m_avida_thread_mdtr, PYSIGNAL("doUpdateAvidaSig"))
+ self.disconnect(
+ self.m_session_mdl.m_session_mdtr,
+ PYSIGNAL("fromLiveCtrlUpdateAvidaSig"),
+ old_avida.m_avida_thread_mdtr, PYSIGNAL("doUpdateAvidaSig"))
+ print "pySessionCtrl.setAvidaSlot(): deleting old_avida ..."
+ del old_avida
+ if self.m_avida and hasattr(self.m_avida, "m_avida_thread_mdtr"):
+ print "pySessionCtrl.setAvidaSlot(): connecting self.m_avida ..."
+# self.connect(
+# self.m_avida.m_avida_thread_mdtr, PYSIGNAL("AvidaUpdatedSig"),
+# self.avidaUpdatedSlot)
+ self.connect(
+ self.m_session_mdl.m_session_mdtr, PYSIGNAL("doStartAvidaSig"),
+ self.m_avida.m_avida_thread_mdtr, PYSIGNAL("doStartAvidaSig"))
+ self.connect(
+ self.m_session_mdl.m_session_mdtr, PYSIGNAL("doPauseAvidaSig"),
+ self.m_avida.m_avida_thread_mdtr, PYSIGNAL("doPauseAvidaSig"))
+ self.connect(
+ self, PYSIGNAL("doUpdateAvidaSig"),
+ self.m_avida.m_avida_thread_mdtr, PYSIGNAL("doUpdateAvidaSig"))
+ self.connect(
+ self.m_session_mdl.m_session_mdtr,
+ PYSIGNAL("fromLiveCtrlUpdateAvidaSig"),
+ self.m_avida.m_avida_thread_mdtr, PYSIGNAL("doUpdateAvidaSig"))
+
+
def doOrphanSessionSlot(self):
print """
FIXME : pySessionCtrl
@@ -84,6 +182,21 @@
"""
self.m_session_mdl.m_main_mdl.m_main_mdtr.m_main_controller_factory_mdtr.emit(
qt.PYSIGNAL("deleteControllerSig"), (self,))
+
+ def doStart(self):
+ if self.sessionInitialized == False:
+ self.m_session_mdl.m_session_mdtr.emit(
+ PYSIGNAL("doInitializeAvidaPhaseISig"),
+ (self.m_session_mdl.m_tempdir,))
+ self.sessionInitialized = True
+ self.m_should_update = True
+ self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("doStartAvidaSig"), ())
+
+ def doPause(self):
+ self.m_should_update = False
+ self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("doPauseAvidaSig"), ())
+
+
def unitTest(self, recurse = False):
return pyUnitTestSuiteRecurser("pySessionCtrl", globals(), recurse).construct().runTest().lastResult()
@@ -107,7 +220,7 @@
self.adoptUnitTestSuite("pyEduSessionMenuBarHdlr")
self.adoptUnitTestSuite("pyMdtr")
self.adoptUnitTestSuite("pySessionControllerFactory")
- self.adoptUnitTestSuite("pySessionDumbCtrl")
+ # self.adoptUnitTestSuite("pySessionDumbCtrl")
class deleteChecks(pyTestCase):
def test(self):
Deleted: branches/brysonda/source/python/AvidaGui2/pySessionDumbCtrl.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pySessionDumbCtrl.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pySessionDumbCtrl.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -1,221 +0,0 @@
-import pySessionDumbView; reload(pySessionDumbView)
-from pySessionDumbView import *
-
-import pyAvida; reload(pyAvida)
-from pyAvida import *
-
-from AvidaCore import *
-from qt import *
-
-class pySessionDumbCtrl(pySessionDumbView):
- def __init__(self):
- pySessionDumbView.__init__(self)
-
- def setAvidaSlot(self, avida):
- old_avida = self.m_avida
- self.m_avida = avida
- if old_avida and hasattr(old_avida, "m_avida_thread_mdtr"):
- print "pySessionDumbCtrl.setAvidaSlot(): disconnecting old_avida ..."
- self.disconnect(
- old_avida.m_avida_thread_mdtr, PYSIGNAL("AvidaUpdatedSig"),
- self.avidaUpdatedSlot)
- self.disconnect(
- self.m_session_mdl.m_session_mdtr, PYSIGNAL("doStartAvidaSig"),
- old_avida.m_avida_thread_mdtr, PYSIGNAL("doStartAvidaSig"))
- self.disconnect(
- self.m_session_mdl.m_session_mdtr, PYSIGNAL("doPauseAvidaSig"),
- old_avida.m_avida_thread_mdtr, PYSIGNAL("doPauseAvidaSig"))
- self.disconnect(
- self, PYSIGNAL("doUpdateAvidaSig"),
- old_avida.m_avida_thread_mdtr, PYSIGNAL("doUpdateAvidaSig"))
- self.disconnect(
- self.m_session_mdl.m_session_mdtr,
- PYSIGNAL("fromLiveCtrlUpdateAvidaSig"),
- old_avida.m_avida_thread_mdtr, PYSIGNAL("doUpdateAvidaSig"))
- print "pySessionDumbCtrl.setAvidaSlot(): deleting old_avida ..."
- del old_avida
- if self.m_avida and hasattr(self.m_avida, "m_avida_thread_mdtr"):
- print "pySessionDumbCtrl.setAvidaSlot(): connecting self.m_avida ..."
- self.connect(
- self.m_avida.m_avida_thread_mdtr, PYSIGNAL("AvidaUpdatedSig"),
- self.avidaUpdatedSlot)
- self.connect(
- self.m_session_mdl.m_session_mdtr, PYSIGNAL("doStartAvidaSig"),
- self.m_avida.m_avida_thread_mdtr, PYSIGNAL("doStartAvidaSig"))
- self.connect(
- self.m_session_mdl.m_session_mdtr, PYSIGNAL("doPauseAvidaSig"),
- self.m_avida.m_avida_thread_mdtr, PYSIGNAL("doPauseAvidaSig"))
- self.connect(
- self, PYSIGNAL("doUpdateAvidaSig"),
- self.m_avida.m_avida_thread_mdtr, PYSIGNAL("doUpdateAvidaSig"))
- self.connect(
- self.m_session_mdl.m_session_mdtr,
- PYSIGNAL("fromLiveCtrlUpdateAvidaSig"),
- self.m_avida.m_avida_thread_mdtr, PYSIGNAL("doUpdateAvidaSig"))
-
- def setupCustomMenus(self, edu_session_menu_bar_hdlr):
- self.m_debugging_menu = QPopupMenu()
- self.m_load_organism_wmi_id = self.m_debugging_menu.insertItem(
- "Load Organism",
- self, PYSIGNAL("doDebugLoadOrganismSig"))
- self.m_menu_bar.insertItem("Debugging", self.m_debugging_menu)
-
- self.connect(
- self, PYSIGNAL("doDebugLoadOrganismSig"),
- self.doDebugLoadOrganismSlot)
-
- def doDebugLoadOrganismSlot(self):
- if self.m_avida:
- organism_file_name = QFileDialog.getOpenFileName(
- ".",
- "(*)",
- None,
- "open file dialog",
- "Choose an organism file")
- self.m_session_mdl.m_session_mdtr.emit(
- PYSIGNAL("setDebugOrganismFileSig"),
- (organism_file_name,))
- else:
- QMessageBox.information(
- None,
- "Can't load organism file yet",
- """
-This version of AvidaEd requires that a genesis file
-be opened before an organism file.
-"""
- )
-
- def construct(self, session_mdl):
- self.m_session_mdl = session_mdl
- self.sessionInitialized = False
-
- self.m_avida = None
- self.connect(
- self.m_session_mdl.m_session_mdtr, PYSIGNAL("setAvidaSig"),
- self.setAvidaSlot)
-
- self.m_session_mdl.m_session_mdtr.emit(
- PYSIGNAL("doSetupMainWindowMenuBarSig"),
- (self,))
-
- self.connect(
- self.m_session_mdl.m_session_mdtr,
- PYSIGNAL("doStartSig"),
- self.doStart)
- self.connect(
- self.m_session_mdl.m_session_mdtr,
- PYSIGNAL("doPauseSig"),
- self.doPause)
- self.connect(
- self.m_session_mdl.m_session_mdtr,
- PYSIGNAL("doNextUpdateSig"),
- self.updatePBClickedSlot)
-
- self.connect(
- self.m_startpause_avida_pb, SIGNAL("clicked()"),
- self.startPausePBClickedSlot)
- self.connect(
- self.m_update_avida_pb, SIGNAL("clicked()"),
- self.updatePBClickedSlot)
-
- self.connect(
- self.m_session_mdl.m_session_mdtr,
- PYSIGNAL("fromLiveCtrlPauseAvidaSig"),
- self.doPause)
- self.connect(
- self.m_session_mdl.m_session_mdtr,
- PYSIGNAL("fromLiveCtrlStartAvidaSig"),
- self.doStart)
-
-
- self.m_start_pb_text = "Start..."
- self.m_pause_pb_text = "Pause..."
- self.m_should_update = False
- self.m_control_menu.setItemVisible(self.m_next_step_cmi_id, False)
- self.m_edit_menu.setItemEnabled(self.m_undo_emi_id, False)
- self.m_edit_menu.setItemEnabled(self.m_redo_emi_id, False)
- self.m_edit_menu.setItemEnabled(self.m_cut_emi_id, False)
- self.m_edit_menu.setItemEnabled(self.m_copy_emi_id, False)
- self.m_edit_menu.setItemEnabled(self.m_paste_emi_id, False)
- self.m_edit_menu.setItemEnabled(self.m_select_all_emi_id, False)
- self.doPause()
- self.show()
-
- def __del__(self):
- print "pySessionDumbCtrl.__del__() disconnecting ..."
- self.disconnect(
- self.m_session_mdl.m_session_mdtr, PYSIGNAL("setAvidaSig"),
- self.setAvidaSlot)
- print "pySessionDumbCtrl.__del__() sending setAvidaSig(None) ..."
- self.m_session_mdl.m_session_mdtr.emit(
- PYSIGNAL("setAvidaSig"),
- (None,))
- #self.setAvidaSlot(None)
- print "pySessionDumbCtrl.__del__() done ..."
-
- def doStart(self):
- if self.sessionInitialized == False:
- self.m_session_mdl.m_session_mdtr.emit(
- PYSIGNAL("doInitializeAvidaPhaseISig"),
- (self.m_session_mdl.m_tempdir,))
- self.sessionInitialized = True
- self.m_should_update = True
- self.m_startpause_avida_pb.setText(self.m_pause_pb_text)
- self.m_update_avida_pb.setEnabled(False)
- self.m_control_menu.setItemVisible(self.m_pause_cmi_id, True)
- self.m_control_menu.setItemVisible(self.m_start_cmi_id, False)
- self.m_control_menu.setItemEnabled(self.m_next_update_cmi_id, False)
- self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("doStartAvidaSig"), ())
-
- def doPause(self):
- self.m_should_update = False
- self.m_startpause_avida_pb.setText(self.m_start_pb_text)
- self.m_update_avida_pb.setEnabled(True)
- self.m_control_menu.setItemVisible(self.m_pause_cmi_id, False)
- self.m_control_menu.setItemVisible(self.m_start_cmi_id, True)
- self.m_control_menu.setItemEnabled(self.m_next_update_cmi_id, True)
- self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("doPauseAvidaSig"), ())
-
- def startPausePBClickedSlot(self):
- if True == self.m_should_update: self.doPause()
- else: self.doStart()
-
- def updatePBClickedSlot(self):
- self.emit(PYSIGNAL("doUpdateAvidaSig"), ())
-
- def avidaUpdatedSlot(self):
- stats = self.m_avida.m_population.GetStats()
- self.m_log_te.append(
- "UD: " + repr(stats.GetUpdate()) +
- "\t Gen: " + repr(stats.SumGeneration().Average()) +
- "\t Fit: " + repr(stats.GetAveFitness()) +
- "\t Size: " + repr(self.m_avida.m_population.GetNumOrganisms()))
-
-
-
-
-# Unit tests.
-
-from pyUnitTestSuiteRecurser import *
-from pyUnitTestSuite import *
-from pyTestCase import *
-
-from pmock import *
-
-class pyUnitTestSuite_pySessionDumbCtrl(pyUnitTestSuite):
- def adoptUnitTests(self):
- print """
- -------------
- %s
- """ % self.__class__.__name__
- print """
- FIXME: pySessionDumbCtrl
- pySessionDumbCtrl has no unit tests.
- """
- self.adoptUnitTestSuite("pyMdtr")
-
- # Dummy test case.
- class crashDummy(pyTestCase):
- def test(self):
- self.test_is_true(True)
- self.adoptUnitTestCase(crashDummy())
Deleted: branches/brysonda/source/python/AvidaGui2/pySessionDumbView.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pySessionDumbView.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pySessionDumbView.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -1,18 +0,0 @@
-import qt
-
-class pySessionDumbView(qt.QMainWindow):
- def __init__(self, *args):
- apply(qt.QMainWindow.__init__, (self,) + args)
- self.m_central_vbox = qt.QVBox(self)
- self.m_startpause_avida_pb = qt.QPushButton(self.m_central_vbox)
- self.m_update_avida_pb = qt.QPushButton(self.m_central_vbox)
- self.m_log_te = qt.QTextEdit(self.m_central_vbox)
-
- self.m_update_avida_pb.setText("Next Update...")
-
- self.m_log_te.setTextFormat(qt.Qt.LogText)
- self.m_log_te.setMaxLogLines(400)
-
- self.setCentralWidget(self.m_central_vbox)
- def __del__(self):
- print "pySessionDumbView.__del__()."
Deleted: branches/brysonda/source/python/AvidaGui2/pySessionDumbViewBase.ui
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pySessionDumbViewBase.ui 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pySessionDumbViewBase.ui 2005-06-21 14:49:28 UTC (rev 214)
@@ -1,56 +0,0 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>pySessionDumbViewBase</class>
-<widget class="QWidget">
- <property name="name">
- <cstring>pySessionDumbViewBase</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>589</width>
- <height>471</height>
- </rect>
- </property>
- <property name="caption">
- <string>Form2</string>
- </property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout1</cstring>
- </property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QPushButton">
- <property name="name">
- <cstring>m_startpause_avida_pb</cstring>
- </property>
- <property name="text">
- <string>pushButton1</string>
- </property>
- </widget>
- <widget class="QPushButton">
- <property name="name">
- <cstring>m_update_avida_pb</cstring>
- </property>
- <property name="text">
- <string>Next Update...</string>
- </property>
- </widget>
- <widget class="QTextEdit">
- <property name="name">
- <cstring>m_log_te</cstring>
- </property>
- </widget>
- </vbox>
- </widget>
- </vbox>
-</widget>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
Modified: branches/brysonda/source/python/AvidaGui2/pyTemporaryReloads.py
===================================================================
--- branches/brysonda/source/python/AvidaGui2/pyTemporaryReloads.py 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/python/AvidaGui2/pyTemporaryReloads.py 2005-06-21 14:49:28 UTC (rev 214)
@@ -37,8 +37,6 @@
#"AvidaGui.UnitTest_pyMdtr",
#"AvidaGui.UnitTest_pySessionControllerFactory",
#"AvidaGui.UnitTest_pySessionCtrl",
- #"AvidaGui.UnitTest_pySessionDumbCtrl",
- #"AvidaGui.UnitTest_pySessionDumbView",
#"AvidaGui.UnitTest_pySessionWorkThreadHdlr",
]
@@ -128,7 +126,6 @@
"AvidaGui2.pyEduWorkspaceCtrl",
"AvidaGui2.pyEduSessionMenuBarHdlr",
- "AvidaGui2.pySessionDumbCtrl",
"AvidaGui2.pyAvida",
# "AvidaGui2.pyAvidaThreadHdlr",
Modified: branches/brysonda/source/support/genesis.smt
===================================================================
--- branches/brysonda/source/support/genesis.smt 2005-06-21 14:41:05 UTC (rev 213)
+++ branches/brysonda/source/support/genesis.smt 2005-06-21 14:49:28 UTC (rev 214)
@@ -11,8 +11,8 @@
END_CONDITION_MODE 0 # End run when ...
# 0 = MAX_UPDATES _OR_ MAX_GENERATIONS is reached
# 1 = MAX_UPDATES _AND_ MAX_GENERATIONS is reached
-WORLD-X 60 # Width of the world in Avida mode.
-WORLD-Y 60 # Height of the world in Avida mode.
+WORLD-X 30 # Width of the world in Avida mode.
+WORLD-Y 30 # Height of the world in Avida mode.
RANDOM_SEED 0 # Random number seed. (0 for based on time)
HARDWARE_TYPE 2 # 0 = Original CPUs
# 1 = New, Stack-based CPUs
More information about the Avida-cvs
mailing list