[Avida-SVN] r1056 - branches/developers/avida-edward/source/python/AvidaGui2
baerb at myxo.css.msu.edu
baerb at myxo.css.msu.edu
Thu Oct 19 14:52:05 PDT 2006
Author: baerb
Date: 2006-10-19 17:52:05 -0400 (Thu, 19 Oct 2006)
New Revision: 1056
Modified:
branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py
branches/developers/avida-edward/source/python/AvidaGui2/to-do_list
Log:
If user puts file named research.version in directory values on petri dish
setting are ignored -- i.e. input files are copied without modification
The first time a user tries to open or create a workspace the program starts
at ~ for linux, ~/Documents for Macs and $HOME/My Documents for windows
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py 2006-10-19 17:17:59 UTC (rev 1055)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py 2006-10-19 21:52:05 UTC (rev 1056)
@@ -205,8 +205,20 @@
created = False
dialog_caption = "Enter the name of a new workspace"
while (created == False):
+
+ # if user has not yet selected a dir try for the ~/Documents on the Mac
+ # ~ on Linux and $HOME/My Documents on Windows
+
+ if not self.m_session_mdl.directory_chosen:
+ initial_dir = os.path.expanduser("~")
+ if os.path.exists(os.path.join(initial_dir,"Documents")):
+ initial_dir = os.path.join(initial_dir,"Documents")
+ elif os.path.exists(os.path.join(initial_dir,"My Documents")):
+ initial_dir = os.path.join(initial_dir,"My Documents")
+ else:
+ initial_dir = ""
new_dir = QFileDialog.getSaveFileName(
- "",
+ initial_dir,
"Workspace (*.workspace)",
None,
"new workspace",
@@ -255,9 +267,22 @@
while (foundFile == False):
+ # if user has not yet selected a dir try for the ~/Documents on the Mac
+ # ~ on Linux and $HOME/My Documents on Windows
+
+ if not self.m_session_mdl.directory_chosen:
+ initial_dir = os.path.expanduser("~")
+ print "BDB: " + os.path.join(initial_dir,"Documents")
+ if os.path.exists(os.path.join(initial_dir,"Documents")):
+ initial_dir = os.path.join(initial_dir,"Documents")
+ elif os.path.exists(os.path.join(initial_dir,"My Documents")):
+ initial_dir = os.path.join(initial_dir,"My Documents")
+ else:
+ initial_dir = ""
+
workspace_dir = QFileDialog.getExistingDirectory(
# self.m_session_mdl.m_current_workspace,
- "",
+ initial_dir,
None,
"get existing workspace",
tmpDialogCap,
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py 2006-10-19 17:17:59 UTC (rev 1055)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py 2006-10-19 21:52:05 UTC (rev 1056)
@@ -11,12 +11,18 @@
class pyWriteGenesisEvent:
- def __init__(self, in_dict = None, session_mdl = None, workspace_dir = None, freeze_dir = None,
- tmp_in_dir = None, tmp_out_dir = None):
+ def __init__(self, in_dict = None, session_mdl = None, workspace_dir = None,
+ freeze_dir = None, tmp_in_dir = None, tmp_out_dir = None):
self.m_session_mdl = session_mdl
- settings_dict = in_dict["SETTINGS"]
+ # If the file "research.version" exists in the current workspace we
+ # are going to ignore any settings in the petri dish
+
+ if os.path.exists(os.path.join(workspace_dir,"research.version")):
+ settings_dict = {}
+ else:
+ settings_dict = in_dict["SETTINGS"]
# Copies default event file and add to the
# temporary dictionary where the input files will live
@@ -28,7 +34,8 @@
#if we have a full petri dish...
- if in_dict.has_key("CELLS"):
+ if in_dict.has_key("CELLS") and \
+ (not (os.path.exists(os.path.join(workspace_dir,"research.version")))):
cells_dict = in_dict["CELLS"]
organisms_dict = in_dict["ORGANISMS"]
self.m_session_mdl.m_founding_cells_dict = cells_dict
@@ -93,14 +100,15 @@
organisms_dict[str(i)] = settings_dict["START_GENOME" + str(i)]
- shutil.copyfile(os.path.join(workspace_dir, "inst_set.default"), os.path.join(tmp_in_dir, "inst_set.default"))
+ shutil.copyfile(os.path.join(workspace_dir, "inst_set.default"), \
+ os.path.join(tmp_in_dir, "inst_set.default"))
settings_dict["EVENT_FILE"] = os.path.join(tmp_in_dir, "events.cfg")
settings_dict["ENVIRONMENT_FILE"] = os.path.join(tmp_in_dir, "environment.cfg")
self.writeEnvironmentFile(workspace_dir, settings_dict)
settings_dict["INST_SET"] = os.path.join(tmp_in_dir, "inst_set.default")
- # settings_dict["START_CREATURE"] = os.path.join(tmp_in_dir, settings_dict["START_CREATURE"])
- genesis_file_name = self.writeGenesisFile(workspace_dir, tmp_in_dir, settings_dict)
+ genesis_file_name = self.writeGenesisFile(workspace_dir, tmp_in_dir, \
+ settings_dict)
# There's a loop around organisms_dict
# organism number is key, sequence is value.
@@ -162,7 +170,8 @@
# BDB -- added second if statment clause to support pause_at hack
- if (settings_dict.has_key(var_name) == True) and (var_name != "MAX_UPDATES"):
+ if (settings_dict.has_key(var_name) == True) and \
+ (var_name != "MAX_UPDATES"):
out_genesis_file.write(var_name + " " + str(settings_dict[var_name]) + "\n")
else:
out_genesis_file.write(line)
Modified: branches/developers/avida-edward/source/python/AvidaGui2/to-do_list
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/to-do_list 2006-10-19 17:17:59 UTC (rev 1055)
+++ branches/developers/avida-edward/source/python/AvidaGui2/to-do_list 2006-10-19 21:52:05 UTC (rev 1056)
@@ -147,6 +147,7 @@
- check why repeatablity does not repeat
- check why program runs so much when program is paused
+5-Oct-2006 Mouse over colored circle on org view.
Priority Low-
More information about the Avida-cvs
mailing list