[Avida-SVN] r2666 - branches/developers/avida-edward/source/python/AvidaGui2
kaben at myxo.css.msu.edu
kaben at myxo.css.msu.edu
Sat Jun 21 11:39:27 PDT 2008
Author: kaben
Date: 2008-06-21 14:39:27 -0400 (Sat, 21 Jun 2008)
New Revision: 2666
Modified:
branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py
branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogCtrl.py
branches/developers/avida-edward/source/python/AvidaGui2/pyTemporaryReloads.py
Log:
Avida-ED Freezer: Fixed bug where there's a missing confirm delete dialog upon
deletion from freezer.
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py 2008-06-21 18:15:09 UTC (rev 2665)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py 2008-06-21 18:39:27 UTC (rev 2666)
@@ -406,7 +406,7 @@
file_name = str(item.text(0)) + ".organism"
file_name = os.path.join(self.m_session_mdl.m_current_freezer, file_name)
- m_right_click_menu = pyRightClickDialogCtrl(item.text(0), file_name)
+ m_right_click_menu = pyRightClickDialogCtrl(item.text(0), file_name, self.m_session_mdl)
(file_list_change, open_obj) = m_right_click_menu.showDialog()
if file_list_change == True:
self.m_session_mdl.m_session_mdtr.emit(
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogCtrl.py 2008-06-21 18:15:09 UTC (rev 2665)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogCtrl.py 2008-06-21 18:39:27 UTC (rev 2666)
@@ -4,6 +4,7 @@
from qt import *
from pyRightClickDialogView import pyRightClickDialogView
+from pyWarnAboutTrashCtrl import pyWarnAboutTrashCtrl
import shutil, os, os.path
# class to pop up a dialog box when the user quits
@@ -11,8 +12,9 @@
# return the name of a file to save information to be frozen
class pyRightClickDialogCtrl (pyRightClickDialogView):
- def __init__(self, item_name, file_name):
+ def __init__(self, item_name, file_name, session_mdl):
pyRightClickDialogView.__init__(self)
+ self.session_mdl = session_mdl
self.file_name = str(file_name)
self.item_name = str(item_name)
self.NewNameLineEdit.setText(self.item_name)
@@ -72,15 +74,28 @@
# if the user chose to delete file or directory
if dialog_result == self.DeleteFlag:
- self.change = True
- if (self.file_ext == '.full'):
- tmp_file_list = os.listdir(self.file_name)
- for file in tmp_file_list:
- os.remove(os.path.join(self.file_name,file))
- os.removedirs(self.file_name)
+ delete_item = False
+ # Request yet another confirmation of delete:
+ tmp_prompt = pyWarnAboutTrashCtrl(new_name_core)
+ prompt_result = tmp_prompt.showDialog()
+ if prompt_result == tmp_prompt.DeleteAllCode:
+ self.session_mdl.m_warn_about_trash = False
+ if (prompt_result == tmp_prompt.DeleteAllCode) or (prompt_result == tmp_prompt.DeleteCode):
+ delete_item = True
else:
- os.remove(self.file_name)
+ delete_item = True
+ # If user says 'yes, really delete' then go ahead and do it.
+ if delete_item:
+ self.change = True
+ if (self.file_ext == '.full'):
+ tmp_file_list = os.listdir(self.file_name)
+ for file in tmp_file_list:
+ os.remove(os.path.join(self.file_name,file))
+ os.removedirs(self.file_name)
+ else:
+ os.remove(self.file_name)
+
# if the user chose to rename the file/directory and they gave an actual
# check if that file already exists if it does not rename the file
Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyTemporaryReloads.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyTemporaryReloads.py 2008-06-21 18:15:09 UTC (rev 2665)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyTemporaryReloads.py 2008-06-21 18:39:27 UTC (rev 2666)
@@ -47,6 +47,8 @@
"AvidaGui2.pyQuitDialogView",
"AvidaGui2.pyQuitDialogCtrl",
+ "AvidaGui2.pyWarnAboutTrashView",
+ "AvidaGui2.pyWarnAboutTrashCtrl",
"AvidaGui2.pyRightClickDialogView",
"AvidaGui2.pyRightClickDialogCtrl",
"AvidaGui2.pyStdTaskDescriptionCtrl",
@@ -108,8 +110,6 @@
"AvidaGui2.pyTimeline",
"AvidaGui2.pyTimelineView",
"AvidaGui2.pyTimelineCtrl",
- "AvidaGui2.pyWarnAboutTrashView",
- "AvidaGui2.pyWarnAboutTrashCtrl",
"AvidaGui2.pyWriteGenesisEvent",
"AvidaGui2.pyWriteToFreezer",
More information about the Avida-cvs
mailing list