[Avida-cvs] [Avida2-svn] r99 - trunk/source/python/AvidaGui2
baerb at myxo.css.msu.edu
baerb at myxo.css.msu.edu
Fri Apr 1 10:20:34 PST 2005
Author: baerb
Date: 2005-04-01 13:20:34 -0500 (Fri, 01 Apr 2005)
New Revision: 99
Modified:
trunk/source/python/AvidaGui2/checkuic.py
trunk/source/python/AvidaGui2/pyEduMainCtrl.py
trunk/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
trunk/source/python/AvidaGui2/pyFreezerCtrl.py
trunk/source/python/AvidaGui2/pyFreezerView.ui
trunk/source/python/AvidaGui2/pyInstructionSet.py
trunk/source/python/AvidaGui2/pyNavBarView.ui
trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
trunk/source/python/AvidaGui2/pyOnePop_PetriDishView.ui
trunk/source/python/AvidaGui2/pyPetriConfigureCtrl.py
trunk/source/python/AvidaGui2/pyPetriConfigureView.ui
trunk/source/python/AvidaGui2/pyPetriDishCtrl.py
trunk/source/python/AvidaGui2/pyWriteGenesis.py
Log:
Instead of letting Avida automatically place start_creature at cell 0 use an
inject command to actually place organism at the center cell.
Allow for the "double-click" version of the program to be stopped. Programmers
must also modify:
AvidaEd.app/Contents/Resources/Python/AvidaEd.py
at approximately line 48 change:
a.exec_loop()
to:
sys.exit(a.exec_loop())
Modified: trunk/source/python/AvidaGui2/checkuic.py
===================================================================
--- trunk/source/python/AvidaGui2/checkuic.py 2005-04-01 17:50:41 UTC (rev 98)
+++ trunk/source/python/AvidaGui2/checkuic.py 2005-04-01 18:20:34 UTC (rev 99)
@@ -5,7 +5,7 @@
if file.endswith('View.py'):
py_dict['./' + file] = 0
for file in dir_listing:
- if file.endswith('.ui'):
+ if file.endswith('View.ui'):
if re.compile('junk').search(file,1):
print "============== " + file + " =============="
ui_name = './' + file
Modified: trunk/source/python/AvidaGui2/pyEduMainCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyEduMainCtrl.py 2005-04-01 17:50:41 UTC (rev 98)
+++ trunk/source/python/AvidaGui2/pyEduMainCtrl.py 2005-04-01 18:20:34 UTC (rev 99)
@@ -19,6 +19,7 @@
class pyEduMainCtrl(qt.QObject):
def __init__(self):
qt.QObject.__init__(self, None, self.__class__.__name__)
+
def construct(self):
class pyMdl: pass
self.m_main_mdl = pyMdl()
@@ -39,6 +40,7 @@
self.m_main_mdl.m_main_mdtr.m_main_controller_factory_mdtr.emit(
qt.PYSIGNAL("newMainControllerSig"), ("pyEduMainMenuBarHdlr",))
return self
+
def unitTest(self, recurse = False):
return pyUnitTestSuiteRecurser(
"pyEduMainCtrl",
Modified: trunk/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyEduWorkspaceCtrl.py 2005-04-01 17:50:41 UTC (rev 98)
+++ trunk/source/python/AvidaGui2/pyEduWorkspaceCtrl.py 2005-04-01 18:20:34 UTC (rev 99)
@@ -53,6 +53,7 @@
self.m_one_population_ctrl.construct(self.m_session_mdl)
self.m_one_organism_ctrl.construct(self.m_session_mdl)
+ self.connect(self, PYSIGNAL("quitAvidaPhaseISig"), qApp, SLOT("quit()"))
self.connect(self.m_nav_bar_ctrl.m_list_view, SIGNAL("clicked(QListViewItem *)"), self.navBarItemClickedSlot)
self.connect(self.m_widget_stack, SIGNAL("aboutToShow(QWidget *)"), self.ctrlAboutToShowSlot)
# self.connect(self.fileOpenFreezerAction,SIGNAL("activated()"),self.freezerOpenSlot)
@@ -110,7 +111,8 @@
def close(self, also_delete = False):
# XXX trying to temporarily prevent closing this window.
- print "pyEduWorkspaceCtrl.close(): Cowardly refusing to close."
+ # print "pyEduWorkspaceCtrl.close(): Cowardly refusing to close."
+ self.emit(PYSIGNAL("quitAvidaPhaseISig"), ())
return False
######### pyuic-one-time-generated-code lives below this line.
@@ -265,4 +267,3 @@
self.controlStartAction.menuText = "Pause"
self.startStatus = False
-
Modified: trunk/source/python/AvidaGui2/pyFreezerCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyFreezerCtrl.py 2005-04-01 17:50:41 UTC (rev 98)
+++ trunk/source/python/AvidaGui2/pyFreezerCtrl.py 2005-04-01 18:20:34 UTC (rev 99)
@@ -64,7 +64,7 @@
# check that the item is not at the top level
- if item.depth() > 0:
+ if item != None and item.depth() > 0:
top_level = item
while top_level.parent():
top_level = top_level.parent()
@@ -80,4 +80,4 @@
file_name = self.m_session_mdl.m_current_freezer + file_name
thawed_item = pyReadFreezer(file_name)
self.m_session_mdl.m_session_mdtr.emit(PYSIGNAL("doDefrostDishSig"),
- (thawed_item,))
+ (item.text(0), thawed_item,))
Modified: trunk/source/python/AvidaGui2/pyFreezerView.ui
===================================================================
--- trunk/source/python/AvidaGui2/pyFreezerView.ui 2005-04-01 17:50:41 UTC (rev 98)
+++ trunk/source/python/AvidaGui2/pyFreezerView.ui 2005-04-01 18:20:34 UTC (rev 99)
@@ -77,6 +77,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="acceptDrops">
<bool>true</bool>
</property>
Modified: trunk/source/python/AvidaGui2/pyInstructionSet.py
===================================================================
--- trunk/source/python/AvidaGui2/pyInstructionSet.py 2005-04-01 17:50:41 UTC (rev 98)
+++ trunk/source/python/AvidaGui2/pyInstructionSet.py 2005-04-01 18:20:34 UTC (rev 99)
@@ -4,13 +4,13 @@
class pyInstructionSet:
- def __init__(self, in_file = None):
+ def __init__(self, inst_file_name = None):
self.cmd_letter_dict = {}
self.letter_cmd_dict = {}
letters = ['z','y','x','w','v','u','t','s','r','q','p','o','n','m','l',
'k','j','i','h','g','f','e','d','c','b','a']
- inst_file = open(in_file)
+ inst_file = open(inst_file_name)
lines = inst_file.readlines()
inst_file.close
for line in lines:
@@ -27,3 +27,24 @@
letter = letters.pop()
self.cmd_letter_dict[cmd_name] = letter
self.letter_cmd_dict[letter] = cmd_name
+
+ def OrgFile2LetterString(self, org_file_name = None):
+
+ print "****** " + org_file_name + " **********"
+ org_file = open(org_file_name)
+ lines = org_file.readlines()
+ org_file.close
+ out_string = ""
+ for line in lines:
+ comment_start = line.find("#")
+ if comment_start > -1:
+ if comment_start == 0:
+ line = ""
+ else:
+ line = line[:comment_start]
+ line = line.strip()
+ if len(line) > 0:
+ cmd_name = line.upper()
+ letter = self.cmd_letter_dict[cmd_name]
+ out_string = out_string + letter
+ return out_string
\ No newline at end of file
Modified: trunk/source/python/AvidaGui2/pyNavBarView.ui
===================================================================
--- trunk/source/python/AvidaGui2/pyNavBarView.ui 2005-04-01 17:50:41 UTC (rev 98)
+++ trunk/source/python/AvidaGui2/pyNavBarView.ui 2005-04-01 18:20:34 UTC (rev 99)
@@ -77,6 +77,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="acceptDrops">
<bool>true</bool>
</property>
Modified: trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py 2005-04-01 17:50:41 UTC (rev 98)
+++ trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py 2005-04-01 18:20:34 UTC (rev 99)
@@ -8,8 +8,8 @@
def __init__(self,parent = None,name = None,fl = 0):
pyOnePop_PetriDishView.__init__(self,parent,name,fl)
- self.connect(self.m_petri_dish_toogle, SIGNAL("clicked()"),
- self.ToogleDish)
+ self.connect(self.m_petri_dish_toggle, SIGNAL("clicked()"),
+ self.ToggleDishSlot)
def construct(self, session_mdl):
self.m_session_mdl = session_mdl
@@ -24,6 +24,10 @@
self.m_petri_configure_ctrl.FreezePetriSlot)
self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("setAvidaSig"),
self.setAvidaSlot)
+ 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)
def setAvidaSlot(self, avida):
old_avida = self.m_avida
@@ -40,16 +44,26 @@
- def ToogleDish (self):
+ def ToggleDishSlot (self):
current_page = self.m_petri_dish_widget_stack.visibleWidget()
current_page_int = self.m_petri_dish_widget_stack.id(current_page)
if (current_page_int == 0):
self.m_petri_dish_widget_stack.raiseWidget(1)
else:
self.m_petri_dish_widget_stack.raiseWidget(0)
+
+ def MakeConfigVisiableSlot (self):
+ current_page = self.m_petri_dish_widget_stack.visibleWidget()
+ current_page_int = self.m_petri_dish_widget_stack.id(current_page)
+ if (current_page_int == 0):
+ self.m_petri_dish_widget_stack.raiseWidget(1)
def avidaUpdatedSlot (self):
stats = self.m_avida.m_population.GetStats()
update = stats.GetUpdate()
self.m_update_label.setText(QString("%1").arg(update))
+
+ def RenameDishSlot(self, dishName):
+ self.PopulationTextLabel.setText(dishName)
+
Modified: trunk/source/python/AvidaGui2/pyOnePop_PetriDishView.ui
===================================================================
--- trunk/source/python/AvidaGui2/pyOnePop_PetriDishView.ui 2005-04-01 17:50:41 UTC (rev 98)
+++ trunk/source/python/AvidaGui2/pyOnePop_PetriDishView.ui 2005-04-01 18:20:34 UTC (rev 99)
@@ -15,8 +15,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>520</width>
- <height>536</height>
+ <width>528</width>
+ <height>540</height>
</rect>
</property>
<property name="caption">
@@ -32,386 +32,402 @@
<property name="resizeMode">
<enum>Minimum</enum>
</property>
- <widget class="QLayoutWidget">
+ <widget class="QFrame">
<property name="name">
- <cstring>layout179</cstring>
+ <cstring>OnPop_PetriFrame</cstring>
</property>
- <hbox>
+ <property name="frameShape">
+ <enum>GroupBoxPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLabel">
- <property name="name">
- <cstring>pixmapLabel1</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="pixmap">
- <pixmap>image0</pixmap>
- </property>
- <property name="scaledContents">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel3</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>3</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <pointsize>11</pointsize>
- </font>
- </property>
- <property name="text">
- <string>[population]</string>
- </property>
- </widget>
<widget class="QLayoutWidget">
<property name="name">
- <cstring>layout178</cstring>
+ <cstring>layout179</cstring>
</property>
- <vbox>
+ <hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <spacer>
+ <widget class="QLabel">
<property name="name">
- <cstring>spacer126</cstring>
+ <cstring>pixmapLabel1</cstring>
</property>
- <property name="orientation">
- <enum>Vertical</enum>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="sizeType">
- <enum>Minimum</enum>
+ <property name="pixmap">
+ <pixmap>image0</pixmap>
</property>
- <property name="sizeHint">
- <size>
- <width>1</width>
- <height>1</height>
- </size>
+ <property name="scaledContents">
+ <bool>true</bool>
</property>
- </spacer>
- <widget class="QToolButton">
+ </widget>
+ <widget class="QLabel">
<property name="name">
- <cstring>m_petri_dish_toogle</cstring>
+ <cstring>PopulationTextLabel</cstring>
</property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="font">
<font>
- <pointsize>10</pointsize>
+ <pointsize>11</pointsize>
</font>
</property>
<property name="text">
- <string></string>
+ <string>[population]</string>
</property>
- <property name="iconSet">
- <iconset>image1</iconset>
- </property>
</widget>
- <spacer>
+ <widget class="QLayoutWidget">
<property name="name">
- <cstring>spacer126_2</cstring>
+ <cstring>layout178</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>
+ <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>m_petri_dish_toggle</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>10</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="iconSet">
+ <iconset>image1</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>
+ </hbox>
</widget>
- </hbox>
- </widget>
- <widget class="QWidgetStack">
- <property name="name">
- <cstring>m_petri_dish_widget_stack</cstring>
- </property>
- <property name="frameShape">
- <enum>Panel</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <widget class="QWidget">
- <property name="name">
- <cstring>WStackPage</cstring>
- </property>
- <attribute name="id">
- <number>0</number>
- </attribute>
- <vbox>
+ <widget class="QWidgetStack">
<property name="name">
- <cstring>unnamed</cstring>
+ <cstring>m_petri_dish_widget_stack</cstring>
</property>
- <widget class="QLayoutWidget">
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <widget class="QWidget">
<property name="name">
- <cstring>layout10</cstring>
+ <cstring>WStackPage</cstring>
</property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
- <cstring>layout91</cstring>
+ <cstring>layout10</cstring>
</property>
- <hbox>
+ <vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="pyPetriDishCtrl">
+ <widget class="QLayoutWidget">
<property name="name">
- <cstring>m_petri_dish_ctrl</cstring>
+ <cstring>layout91</cstring>
</property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>3</hsizetype>
- <vsizetype>3</vsizetype>
- <horstretch>5</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="pyPetriDishCtrl">
+ <property name="name">
+ <cstring>m_petri_dish_ctrl</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>5</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="pyGradientScaleCtrl">
+ <property name="name">
+ <cstring>m_gradient_scale_ctrl</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>50</width>
+ <height>50</height>
+ </size>
+ </property>
+ <property name="backgroundMode">
+ <enum>PaletteDark</enum>
+ </property>
+ </widget>
+ </hbox>
</widget>
- <widget class="pyGradientScaleCtrl">
+ <widget class="QLayoutWidget">
<property name="name">
- <cstring>m_gradient_scale_ctrl</cstring>
+ <cstring>layout1</cstring>
</property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>1</vsizetype>
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>50</height>
- </size>
- </property>
- <property name="backgroundMode">
- <enum>PaletteDark</enum>
- </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel11</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string><font size="-1"><p align="right">Update:</p></font></string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_update_label</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string><font size="-1">-</font></string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>Merit</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_mode_combobox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>11</pointsize>
+ </font>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel10</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string><font size="-1"><p align="right">Zoom:</p></font></string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>m_zoom_spinbox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
</widget>
- </hbox>
- </widget>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout1</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
+ <widget class="QLayoutWidget">
<property name="name">
- <cstring>textLabel11</cstring>
+ <cstring>layout229</cstring>
</property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>1</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string><font size="-1"><p align="right">Update:</p></font></string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>m_update_label</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>1</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string><font size="-1">-</font></string>
- </property>
- </widget>
- <widget class="QComboBox">
- <item>
- <property name="text">
- <string>Merit</string>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
</property>
- </item>
- <property name="name">
- <cstring>m_mode_combobox</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <pointsize>11</pointsize>
- </font>
- </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer169_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>10</width>
+ <height>10</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="pyLiveControlsCtrl">
+ <property name="name">
+ <cstring>m_live_controls_ctrl</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>50</height>
+ </size>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer169</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>10</width>
+ <height>10</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
</widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel10</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>1</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string><font size="-1"><p align="right">Zoom:</p></font></string>
- </property>
- </widget>
- <widget class="QSpinBox">
- <property name="name">
- <cstring>m_zoom_spinbox</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </hbox>
+ </vbox>
</widget>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout229</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <spacer>
- <property name="name">
- <cstring>spacer169_2</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>MinimumExpanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>10</width>
- <height>10</height>
- </size>
- </property>
- </spacer>
- <widget class="pyLiveControlsCtrl">
- <property name="name">
- <cstring>m_live_controls_ctrl</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>50</height>
- </size>
- </property>
- </widget>
- <spacer>
- <property name="name">
- <cstring>spacer169</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>MinimumExpanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>10</width>
- <height>10</height>
- </size>
- </property>
- </spacer>
- </hbox>
- </widget>
</vbox>
</widget>
- </vbox>
- </widget>
- <widget class="QWidget">
- <property name="name">
- <cstring>WStackPage</cstring>
- </property>
- <attribute name="id">
- <number>1</number>
- </attribute>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <property name="margin">
- <number>2</number>
- </property>
- <property name="spacing">
- <number>2</number>
- </property>
- <widget class="pyPetriConfigureCtrl">
+ <widget class="QWidget">
<property name="name">
- <cstring>m_petri_configure_ctrl</cstring>
+ <cstring>WStackPage</cstring>
</property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>3</hsizetype>
- <vsizetype>3</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="acceptDrops">
- <bool>true</bool>
- </property>
+ <attribute name="id">
+ <number>1</number>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <widget class="pyPetriConfigureCtrl">
+ <property name="name">
+ <cstring>m_petri_configure_ctrl</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="acceptDrops">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
</widget>
- </hbox>
- </widget>
+ </widget>
+ </vbox>
</widget>
</vbox>
</widget>
@@ -460,6 +476,8 @@
<property type="0">-1</property>
<property type="1">pyPetriDishCtrl</property>
<property type="0">-1</property>
+ <property type="1">pyPetriDishCtrl</property>
+ <property type="0">-1</property>
<property type="pyPetriDishCtrl"></property>
<property type="-1">1</property>
</customwidget>
@@ -507,6 +525,8 @@
<property type="0">-1</property>
<property type="1">pyGradientScaleCtrl</property>
<property type="0">-1</property>
+ <property type="1">pyGradientScaleCtrl</property>
+ <property type="0">-1</property>
<property type="pyGradientScaleCtrl"></property>
<property type="-1">1</property>
</customwidget>
@@ -554,6 +574,8 @@
<property type="0">-1</property>
<property type="1">pyLiveControlsCtrl</property>
<property type="0">-1</property>
+ <property type="1">pyLiveControlsCtrl</property>
+ <property type="0">-1</property>
<property type="pyLiveControlsCtrl"></property>
<property type="-1">1</property>
</customwidget>
Modified: trunk/source/python/AvidaGui2/pyPetriConfigureCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyPetriConfigureCtrl.py 2005-04-01 17:50:41 UTC (rev 98)
+++ trunk/source/python/AvidaGui2/pyPetriConfigureCtrl.py 2005-04-01 18:20:34 UTC (rev 99)
@@ -44,19 +44,21 @@
self.DisablePetriConfigureSlot)
self.connect(self.m_session_mdl.m_session_mdtr, PYSIGNAL("doInitializeAvidaPhaseISig"),
self.CreateFilesFromPetriSlot)
+ self.ChangeMutationTextSlot()
+ self.ChangeWorldSizeTextSlot()
self.populated = False
self.run_started = False
def ChangeMutationTextSlot(self):
- slide_value = float(self.MutationSlider.value())/10.0
+ slide_value = float(self.MutationSlider.value())/100.0
slide_value = pow(10,slide_value)
- if slide_value < 0.0002:
- slide_value = 0
- if slide_value > 1:
+ if slide_value < 0.0011:
+ slide_value = 0.0
+ if slide_value > 1 or slide_value < 0.00001:
slide_value_txt = ("%1.1f" % (slide_value)) + "%"
elif slide_value > 0.1:
slide_value_txt = ("%1.2f" % (slide_value)) + "%"
- elif slide_value > 0.001:
+ elif slide_value > 0.01:
slide_value_txt = ("%1.3f" % (slide_value)) + "%"
else:
slide_value_txt = ("%1.4f" % (slide_value)) + "%"
@@ -89,7 +91,7 @@
else:
self.StopAtSpinBox.setEnabled(True)
- def FillDishSlot(self, petri_dict):
+ def FillDishSlot(self, dish_name, petri_dict):
self.full_petri_dict = petri_dict.dictionary
settings_dict = petri_dict.dictionary["SETTINGS"]
self.AncestorComboBox.removeItem (0)
@@ -113,7 +115,10 @@
self.RadomGeneratedRadioButton.setChecked(False)
self.RandomFixedRadioButton.setChecked(True)
copy_mutation_percent = float(settings_dict["COPY_MUT_PROB"]) * 100;
- self.MutationSlider.setValue(int(math.log10(copy_mutation_percent) * 10))
+ if copy_mutation_percent > 0.00000001:
+ self.MutationSlider.setValue(int(math.log10(copy_mutation_percent) * 100))
+ else:
+ self.MutationSlider.setValue(-300)
if int(settings_dict["BIRTH_METHOD"]) in [0, 1, 2, 3]:
self.LocalBirthRadioButton.setChecked(True)
self.MassActionRadioButton.setChecked(False)
@@ -186,15 +191,15 @@
settings_dict["RANDOM_SEED"] = self.RandomSpinBox.value()
else:
settings_dict["RANDOM_SEED"] = 0
- slide_value = float(self.MutationSlider.value())/10.0
+ slide_value = float(self.MutationSlider.value())/100.0
slide_value = pow(10,slide_value)
- if slide_value < 0.0002:
+ if slide_value < 0.0011:
slide_value = 0.0
settings_dict["COPY_MUT_PROB"] = slide_value/100.0
if self.LocalBirthRadioButton.isChecked() == True:
settings_dict["BIRTH_METHOD"] = 0
else:
- settings_dict["BIRTH_METHOD"] = 0
+ settings_dict["BIRTH_METHOD"] = 4
settings_dict["AGE_LIMIT"] = self.LifeSpanSpinBox.value()
if self.DieNoButton.isChecked() == True:
settings_dict["DEATH_METHOD"] = 0
Modified: trunk/source/python/AvidaGui2/pyPetriConfigureView.ui
===================================================================
--- trunk/source/python/AvidaGui2/pyPetriConfigureView.ui 2005-04-01 17:50:41 UTC (rev 98)
+++ trunk/source/python/AvidaGui2/pyPetriConfigureView.ui 2005-04-01 18:20:34 UTC (rev 99)
@@ -65,7 +65,7 @@
</property>
<widget class="QLayoutWidget">
<property name="name">
- <cstring>layout10</cstring>
+ <cstring>layout12</cstring>
</property>
<vbox>
<property name="name">
@@ -92,7 +92,7 @@
</widget>
<widget class="QLayoutWidget">
<property name="name">
- <cstring>layout9</cstring>
+ <cstring>layout11</cstring>
</property>
<hbox>
<property name="name">
@@ -107,16 +107,16 @@
</font>
</property>
<property name="minValue">
- <number>-40</number>
+ <number>-300</number>
</property>
<property name="maxValue">
- <number>20</number>
+ <number>200</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
- <number>3</number>
+ <number>50</number>
</property>
<property name="orientation">
<enum>Horizontal</enum>
@@ -137,12 +137,18 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="minimumSize">
+ <size>
+ <width>40</width>
+ <height>0</height>
+ </size>
+ </property>
<property name="font">
<font>
</font>
</property>
<property name="text">
- <string>3 %</string>
+ <string>%</string>
</property>
</widget>
</hbox>
@@ -223,7 +229,7 @@
</font>
</property>
<property name="text">
- <string>30 x 30 cells</string>
+ <string>0 x 0 cells</string>
</property>
</widget>
</hbox>
@@ -425,11 +431,14 @@
<property name="minValue">
<number>1</number>
</property>
- <property name="value">
+ <property name="lineStep">
<number>10</number>
</property>
+ <property name="value">
+ <number>100</number>
+ </property>
<property name="toolTip" stdset="0">
- <string>How long</string>
+ <string>How long to let organism live</string>
</property>
</widget>
<widget class="QLabel">
Modified: trunk/source/python/AvidaGui2/pyPetriDishCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyPetriDishCtrl.py 2005-04-01 17:50:41 UTC (rev 98)
+++ trunk/source/python/AvidaGui2/pyPetriDishCtrl.py 2005-04-01 18:20:34 UTC (rev 99)
@@ -261,9 +261,10 @@
world_h = cConfig.GetWorldY()
for x in range(world_w):
for y in range(world_h):
- cell = self.m_avida.m_population.GetCell(x + world_w*y)
- if cell.IsOccupied() == True:
- organism = cell.GetOrganism()
- genome = organism.GetGenome()
- population_dict[cell.GetID()] = str(genome.AsString())
+ if self.m_avida != None:
+ cell = self.m_avida.m_population.GetCell(x + world_w*y)
+ if cell.IsOccupied() == True:
+ organism = cell.GetOrganism()
+ genome = organism.GetGenome()
+ population_dict[cell.GetID()] = str(genome.AsString())
self.emit(PYSIGNAL("freezeDishPhaseIISig"), ("/freezer", population_dict, ))
Modified: trunk/source/python/AvidaGui2/pyWriteGenesis.py
===================================================================
--- trunk/source/python/AvidaGui2/pyWriteGenesis.py 2005-04-01 17:50:41 UTC (rev 98)
+++ trunk/source/python/AvidaGui2/pyWriteGenesis.py 2005-04-01 18:20:34 UTC (rev 99)
@@ -13,16 +13,34 @@
# incoming dictionary
shutil.copyfile(workspace_dir + "events.default", out_dir + "events.cfg")
+
+ # If this is a full petri dish inject all the organisms otherwise
+ # inject the start creature in the center of the grid
+
if in_dict.has_key("CELLS"):
- self.createInjects(in_dict, out_dir + "events.cfg")
+ cells_dict = in_dict["CELLS"]
+ organisms_dict = in_dict["ORGANISMS"]
+ else:
+ cells_dict = {}
+ organisms_dict = {}
+ if settings_dict.has_key("START_CREATURE"):
+ world_x = settings_dict["WORLD-X"]
+ world_y = settings_dict["WORLD-Y"]
+ self.start_cell_location = int(((world_y/2) * world_x) +(world_x/2))
+ cells_dict[str(self.start_cell_location)] = str(1)
+ tmp_inst_set = pyInstructionSet.pyInstructionSet(workspace_dir + "inst_set.default")
+ org_string = tmp_inst_set.OrgFile2LetterString(freeze_dir + settings_dict["START_CREATURE"])
+ organisms_dict[str(1)] = org_string
+ self.createInjects(cells_dict, organisms_dict, out_dir + "events.cfg")
+
shutil.copyfile(workspace_dir + "environment.default", out_dir + "environment.cfg")
shutil.copyfile(workspace_dir + "inst_set.default", out_dir + "inst_set.default")
- shutil.copyfile(freeze_dir + settings_dict["START_CREATURE"],
- out_dir + settings_dict["START_CREATURE"])
+ # shutil.copyfile(freeze_dir + settings_dict["START_CREATURE"],
+ # out_dir + settings_dict["START_CREATURE"])
settings_dict["EVENT_FILE"] = out_dir + "events.cfg"
settings_dict["ENVIRONMENT_FILE"] = out_dir + "environment.cfg"
settings_dict["INST_SET"] = out_dir + "inst_set.default"
- settings_dict["START_CREATURE"] = out_dir + settings_dict["START_CREATURE"]
+ # settings_dict["START_CREATURE"] = out_dir + settings_dict["START_CREATURE"]
# Read the default genesis file, if there is a equivilent line in the
# dictionary replace it the new values, otherwise just copy the line
@@ -52,9 +70,7 @@
out_genesis_file.write(line)
out_genesis_file.close()
- def createInjects(self, in_dict, out_file):
- cells_dict = in_dict["CELLS"]
- organisms_dict = in_dict["ORGANISMS"]
+ def createInjects(self, cells_dict, organisms_dict, out_file):
event_out_file = open(out_file, 'a')
for cell in cells_dict.keys():
part1 = "u 0 inject_sequence " + organisms_dict[cells_dict[cell]] + " "
More information about the Avida-cvs
mailing list