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

kaben at myxo.css.msu.edu kaben at myxo.css.msu.edu
Sat Jun 21 11:15:09 PDT 2008


Author: kaben
Date: 2008-06-21 14:15:09 -0400 (Sat, 21 Jun 2008)
New Revision: 2665

Modified:
   branches/developers/avida-edward/source/python/AvidaGui2/pyBeforeStartingCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py
Log:
Avida-ED Freezer: Fixed bug where one shouldn't be able to delete items from
the default workspace. If user is still using default workspace, right-clicks
in freezer are intercepted, and a dialog box is show giving user option to
create a new workspace, or open a new one.  Similar interception if user tries
to select "Delete..." or "Rename..." File menu items.


Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyBeforeStartingCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyBeforeStartingCtrl.py	2008-06-21 18:02:27 UTC (rev 2664)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyBeforeStartingCtrl.py	2008-06-21 18:15:09 UTC (rev 2665)
@@ -23,7 +23,7 @@
 
     # Change the propt depending if the user is trying to import or freeze
 
-    # self.BeforeStartTextLabel.setText(self.__tr("<p align=\"center\">Before you can " + verb + " a petri dish or organism<br> you must choose a workspace to work with</p>"))
+    self.BeforeStartTextLabel.setText("<p align=\"center\">Before you can " + verb + " a petri dish or organism<br> you must choose a workspace to work with.</p>")
 
     dialog_result = 1
     while (dialog_result > 0):

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py	2008-06-21 18:02:27 UTC (rev 2664)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py	2008-06-21 18:15:09 UTC (rev 2665)
@@ -537,6 +537,12 @@
   # public slot
 
   def fileRenameItem(self):
+    if (self.m_session_mdl.directory_chosen == False):
+      m_prompt_dir = pyBeforeStartingCtrl()
+      m_prompt_dir.construct(self.m_session_mdl)
+      if (m_prompt_dir.showDialog("rename") == 0):
+        return ''
+
     files2process = self.curr_sel_files.split("\t")
     rename_dialog = pyRenameDialogCtrl()
     dialog_result = rename_dialog.showDialog(files2process[1:])
@@ -592,6 +598,12 @@
   # allow user to delete one or more freezer items
 
   def fileDeleteItemSlot(self):
+      if (self.m_session_mdl.directory_chosen == False):
+        m_prompt_dir = pyBeforeStartingCtrl()
+        m_prompt_dir.construct(self.m_session_mdl)
+        if (m_prompt_dir.showDialog("delete") == 0):
+          return ''
+
       for freezer_item_name in self.curr_sel_files.split("\t")[1:]:
         delete_item = False
         if self.m_session_mdl.m_warn_about_trash:

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py	2008-06-21 18:02:27 UTC (rev 2664)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py	2008-06-21 18:15:09 UTC (rev 2665)
@@ -5,6 +5,7 @@
 import os
 from qt import *
 import pyNewIconView
+from pyBeforeStartingCtrl import pyBeforeStartingCtrl
 from pyFreezerView import *
 from pyReadFreezer import pyReadFreezer
 from pyWriteToFreezer import pyWriteToFreezer
@@ -377,6 +378,17 @@
 
   def right_clicked_itemSlot(self, item):
 
+    # If the user has not already chosen an active workspace for this session
+    # make them do so now. If they chose not to pick a workspace, don't let
+    # them rename, delete, or open the file. For simplicity and code re-use,
+    # this is going to also prevent exporting until after they've chose a workspace.
+
+    if (self.m_session_mdl.directory_chosen == False):
+      m_prompt_dir = pyBeforeStartingCtrl()
+      m_prompt_dir.construct(self.m_session_mdl)
+      if (m_prompt_dir.showDialog("manipulate") == 0):
+        return ''
+
     # check that the item is not at the top level
 
     if item != None and item.depth() > 0:




More information about the Avida-cvs mailing list